Skip to content

Commit

Permalink
feat: Publish CBT deletion_protection field in Table, UpdateTableRequ…
Browse files Browse the repository at this point in the history
…est, and UpdateTable API in **stable** proto to external customers (#1383)

* chore(bazel): Update WORKSPACE files for rules_gapic, gax_java, generator_java versions

PiperOrigin-RevId: 472750037

Source-Link: googleapis/googleapis@88f2ea3

Source-Link: googleapis/googleapis-gen@230a558
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjMwYTU1ODgzMDZhYWUxOGZlOGYyYTU3ZjE0ZDQwMzlhZDcyYzkwMSJ9

* 🦉 Updates from OwlBot post-processor

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

* 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: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkNWM1OGI2NDdlYTljMDUwYTAwYzNiNjgyNWEzY2YzMTZmODk0OCJ9

* 🦉 Updates from OwlBot post-processor

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

* add properties to table admin toString

* fix

* fix

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Kristen O'Leary <[email protected]>
  • Loading branch information
3 people committed Sep 15, 2022
1 parent a2db183 commit f1f3f05
Show file tree
Hide file tree
Showing 28 changed files with 4,783 additions and 768 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
import com.google.bigtable.admin.v2.UndeleteTableMetadata;
import com.google.bigtable.admin.v2.UndeleteTableRequest;
import com.google.bigtable.admin.v2.UpdateBackupRequest;
import com.google.bigtable.admin.v2.UpdateTableMetadata;
import com.google.bigtable.admin.v2.UpdateTableRequest;
import com.google.cloud.bigtable.admin.v2.stub.BigtableTableAdminStubSettings;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
Expand Down Expand Up @@ -114,6 +116,17 @@ public UnaryCallSettings<GetTableRequest, Table> getTableSettings() {
return ((BigtableTableAdminStubSettings) getStubSettings()).getTableSettings();
}

/** Returns the object with the settings used for calls to updateTable. */
public UnaryCallSettings<UpdateTableRequest, Operation> updateTableSettings() {
return ((BigtableTableAdminStubSettings) getStubSettings()).updateTableSettings();
}

/** Returns the object with the settings used for calls to updateTable. */
public OperationCallSettings<UpdateTableRequest, Table, UpdateTableMetadata>
updateTableOperationSettings() {
return ((BigtableTableAdminStubSettings) getStubSettings()).updateTableOperationSettings();
}

/** Returns the object with the settings used for calls to deleteTable. */
public UnaryCallSettings<DeleteTableRequest, Empty> deleteTableSettings() {
return ((BigtableTableAdminStubSettings) getStubSettings()).deleteTableSettings();
Expand Down Expand Up @@ -365,6 +378,17 @@ public UnaryCallSettings.Builder<GetTableRequest, Table> getTableSettings() {
return getStubSettingsBuilder().getTableSettings();
}

/** Returns the builder for the settings used for calls to updateTable. */
public UnaryCallSettings.Builder<UpdateTableRequest, Operation> updateTableSettings() {
return getStubSettingsBuilder().updateTableSettings();
}

/** Returns the builder for the settings used for calls to updateTable. */
public OperationCallSettings.Builder<UpdateTableRequest, Table, UpdateTableMetadata>
updateTableOperationSettings() {
return getStubSettingsBuilder().updateTableOperationSettings();
}

/** Returns the builder for the settings used for calls to deleteTable. */
public UnaryCallSettings.Builder<DeleteTableRequest, Empty> deleteTableSettings() {
return getStubSettingsBuilder().deleteTableSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public String toString() {
.add("stubSettings", stubSettings)
.add("undeleteTableSettings", stubSettings.undeleteTableSettings())
.add("undeleteTableOperationSettings", stubSettings.undeleteTableOperationSettings())
.add("updateTableSettings", stubSettings.updateTableSettings())
.add("updateTableOperationSettings", stubSettings.updateTableOperationSettings())
.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
},
"UpdateBackup": {
"methods": ["updateBackup", "updateBackup", "updateBackupCallable"]
},
"UpdateTable": {
"methods": ["updateTableAsync", "updateTableAsync", "updateTableOperationCallable", "updateTableCallable"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@
* <p>For example, to set the total timeout of getInstance to 30 seconds:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* BigtableInstanceAdminStubSettings.Builder baseBigtableInstanceAdminSettingsBuilder =
* BigtableInstanceAdminStubSettings.newBuilder();
* baseBigtableInstanceAdminSettingsBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
import com.google.bigtable.admin.v2.UndeleteTableMetadata;
import com.google.bigtable.admin.v2.UndeleteTableRequest;
import com.google.bigtable.admin.v2.UpdateBackupRequest;
import com.google.bigtable.admin.v2.UpdateTableMetadata;
import com.google.bigtable.admin.v2.UpdateTableRequest;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
Expand Down Expand Up @@ -104,6 +106,15 @@ public UnaryCallable<GetTableRequest, Table> getTableCallable() {
throw new UnsupportedOperationException("Not implemented: getTableCallable()");
}

public OperationCallable<UpdateTableRequest, Table, UpdateTableMetadata>
updateTableOperationCallable() {
throw new UnsupportedOperationException("Not implemented: updateTableOperationCallable()");
}

public UnaryCallable<UpdateTableRequest, Operation> updateTableCallable() {
throw new UnsupportedOperationException("Not implemented: updateTableCallable()");
}

public UnaryCallable<DeleteTableRequest, Empty> deleteTableCallable() {
throw new UnsupportedOperationException("Not implemented: deleteTableCallable()");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
import com.google.bigtable.admin.v2.UndeleteTableMetadata;
import com.google.bigtable.admin.v2.UndeleteTableRequest;
import com.google.bigtable.admin.v2.UpdateBackupRequest;
import com.google.bigtable.admin.v2.UpdateTableMetadata;
import com.google.bigtable.admin.v2.UpdateTableRequest;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
Expand Down Expand Up @@ -113,8 +115,11 @@
* <p>For example, to set the total timeout of createTable to 30 seconds:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* BigtableTableAdminStubSettings.Builder baseBigtableTableAdminSettingsBuilder =
* BigtableTableAdminStubSettings.newBuilder();
* baseBigtableTableAdminSettingsBuilder
Expand Down Expand Up @@ -152,6 +157,9 @@ public class BigtableTableAdminStubSettings extends StubSettings<BigtableTableAd
private final PagedCallSettings<ListTablesRequest, ListTablesResponse, ListTablesPagedResponse>
listTablesSettings;
private final UnaryCallSettings<GetTableRequest, Table> getTableSettings;
private final UnaryCallSettings<UpdateTableRequest, Operation> updateTableSettings;
private final OperationCallSettings<UpdateTableRequest, Table, UpdateTableMetadata>
updateTableOperationSettings;
private final UnaryCallSettings<DeleteTableRequest, Empty> deleteTableSettings;
private final UnaryCallSettings<UndeleteTableRequest, Operation> undeleteTableSettings;
private final OperationCallSettings<UndeleteTableRequest, Table, UndeleteTableMetadata>
Expand Down Expand Up @@ -374,6 +382,17 @@ public UnaryCallSettings<GetTableRequest, Table> getTableSettings() {
return getTableSettings;
}

/** Returns the object with the settings used for calls to updateTable. */
public UnaryCallSettings<UpdateTableRequest, Operation> updateTableSettings() {
return updateTableSettings;
}

/** Returns the object with the settings used for calls to updateTable. */
public OperationCallSettings<UpdateTableRequest, Table, UpdateTableMetadata>
updateTableOperationSettings() {
return updateTableOperationSettings;
}

/** Returns the object with the settings used for calls to deleteTable. */
public UnaryCallSettings<DeleteTableRequest, Empty> deleteTableSettings() {
return deleteTableSettings;
Expand Down Expand Up @@ -579,6 +598,8 @@ protected BigtableTableAdminStubSettings(Builder settingsBuilder) throws IOExcep
settingsBuilder.createTableFromSnapshotOperationSettings().build();
listTablesSettings = settingsBuilder.listTablesSettings().build();
getTableSettings = settingsBuilder.getTableSettings().build();
updateTableSettings = settingsBuilder.updateTableSettings().build();
updateTableOperationSettings = settingsBuilder.updateTableOperationSettings().build();
deleteTableSettings = settingsBuilder.deleteTableSettings().build();
undeleteTableSettings = settingsBuilder.undeleteTableSettings().build();
undeleteTableOperationSettings = settingsBuilder.undeleteTableOperationSettings().build();
Expand Down Expand Up @@ -618,6 +639,9 @@ public static class Builder
ListTablesRequest, ListTablesResponse, ListTablesPagedResponse>
listTablesSettings;
private final UnaryCallSettings.Builder<GetTableRequest, Table> getTableSettings;
private final UnaryCallSettings.Builder<UpdateTableRequest, Operation> updateTableSettings;
private final OperationCallSettings.Builder<UpdateTableRequest, Table, UpdateTableMetadata>
updateTableOperationSettings;
private final UnaryCallSettings.Builder<DeleteTableRequest, Empty> deleteTableSettings;
private final UnaryCallSettings.Builder<UndeleteTableRequest, Operation> undeleteTableSettings;
private final OperationCallSettings.Builder<UndeleteTableRequest, Table, UndeleteTableMetadata>
Expand Down Expand Up @@ -749,6 +773,8 @@ protected Builder(ClientContext clientContext) {
createTableFromSnapshotOperationSettings = OperationCallSettings.newBuilder();
listTablesSettings = PagedCallSettings.newBuilder(LIST_TABLES_PAGE_STR_FACT);
getTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
updateTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
updateTableOperationSettings = OperationCallSettings.newBuilder();
deleteTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
undeleteTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
undeleteTableOperationSettings = OperationCallSettings.newBuilder();
Expand Down Expand Up @@ -779,6 +805,7 @@ protected Builder(ClientContext clientContext) {
createTableFromSnapshotSettings,
listTablesSettings,
getTableSettings,
updateTableSettings,
deleteTableSettings,
undeleteTableSettings,
modifyColumnFamiliesSettings,
Expand Down Expand Up @@ -810,6 +837,8 @@ protected Builder(BigtableTableAdminStubSettings settings) {
settings.createTableFromSnapshotOperationSettings.toBuilder();
listTablesSettings = settings.listTablesSettings.toBuilder();
getTableSettings = settings.getTableSettings.toBuilder();
updateTableSettings = settings.updateTableSettings.toBuilder();
updateTableOperationSettings = settings.updateTableOperationSettings.toBuilder();
deleteTableSettings = settings.deleteTableSettings.toBuilder();
undeleteTableSettings = settings.undeleteTableSettings.toBuilder();
undeleteTableOperationSettings = settings.undeleteTableOperationSettings.toBuilder();
Expand Down Expand Up @@ -840,6 +869,7 @@ protected Builder(BigtableTableAdminStubSettings settings) {
createTableFromSnapshotSettings,
listTablesSettings,
getTableSettings,
updateTableSettings,
deleteTableSettings,
undeleteTableSettings,
modifyColumnFamiliesSettings,
Expand Down Expand Up @@ -895,6 +925,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));

builder
.updateTableSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.deleteTableSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
Expand Down Expand Up @@ -1015,6 +1050,29 @@ private static Builder initDefaults(Builder builder) {
.setTotalTimeout(Duration.ofMillis(3600000L))
.build()));

builder
.updateTableOperationSettings()
.setInitialCallSettings(
UnaryCallSettings.<UpdateTableRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Table.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(UpdateTableMetadata.class))
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(45000L))
.setInitialRpcTimeout(Duration.ZERO)
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));

builder
.undeleteTableOperationSettings()
.setInitialCallSettings(
Expand Down Expand Up @@ -1160,6 +1218,19 @@ public UnaryCallSettings.Builder<GetTableRequest, Table> getTableSettings() {
return getTableSettings;
}

/** Returns the builder for the settings used for calls to updateTable. */
public UnaryCallSettings.Builder<UpdateTableRequest, Operation> updateTableSettings() {
return updateTableSettings;
}

/** Returns the builder for the settings used for calls to updateTable. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<UpdateTableRequest, Table, UpdateTableMetadata>
updateTableOperationSettings() {
return updateTableOperationSettings;
}

/** Returns the builder for the settings used for calls to deleteTable. */
public UnaryCallSettings.Builder<DeleteTableRequest, Empty> deleteTableSettings() {
return deleteTableSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
import com.google.bigtable.admin.v2.UndeleteTableMetadata;
import com.google.bigtable.admin.v2.UndeleteTableRequest;
import com.google.bigtable.admin.v2.UpdateBackupRequest;
import com.google.bigtable.admin.v2.UpdateTableMetadata;
import com.google.bigtable.admin.v2.UpdateTableRequest;
import com.google.common.collect.ImmutableMap;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
Expand Down Expand Up @@ -117,6 +119,14 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub {
.setResponseMarshaller(ProtoUtils.marshaller(Table.getDefaultInstance()))
.build();

private static final MethodDescriptor<UpdateTableRequest, Operation> updateTableMethodDescriptor =
MethodDescriptor.<UpdateTableRequest, Operation>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.bigtable.admin.v2.BigtableTableAdmin/UpdateTable")
.setRequestMarshaller(ProtoUtils.marshaller(UpdateTableRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();

private static final MethodDescriptor<DeleteTableRequest, Empty> deleteTableMethodDescriptor =
MethodDescriptor.<DeleteTableRequest, Empty>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
Expand Down Expand Up @@ -305,6 +315,9 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub {
private final UnaryCallable<ListTablesRequest, ListTablesResponse> listTablesCallable;
private final UnaryCallable<ListTablesRequest, ListTablesPagedResponse> listTablesPagedCallable;
private final UnaryCallable<GetTableRequest, Table> getTableCallable;
private final UnaryCallable<UpdateTableRequest, Operation> updateTableCallable;
private final OperationCallable<UpdateTableRequest, Table, UpdateTableMetadata>
updateTableOperationCallable;
private final UnaryCallable<DeleteTableRequest, Empty> deleteTableCallable;
private final UnaryCallable<UndeleteTableRequest, Operation> undeleteTableCallable;
private final OperationCallable<UndeleteTableRequest, Table, UndeleteTableMetadata>
Expand Down Expand Up @@ -425,6 +438,16 @@ protected GrpcBigtableTableAdminStub(
return params.build();
})
.build();
GrpcCallSettings<UpdateTableRequest, Operation> updateTableTransportSettings =
GrpcCallSettings.<UpdateTableRequest, Operation>newBuilder()
.setMethodDescriptor(updateTableMethodDescriptor)
.setParamsExtractor(
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("table.name", String.valueOf(request.getTable().getName()));
return params.build();
})
.build();
GrpcCallSettings<DeleteTableRequest, Empty> deleteTableTransportSettings =
GrpcCallSettings.<DeleteTableRequest, Empty>newBuilder()
.setMethodDescriptor(deleteTableMethodDescriptor)
Expand Down Expand Up @@ -643,6 +666,15 @@ protected GrpcBigtableTableAdminStub(
this.getTableCallable =
callableFactory.createUnaryCallable(
getTableTransportSettings, settings.getTableSettings(), clientContext);
this.updateTableCallable =
callableFactory.createUnaryCallable(
updateTableTransportSettings, settings.updateTableSettings(), clientContext);
this.updateTableOperationCallable =
callableFactory.createOperationCallable(
updateTableTransportSettings,
settings.updateTableOperationSettings(),
clientContext,
operationsStub);
this.deleteTableCallable =
callableFactory.createUnaryCallable(
deleteTableTransportSettings, settings.deleteTableSettings(), clientContext);
Expand Down Expand Up @@ -777,6 +809,17 @@ public UnaryCallable<GetTableRequest, Table> getTableCallable() {
return getTableCallable;
}

@Override
public UnaryCallable<UpdateTableRequest, Operation> updateTableCallable() {
return updateTableCallable;
}

@Override
public OperationCallable<UpdateTableRequest, Table, UpdateTableMetadata>
updateTableOperationCallable() {
return updateTableOperationCallable;
}

@Override
public UnaryCallable<DeleteTableRequest, Empty> deleteTableCallable() {
return deleteTableCallable;
Expand Down

0 comments on commit f1f3f05

Please sign in to comment.