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: publish CopyBackup protos to external customers #1883

Merged
merged 3 commits into from
Aug 16, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import com.google.bigtable.admin.v2.Backup;
import com.google.bigtable.admin.v2.CheckConsistencyRequest;
import com.google.bigtable.admin.v2.CheckConsistencyResponse;
import com.google.bigtable.admin.v2.CopyBackupMetadata;
import com.google.bigtable.admin.v2.CopyBackupRequest;
import com.google.bigtable.admin.v2.CreateBackupMetadata;
import com.google.bigtable.admin.v2.CreateBackupRequest;
import com.google.bigtable.admin.v2.CreateTableFromSnapshotMetadata;
Expand Down Expand Up @@ -235,6 +237,17 @@ public UnaryCallSettings<RestoreTableRequest, Operation> restoreTableSettings()
return ((BigtableTableAdminStubSettings) getStubSettings()).restoreTableOperationSettings();
}

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

/** Returns the object with the settings used for calls to copyBackup. */
public OperationCallSettings<CopyBackupRequest, Backup, CopyBackupMetadata>
copyBackupOperationSettings() {
return ((BigtableTableAdminStubSettings) getStubSettings()).copyBackupOperationSettings();
}

/** Returns the object with the settings used for calls to getIamPolicy. */
public UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings() {
return ((BigtableTableAdminStubSettings) getStubSettings()).getIamPolicySettings();
Expand Down Expand Up @@ -501,6 +514,17 @@ public UnaryCallSettings.Builder<RestoreTableRequest, Operation> restoreTableSet
return getStubSettingsBuilder().restoreTableOperationSettings();
}

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

/** Returns the builder for the settings used for calls to copyBackup. */
public OperationCallSettings.Builder<CopyBackupRequest, Backup, CopyBackupMetadata>
copyBackupOperationSettings() {
return getStubSettingsBuilder().copyBackupOperationSettings();
}

/** Returns the builder for the settings used for calls to getIamPolicy. */
public UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings() {
return getStubSettingsBuilder().getIamPolicySettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ public String toString() {
.add("undeleteTableOperationSettings", stubSettings.undeleteTableOperationSettings())
.add("updateTableSettings", stubSettings.updateTableSettings())
.add("updateTableOperationSettings", stubSettings.updateTableOperationSettings())
.add("copyBackupSettings", stubSettings.copyBackupSettings())
.add("copyBackupOperationSettings", stubSettings.copyBackupOperationSettings())
.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
"CheckConsistency": {
"methods": ["checkConsistency", "checkConsistency", "checkConsistency", "checkConsistencyCallable"]
},
"CopyBackup": {
"methods": ["copyBackupAsync", "copyBackupAsync", "copyBackupAsync", "copyBackupAsync", "copyBackupAsync", "copyBackupOperationCallable", "copyBackupCallable"]
},
"CreateBackup": {
"methods": ["createBackupAsync", "createBackupAsync", "createBackupAsync", "createBackupOperationCallable", "createBackupCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import com.google.bigtable.admin.v2.Backup;
import com.google.bigtable.admin.v2.CheckConsistencyRequest;
import com.google.bigtable.admin.v2.CheckConsistencyResponse;
import com.google.bigtable.admin.v2.CopyBackupMetadata;
import com.google.bigtable.admin.v2.CopyBackupRequest;
import com.google.bigtable.admin.v2.CreateBackupMetadata;
import com.google.bigtable.admin.v2.CreateBackupRequest;
import com.google.bigtable.admin.v2.CreateTableFromSnapshotMetadata;
Expand Down Expand Up @@ -210,6 +212,15 @@ public UnaryCallable<RestoreTableRequest, Operation> restoreTableCallable() {
throw new UnsupportedOperationException("Not implemented: restoreTableCallable()");
}

public OperationCallable<CopyBackupRequest, Backup, CopyBackupMetadata>
copyBackupOperationCallable() {
throw new UnsupportedOperationException("Not implemented: copyBackupOperationCallable()");
}

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

public UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
import com.google.bigtable.admin.v2.Backup;
import com.google.bigtable.admin.v2.CheckConsistencyRequest;
import com.google.bigtable.admin.v2.CheckConsistencyResponse;
import com.google.bigtable.admin.v2.CopyBackupMetadata;
import com.google.bigtable.admin.v2.CopyBackupRequest;
import com.google.bigtable.admin.v2.CreateBackupMetadata;
import com.google.bigtable.admin.v2.CreateBackupRequest;
import com.google.bigtable.admin.v2.CreateTableFromSnapshotMetadata;
Expand Down Expand Up @@ -189,6 +191,9 @@ public class BigtableTableAdminStubSettings extends StubSettings<BigtableTableAd
private final UnaryCallSettings<RestoreTableRequest, Operation> restoreTableSettings;
private final OperationCallSettings<RestoreTableRequest, Table, RestoreTableMetadata>
restoreTableOperationSettings;
private final UnaryCallSettings<CopyBackupRequest, Operation> copyBackupSettings;
private final OperationCallSettings<CopyBackupRequest, Backup, CopyBackupMetadata>
copyBackupOperationSettings;
private final UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings;
private final UnaryCallSettings<SetIamPolicyRequest, Policy> setIamPolicySettings;
private final UnaryCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse>
Expand Down Expand Up @@ -501,6 +506,17 @@ public UnaryCallSettings<RestoreTableRequest, Operation> restoreTableSettings()
return restoreTableOperationSettings;
}

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

/** Returns the object with the settings used for calls to copyBackup. */
public OperationCallSettings<CopyBackupRequest, Backup, CopyBackupMetadata>
copyBackupOperationSettings() {
return copyBackupOperationSettings;
}

/** Returns the object with the settings used for calls to getIamPolicy. */
public UnaryCallSettings<GetIamPolicyRequest, Policy> getIamPolicySettings() {
return getIamPolicySettings;
Expand Down Expand Up @@ -620,6 +636,8 @@ protected BigtableTableAdminStubSettings(Builder settingsBuilder) throws IOExcep
listBackupsSettings = settingsBuilder.listBackupsSettings().build();
restoreTableSettings = settingsBuilder.restoreTableSettings().build();
restoreTableOperationSettings = settingsBuilder.restoreTableOperationSettings().build();
copyBackupSettings = settingsBuilder.copyBackupSettings().build();
copyBackupOperationSettings = settingsBuilder.copyBackupOperationSettings().build();
getIamPolicySettings = settingsBuilder.getIamPolicySettings().build();
setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build();
Expand Down Expand Up @@ -675,6 +693,9 @@ public static class Builder
private final UnaryCallSettings.Builder<RestoreTableRequest, Operation> restoreTableSettings;
private final OperationCallSettings.Builder<RestoreTableRequest, Table, RestoreTableMetadata>
restoreTableOperationSettings;
private final UnaryCallSettings.Builder<CopyBackupRequest, Operation> copyBackupSettings;
private final OperationCallSettings.Builder<CopyBackupRequest, Backup, CopyBackupMetadata>
copyBackupOperationSettings;
private final UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings;
private final UnaryCallSettings.Builder<SetIamPolicyRequest, Policy> setIamPolicySettings;
private final UnaryCallSettings.Builder<TestIamPermissionsRequest, TestIamPermissionsResponse>
Expand Down Expand Up @@ -795,6 +816,8 @@ protected Builder(ClientContext clientContext) {
listBackupsSettings = PagedCallSettings.newBuilder(LIST_BACKUPS_PAGE_STR_FACT);
restoreTableSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
restoreTableOperationSettings = OperationCallSettings.newBuilder();
copyBackupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
copyBackupOperationSettings = OperationCallSettings.newBuilder();
getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
Expand Down Expand Up @@ -822,6 +845,7 @@ protected Builder(ClientContext clientContext) {
deleteBackupSettings,
listBackupsSettings,
restoreTableSettings,
copyBackupSettings,
getIamPolicySettings,
setIamPolicySettings,
testIamPermissionsSettings);
Expand Down Expand Up @@ -859,6 +883,8 @@ protected Builder(BigtableTableAdminStubSettings settings) {
listBackupsSettings = settings.listBackupsSettings.toBuilder();
restoreTableSettings = settings.restoreTableSettings.toBuilder();
restoreTableOperationSettings = settings.restoreTableOperationSettings.toBuilder();
copyBackupSettings = settings.copyBackupSettings.toBuilder();
copyBackupOperationSettings = settings.copyBackupOperationSettings.toBuilder();
getIamPolicySettings = settings.getIamPolicySettings.toBuilder();
setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder();
Expand Down Expand Up @@ -886,6 +912,7 @@ protected Builder(BigtableTableAdminStubSettings settings) {
deleteBackupSettings,
listBackupsSettings,
restoreTableSettings,
copyBackupSettings,
getIamPolicySettings,
setIamPolicySettings,
testIamPermissionsSettings);
Expand Down Expand Up @@ -1010,6 +1037,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));

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

builder
.getIamPolicySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
Expand Down Expand Up @@ -1169,6 +1201,29 @@ private static Builder initDefaults(Builder builder) {
.setTotalTimeout(Duration.ofMillis(600000L))
.build()));

builder
.copyBackupOperationSettings()
.setInitialCallSettings(
UnaryCallSettings.<CopyBackupRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Backup.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(CopyBackupMetadata.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()));

return builder;
}

Expand Down Expand Up @@ -1351,6 +1406,19 @@ public UnaryCallSettings.Builder<RestoreTableRequest, Operation> restoreTableSet
return restoreTableOperationSettings;
}

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

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

/** Returns the builder for the settings used for calls to getIamPolicy. */
public UnaryCallSettings.Builder<GetIamPolicyRequest, Policy> getIamPolicySettings() {
return getIamPolicySettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.google.bigtable.admin.v2.Backup;
import com.google.bigtable.admin.v2.CheckConsistencyRequest;
import com.google.bigtable.admin.v2.CheckConsistencyResponse;
import com.google.bigtable.admin.v2.CopyBackupMetadata;
import com.google.bigtable.admin.v2.CopyBackupRequest;
import com.google.bigtable.admin.v2.CreateBackupMetadata;
import com.google.bigtable.admin.v2.CreateBackupRequest;
import com.google.bigtable.admin.v2.CreateTableFromSnapshotMetadata;
Expand Down Expand Up @@ -279,6 +281,14 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub {
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();

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

private static final MethodDescriptor<GetIamPolicyRequest, Policy> getIamPolicyMethodDescriptor =
MethodDescriptor.<GetIamPolicyRequest, Policy>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
Expand Down Expand Up @@ -348,6 +358,9 @@ public class GrpcBigtableTableAdminStub extends BigtableTableAdminStub {
private final UnaryCallable<RestoreTableRequest, Operation> restoreTableCallable;
private final OperationCallable<RestoreTableRequest, Table, RestoreTableMetadata>
restoreTableOperationCallable;
private final UnaryCallable<CopyBackupRequest, Operation> copyBackupCallable;
private final OperationCallable<CopyBackupRequest, Backup, CopyBackupMetadata>
copyBackupOperationCallable;
private final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable;
private final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable;
private final UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse>
Expand Down Expand Up @@ -611,6 +624,16 @@ protected GrpcBigtableTableAdminStub(
return builder.build();
})
.build();
GrpcCallSettings<CopyBackupRequest, Operation> copyBackupTransportSettings =
GrpcCallSettings.<CopyBackupRequest, Operation>newBuilder()
.setMethodDescriptor(copyBackupMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings<GetIamPolicyRequest, Policy> getIamPolicyTransportSettings =
GrpcCallSettings.<GetIamPolicyRequest, Policy>newBuilder()
.setMethodDescriptor(getIamPolicyMethodDescriptor)
Expand Down Expand Up @@ -757,6 +780,15 @@ protected GrpcBigtableTableAdminStub(
settings.restoreTableOperationSettings(),
clientContext,
operationsStub);
this.copyBackupCallable =
callableFactory.createUnaryCallable(
copyBackupTransportSettings, settings.copyBackupSettings(), clientContext);
this.copyBackupOperationCallable =
callableFactory.createOperationCallable(
copyBackupTransportSettings,
settings.copyBackupOperationSettings(),
clientContext,
operationsStub);
this.getIamPolicyCallable =
callableFactory.createUnaryCallable(
getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext);
Expand Down Expand Up @@ -937,6 +969,17 @@ public UnaryCallable<RestoreTableRequest, Operation> restoreTableCallable() {
return restoreTableOperationCallable;
}

@Override
public UnaryCallable<CopyBackupRequest, Operation> copyBackupCallable() {
return copyBackupCallable;
}

@Override
public OperationCallable<CopyBackupRequest, Backup, CopyBackupMetadata>
copyBackupOperationCallable() {
return copyBackupOperationCallable;
}

@Override
public UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
return getIamPolicyCallable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,42 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
{
"name": "com.google.bigtable.admin.v2.CopyBackupMetadata",
"queryAllDeclaredConstructors": true,
"queryAllPublicConstructors": true,
"queryAllDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
},
{
"name": "com.google.bigtable.admin.v2.CopyBackupMetadata$Builder",
"queryAllDeclaredConstructors": true,
"queryAllPublicConstructors": true,
"queryAllDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
},
{
"name": "com.google.bigtable.admin.v2.CopyBackupRequest",
"queryAllDeclaredConstructors": true,
"queryAllPublicConstructors": true,
"queryAllDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
},
{
"name": "com.google.bigtable.admin.v2.CopyBackupRequest$Builder",
"queryAllDeclaredConstructors": true,
"queryAllPublicConstructors": true,
"queryAllDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
},
{
"name": "com.google.bigtable.admin.v2.CreateAppProfileRequest",
"queryAllDeclaredConstructors": true,
Expand Down
Loading