Skip to content

Commit f1f3f05

Browse files
feat: Publish CBT deletion_protection field in Table, UpdateTableRequest, 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: https://github.com/googleapis/googleapis-gen/commit/230a5588306aae18fe8f2a57f14d4039ad72c901 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: https://github.com/googleapis/googleapis-gen/commit/46d5c58b647ea9c050a00c3b6825a3cf316f8948 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 <kaoleary@google.com>
1 parent a2db183 commit f1f3f05

28 files changed

+4783
-768
lines changed

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableInstanceAdminClient.java

Lines changed: 427 additions & 170 deletions
Large diffs are not rendered by default.

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java

Lines changed: 627 additions & 198 deletions
Large diffs are not rendered by default.

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminSettings.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
import com.google.bigtable.admin.v2.UndeleteTableMetadata;
6767
import com.google.bigtable.admin.v2.UndeleteTableRequest;
6868
import com.google.bigtable.admin.v2.UpdateBackupRequest;
69+
import com.google.bigtable.admin.v2.UpdateTableMetadata;
70+
import com.google.bigtable.admin.v2.UpdateTableRequest;
6971
import com.google.cloud.bigtable.admin.v2.stub.BigtableTableAdminStubSettings;
7072
import com.google.iam.v1.GetIamPolicyRequest;
7173
import com.google.iam.v1.Policy;
@@ -114,6 +116,17 @@ public UnaryCallSettings<GetTableRequest, Table> getTableSettings() {
114116
return ((BigtableTableAdminStubSettings) getStubSettings()).getTableSettings();
115117
}
116118

119+
/** Returns the object with the settings used for calls to updateTable. */
120+
public UnaryCallSettings<UpdateTableRequest, Operation> updateTableSettings() {
121+
return ((BigtableTableAdminStubSettings) getStubSettings()).updateTableSettings();
122+
}
123+
124+
/** Returns the object with the settings used for calls to updateTable. */
125+
public OperationCallSettings<UpdateTableRequest, Table, UpdateTableMetadata>
126+
updateTableOperationSettings() {
127+
return ((BigtableTableAdminStubSettings) getStubSettings()).updateTableOperationSettings();
128+
}
129+
117130
/** Returns the object with the settings used for calls to deleteTable. */
118131
public UnaryCallSettings<DeleteTableRequest, Empty> deleteTableSettings() {
119132
return ((BigtableTableAdminStubSettings) getStubSettings()).deleteTableSettings();
@@ -365,6 +378,17 @@ public UnaryCallSettings.Builder<GetTableRequest, Table> getTableSettings() {
365378
return getStubSettingsBuilder().getTableSettings();
366379
}
367380

381+
/** Returns the builder for the settings used for calls to updateTable. */
382+
public UnaryCallSettings.Builder<UpdateTableRequest, Operation> updateTableSettings() {
383+
return getStubSettingsBuilder().updateTableSettings();
384+
}
385+
386+
/** Returns the builder for the settings used for calls to updateTable. */
387+
public OperationCallSettings.Builder<UpdateTableRequest, Table, UpdateTableMetadata>
388+
updateTableOperationSettings() {
389+
return getStubSettingsBuilder().updateTableOperationSettings();
390+
}
391+
368392
/** Returns the builder for the settings used for calls to deleteTable. */
369393
public UnaryCallSettings.Builder<DeleteTableRequest, Empty> deleteTableSettings() {
370394
return getStubSettingsBuilder().deleteTableSettings();

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ public String toString() {
122122
.add("stubSettings", stubSettings)
123123
.add("undeleteTableSettings", stubSettings.undeleteTableSettings())
124124
.add("undeleteTableOperationSettings", stubSettings.undeleteTableOperationSettings())
125+
.add("updateTableSettings", stubSettings.updateTableSettings())
126+
.add("updateTableOperationSettings", stubSettings.updateTableOperationSettings())
125127
.toString();
126128
}
127129

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/gapic_metadata.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@
150150
},
151151
"UpdateBackup": {
152152
"methods": ["updateBackup", "updateBackup", "updateBackupCallable"]
153+
},
154+
"UpdateTable": {
155+
"methods": ["updateTableAsync", "updateTableAsync", "updateTableOperationCallable", "updateTableCallable"]
153156
}
154157
}
155158
}

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableInstanceAdminStubSettings.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@
109109
* <p>For example, to set the total timeout of getInstance to 30 seconds:
110110
*
111111
* <pre>{@code
112-
* // This snippet has been automatically generated for illustrative purposes only.
113-
* // It may require modifications to work in your environment.
112+
* // This snippet has been automatically generated and should be regarded as a code template only.
113+
* // It will require modifications to work:
114+
* // - It may require correct/in-range values for request initialization.
115+
* // - It may require specifying regional endpoints when creating the service client as shown in
116+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
114117
* BigtableInstanceAdminStubSettings.Builder baseBigtableInstanceAdminSettingsBuilder =
115118
* BigtableInstanceAdminStubSettings.newBuilder();
116119
* baseBigtableInstanceAdminSettingsBuilder

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStub.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
import com.google.bigtable.admin.v2.UndeleteTableMetadata;
5858
import com.google.bigtable.admin.v2.UndeleteTableRequest;
5959
import com.google.bigtable.admin.v2.UpdateBackupRequest;
60+
import com.google.bigtable.admin.v2.UpdateTableMetadata;
61+
import com.google.bigtable.admin.v2.UpdateTableRequest;
6062
import com.google.iam.v1.GetIamPolicyRequest;
6163
import com.google.iam.v1.Policy;
6264
import com.google.iam.v1.SetIamPolicyRequest;
@@ -104,6 +106,15 @@ public UnaryCallable<GetTableRequest, Table> getTableCallable() {
104106
throw new UnsupportedOperationException("Not implemented: getTableCallable()");
105107
}
106108

109+
public OperationCallable<UpdateTableRequest, Table, UpdateTableMetadata>
110+
updateTableOperationCallable() {
111+
throw new UnsupportedOperationException("Not implemented: updateTableOperationCallable()");
112+
}
113+
114+
public UnaryCallable<UpdateTableRequest, Operation> updateTableCallable() {
115+
throw new UnsupportedOperationException("Not implemented: updateTableCallable()");
116+
}
117+
107118
public UnaryCallable<DeleteTableRequest, Empty> deleteTableCallable() {
108119
throw new UnsupportedOperationException("Not implemented: deleteTableCallable()");
109120
}

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/BigtableTableAdminStubSettings.java

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
import com.google.bigtable.admin.v2.UndeleteTableMetadata;
8080
import com.google.bigtable.admin.v2.UndeleteTableRequest;
8181
import com.google.bigtable.admin.v2.UpdateBackupRequest;
82+
import com.google.bigtable.admin.v2.UpdateTableMetadata;
83+
import com.google.bigtable.admin.v2.UpdateTableRequest;
8284
import com.google.common.collect.ImmutableList;
8385
import com.google.common.collect.ImmutableMap;
8486
import com.google.common.collect.ImmutableSet;
@@ -113,8 +115,11 @@
113115
* <p>For example, to set the total timeout of createTable to 30 seconds:
114116
*
115117
* <pre>{@code
116-
* // This snippet has been automatically generated for illustrative purposes only.
117-
* // It may require modifications to work in your environment.
118+
* // This snippet has been automatically generated and should be regarded as a code template only.
119+
* // It will require modifications to work:
120+
* // - It may require correct/in-range values for request initialization.
121+
* // - It may require specifying regional endpoints when creating the service client as shown in
122+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
118123
* BigtableTableAdminStubSettings.Builder baseBigtableTableAdminSettingsBuilder =
119124
* BigtableTableAdminStubSettings.newBuilder();
120125
* baseBigtableTableAdminSettingsBuilder
@@ -152,6 +157,9 @@ public class BigtableTableAdminStubSettings extends StubSettings<BigtableTableAd
152157
private final PagedCallSettings<ListTablesRequest, ListTablesResponse, ListTablesPagedResponse>
153158
listTablesSettings;
154159
private final UnaryCallSettings<GetTableRequest, Table> getTableSettings;
160+
private final UnaryCallSettings<UpdateTableRequest, Operation> updateTableSettings;
161+
private final OperationCallSettings<UpdateTableRequest, Table, UpdateTableMetadata>
162+
updateTableOperationSettings;
155163
private final UnaryCallSettings<DeleteTableRequest, Empty> deleteTableSettings;
156164
private final UnaryCallSettings<UndeleteTableRequest, Operation> undeleteTableSettings;
157165
private final OperationCallSettings<UndeleteTableRequest, Table, UndeleteTableMetadata>
@@ -374,6 +382,17 @@ public UnaryCallSettings<GetTableRequest, Table> getTableSettings() {
374382
return getTableSettings;
375383
}
376384

385+
/** Returns the object with the settings used for calls to updateTable. */
386+
public UnaryCallSettings<UpdateTableRequest, Operation> updateTableSettings() {
387+
return updateTableSettings;
388+
}
389+
390+
/** Returns the object with the settings used for calls to updateTable. */
391+
public OperationCallSettings<UpdateTableRequest, Table, UpdateTableMetadata>
392+
updateTableOperationSettings() {
393+
return updateTableOperationSettings;
394+
}
395+
377396
/** Returns the object with the settings used for calls to deleteTable. */
378397
public UnaryCallSettings<DeleteTableRequest, Empty> deleteTableSettings() {
379398
return deleteTableSettings;
@@ -579,6 +598,8 @@ protected BigtableTableAdminStubSettings(Builder settingsBuilder) throws IOExcep
579598
settingsBuilder.createTableFromSnapshotOperationSettings().build();
580599
listTablesSettings = settingsBuilder.listTablesSettings().build();
581600
getTableSettings = settingsBuilder.getTableSettings().build();
601+
updateTableSettings = settingsBuilder.updateTableSettings().build();
602+
updateTableOperationSettings = settingsBuilder.updateTableOperationSettings().build();
582603
deleteTableSettings = settingsBuilder.deleteTableSettings().build();
583604
undeleteTableSettings = settingsBuilder.undeleteTableSettings().build();
584605
undeleteTableOperationSettings = settingsBuilder.undeleteTableOperationSettings().build();
@@ -618,6 +639,9 @@ public static class Builder
618639
ListTablesRequest, ListTablesResponse, ListTablesPagedResponse>
619640
listTablesSettings;
620641
private final UnaryCallSettings.Builder<GetTableRequest, Table> getTableSettings;
642+
private final UnaryCallSettings.Builder<UpdateTableRequest, Operation> updateTableSettings;
643+
private final OperationCallSettings.Builder<UpdateTableRequest, Table, UpdateTableMetadata>
644+
updateTableOperationSettings;
621645
private final UnaryCallSettings.Builder<DeleteTableRequest, Empty> deleteTableSettings;
622646
private final UnaryCallSettings.Builder<UndeleteTableRequest, Operation> undeleteTableSettings;
623647
private final OperationCallSettings.Builder<UndeleteTableRequest, Table, UndeleteTableMetadata>
@@ -749,6 +773,8 @@ protected Builder(ClientContext clientContext) {
749773
createTableFromSnapshotOperationSettings = OperationCallSettings.newBuilder();
750774
listTablesSettings = PagedCallSettings.newBuilder(LIST_TABLES_PAGE_STR_FACT);
751775
getTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
776+
updateTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
777+
updateTableOperationSettings = OperationCallSettings.newBuilder();
752778
deleteTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
753779
undeleteTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
754780
undeleteTableOperationSettings = OperationCallSettings.newBuilder();
@@ -779,6 +805,7 @@ protected Builder(ClientContext clientContext) {
779805
createTableFromSnapshotSettings,
780806
listTablesSettings,
781807
getTableSettings,
808+
updateTableSettings,
782809
deleteTableSettings,
783810
undeleteTableSettings,
784811
modifyColumnFamiliesSettings,
@@ -810,6 +837,8 @@ protected Builder(BigtableTableAdminStubSettings settings) {
810837
settings.createTableFromSnapshotOperationSettings.toBuilder();
811838
listTablesSettings = settings.listTablesSettings.toBuilder();
812839
getTableSettings = settings.getTableSettings.toBuilder();
840+
updateTableSettings = settings.updateTableSettings.toBuilder();
841+
updateTableOperationSettings = settings.updateTableOperationSettings.toBuilder();
813842
deleteTableSettings = settings.deleteTableSettings.toBuilder();
814843
undeleteTableSettings = settings.undeleteTableSettings.toBuilder();
815844
undeleteTableOperationSettings = settings.undeleteTableOperationSettings.toBuilder();
@@ -840,6 +869,7 @@ protected Builder(BigtableTableAdminStubSettings settings) {
840869
createTableFromSnapshotSettings,
841870
listTablesSettings,
842871
getTableSettings,
872+
updateTableSettings,
843873
deleteTableSettings,
844874
undeleteTableSettings,
845875
modifyColumnFamiliesSettings,
@@ -895,6 +925,11 @@ private static Builder initDefaults(Builder builder) {
895925
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
896926
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
897927

928+
builder
929+
.updateTableSettings()
930+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
931+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));
932+
898933
builder
899934
.deleteTableSettings()
900935
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
@@ -1015,6 +1050,29 @@ private static Builder initDefaults(Builder builder) {
10151050
.setTotalTimeout(Duration.ofMillis(3600000L))
10161051
.build()));
10171052

1053+
builder
1054+
.updateTableOperationSettings()
1055+
.setInitialCallSettings(
1056+
UnaryCallSettings.<UpdateTableRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
1057+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
1058+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"))
1059+
.build())
1060+
.setResponseTransformer(
1061+
ProtoOperationTransformers.ResponseTransformer.create(Table.class))
1062+
.setMetadataTransformer(
1063+
ProtoOperationTransformers.MetadataTransformer.create(UpdateTableMetadata.class))
1064+
.setPollingAlgorithm(
1065+
OperationTimedPollAlgorithm.create(
1066+
RetrySettings.newBuilder()
1067+
.setInitialRetryDelay(Duration.ofMillis(5000L))
1068+
.setRetryDelayMultiplier(1.5)
1069+
.setMaxRetryDelay(Duration.ofMillis(45000L))
1070+
.setInitialRpcTimeout(Duration.ZERO)
1071+
.setRpcTimeoutMultiplier(1.0)
1072+
.setMaxRpcTimeout(Duration.ZERO)
1073+
.setTotalTimeout(Duration.ofMillis(300000L))
1074+
.build()));
1075+
10181076
builder
10191077
.undeleteTableOperationSettings()
10201078
.setInitialCallSettings(
@@ -1160,6 +1218,19 @@ public UnaryCallSettings.Builder<GetTableRequest, Table> getTableSettings() {
11601218
return getTableSettings;
11611219
}
11621220

1221+
/** Returns the builder for the settings used for calls to updateTable. */
1222+
public UnaryCallSettings.Builder<UpdateTableRequest, Operation> updateTableSettings() {
1223+
return updateTableSettings;
1224+
}
1225+
1226+
/** Returns the builder for the settings used for calls to updateTable. */
1227+
@BetaApi(
1228+
"The surface for use by generated code is not stable yet and may change in the future.")
1229+
public OperationCallSettings.Builder<UpdateTableRequest, Table, UpdateTableMetadata>
1230+
updateTableOperationSettings() {
1231+
return updateTableOperationSettings;
1232+
}
1233+
11631234
/** Returns the builder for the settings used for calls to deleteTable. */
11641235
public UnaryCallSettings.Builder<DeleteTableRequest, Empty> deleteTableSettings() {
11651236
return deleteTableSettings;

google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/GrpcBigtableTableAdminStub.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
import com.google.bigtable.admin.v2.UndeleteTableMetadata;
6262
import com.google.bigtable.admin.v2.UndeleteTableRequest;
6363
import com.google.bigtable.admin.v2.UpdateBackupRequest;
64+
import com.google.bigtable.admin.v2.UpdateTableMetadata;
65+
import com.google.bigtable.admin.v2.UpdateTableRequest;
6466
import com.google.common.collect.ImmutableMap;
6567
import com.google.iam.v1.GetIamPolicyRequest;
6668
import com.google.iam.v1.Policy;
@@ -117,6 +119,14 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub {
117119
.setResponseMarshaller(ProtoUtils.marshaller(Table.getDefaultInstance()))
118120
.build();
119121

122+
private static final MethodDescriptor<UpdateTableRequest, Operation> updateTableMethodDescriptor =
123+
MethodDescriptor.<UpdateTableRequest, Operation>newBuilder()
124+
.setType(MethodDescriptor.MethodType.UNARY)
125+
.setFullMethodName("google.bigtable.admin.v2.BigtableTableAdmin/UpdateTable")
126+
.setRequestMarshaller(ProtoUtils.marshaller(UpdateTableRequest.getDefaultInstance()))
127+
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
128+
.build();
129+
120130
private static final MethodDescriptor<DeleteTableRequest, Empty> deleteTableMethodDescriptor =
121131
MethodDescriptor.<DeleteTableRequest, Empty>newBuilder()
122132
.setType(MethodDescriptor.MethodType.UNARY)
@@ -305,6 +315,9 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub {
305315
private final UnaryCallable<ListTablesRequest, ListTablesResponse> listTablesCallable;
306316
private final UnaryCallable<ListTablesRequest, ListTablesPagedResponse> listTablesPagedCallable;
307317
private final UnaryCallable<GetTableRequest, Table> getTableCallable;
318+
private final UnaryCallable<UpdateTableRequest, Operation> updateTableCallable;
319+
private final OperationCallable<UpdateTableRequest, Table, UpdateTableMetadata>
320+
updateTableOperationCallable;
308321
private final UnaryCallable<DeleteTableRequest, Empty> deleteTableCallable;
309322
private final UnaryCallable<UndeleteTableRequest, Operation> undeleteTableCallable;
310323
private final OperationCallable<UndeleteTableRequest, Table, UndeleteTableMetadata>
@@ -425,6 +438,16 @@ protected GrpcBigtableTableAdminStub(
425438
return params.build();
426439
})
427440
.build();
441+
GrpcCallSettings<UpdateTableRequest, Operation> updateTableTransportSettings =
442+
GrpcCallSettings.<UpdateTableRequest, Operation>newBuilder()
443+
.setMethodDescriptor(updateTableMethodDescriptor)
444+
.setParamsExtractor(
445+
request -> {
446+
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
447+
params.put("table.name", String.valueOf(request.getTable().getName()));
448+
return params.build();
449+
})
450+
.build();
428451
GrpcCallSettings<DeleteTableRequest, Empty> deleteTableTransportSettings =
429452
GrpcCallSettings.<DeleteTableRequest, Empty>newBuilder()
430453
.setMethodDescriptor(deleteTableMethodDescriptor)
@@ -643,6 +666,15 @@ protected GrpcBigtableTableAdminStub(
643666
this.getTableCallable =
644667
callableFactory.createUnaryCallable(
645668
getTableTransportSettings, settings.getTableSettings(), clientContext);
669+
this.updateTableCallable =
670+
callableFactory.createUnaryCallable(
671+
updateTableTransportSettings, settings.updateTableSettings(), clientContext);
672+
this.updateTableOperationCallable =
673+
callableFactory.createOperationCallable(
674+
updateTableTransportSettings,
675+
settings.updateTableOperationSettings(),
676+
clientContext,
677+
operationsStub);
646678
this.deleteTableCallable =
647679
callableFactory.createUnaryCallable(
648680
deleteTableTransportSettings, settings.deleteTableSettings(), clientContext);
@@ -777,6 +809,17 @@ public UnaryCallable<GetTableRequest, Table> getTableCallable() {
777809
return getTableCallable;
778810
}
779811

812+
@Override
813+
public UnaryCallable<UpdateTableRequest, Operation> updateTableCallable() {
814+
return updateTableCallable;
815+
}
816+
817+
@Override
818+
public OperationCallable<UpdateTableRequest, Table, UpdateTableMetadata>
819+
updateTableOperationCallable() {
820+
return updateTableOperationCallable;
821+
}
822+
780823
@Override
781824
public UnaryCallable<DeleteTableRequest, Empty> deleteTableCallable() {
782825
return deleteTableCallable;

0 commit comments

Comments
 (0)