Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update BigtableTableAdmin GetIamPolicy to include the additional binding for Backup, change DeleteAppProfileRequest.ignore_warnings to REQUIRED. #530

Merged
merged 1 commit into from Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -1725,8 +1725,10 @@ public final void deleteAppProfile(String name) {
* <pre><code>
* try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
* AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
* boolean ignoreWarnings = false;
* DeleteAppProfileRequest request = DeleteAppProfileRequest.newBuilder()
* .setName(name.toString())
* .setIgnoreWarnings(ignoreWarnings)
* .build();
* baseBigtableInstanceAdminClient.deleteAppProfile(request);
* }
Expand All @@ -1748,8 +1750,10 @@ public final void deleteAppProfile(DeleteAppProfileRequest request) {
* <pre><code>
* try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) {
* AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
* boolean ignoreWarnings = false;
* DeleteAppProfileRequest request = DeleteAppProfileRequest.newBuilder()
* .setName(name.toString())
* .setIgnoreWarnings(ignoreWarnings)
* .build();
* ApiFuture&lt;Void&gt; future = baseBigtableInstanceAdminClient.deleteAppProfileCallable().futureCall(request);
* // Do something
Expand Down
Expand Up @@ -1157,8 +1157,8 @@ public final CheckConsistencyResponse checkConsistency(CheckConsistencyRequest r

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Gets the access control policy for a resource. Returns an empty policy if the resource exists
* but does not have a policy set.
* Gets the access control policy for a Table or Backup resource. Returns an empty policy if the
* resource exists but does not have a policy set.
*
* <p>Sample code:
*
Expand All @@ -1183,8 +1183,8 @@ public final Policy getIamPolicy(ResourceName resource) {

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Gets the access control policy for a resource. Returns an empty policy if the resource exists
* but does not have a policy set.
* Gets the access control policy for a Table or Backup resource. Returns an empty policy if the
* resource exists but does not have a policy set.
*
* <p>Sample code:
*
Expand All @@ -1206,8 +1206,8 @@ public final Policy getIamPolicy(String resource) {

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Gets the access control policy for a resource. Returns an empty policy if the resource exists
* but does not have a policy set.
* Gets the access control policy for a Table or Backup resource. Returns an empty policy if the
* resource exists but does not have a policy set.
*
* <p>Sample code:
*
Expand All @@ -1230,8 +1230,8 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Gets the access control policy for a resource. Returns an empty policy if the resource exists
* but does not have a policy set.
* Gets the access control policy for a Table or Backup resource. Returns an empty policy if the
* resource exists but does not have a policy set.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -1359,7 +1359,7 @@ public final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() {

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns permissions that the caller has on the specified table resource.
* Returns permissions that the caller has on the specified Table or Backup resource.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -1390,7 +1390,7 @@ public final TestIamPermissionsResponse testIamPermissions(

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns permissions that the caller has on the specified table resource.
* Returns permissions that the caller has on the specified Table or Backup resource.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -1421,7 +1421,7 @@ public final TestIamPermissionsResponse testIamPermissions(

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns permissions that the caller has on the specified table resource.
* Returns permissions that the caller has on the specified Table or Backup resource.
*
* <p>Sample code:
*
Expand All @@ -1446,7 +1446,7 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Returns permissions that the caller has on the specified table resource.
* Returns permissions that the caller has on the specified Table or Backup resource.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -2646,7 +2646,12 @@ public final UnaryCallable<DeleteBackupRequest, Empty> deleteBackupCallable() {
*
* <pre><code>
* try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
* RestoreTableRequest request = RestoreTableRequest.newBuilder().build();
* InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
* String tableId = "";
* RestoreTableRequest request = RestoreTableRequest.newBuilder()
* .setParent(parent.toString())
* .setTableId(tableId)
* .build();
* Table response = baseBigtableTableAdminClient.restoreTableAsync(request).get();
* }
* </code></pre>
Expand Down Expand Up @@ -2675,7 +2680,12 @@ public final OperationFuture<Table, RestoreTableMetadata> restoreTableAsync(
*
* <pre><code>
* try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
* RestoreTableRequest request = RestoreTableRequest.newBuilder().build();
* InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
* String tableId = "";
* RestoreTableRequest request = RestoreTableRequest.newBuilder()
* .setParent(parent.toString())
* .setTableId(tableId)
* .build();
* OperationFuture&lt;Table, RestoreTableMetadata&gt; future = baseBigtableTableAdminClient.restoreTableOperationCallable().futureCall(request);
* // Do something
* Table response = future.get();
Expand All @@ -2702,7 +2712,12 @@ public final OperationFuture<Table, RestoreTableMetadata> restoreTableAsync(
*
* <pre><code>
* try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) {
* RestoreTableRequest request = RestoreTableRequest.newBuilder().build();
* InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
* String tableId = "";
* RestoreTableRequest request = RestoreTableRequest.newBuilder()
* .setParent(parent.toString())
* .setTableId(tableId)
* .build();
* ApiFuture&lt;Operation&gt; future = baseBigtableTableAdminClient.restoreTableCallable().futureCall(request);
* // Do something
* Operation response = future.get();
Expand Down
Expand Up @@ -1094,7 +1094,10 @@ public void restoreTableTest() throws Exception {
.build();
mockBigtableTableAdmin.addResponse(resultOperation);

RestoreTableRequest request = RestoreTableRequest.newBuilder().build();
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
String tableId = "tableId-895419604";
RestoreTableRequest request =
RestoreTableRequest.newBuilder().setParent(parent.toString()).setTableId(tableId).build();

Table actualResponse = client.restoreTableAsync(request).get();
Assert.assertEquals(expectedResponse, actualResponse);
Expand All @@ -1103,6 +1106,8 @@ public void restoreTableTest() throws Exception {
Assert.assertEquals(1, actualRequests.size());
RestoreTableRequest actualRequest = (RestoreTableRequest) actualRequests.get(0);

Assert.assertEquals(parent, InstanceName.parse(actualRequest.getParent()));
Assert.assertEquals(tableId, actualRequest.getTableId());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
Expand All @@ -1116,7 +1121,10 @@ public void restoreTableExceptionTest() throws Exception {
mockBigtableTableAdmin.addException(exception);

try {
RestoreTableRequest request = RestoreTableRequest.newBuilder().build();
InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
String tableId = "tableId-895419604";
RestoreTableRequest request =
RestoreTableRequest.newBuilder().setParent(parent.toString()).setTableId(tableId).build();

client.restoreTableAsync(request).get();
Assert.fail("No exception raised");
Expand Down
Expand Up @@ -1278,14 +1278,14 @@ public void deleteSnapshot(
*
*
* <pre>
* Starts creating a new Cloud Bigtable Backup. The returned backup
* Starts creating a new Cloud Bigtable Backup. The returned backup
* [long-running operation][google.longrunning.Operation] can be used to
* track creation of the backup. The
* [metadata][google.longrunning.Operation.metadata] field type is
* [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The
* [response][google.longrunning.Operation.response] field type is
* [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the
* returned operation will stop the creation and delete the backup.
* [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the returned operation will stop the
* creation and delete the backup.
* </pre>
*/
public void createBackup(
Expand Down Expand Up @@ -1353,11 +1353,11 @@ public void listBackups(
*
* <pre>
* Create a new table by restoring from a completed backup. The new table
* must be in the same instance as the instance containing the backup. The
* must be in the same instance as the instance containing the backup. The
* returned table [long-running operation][google.longrunning.Operation] can
* be used to track the progress of the operation, and to cancel it. The
* be used to track the progress of the operation, and to cancel it. The
* [metadata][google.longrunning.Operation.metadata] field type is
* [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
* [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
* [response][google.longrunning.Operation.response] type is
* [Table][google.bigtable.admin.v2.Table], if successful.
* </pre>
Expand All @@ -1372,7 +1372,7 @@ public void restoreTable(
*
*
* <pre>
* Gets the access control policy for a resource.
* Gets the access control policy for a Table or Backup resource.
* Returns an empty policy if the resource exists but does not have a policy
* set.
* </pre>
Expand Down Expand Up @@ -1401,7 +1401,7 @@ public void setIamPolicy(
*
*
* <pre>
* Returns permissions that the caller has on the specified table resource.
* Returns permissions that the caller has on the specified Table or Backup resource.
* </pre>
*/
public void testIamPermissions(
Expand Down Expand Up @@ -1827,14 +1827,14 @@ public void deleteSnapshot(
*
*
* <pre>
* Starts creating a new Cloud Bigtable Backup. The returned backup
* Starts creating a new Cloud Bigtable Backup. The returned backup
* [long-running operation][google.longrunning.Operation] can be used to
* track creation of the backup. The
* [metadata][google.longrunning.Operation.metadata] field type is
* [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The
* [response][google.longrunning.Operation.response] field type is
* [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the
* returned operation will stop the creation and delete the backup.
* [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the returned operation will stop the
* creation and delete the backup.
* </pre>
*/
public void createBackup(
Expand Down Expand Up @@ -1915,11 +1915,11 @@ public void listBackups(
*
* <pre>
* Create a new table by restoring from a completed backup. The new table
* must be in the same instance as the instance containing the backup. The
* must be in the same instance as the instance containing the backup. The
* returned table [long-running operation][google.longrunning.Operation] can
* be used to track the progress of the operation, and to cancel it. The
* be used to track the progress of the operation, and to cancel it. The
* [metadata][google.longrunning.Operation.metadata] field type is
* [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
* [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
* [response][google.longrunning.Operation.response] type is
* [Table][google.bigtable.admin.v2.Table], if successful.
* </pre>
Expand All @@ -1937,7 +1937,7 @@ public void restoreTable(
*
*
* <pre>
* Gets the access control policy for a resource.
* Gets the access control policy for a Table or Backup resource.
* Returns an empty policy if the resource exists but does not have a policy
* set.
* </pre>
Expand Down Expand Up @@ -1972,7 +1972,7 @@ public void setIamPolicy(
*
*
* <pre>
* Returns permissions that the caller has on the specified table resource.
* Returns permissions that the caller has on the specified Table or Backup resource.
* </pre>
*/
public void testIamPermissions(
Expand Down Expand Up @@ -2211,14 +2211,14 @@ public com.google.protobuf.Empty deleteSnapshot(
*
*
* <pre>
* Starts creating a new Cloud Bigtable Backup. The returned backup
* Starts creating a new Cloud Bigtable Backup. The returned backup
* [long-running operation][google.longrunning.Operation] can be used to
* track creation of the backup. The
* [metadata][google.longrunning.Operation.metadata] field type is
* [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The
* [response][google.longrunning.Operation.response] field type is
* [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the
* returned operation will stop the creation and delete the backup.
* [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the returned operation will stop the
* creation and delete the backup.
* </pre>
*/
public com.google.longrunning.Operation createBackup(
Expand Down Expand Up @@ -2280,11 +2280,11 @@ public com.google.bigtable.admin.v2.ListBackupsResponse listBackups(
*
* <pre>
* Create a new table by restoring from a completed backup. The new table
* must be in the same instance as the instance containing the backup. The
* must be in the same instance as the instance containing the backup. The
* returned table [long-running operation][google.longrunning.Operation] can
* be used to track the progress of the operation, and to cancel it. The
* be used to track the progress of the operation, and to cancel it. The
* [metadata][google.longrunning.Operation.metadata] field type is
* [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
* [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
* [response][google.longrunning.Operation.response] type is
* [Table][google.bigtable.admin.v2.Table], if successful.
* </pre>
Expand All @@ -2298,7 +2298,7 @@ public com.google.longrunning.Operation restoreTable(
*
*
* <pre>
* Gets the access control policy for a resource.
* Gets the access control policy for a Table or Backup resource.
* Returns an empty policy if the resource exists but does not have a policy
* set.
* </pre>
Expand All @@ -2323,7 +2323,7 @@ public com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyReque
*
*
* <pre>
* Returns permissions that the caller has on the specified table resource.
* Returns permissions that the caller has on the specified Table or Backup resource.
* </pre>
*/
public com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(
Expand Down Expand Up @@ -2571,14 +2571,14 @@ protected BigtableTableAdminFutureStub build(
*
*
* <pre>
* Starts creating a new Cloud Bigtable Backup. The returned backup
* Starts creating a new Cloud Bigtable Backup. The returned backup
* [long-running operation][google.longrunning.Operation] can be used to
* track creation of the backup. The
* [metadata][google.longrunning.Operation.metadata] field type is
* [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The
* [response][google.longrunning.Operation.response] field type is
* [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the
* returned operation will stop the creation and delete the backup.
* [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the returned operation will stop the
* creation and delete the backup.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation>
Expand Down Expand Up @@ -2645,11 +2645,11 @@ protected BigtableTableAdminFutureStub build(
*
* <pre>
* Create a new table by restoring from a completed backup. The new table
* must be in the same instance as the instance containing the backup. The
* must be in the same instance as the instance containing the backup. The
* returned table [long-running operation][google.longrunning.Operation] can
* be used to track the progress of the operation, and to cancel it. The
* be used to track the progress of the operation, and to cancel it. The
* [metadata][google.longrunning.Operation.metadata] field type is
* [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
* [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
* [response][google.longrunning.Operation.response] type is
* [Table][google.bigtable.admin.v2.Table], if successful.
* </pre>
Expand All @@ -2664,7 +2664,7 @@ protected BigtableTableAdminFutureStub build(
*
*
* <pre>
* Gets the access control policy for a resource.
* Gets the access control policy for a Table or Backup resource.
* Returns an empty policy if the resource exists but does not have a policy
* set.
* </pre>
Expand Down Expand Up @@ -2693,7 +2693,7 @@ protected BigtableTableAdminFutureStub build(
*
*
* <pre>
* Returns permissions that the caller has on the specified table resource.
* Returns permissions that the caller has on the specified Table or Backup resource.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<
Expand Down