Skip to content

Commit

Permalink
feat: [Bigtable] Publish CBT deletion_protection field in Table, Upda…
Browse files Browse the repository at this point in the history
…teTableRequest, and UpdateTable API in **stable** proto to external customers (#5496)

* feat: Publish CBT deletion_protection field in Table, UpdateTableRequest, and UpdateTable API in **stable** proto to external customers

PiperOrigin-RevId: 474010093

Source-Link: googleapis/googleapis@e210283

Source-Link: googleapis/googleapis-gen@46d5c58
Copy-Tag: eyJwIjoiQmlndGFibGUvLk93bEJvdC55YW1sIiwiaCI6IjQ2ZDVjNThiNjQ3ZWE5YzA1MGEwMGMzYjY4MjVhM2NmMzE2Zjg5NDgifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Sep 13, 2022
1 parent bf75ee4 commit 5d57d2f
Show file tree
Hide file tree
Showing 11 changed files with 637 additions and 0 deletions.
Binary file modified Bigtable/metadata/Admin/V2/BigtableTableAdmin.php
Binary file not shown.
Binary file modified Bigtable/metadata/Admin/V2/Table.php
Binary file not shown.
15 changes: 15 additions & 0 deletions Bigtable/src/Admin/V2/BigtableTableAdminGrpcClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ public function GetTable(\Google\Cloud\Bigtable\Admin\V2\GetTableRequest $argume
$metadata, $options);
}

/**
* Updates a specified table.
* @param \Google\Cloud\Bigtable\Admin\V2\UpdateTableRequest $argument input argument
* @param array $metadata metadata
* @param array $options call options
* @return \Grpc\UnaryCall
*/
public function UpdateTable(\Google\Cloud\Bigtable\Admin\V2\UpdateTableRequest $argument,
$metadata = [], $options = []) {
return $this->_simpleRequest('/google.bigtable.admin.v2.BigtableTableAdmin/UpdateTable',
$argument,
['\Google\LongRunning\Operation', 'decode'],
$metadata, $options);
}

/**
* Permanently deletes a specified table and all of its data.
* @param \Google\Cloud\Bigtable\Admin\V2\DeleteTableRequest $argument input argument
Expand Down
78 changes: 78 additions & 0 deletions Bigtable/src/Admin/V2/Gapic/BigtableTableAdminGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
use Google\Cloud\Bigtable\Admin\V2\Table\View;
use Google\Cloud\Bigtable\Admin\V2\UndeleteTableRequest;
use Google\Cloud\Bigtable\Admin\V2\UpdateBackupRequest;
use Google\Cloud\Bigtable\Admin\V2\UpdateTableRequest;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\GetPolicyOptions;
use Google\Cloud\Iam\V1\Policy;
Expand Down Expand Up @@ -1903,4 +1904,81 @@ public function updateBackup($backup, $updateMask, array $optionalArgs = [])
$optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
return $this->startCall('UpdateBackup', Backup::class, $optionalArgs, $request)->wait();
}

/**
* Updates a specified table.
*
* Sample code:
* ```
* $bigtableTableAdminClient = new Google\Cloud\Bigtable\Admin\V2\BigtableTableAdminClient();
* try {
* $table = new Google\Cloud\Bigtable\Admin\V2\Table();
* $updateMask = new Google\Protobuf\FieldMask();
* $operationResponse = $bigtableTableAdminClient->updateTable($table, $updateMask);
* $operationResponse->pollUntilComplete();
* if ($operationResponse->operationSucceeded()) {
* $result = $operationResponse->getResult();
* // doSomethingWith($result)
* } else {
* $error = $operationResponse->getError();
* // handleError($error)
* }
* // Alternatively:
* // start the operation, keep the operation name, and resume later
* $operationResponse = $bigtableTableAdminClient->updateTable($table, $updateMask);
* $operationName = $operationResponse->getName();
* // ... do other work
* $newOperationResponse = $bigtableTableAdminClient->resumeOperation($operationName, 'updateTable');
* while (!$newOperationResponse->isDone()) {
* // ... do other work
* $newOperationResponse->reload();
* }
* if ($newOperationResponse->operationSucceeded()) {
* $result = $newOperationResponse->getResult();
* // doSomethingWith($result)
* } else {
* $error = $newOperationResponse->getError();
* // handleError($error)
* }
* } finally {
* $bigtableTableAdminClient->close();
* }
* ```
*
* @param Table $table Required. The table to update.
* The table's `name` field is used to identify the table to update.
* Format:
* `projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`
* @param FieldMask $updateMask Required. The list of fields to update.
* A mask specifying which fields (e.g. `deletion_protection`) in the `table`
* field should be updated. This mask is relative to the `table` field, not to
* the request message. The wildcard (*) path is currently not supported.
* Currently UpdateTable is only supported for the following field:
* * `deletion_protection`
* If `column_families` is set in `update_mask`, it will return an
* UNIMPLEMENTED error.
* @param array $optionalArgs {
* Optional.
*
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
* associative array of retry settings parameters. See the documentation on
* {@see RetrySettings} for example usage.
* }
*
* @return \Google\ApiCore\OperationResponse
*
* @throws ApiException if the remote call fails
*/
public function updateTable($table, $updateMask, array $optionalArgs = [])
{
$request = new UpdateTableRequest();
$requestParamHeaders = [];
$request->setTable($table);
$request->setUpdateMask($updateMask);
$requestParamHeaders['table.name'] = $table->getName();
$requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders);
$optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader();
return $this->startOperationsCall('UpdateTable', $optionalArgs, $request, $this->getOperationsClient())->wait();
}
}
54 changes: 54 additions & 0 deletions Bigtable/src/Admin/V2/Table.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

156 changes: 156 additions & 0 deletions Bigtable/src/Admin/V2/UpdateTableMetadata.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5d57d2f

Please sign in to comment.