Skip to content

Commit

Permalink
feat: Cross Region backup proto changes (#1754)
Browse files Browse the repository at this point in the history
* chore: remove unused imports from google/spanner/*

PiperOrigin-RevId: 435163448

Source-Link: googleapis/googleapis@db9d2a3

Source-Link: https://github.com/googleapis/googleapis-gen/commit/ba34d4280bafc24a5ee801db4d107aeda1f94851
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmEzNGQ0MjgwYmFmYzI0YTVlZTgwMWRiNGQxMDdhZWRhMWY5NDg1MSJ9

* 🦉 Updates from OwlBot post-processor

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

* Synchronize new proto/yaml changes.

PiperOrigin-RevId: 436114471

Source-Link: googleapis/googleapis@6379d5f

Source-Link: https://github.com/googleapis/googleapis-gen/commit/a59984b4cb711eeb186bca4f5b35adbfe60825df
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTU5OTg0YjRjYjcxMWVlYjE4NmJjYTRmNWIzNWFkYmZlNjA4MjVkZiJ9

* 🦉 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 Mar 24, 2022
1 parent 2d213f0 commit 6d64104
Show file tree
Hide file tree
Showing 43 changed files with 7,844 additions and 689 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.spanner.admin.database.v1.Backup;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
Expand Down Expand Up @@ -174,6 +176,17 @@ public UnaryCallSettings<CreateBackupRequest, Operation> createBackupSettings()
return ((DatabaseAdminStubSettings) getStubSettings()).createBackupOperationSettings();
}

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

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

/** Returns the object with the settings used for calls to getBackup. */
public UnaryCallSettings<GetBackupRequest, Backup> getBackupSettings() {
return ((DatabaseAdminStubSettings) getStubSettings()).getBackupSettings();
Expand Down Expand Up @@ -394,6 +407,17 @@ public UnaryCallSettings.Builder<CreateBackupRequest, Operation> createBackupSet
return getStubSettingsBuilder().createBackupOperationSettings();
}

/** 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 getBackup. */
public UnaryCallSettings.Builder<GetBackupRequest, Backup> getBackupSettings() {
return getStubSettingsBuilder().getBackupSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"grpc": {
"libraryClient": "DatabaseAdminClient",
"rpcs": {
"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 @@ -33,6 +33,8 @@
import com.google.longrunning.stub.OperationsStub;
import com.google.protobuf.Empty;
import com.google.spanner.admin.database.v1.Backup;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
Expand Down Expand Up @@ -134,6 +136,15 @@ public UnaryCallable<CreateBackupRequest, Operation> createBackupCallable() {
throw new UnsupportedOperationException("Not implemented: createBackupCallable()");
}

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<GetBackupRequest, Backup> getBackupCallable() {
throw new UnsupportedOperationException("Not implemented: getBackupCallable()");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.spanner.admin.database.v1.Backup;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
Expand Down Expand Up @@ -149,6 +151,9 @@ public class DatabaseAdminStubSettings extends StubSettings<DatabaseAdminStubSet
private final UnaryCallSettings<CreateBackupRequest, Operation> createBackupSettings;
private final OperationCallSettings<CreateBackupRequest, Backup, CreateBackupMetadata>
createBackupOperationSettings;
private final UnaryCallSettings<CopyBackupRequest, Operation> copyBackupSettings;
private final OperationCallSettings<CopyBackupRequest, Backup, CopyBackupMetadata>
copyBackupOperationSettings;
private final UnaryCallSettings<GetBackupRequest, Backup> getBackupSettings;
private final UnaryCallSettings<UpdateBackupRequest, Backup> updateBackupSettings;
private final UnaryCallSettings<DeleteBackupRequest, Empty> deleteBackupSettings;
Expand Down Expand Up @@ -473,6 +478,17 @@ public UnaryCallSettings<CreateBackupRequest, Operation> createBackupSettings()
return createBackupOperationSettings;
}

/** 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 getBackup. */
public UnaryCallSettings<GetBackupRequest, Backup> getBackupSettings() {
return getBackupSettings;
Expand Down Expand Up @@ -613,6 +629,8 @@ protected DatabaseAdminStubSettings(Builder settingsBuilder) throws IOException
testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build();
createBackupSettings = settingsBuilder.createBackupSettings().build();
createBackupOperationSettings = settingsBuilder.createBackupOperationSettings().build();
copyBackupSettings = settingsBuilder.copyBackupSettings().build();
copyBackupOperationSettings = settingsBuilder.copyBackupOperationSettings().build();
getBackupSettings = settingsBuilder.getBackupSettings().build();
updateBackupSettings = settingsBuilder.updateBackupSettings().build();
deleteBackupSettings = settingsBuilder.deleteBackupSettings().build();
Expand Down Expand Up @@ -650,6 +668,9 @@ public static class Builder extends StubSettings.Builder<DatabaseAdminStubSettin
private final UnaryCallSettings.Builder<CreateBackupRequest, Operation> createBackupSettings;
private final OperationCallSettings.Builder<CreateBackupRequest, Backup, CreateBackupMetadata>
createBackupOperationSettings;
private final UnaryCallSettings.Builder<CopyBackupRequest, Operation> copyBackupSettings;
private final OperationCallSettings.Builder<CopyBackupRequest, Backup, CopyBackupMetadata>
copyBackupOperationSettings;
private final UnaryCallSettings.Builder<GetBackupRequest, Backup> getBackupSettings;
private final UnaryCallSettings.Builder<UpdateBackupRequest, Backup> updateBackupSettings;
private final UnaryCallSettings.Builder<DeleteBackupRequest, Empty> deleteBackupSettings;
Expand Down Expand Up @@ -760,6 +781,8 @@ protected Builder(ClientContext clientContext) {
testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
createBackupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
createBackupOperationSettings = OperationCallSettings.newBuilder();
copyBackupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
copyBackupOperationSettings = OperationCallSettings.newBuilder();
getBackupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
updateBackupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
deleteBackupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
Expand All @@ -783,6 +806,7 @@ protected Builder(ClientContext clientContext) {
getIamPolicySettings,
testIamPermissionsSettings,
createBackupSettings,
copyBackupSettings,
getBackupSettings,
updateBackupSettings,
deleteBackupSettings,
Expand All @@ -809,6 +833,8 @@ protected Builder(DatabaseAdminStubSettings settings) {
testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder();
createBackupSettings = settings.createBackupSettings.toBuilder();
createBackupOperationSettings = settings.createBackupOperationSettings.toBuilder();
copyBackupSettings = settings.copyBackupSettings.toBuilder();
copyBackupOperationSettings = settings.copyBackupOperationSettings.toBuilder();
getBackupSettings = settings.getBackupSettings.toBuilder();
updateBackupSettings = settings.updateBackupSettings.toBuilder();
deleteBackupSettings = settings.deleteBackupSettings.toBuilder();
Expand All @@ -830,6 +856,7 @@ protected Builder(DatabaseAdminStubSettings settings) {
getIamPolicySettings,
testIamPermissionsSettings,
createBackupSettings,
copyBackupSettings,
getBackupSettings,
updateBackupSettings,
deleteBackupSettings,
Expand Down Expand Up @@ -903,6 +930,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params"));

builder
.copyBackupSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params"));

builder
.getBackupSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
Expand Down Expand Up @@ -1011,6 +1043,29 @@ private static Builder initDefaults(Builder builder) {
.setTotalTimeout(Duration.ofMillis(172800000L))
.build()));

builder
.copyBackupOperationSettings()
.setInitialCallSettings(
UnaryCallSettings.<CopyBackupRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_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()));

builder
.restoreDatabaseOperationSettings()
.setInitialCallSettings(
Expand Down Expand Up @@ -1132,6 +1187,19 @@ public UnaryCallSettings.Builder<CreateBackupRequest, Operation> createBackupSet
return createBackupOperationSettings;
}

/** 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 getBackup. */
public UnaryCallSettings.Builder<GetBackupRequest, Backup> getBackupSettings() {
return getBackupSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import com.google.longrunning.stub.GrpcOperationsStub;
import com.google.protobuf.Empty;
import com.google.spanner.admin.database.v1.Backup;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
Expand Down Expand Up @@ -171,6 +173,14 @@ public class GrpcDatabaseAdminStub extends DatabaseAdminStub {
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();

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

private static final MethodDescriptor<GetBackupRequest, Backup> getBackupMethodDescriptor =
MethodDescriptor.<GetBackupRequest, Backup>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
Expand Down Expand Up @@ -260,6 +270,9 @@ public class GrpcDatabaseAdminStub extends DatabaseAdminStub {
private final UnaryCallable<CreateBackupRequest, Operation> createBackupCallable;
private final OperationCallable<CreateBackupRequest, Backup, CreateBackupMetadata>
createBackupOperationCallable;
private final UnaryCallable<CopyBackupRequest, Operation> copyBackupCallable;
private final OperationCallable<CopyBackupRequest, Backup, CopyBackupMetadata>
copyBackupOperationCallable;
private final UnaryCallable<GetBackupRequest, Backup> getBackupCallable;
private final UnaryCallable<UpdateBackupRequest, Backup> updateBackupCallable;
private final UnaryCallable<DeleteBackupRequest, Empty> deleteBackupCallable;
Expand Down Expand Up @@ -422,6 +435,16 @@ protected GrpcDatabaseAdminStub(
return params.build();
})
.build();
GrpcCallSettings<CopyBackupRequest, Operation> copyBackupTransportSettings =
GrpcCallSettings.<CopyBackupRequest, Operation>newBuilder()
.setMethodDescriptor(copyBackupMethodDescriptor)
.setParamsExtractor(
request -> {
ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
params.put("parent", String.valueOf(request.getParent()));
return params.build();
})
.build();
GrpcCallSettings<GetBackupRequest, Backup> getBackupTransportSettings =
GrpcCallSettings.<GetBackupRequest, Backup>newBuilder()
.setMethodDescriptor(getBackupMethodDescriptor)
Expand Down Expand Up @@ -551,6 +574,15 @@ protected GrpcDatabaseAdminStub(
settings.createBackupOperationSettings(),
clientContext,
operationsStub);
this.copyBackupCallable =
callableFactory.createUnaryCallable(
copyBackupTransportSettings, settings.copyBackupSettings(), clientContext);
this.copyBackupOperationCallable =
callableFactory.createOperationCallable(
copyBackupTransportSettings,
settings.copyBackupOperationSettings(),
clientContext,
operationsStub);
this.getBackupCallable =
callableFactory.createUnaryCallable(
getBackupTransportSettings, settings.getBackupSettings(), clientContext);
Expand Down Expand Up @@ -679,6 +711,17 @@ public UnaryCallable<CreateBackupRequest, Operation> createBackupCallable() {
return createBackupOperationCallable;
}

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

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

@Override
public UnaryCallable<GetBackupRequest, Backup> getBackupCallable() {
return getBackupCallable;
Expand Down
Loading

0 comments on commit 6d64104

Please sign in to comment.