diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java
index 112b43e2ef..27dd9c515a 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminClient.java
@@ -210,138 +210,6 @@ public final OperationsClient getOperationsClient() {
return operationsClient;
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists Cloud Spanner databases.
- *
- *
Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * for (Database element : databaseAdminClient.listDatabases(parent).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param parent Required. The instance whose databases should be listed. Values are of the form
- * `projects/<project>/instances/<instance>`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListDatabasesPagedResponse listDatabases(InstanceName parent) {
- ListDatabasesRequest request =
- ListDatabasesRequest.newBuilder()
- .setParent(parent == null ? null : parent.toString())
- .build();
- return listDatabases(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists Cloud Spanner databases.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * for (Database element : databaseAdminClient.listDatabases(parent.toString()).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param parent Required. The instance whose databases should be listed. Values are of the form
- * `projects/<project>/instances/<instance>`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListDatabasesPagedResponse listDatabases(String parent) {
- ListDatabasesRequest request = ListDatabasesRequest.newBuilder().setParent(parent).build();
- return listDatabases(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists Cloud Spanner databases.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * ListDatabasesRequest request = ListDatabasesRequest.newBuilder()
- * .setParent(parent.toString())
- * .build();
- * for (Database element : databaseAdminClient.listDatabases(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListDatabasesPagedResponse listDatabases(ListDatabasesRequest request) {
- return listDatabasesPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists Cloud Spanner databases.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * ListDatabasesRequest request = ListDatabasesRequest.newBuilder()
- * .setParent(parent.toString())
- * .build();
- * ApiFuture<ListDatabasesPagedResponse> future = databaseAdminClient.listDatabasesPagedCallable().futureCall(request);
- * // Do something
- * for (Database element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- listDatabasesPagedCallable() {
- return stub.listDatabasesPagedCallable();
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists Cloud Spanner databases.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * ListDatabasesRequest request = ListDatabasesRequest.newBuilder()
- * .setParent(parent.toString())
- * .build();
- * while (true) {
- * ListDatabasesResponse response = databaseAdminClient.listDatabasesCallable().call(request);
- * for (Database element : response.getDatabasesList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- *
- */
- public final UnaryCallable listDatabasesCallable() {
- return stub.listDatabasesCallable();
- }
-
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Creates a new Cloud Spanner database and starts to prepare it for serving. The returned
@@ -520,96 +388,6 @@ public final UnaryCallable createDatabaseCalla
return stub.createDatabaseCallable();
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets the state of a Cloud Spanner database.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * DatabaseName name = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
- * Database response = databaseAdminClient.getDatabase(name);
- * }
- *
- *
- * @param name Required. The name of the requested database. Values are of the form
- * `projects/<project>/instances/<instance>/databases/<database>`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Database getDatabase(DatabaseName name) {
- GetDatabaseRequest request =
- GetDatabaseRequest.newBuilder().setName(name == null ? null : name.toString()).build();
- return getDatabase(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets the state of a Cloud Spanner database.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * DatabaseName name = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
- * Database response = databaseAdminClient.getDatabase(name.toString());
- * }
- *
- *
- * @param name Required. The name of the requested database. Values are of the form
- * `projects/<project>/instances/<instance>/databases/<database>`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Database getDatabase(String name) {
- GetDatabaseRequest request = GetDatabaseRequest.newBuilder().setName(name).build();
- return getDatabase(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets the state of a Cloud Spanner database.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * DatabaseName name = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
- * GetDatabaseRequest request = GetDatabaseRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * Database response = databaseAdminClient.getDatabase(request);
- * }
- *
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Database getDatabase(GetDatabaseRequest request) {
- return getDatabaseCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets the state of a Cloud Spanner database.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * DatabaseName name = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
- * GetDatabaseRequest request = GetDatabaseRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<Database> future = databaseAdminClient.getDatabaseCallable().futureCall(request);
- * // Do something
- * Database response = future.get();
- * }
- *
- */
- public final UnaryCallable getDatabaseCallable() {
- return stub.getDatabaseCallable();
- }
-
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns,
@@ -736,46 +514,696 @@ public final OperationFuture updateDatabaseDdl
* .setDatabase(database.toString())
* .addAllStatements(statements)
* .build();
- * OperationFuture<Empty, UpdateDatabaseDdlMetadata> future = databaseAdminClient.updateDatabaseDdlOperationCallable().futureCall(request);
- * // Do something
- * future.get();
+ * OperationFuture<Empty, UpdateDatabaseDdlMetadata> future = databaseAdminClient.updateDatabaseDdlOperationCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable
+ updateDatabaseDdlOperationCallable() {
+ return stub.updateDatabaseDdlOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns,
+ * indexes, etc. The returned [long-running operation][google.longrunning.Operation] will have a
+ * name of the format `<database_name>/operations/<operation_id>` and can be used to
+ * track execution of the schema change(s). The [metadata][google.longrunning.Operation.metadata]
+ * field type is
+ * [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. The
+ * operation has no response.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * DatabaseName database = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ * List<String> statements = new ArrayList<>();
+ * UpdateDatabaseDdlRequest request = UpdateDatabaseDdlRequest.newBuilder()
+ * .setDatabase(database.toString())
+ * .addAllStatements(statements)
+ * .build();
+ * ApiFuture<Operation> future = databaseAdminClient.updateDatabaseDdlCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ public final UnaryCallable updateDatabaseDdlCallable() {
+ return stub.updateDatabaseDdlCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Starts creating a new Cloud Spanner Backup. The returned backup [long-running
+ * operation][google.longrunning.Operation] will have a name of the format
+ * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
+ * and can be used to track creation of the backup. The
+ * [metadata][google.longrunning.Operation.metadata] field type is
+ * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The
+ * [response][google.longrunning.Operation.response] field type is
+ * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned
+ * operation will stop the creation and delete the backup. There can be only one pending backup
+ * creation per database. Backup creation of different databases can run concurrently.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * Backup backup = Backup.newBuilder().build();
+ * String backupId = "";
+ * Backup response = databaseAdminClient.createBackupAsync(parent, backup, backupId).get();
+ * }
+ *
+ *
+ * @param parent Required. The name of the instance in which the backup will be created. This must
+ * be the same instance that contains the database the backup will be created from. The backup
+ * will be stored in the location(s) specified in the instance configuration of this instance.
+ * Values are of the form `projects/<project>/instances/<instance>`.
+ * @param backup Required. The backup to create.
+ * @param backupId Required. The id of the backup to be created. The `backup_id` appended to
+ * `parent` forms the full backup name of the form
+ * `projects/<project>/instances/<instance>/backups/<backup_id>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture createBackupAsync(
+ InstanceName parent, Backup backup, String backupId) {
+ CreateBackupRequest request =
+ CreateBackupRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setBackup(backup)
+ .setBackupId(backupId)
+ .build();
+ return createBackupAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Starts creating a new Cloud Spanner Backup. The returned backup [long-running
+ * operation][google.longrunning.Operation] will have a name of the format
+ * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
+ * and can be used to track creation of the backup. The
+ * [metadata][google.longrunning.Operation.metadata] field type is
+ * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The
+ * [response][google.longrunning.Operation.response] field type is
+ * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned
+ * operation will stop the creation and delete the backup. There can be only one pending backup
+ * creation per database. Backup creation of different databases can run concurrently.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * Backup backup = Backup.newBuilder().build();
+ * String backupId = "";
+ * Backup response = databaseAdminClient.createBackupAsync(parent.toString(), backup, backupId).get();
+ * }
+ *
+ *
+ * @param parent Required. The name of the instance in which the backup will be created. This must
+ * be the same instance that contains the database the backup will be created from. The backup
+ * will be stored in the location(s) specified in the instance configuration of this instance.
+ * Values are of the form `projects/<project>/instances/<instance>`.
+ * @param backup Required. The backup to create.
+ * @param backupId Required. The id of the backup to be created. The `backup_id` appended to
+ * `parent` forms the full backup name of the form
+ * `projects/<project>/instances/<instance>/backups/<backup_id>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture createBackupAsync(
+ String parent, Backup backup, String backupId) {
+ CreateBackupRequest request =
+ CreateBackupRequest.newBuilder()
+ .setParent(parent)
+ .setBackup(backup)
+ .setBackupId(backupId)
+ .build();
+ return createBackupAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Starts creating a new Cloud Spanner Backup. The returned backup [long-running
+ * operation][google.longrunning.Operation] will have a name of the format
+ * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
+ * and can be used to track creation of the backup. The
+ * [metadata][google.longrunning.Operation.metadata] field type is
+ * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The
+ * [response][google.longrunning.Operation.response] field type is
+ * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned
+ * operation will stop the creation and delete the backup. There can be only one pending backup
+ * creation per database. Backup creation of different databases can run concurrently.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * String backupId = "";
+ * Backup backup = Backup.newBuilder().build();
+ * CreateBackupRequest request = CreateBackupRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setBackupId(backupId)
+ * .setBackup(backup)
+ * .build();
+ * Backup response = databaseAdminClient.createBackupAsync(request).get();
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture createBackupAsync(
+ CreateBackupRequest request) {
+ return createBackupOperationCallable().futureCall(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Starts creating a new Cloud Spanner Backup. The returned backup [long-running
+ * operation][google.longrunning.Operation] will have a name of the format
+ * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
+ * and can be used to track creation of the backup. The
+ * [metadata][google.longrunning.Operation.metadata] field type is
+ * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The
+ * [response][google.longrunning.Operation.response] field type is
+ * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned
+ * operation will stop the creation and delete the backup. There can be only one pending backup
+ * creation per database. Backup creation of different databases can run concurrently.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * String backupId = "";
+ * Backup backup = Backup.newBuilder().build();
+ * CreateBackupRequest request = CreateBackupRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setBackupId(backupId)
+ * .setBackup(backup)
+ * .build();
+ * OperationFuture<Backup, CreateBackupMetadata> future = databaseAdminClient.createBackupOperationCallable().futureCall(request);
+ * // Do something
+ * Backup response = future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable
+ createBackupOperationCallable() {
+ return stub.createBackupOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Starts creating a new Cloud Spanner Backup. The returned backup [long-running
+ * operation][google.longrunning.Operation] will have a name of the format
+ * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
+ * and can be used to track creation of the backup. The
+ * [metadata][google.longrunning.Operation.metadata] field type is
+ * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The
+ * [response][google.longrunning.Operation.response] field type is
+ * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned
+ * operation will stop the creation and delete the backup. There can be only one pending backup
+ * creation per database. Backup creation of different databases can run concurrently.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * String backupId = "";
+ * Backup backup = Backup.newBuilder().build();
+ * CreateBackupRequest request = CreateBackupRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setBackupId(backupId)
+ * .setBackup(backup)
+ * .build();
+ * ApiFuture<Operation> future = databaseAdminClient.createBackupCallable().futureCall(request);
+ * // Do something
+ * Operation response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallable createBackupCallable() {
+ return stub.createBackupCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Create a new database by restoring from a completed backup. The new database must be in the
+ * same project and in an instance with the same instance configuration as the instance containing
+ * the backup. The returned database [long-running operation][google.longrunning.Operation] has a
+ * name of the format
+ * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
+ * and can be used to track the progress of the operation, and to cancel it. The
+ * [metadata][google.longrunning.Operation.metadata] field type is
+ * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The
+ * [response][google.longrunning.Operation.response] type is
+ * [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned
+ * operation will stop the restore and delete the database. There can be only one database being
+ * restored into an instance at a time. Once the restore operation completes, a new restore
+ * operation can be initiated, without waiting for the optimize operation associated with the
+ * first restore to complete.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * String databaseId = "";
+ * BackupName backup = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
+ * Database response = databaseAdminClient.restoreDatabaseAsync(parent, databaseId, backup).get();
+ * }
+ *
+ *
+ * @param parent Required. The name of the instance in which to create the restored database. This
+ * instance must be in the same project and have the same instance configuration as the
+ * instance containing the source backup. Values are of the form
+ * `projects/<project>/instances/<instance>`.
+ * @param databaseId Required. The id of the database to create and restore to. This database must
+ * not already exist. The `database_id` appended to `parent` forms the full database name of
+ * the form
+ * `projects/<project>/instances/<instance>/databases/<database_id>`.
+ * @param backup Name of the backup from which to restore. Values are of the form
+ * `projects/<project>/instances/<instance>/backups/<backup>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture restoreDatabaseAsync(
+ InstanceName parent, String databaseId, BackupName backup) {
+ RestoreDatabaseRequest request =
+ RestoreDatabaseRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setDatabaseId(databaseId)
+ .setBackup(backup == null ? null : backup.toString())
+ .build();
+ return restoreDatabaseAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Create a new database by restoring from a completed backup. The new database must be in the
+ * same project and in an instance with the same instance configuration as the instance containing
+ * the backup. The returned database [long-running operation][google.longrunning.Operation] has a
+ * name of the format
+ * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
+ * and can be used to track the progress of the operation, and to cancel it. The
+ * [metadata][google.longrunning.Operation.metadata] field type is
+ * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The
+ * [response][google.longrunning.Operation.response] type is
+ * [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned
+ * operation will stop the restore and delete the database. There can be only one database being
+ * restored into an instance at a time. Once the restore operation completes, a new restore
+ * operation can be initiated, without waiting for the optimize operation associated with the
+ * first restore to complete.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * String databaseId = "";
+ * BackupName backup = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
+ * Database response = databaseAdminClient.restoreDatabaseAsync(parent.toString(), databaseId, backup.toString()).get();
+ * }
+ *
+ *
+ * @param parent Required. The name of the instance in which to create the restored database. This
+ * instance must be in the same project and have the same instance configuration as the
+ * instance containing the source backup. Values are of the form
+ * `projects/<project>/instances/<instance>`.
+ * @param databaseId Required. The id of the database to create and restore to. This database must
+ * not already exist. The `database_id` appended to `parent` forms the full database name of
+ * the form
+ * `projects/<project>/instances/<instance>/databases/<database_id>`.
+ * @param backup Name of the backup from which to restore. Values are of the form
+ * `projects/<project>/instances/<instance>/backups/<backup>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture restoreDatabaseAsync(
+ String parent, String databaseId, String backup) {
+ RestoreDatabaseRequest request =
+ RestoreDatabaseRequest.newBuilder()
+ .setParent(parent)
+ .setDatabaseId(databaseId)
+ .setBackup(backup)
+ .build();
+ return restoreDatabaseAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Create a new database by restoring from a completed backup. The new database must be in the
+ * same project and in an instance with the same instance configuration as the instance containing
+ * the backup. The returned database [long-running operation][google.longrunning.Operation] has a
+ * name of the format
+ * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
+ * and can be used to track the progress of the operation, and to cancel it. The
+ * [metadata][google.longrunning.Operation.metadata] field type is
+ * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The
+ * [response][google.longrunning.Operation.response] type is
+ * [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned
+ * operation will stop the restore and delete the database. There can be only one database being
+ * restored into an instance at a time. Once the restore operation completes, a new restore
+ * operation can be initiated, without waiting for the optimize operation associated with the
+ * first restore to complete.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * String databaseId = "";
+ * RestoreDatabaseRequest request = RestoreDatabaseRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setDatabaseId(databaseId)
+ * .build();
+ * Database response = databaseAdminClient.restoreDatabaseAsync(request).get();
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture restoreDatabaseAsync(
+ RestoreDatabaseRequest request) {
+ return restoreDatabaseOperationCallable().futureCall(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Create a new database by restoring from a completed backup. The new database must be in the
+ * same project and in an instance with the same instance configuration as the instance containing
+ * the backup. The returned database [long-running operation][google.longrunning.Operation] has a
+ * name of the format
+ * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
+ * and can be used to track the progress of the operation, and to cancel it. The
+ * [metadata][google.longrunning.Operation.metadata] field type is
+ * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The
+ * [response][google.longrunning.Operation.response] type is
+ * [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned
+ * operation will stop the restore and delete the database. There can be only one database being
+ * restored into an instance at a time. Once the restore operation completes, a new restore
+ * operation can be initiated, without waiting for the optimize operation associated with the
+ * first restore to complete.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * String databaseId = "";
+ * RestoreDatabaseRequest request = RestoreDatabaseRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setDatabaseId(databaseId)
+ * .build();
+ * OperationFuture<Database, RestoreDatabaseMetadata> future = databaseAdminClient.restoreDatabaseOperationCallable().futureCall(request);
+ * // Do something
+ * Database response = future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable
+ restoreDatabaseOperationCallable() {
+ return stub.restoreDatabaseOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Create a new database by restoring from a completed backup. The new database must be in the
+ * same project and in an instance with the same instance configuration as the instance containing
+ * the backup. The returned database [long-running operation][google.longrunning.Operation] has a
+ * name of the format
+ * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
+ * and can be used to track the progress of the operation, and to cancel it. The
+ * [metadata][google.longrunning.Operation.metadata] field type is
+ * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The
+ * [response][google.longrunning.Operation.response] type is
+ * [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned
+ * operation will stop the restore and delete the database. There can be only one database being
+ * restored into an instance at a time. Once the restore operation completes, a new restore
+ * operation can be initiated, without waiting for the optimize operation associated with the
+ * first restore to complete.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * String databaseId = "";
+ * RestoreDatabaseRequest request = RestoreDatabaseRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setDatabaseId(databaseId)
+ * .build();
+ * ApiFuture<Operation> future = databaseAdminClient.restoreDatabaseCallable().futureCall(request);
+ * // Do something
+ * Operation response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallable restoreDatabaseCallable() {
+ return stub.restoreDatabaseCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists Cloud Spanner databases.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * for (Database element : databaseAdminClient.listDatabases(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The instance whose databases should be listed. Values are of the form
+ * `projects/<project>/instances/<instance>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListDatabasesPagedResponse listDatabases(InstanceName parent) {
+ ListDatabasesRequest request =
+ ListDatabasesRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listDatabases(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists Cloud Spanner databases.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * for (Database element : databaseAdminClient.listDatabases(parent.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param parent Required. The instance whose databases should be listed. Values are of the form
+ * `projects/<project>/instances/<instance>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListDatabasesPagedResponse listDatabases(String parent) {
+ ListDatabasesRequest request = ListDatabasesRequest.newBuilder().setParent(parent).build();
+ return listDatabases(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists Cloud Spanner databases.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * ListDatabasesRequest request = ListDatabasesRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * for (Database element : databaseAdminClient.listDatabases(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListDatabasesPagedResponse listDatabases(ListDatabasesRequest request) {
+ return listDatabasesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists Cloud Spanner databases.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * ListDatabasesRequest request = ListDatabasesRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * ApiFuture<ListDatabasesPagedResponse> future = databaseAdminClient.listDatabasesPagedCallable().futureCall(request);
+ * // Do something
+ * for (Database element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ listDatabasesPagedCallable() {
+ return stub.listDatabasesPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists Cloud Spanner databases.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * ListDatabasesRequest request = ListDatabasesRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListDatabasesResponse response = databaseAdminClient.listDatabasesCallable().call(request);
+ * for (Database element : response.getDatabasesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable listDatabasesCallable() {
+ return stub.listDatabasesCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets the state of a Cloud Spanner database.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * DatabaseName name = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ * Database response = databaseAdminClient.getDatabase(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the requested database. Values are of the form
+ * `projects/<project>/instances/<instance>/databases/<database>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Database getDatabase(DatabaseName name) {
+ GetDatabaseRequest request =
+ GetDatabaseRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getDatabase(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets the state of a Cloud Spanner database.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * DatabaseName name = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ * Database response = databaseAdminClient.getDatabase(name.toString());
+ * }
+ *
+ *
+ * @param name Required. The name of the requested database. Values are of the form
+ * `projects/<project>/instances/<instance>/databases/<database>`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Database getDatabase(String name) {
+ GetDatabaseRequest request = GetDatabaseRequest.newBuilder().setName(name).build();
+ return getDatabase(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets the state of a Cloud Spanner database.
+ *
+ * Sample code:
+ *
+ *
+ * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
+ * DatabaseName name = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ * GetDatabaseRequest request = GetDatabaseRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * Database response = databaseAdminClient.getDatabase(request);
* }
*
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public final OperationCallable
- updateDatabaseDdlOperationCallable() {
- return stub.updateDatabaseDdlOperationCallable();
+ public final Database getDatabase(GetDatabaseRequest request) {
+ return getDatabaseCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns,
- * indexes, etc. The returned [long-running operation][google.longrunning.Operation] will have a
- * name of the format `<database_name>/operations/<operation_id>` and can be used to
- * track execution of the schema change(s). The [metadata][google.longrunning.Operation.metadata]
- * field type is
- * [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]. The
- * operation has no response.
+ * Gets the state of a Cloud Spanner database.
*
* Sample code:
*
*
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * DatabaseName database = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
- * List<String> statements = new ArrayList<>();
- * UpdateDatabaseDdlRequest request = UpdateDatabaseDdlRequest.newBuilder()
- * .setDatabase(database.toString())
- * .addAllStatements(statements)
+ * DatabaseName name = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
+ * GetDatabaseRequest request = GetDatabaseRequest.newBuilder()
+ * .setName(name.toString())
* .build();
- * ApiFuture<Operation> future = databaseAdminClient.updateDatabaseDdlCallable().futureCall(request);
+ * ApiFuture<Database> future = databaseAdminClient.getDatabaseCallable().futureCall(request);
* // Do something
- * future.get();
+ * Database response = future.get();
* }
*
*/
- public final UnaryCallable updateDatabaseDdlCallable() {
- return stub.updateDatabaseDdlCallable();
+ public final UnaryCallable getDatabaseCallable() {
+ return stub.getDatabaseCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
@@ -1316,243 +1744,38 @@ public final TestIamPermissionsResponse testIamPermissions(
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) {
- return testIamPermissionsCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Returns permissions that the caller has on the specified database or backup resource.
- *
- * Attempting this RPC on a non-existent Cloud Spanner database will result in a NOT_FOUND
- * error if the user has `spanner.databases.list` permission on the containing Cloud Spanner
- * instance. Otherwise returns an empty set of permissions. Calling this method on a backup that
- * does not exist will result in a NOT_FOUND error if the user has `spanner.backups.list`
- * permission on the containing instance.
- *
- *
Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * ResourceName resource = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
- * List<String> permissions = new ArrayList<>();
- * TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
- * .setResource(resource.toString())
- * .addAllPermissions(permissions)
- * .build();
- * ApiFuture<TestIamPermissionsResponse> future = databaseAdminClient.testIamPermissionsCallable().futureCall(request);
- * // Do something
- * TestIamPermissionsResponse response = future.get();
- * }
- *
- */
- public final UnaryCallable
- testIamPermissionsCallable() {
- return stub.testIamPermissionsCallable();
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Starts creating a new Cloud Spanner Backup. The returned backup [long-running
- * operation][google.longrunning.Operation] will have a name of the format
- * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
- * and can be used to track creation of the backup. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The
- * [response][google.longrunning.Operation.response] field type is
- * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned
- * operation will stop the creation and delete the backup. There can be only one pending backup
- * creation per database. Backup creation of different databases can run concurrently.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * Backup backup = Backup.newBuilder().build();
- * String backupId = "";
- * Backup response = databaseAdminClient.createBackupAsync(parent, backup, backupId).get();
- * }
- *
- *
- * @param parent Required. The name of the instance in which the backup will be created. This must
- * be the same instance that contains the database the backup will be created from. The backup
- * will be stored in the location(s) specified in the instance configuration of this instance.
- * Values are of the form `projects/<project>/instances/<instance>`.
- * @param backup Required. The backup to create.
- * @param backupId Required. The id of the backup to be created. The `backup_id` appended to
- * `parent` forms the full backup name of the form
- * `projects/<project>/instances/<instance>/backups/<backup_id>`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture createBackupAsync(
- InstanceName parent, Backup backup, String backupId) {
- CreateBackupRequest request =
- CreateBackupRequest.newBuilder()
- .setParent(parent == null ? null : parent.toString())
- .setBackup(backup)
- .setBackupId(backupId)
- .build();
- return createBackupAsync(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Starts creating a new Cloud Spanner Backup. The returned backup [long-running
- * operation][google.longrunning.Operation] will have a name of the format
- * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
- * and can be used to track creation of the backup. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The
- * [response][google.longrunning.Operation.response] field type is
- * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned
- * operation will stop the creation and delete the backup. There can be only one pending backup
- * creation per database. Backup creation of different databases can run concurrently.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * Backup backup = Backup.newBuilder().build();
- * String backupId = "";
- * Backup response = databaseAdminClient.createBackupAsync(parent.toString(), backup, backupId).get();
- * }
- *
- *
- * @param parent Required. The name of the instance in which the backup will be created. This must
- * be the same instance that contains the database the backup will be created from. The backup
- * will be stored in the location(s) specified in the instance configuration of this instance.
- * Values are of the form `projects/<project>/instances/<instance>`.
- * @param backup Required. The backup to create.
- * @param backupId Required. The id of the backup to be created. The `backup_id` appended to
- * `parent` forms the full backup name of the form
- * `projects/<project>/instances/<instance>/backups/<backup_id>`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture createBackupAsync(
- String parent, Backup backup, String backupId) {
- CreateBackupRequest request =
- CreateBackupRequest.newBuilder()
- .setParent(parent)
- .setBackup(backup)
- .setBackupId(backupId)
- .build();
- return createBackupAsync(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Starts creating a new Cloud Spanner Backup. The returned backup [long-running
- * operation][google.longrunning.Operation] will have a name of the format
- * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
- * and can be used to track creation of the backup. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The
- * [response][google.longrunning.Operation.response] field type is
- * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned
- * operation will stop the creation and delete the backup. There can be only one pending backup
- * creation per database. Backup creation of different databases can run concurrently.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * String backupId = "";
- * Backup backup = Backup.newBuilder().build();
- * CreateBackupRequest request = CreateBackupRequest.newBuilder()
- * .setParent(parent.toString())
- * .setBackupId(backupId)
- * .setBackup(backup)
- * .build();
- * Backup response = databaseAdminClient.createBackupAsync(request).get();
- * }
- *
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture createBackupAsync(
- CreateBackupRequest request) {
- return createBackupOperationCallable().futureCall(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Starts creating a new Cloud Spanner Backup. The returned backup [long-running
- * operation][google.longrunning.Operation] will have a name of the format
- * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
- * and can be used to track creation of the backup. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The
- * [response][google.longrunning.Operation.response] field type is
- * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned
- * operation will stop the creation and delete the backup. There can be only one pending backup
- * creation per database. Backup creation of different databases can run concurrently.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * String backupId = "";
- * Backup backup = Backup.newBuilder().build();
- * CreateBackupRequest request = CreateBackupRequest.newBuilder()
- * .setParent(parent.toString())
- * .setBackupId(backupId)
- * .setBackup(backup)
- * .build();
- * OperationFuture<Backup, CreateBackupMetadata> future = databaseAdminClient.createBackupOperationCallable().futureCall(request);
- * // Do something
- * Backup response = future.get();
- * }
- *
- */
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public final OperationCallable
- createBackupOperationCallable() {
- return stub.createBackupOperationCallable();
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Starts creating a new Cloud Spanner Backup. The returned backup [long-running
- * operation][google.longrunning.Operation] will have a name of the format
- * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
- * and can be used to track creation of the backup. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. The
- * [response][google.longrunning.Operation.response] field type is
- * [Backup][google.spanner.admin.database.v1.Backup], if successful. Cancelling the returned
- * operation will stop the creation and delete the backup. There can be only one pending backup
- * creation per database. Backup creation of different databases can run concurrently.
+ return testIamPermissionsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns permissions that the caller has on the specified database or backup resource.
+ *
+ * Attempting this RPC on a non-existent Cloud Spanner database will result in a NOT_FOUND
+ * error if the user has `spanner.databases.list` permission on the containing Cloud Spanner
+ * instance. Otherwise returns an empty set of permissions. Calling this method on a backup that
+ * does not exist will result in a NOT_FOUND error if the user has `spanner.backups.list`
+ * permission on the containing instance.
*
*
Sample code:
*
*
* try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * String backupId = "";
- * Backup backup = Backup.newBuilder().build();
- * CreateBackupRequest request = CreateBackupRequest.newBuilder()
- * .setParent(parent.toString())
- * .setBackupId(backupId)
- * .setBackup(backup)
+ * ResourceName resource = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
+ * List<String> permissions = new ArrayList<>();
+ * TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
+ * .setResource(resource.toString())
+ * .addAllPermissions(permissions)
* .build();
- * ApiFuture<Operation> future = databaseAdminClient.createBackupCallable().futureCall(request);
+ * ApiFuture<TestIamPermissionsResponse> future = databaseAdminClient.testIamPermissionsCallable().futureCall(request);
* // Do something
- * Operation response = future.get();
+ * TestIamPermissionsResponse response = future.get();
* }
*
*/
- public final UnaryCallable createBackupCallable() {
- return stub.createBackupCallable();
+ public final UnaryCallable
+ testIamPermissionsCallable() {
+ return stub.testIamPermissionsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
@@ -1950,229 +2173,6 @@ public final UnaryCallable listBackupsC
return stub.listBackupsCallable();
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Create a new database by restoring from a completed backup. The new database must be in the
- * same project and in an instance with the same instance configuration as the instance containing
- * the backup. The returned database [long-running operation][google.longrunning.Operation] has a
- * name of the format
- * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
- * and can be used to track the progress of the operation, and to cancel it. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The
- * [response][google.longrunning.Operation.response] type is
- * [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned
- * operation will stop the restore and delete the database. There can be only one database being
- * restored into an instance at a time. Once the restore operation completes, a new restore
- * operation can be initiated, without waiting for the optimize operation associated with the
- * first restore to complete.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * String databaseId = "";
- * BackupName backup = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
- * Database response = databaseAdminClient.restoreDatabaseAsync(parent, databaseId, backup).get();
- * }
- *
- *
- * @param parent Required. The name of the instance in which to create the restored database. This
- * instance must be in the same project and have the same instance configuration as the
- * instance containing the source backup. Values are of the form
- * `projects/<project>/instances/<instance>`.
- * @param databaseId Required. The id of the database to create and restore to. This database must
- * not already exist. The `database_id` appended to `parent` forms the full database name of
- * the form
- * `projects/<project>/instances/<instance>/databases/<database_id>`.
- * @param backup Name of the backup from which to restore. Values are of the form
- * `projects/<project>/instances/<instance>/backups/<backup>`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture restoreDatabaseAsync(
- InstanceName parent, String databaseId, BackupName backup) {
- RestoreDatabaseRequest request =
- RestoreDatabaseRequest.newBuilder()
- .setParent(parent == null ? null : parent.toString())
- .setDatabaseId(databaseId)
- .setBackup(backup == null ? null : backup.toString())
- .build();
- return restoreDatabaseAsync(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Create a new database by restoring from a completed backup. The new database must be in the
- * same project and in an instance with the same instance configuration as the instance containing
- * the backup. The returned database [long-running operation][google.longrunning.Operation] has a
- * name of the format
- * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
- * and can be used to track the progress of the operation, and to cancel it. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The
- * [response][google.longrunning.Operation.response] type is
- * [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned
- * operation will stop the restore and delete the database. There can be only one database being
- * restored into an instance at a time. Once the restore operation completes, a new restore
- * operation can be initiated, without waiting for the optimize operation associated with the
- * first restore to complete.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * String databaseId = "";
- * BackupName backup = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
- * Database response = databaseAdminClient.restoreDatabaseAsync(parent.toString(), databaseId, backup.toString()).get();
- * }
- *
- *
- * @param parent Required. The name of the instance in which to create the restored database. This
- * instance must be in the same project and have the same instance configuration as the
- * instance containing the source backup. Values are of the form
- * `projects/<project>/instances/<instance>`.
- * @param databaseId Required. The id of the database to create and restore to. This database must
- * not already exist. The `database_id` appended to `parent` forms the full database name of
- * the form
- * `projects/<project>/instances/<instance>/databases/<database_id>`.
- * @param backup Name of the backup from which to restore. Values are of the form
- * `projects/<project>/instances/<instance>/backups/<backup>`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture restoreDatabaseAsync(
- String parent, String databaseId, String backup) {
- RestoreDatabaseRequest request =
- RestoreDatabaseRequest.newBuilder()
- .setParent(parent)
- .setDatabaseId(databaseId)
- .setBackup(backup)
- .build();
- return restoreDatabaseAsync(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Create a new database by restoring from a completed backup. The new database must be in the
- * same project and in an instance with the same instance configuration as the instance containing
- * the backup. The returned database [long-running operation][google.longrunning.Operation] has a
- * name of the format
- * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
- * and can be used to track the progress of the operation, and to cancel it. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The
- * [response][google.longrunning.Operation.response] type is
- * [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned
- * operation will stop the restore and delete the database. There can be only one database being
- * restored into an instance at a time. Once the restore operation completes, a new restore
- * operation can be initiated, without waiting for the optimize operation associated with the
- * first restore to complete.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * String databaseId = "";
- * RestoreDatabaseRequest request = RestoreDatabaseRequest.newBuilder()
- * .setParent(parent.toString())
- * .setDatabaseId(databaseId)
- * .build();
- * Database response = databaseAdminClient.restoreDatabaseAsync(request).get();
- * }
- *
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture restoreDatabaseAsync(
- RestoreDatabaseRequest request) {
- return restoreDatabaseOperationCallable().futureCall(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Create a new database by restoring from a completed backup. The new database must be in the
- * same project and in an instance with the same instance configuration as the instance containing
- * the backup. The returned database [long-running operation][google.longrunning.Operation] has a
- * name of the format
- * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
- * and can be used to track the progress of the operation, and to cancel it. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The
- * [response][google.longrunning.Operation.response] type is
- * [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned
- * operation will stop the restore and delete the database. There can be only one database being
- * restored into an instance at a time. Once the restore operation completes, a new restore
- * operation can be initiated, without waiting for the optimize operation associated with the
- * first restore to complete.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * String databaseId = "";
- * RestoreDatabaseRequest request = RestoreDatabaseRequest.newBuilder()
- * .setParent(parent.toString())
- * .setDatabaseId(databaseId)
- * .build();
- * OperationFuture<Database, RestoreDatabaseMetadata> future = databaseAdminClient.restoreDatabaseOperationCallable().futureCall(request);
- * // Do something
- * Database response = future.get();
- * }
- *
- */
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public final OperationCallable
- restoreDatabaseOperationCallable() {
- return stub.restoreDatabaseOperationCallable();
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Create a new database by restoring from a completed backup. The new database must be in the
- * same project and in an instance with the same instance configuration as the instance containing
- * the backup. The returned database [long-running operation][google.longrunning.Operation] has a
- * name of the format
- * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
- * and can be used to track the progress of the operation, and to cancel it. The
- * [metadata][google.longrunning.Operation.metadata] field type is
- * [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata]. The
- * [response][google.longrunning.Operation.response] type is
- * [Database][google.spanner.admin.database.v1.Database], if successful. Cancelling the returned
- * operation will stop the restore and delete the database. There can be only one database being
- * restored into an instance at a time. Once the restore operation completes, a new restore
- * operation can be initiated, without waiting for the optimize operation associated with the
- * first restore to complete.
- *
- * Sample code:
- *
- *
- * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
- * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * String databaseId = "";
- * RestoreDatabaseRequest request = RestoreDatabaseRequest.newBuilder()
- * .setParent(parent.toString())
- * .setDatabaseId(databaseId)
- * .build();
- * ApiFuture<Operation> future = databaseAdminClient.restoreDatabaseCallable().futureCall(request);
- * // Do something
- * Operation response = future.get();
- * }
- *
- */
- public final UnaryCallable restoreDatabaseCallable() {
- return stub.restoreDatabaseCallable();
- }
-
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Lists database [longrunning-operations][google.longrunning.Operation]. A database operation has
diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java
index 53edae1edf..8ae9ec5303 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/DatabaseAdminSettings.java
@@ -103,12 +103,6 @@
@Generated("by gapic-generator")
@BetaApi
public class DatabaseAdminSettings extends ClientSettings {
- /** Returns the object with the settings used for calls to listDatabases. */
- public PagedCallSettings
- listDatabasesSettings() {
- return ((DatabaseAdminStubSettings) getStubSettings()).listDatabasesSettings();
- }
-
/** Returns the object with the settings used for calls to createDatabase. */
public UnaryCallSettings createDatabaseSettings() {
return ((DatabaseAdminStubSettings) getStubSettings()).createDatabaseSettings();
@@ -122,11 +116,6 @@ public UnaryCallSettings createDatabaseSetting
return ((DatabaseAdminStubSettings) getStubSettings()).createDatabaseOperationSettings();
}
- /** Returns the object with the settings used for calls to getDatabase. */
- public UnaryCallSettings getDatabaseSettings() {
- return ((DatabaseAdminStubSettings) getStubSettings()).getDatabaseSettings();
- }
-
/** Returns the object with the settings used for calls to updateDatabaseDdl. */
public UnaryCallSettings updateDatabaseDdlSettings() {
return ((DatabaseAdminStubSettings) getStubSettings()).updateDatabaseDdlSettings();
@@ -140,6 +129,43 @@ public UnaryCallSettings updateDatabaseDdlS
return ((DatabaseAdminStubSettings) getStubSettings()).updateDatabaseDdlOperationSettings();
}
+ /** Returns the object with the settings used for calls to createBackup. */
+ public UnaryCallSettings createBackupSettings() {
+ return ((DatabaseAdminStubSettings) getStubSettings()).createBackupSettings();
+ }
+
+ /** Returns the object with the settings used for calls to createBackup. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings
+ createBackupOperationSettings() {
+ return ((DatabaseAdminStubSettings) getStubSettings()).createBackupOperationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to restoreDatabase. */
+ public UnaryCallSettings restoreDatabaseSettings() {
+ return ((DatabaseAdminStubSettings) getStubSettings()).restoreDatabaseSettings();
+ }
+
+ /** Returns the object with the settings used for calls to restoreDatabase. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings
+ restoreDatabaseOperationSettings() {
+ return ((DatabaseAdminStubSettings) getStubSettings()).restoreDatabaseOperationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to listDatabases. */
+ public PagedCallSettings
+ listDatabasesSettings() {
+ return ((DatabaseAdminStubSettings) getStubSettings()).listDatabasesSettings();
+ }
+
+ /** Returns the object with the settings used for calls to getDatabase. */
+ public UnaryCallSettings getDatabaseSettings() {
+ return ((DatabaseAdminStubSettings) getStubSettings()).getDatabaseSettings();
+ }
+
/** Returns the object with the settings used for calls to dropDatabase. */
public UnaryCallSettings dropDatabaseSettings() {
return ((DatabaseAdminStubSettings) getStubSettings()).dropDatabaseSettings();
@@ -166,19 +192,6 @@ public UnaryCallSettings getIamPolicySettings() {
return ((DatabaseAdminStubSettings) getStubSettings()).testIamPermissionsSettings();
}
- /** Returns the object with the settings used for calls to createBackup. */
- public UnaryCallSettings createBackupSettings() {
- return ((DatabaseAdminStubSettings) getStubSettings()).createBackupSettings();
- }
-
- /** Returns the object with the settings used for calls to createBackup. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public OperationCallSettings
- createBackupOperationSettings() {
- return ((DatabaseAdminStubSettings) getStubSettings()).createBackupOperationSettings();
- }
-
/** Returns the object with the settings used for calls to getBackup. */
public UnaryCallSettings getBackupSettings() {
return ((DatabaseAdminStubSettings) getStubSettings()).getBackupSettings();
@@ -200,19 +213,6 @@ public UnaryCallSettings deleteBackupSettings() {
return ((DatabaseAdminStubSettings) getStubSettings()).listBackupsSettings();
}
- /** Returns the object with the settings used for calls to restoreDatabase. */
- public UnaryCallSettings restoreDatabaseSettings() {
- return ((DatabaseAdminStubSettings) getStubSettings()).restoreDatabaseSettings();
- }
-
- /** Returns the object with the settings used for calls to restoreDatabase. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public OperationCallSettings
- restoreDatabaseOperationSettings() {
- return ((DatabaseAdminStubSettings) getStubSettings()).restoreDatabaseOperationSettings();
- }
-
/** Returns the object with the settings used for calls to listDatabaseOperations. */
public PagedCallSettings<
ListDatabaseOperationsRequest,
@@ -328,13 +328,6 @@ public Builder applyToAllUnaryMethods(
return this;
}
- /** Returns the builder for the settings used for calls to listDatabases. */
- public PagedCallSettings.Builder<
- ListDatabasesRequest, ListDatabasesResponse, ListDatabasesPagedResponse>
- listDatabasesSettings() {
- return getStubSettingsBuilder().listDatabasesSettings();
- }
-
/** Returns the builder for the settings used for calls to createDatabase. */
public UnaryCallSettings.Builder createDatabaseSettings() {
return getStubSettingsBuilder().createDatabaseSettings();
@@ -348,11 +341,6 @@ public UnaryCallSettings.Builder createDatabas
return getStubSettingsBuilder().createDatabaseOperationSettings();
}
- /** Returns the builder for the settings used for calls to getDatabase. */
- public UnaryCallSettings.Builder getDatabaseSettings() {
- return getStubSettingsBuilder().getDatabaseSettings();
- }
-
/** Returns the builder for the settings used for calls to updateDatabaseDdl. */
public UnaryCallSettings.Builder
updateDatabaseDdlSettings() {
@@ -367,6 +355,44 @@ public UnaryCallSettings.Builder getDatabaseSettin
return getStubSettingsBuilder().updateDatabaseDdlOperationSettings();
}
+ /** Returns the builder for the settings used for calls to createBackup. */
+ public UnaryCallSettings.Builder createBackupSettings() {
+ return getStubSettingsBuilder().createBackupSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to createBackup. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder
+ createBackupOperationSettings() {
+ return getStubSettingsBuilder().createBackupOperationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to restoreDatabase. */
+ public UnaryCallSettings.Builder restoreDatabaseSettings() {
+ return getStubSettingsBuilder().restoreDatabaseSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to restoreDatabase. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder
+ restoreDatabaseOperationSettings() {
+ return getStubSettingsBuilder().restoreDatabaseOperationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to listDatabases. */
+ public PagedCallSettings.Builder<
+ ListDatabasesRequest, ListDatabasesResponse, ListDatabasesPagedResponse>
+ listDatabasesSettings() {
+ return getStubSettingsBuilder().listDatabasesSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to getDatabase. */
+ public UnaryCallSettings.Builder getDatabaseSettings() {
+ return getStubSettingsBuilder().getDatabaseSettings();
+ }
+
/** Returns the builder for the settings used for calls to dropDatabase. */
public UnaryCallSettings.Builder dropDatabaseSettings() {
return getStubSettingsBuilder().dropDatabaseSettings();
@@ -394,19 +420,6 @@ public UnaryCallSettings.Builder getIamPolicySettin
return getStubSettingsBuilder().testIamPermissionsSettings();
}
- /** Returns the builder for the settings used for calls to createBackup. */
- public UnaryCallSettings.Builder createBackupSettings() {
- return getStubSettingsBuilder().createBackupSettings();
- }
-
- /** Returns the builder for the settings used for calls to createBackup. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public OperationCallSettings.Builder
- createBackupOperationSettings() {
- return getStubSettingsBuilder().createBackupOperationSettings();
- }
-
/** Returns the builder for the settings used for calls to getBackup. */
public UnaryCallSettings.Builder getBackupSettings() {
return getStubSettingsBuilder().getBackupSettings();
@@ -429,19 +442,6 @@ public UnaryCallSettings.Builder deleteBackupSetting
return getStubSettingsBuilder().listBackupsSettings();
}
- /** Returns the builder for the settings used for calls to restoreDatabase. */
- public UnaryCallSettings.Builder restoreDatabaseSettings() {
- return getStubSettingsBuilder().restoreDatabaseSettings();
- }
-
- /** Returns the builder for the settings used for calls to restoreDatabase. */
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public OperationCallSettings.Builder
- restoreDatabaseOperationSettings() {
- return getStubSettingsBuilder().restoreDatabaseOperationSettings();
- }
-
/** Returns the builder for the settings used for calls to listDatabaseOperations. */
public PagedCallSettings.Builder<
ListDatabaseOperationsRequest,
diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStub.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStub.java
index fd92157c55..9f060f971a 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStub.java
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStub.java
@@ -74,15 +74,6 @@ public OperationsStub getOperationsStub() {
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
}
- public UnaryCallable
- listDatabasesPagedCallable() {
- throw new UnsupportedOperationException("Not implemented: listDatabasesPagedCallable()");
- }
-
- public UnaryCallable listDatabasesCallable() {
- throw new UnsupportedOperationException("Not implemented: listDatabasesCallable()");
- }
-
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallable
createDatabaseOperationCallable() {
@@ -93,10 +84,6 @@ public UnaryCallable createDatabaseCallable()
throw new UnsupportedOperationException("Not implemented: createDatabaseCallable()");
}
- public UnaryCallable getDatabaseCallable() {
- throw new UnsupportedOperationException("Not implemented: getDatabaseCallable()");
- }
-
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallable
updateDatabaseDdlOperationCallable() {
@@ -108,6 +95,39 @@ public UnaryCallable updateDatabaseDdlCalla
throw new UnsupportedOperationException("Not implemented: updateDatabaseDdlCallable()");
}
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallable
+ createBackupOperationCallable() {
+ throw new UnsupportedOperationException("Not implemented: createBackupOperationCallable()");
+ }
+
+ public UnaryCallable createBackupCallable() {
+ throw new UnsupportedOperationException("Not implemented: createBackupCallable()");
+ }
+
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallable
+ restoreDatabaseOperationCallable() {
+ throw new UnsupportedOperationException("Not implemented: restoreDatabaseOperationCallable()");
+ }
+
+ public UnaryCallable restoreDatabaseCallable() {
+ throw new UnsupportedOperationException("Not implemented: restoreDatabaseCallable()");
+ }
+
+ public UnaryCallable
+ listDatabasesPagedCallable() {
+ throw new UnsupportedOperationException("Not implemented: listDatabasesPagedCallable()");
+ }
+
+ public UnaryCallable listDatabasesCallable() {
+ throw new UnsupportedOperationException("Not implemented: listDatabasesCallable()");
+ }
+
+ public UnaryCallable getDatabaseCallable() {
+ throw new UnsupportedOperationException("Not implemented: getDatabaseCallable()");
+ }
+
public UnaryCallable dropDatabaseCallable() {
throw new UnsupportedOperationException("Not implemented: dropDatabaseCallable()");
}
@@ -129,16 +149,6 @@ public UnaryCallable getIamPolicyCallable() {
throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()");
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public OperationCallable
- createBackupOperationCallable() {
- throw new UnsupportedOperationException("Not implemented: createBackupOperationCallable()");
- }
-
- public UnaryCallable createBackupCallable() {
- throw new UnsupportedOperationException("Not implemented: createBackupCallable()");
- }
-
public UnaryCallable getBackupCallable() {
throw new UnsupportedOperationException("Not implemented: getBackupCallable()");
}
@@ -159,16 +169,6 @@ public UnaryCallable listBackupsCallabl
throw new UnsupportedOperationException("Not implemented: listBackupsCallable()");
}
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public OperationCallable
- restoreDatabaseOperationCallable() {
- throw new UnsupportedOperationException("Not implemented: restoreDatabaseOperationCallable()");
- }
-
- public UnaryCallable restoreDatabaseCallable() {
- throw new UnsupportedOperationException("Not implemented: restoreDatabaseCallable()");
- }
-
public UnaryCallable
listDatabaseOperationsPagedCallable() {
throw new UnsupportedOperationException(
diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java
index 53d5767a89..7799b21fc3 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/DatabaseAdminStubSettings.java
@@ -128,16 +128,22 @@ public class DatabaseAdminStubSettings extends StubSettings
- listDatabasesSettings;
private final UnaryCallSettings createDatabaseSettings;
private final OperationCallSettings
createDatabaseOperationSettings;
- private final UnaryCallSettings getDatabaseSettings;
private final UnaryCallSettings updateDatabaseDdlSettings;
private final OperationCallSettings
updateDatabaseDdlOperationSettings;
+ private final UnaryCallSettings createBackupSettings;
+ private final OperationCallSettings
+ createBackupOperationSettings;
+ private final UnaryCallSettings restoreDatabaseSettings;
+ private final OperationCallSettings
+ restoreDatabaseOperationSettings;
+ private final PagedCallSettings<
+ ListDatabasesRequest, ListDatabasesResponse, ListDatabasesPagedResponse>
+ listDatabasesSettings;
+ private final UnaryCallSettings getDatabaseSettings;
private final UnaryCallSettings dropDatabaseSettings;
private final UnaryCallSettings
getDatabaseDdlSettings;
@@ -145,17 +151,11 @@ public class DatabaseAdminStubSettings extends StubSettings getIamPolicySettings;
private final UnaryCallSettings
testIamPermissionsSettings;
- private final UnaryCallSettings createBackupSettings;
- private final OperationCallSettings
- createBackupOperationSettings;
private final UnaryCallSettings getBackupSettings;
private final UnaryCallSettings updateBackupSettings;
private final UnaryCallSettings deleteBackupSettings;
private final PagedCallSettings
listBackupsSettings;
- private final UnaryCallSettings restoreDatabaseSettings;
- private final OperationCallSettings
- restoreDatabaseOperationSettings;
private final PagedCallSettings<
ListDatabaseOperationsRequest,
ListDatabaseOperationsResponse,
@@ -167,12 +167,6 @@ public class DatabaseAdminStubSettings extends StubSettings
listBackupOperationsSettings;
- /** Returns the object with the settings used for calls to listDatabases. */
- public PagedCallSettings
- listDatabasesSettings() {
- return listDatabasesSettings;
- }
-
/** Returns the object with the settings used for calls to createDatabase. */
public UnaryCallSettings createDatabaseSettings() {
return createDatabaseSettings;
@@ -185,11 +179,6 @@ public UnaryCallSettings createDatabaseSetting
return createDatabaseOperationSettings;
}
- /** Returns the object with the settings used for calls to getDatabase. */
- public UnaryCallSettings getDatabaseSettings() {
- return getDatabaseSettings;
- }
-
/** Returns the object with the settings used for calls to updateDatabaseDdl. */
public UnaryCallSettings updateDatabaseDdlSettings() {
return updateDatabaseDdlSettings;
@@ -202,6 +191,41 @@ public UnaryCallSettings updateDatabaseDdlS
return updateDatabaseDdlOperationSettings;
}
+ /** Returns the object with the settings used for calls to createBackup. */
+ public UnaryCallSettings createBackupSettings() {
+ return createBackupSettings;
+ }
+
+ /** Returns the object with the settings used for calls to createBackup. */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings
+ createBackupOperationSettings() {
+ return createBackupOperationSettings;
+ }
+
+ /** Returns the object with the settings used for calls to restoreDatabase. */
+ public UnaryCallSettings restoreDatabaseSettings() {
+ return restoreDatabaseSettings;
+ }
+
+ /** Returns the object with the settings used for calls to restoreDatabase. */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings
+ restoreDatabaseOperationSettings() {
+ return restoreDatabaseOperationSettings;
+ }
+
+ /** Returns the object with the settings used for calls to listDatabases. */
+ public PagedCallSettings
+ listDatabasesSettings() {
+ return listDatabasesSettings;
+ }
+
+ /** Returns the object with the settings used for calls to getDatabase. */
+ public UnaryCallSettings getDatabaseSettings() {
+ return getDatabaseSettings;
+ }
+
/** Returns the object with the settings used for calls to dropDatabase. */
public UnaryCallSettings dropDatabaseSettings() {
return dropDatabaseSettings;
@@ -228,18 +252,6 @@ public UnaryCallSettings getIamPolicySettings() {
return testIamPermissionsSettings;
}
- /** Returns the object with the settings used for calls to createBackup. */
- public UnaryCallSettings createBackupSettings() {
- return createBackupSettings;
- }
-
- /** Returns the object with the settings used for calls to createBackup. */
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public OperationCallSettings
- createBackupOperationSettings() {
- return createBackupOperationSettings;
- }
-
/** Returns the object with the settings used for calls to getBackup. */
public UnaryCallSettings getBackupSettings() {
return getBackupSettings;
@@ -261,18 +273,6 @@ public UnaryCallSettings deleteBackupSettings() {
return listBackupsSettings;
}
- /** Returns the object with the settings used for calls to restoreDatabase. */
- public UnaryCallSettings restoreDatabaseSettings() {
- return restoreDatabaseSettings;
- }
-
- /** Returns the object with the settings used for calls to restoreDatabase. */
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public OperationCallSettings
- restoreDatabaseOperationSettings() {
- return restoreDatabaseOperationSettings;
- }
-
/** Returns the object with the settings used for calls to listDatabaseOperations. */
public PagedCallSettings<
ListDatabaseOperationsRequest,
@@ -360,26 +360,26 @@ public Builder toBuilder() {
protected DatabaseAdminStubSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
- listDatabasesSettings = settingsBuilder.listDatabasesSettings().build();
createDatabaseSettings = settingsBuilder.createDatabaseSettings().build();
createDatabaseOperationSettings = settingsBuilder.createDatabaseOperationSettings().build();
- getDatabaseSettings = settingsBuilder.getDatabaseSettings().build();
updateDatabaseDdlSettings = settingsBuilder.updateDatabaseDdlSettings().build();
updateDatabaseDdlOperationSettings =
settingsBuilder.updateDatabaseDdlOperationSettings().build();
+ createBackupSettings = settingsBuilder.createBackupSettings().build();
+ createBackupOperationSettings = settingsBuilder.createBackupOperationSettings().build();
+ restoreDatabaseSettings = settingsBuilder.restoreDatabaseSettings().build();
+ restoreDatabaseOperationSettings = settingsBuilder.restoreDatabaseOperationSettings().build();
+ listDatabasesSettings = settingsBuilder.listDatabasesSettings().build();
+ getDatabaseSettings = settingsBuilder.getDatabaseSettings().build();
dropDatabaseSettings = settingsBuilder.dropDatabaseSettings().build();
getDatabaseDdlSettings = settingsBuilder.getDatabaseDdlSettings().build();
setIamPolicySettings = settingsBuilder.setIamPolicySettings().build();
getIamPolicySettings = settingsBuilder.getIamPolicySettings().build();
testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build();
- createBackupSettings = settingsBuilder.createBackupSettings().build();
- createBackupOperationSettings = settingsBuilder.createBackupOperationSettings().build();
getBackupSettings = settingsBuilder.getBackupSettings().build();
updateBackupSettings = settingsBuilder.updateBackupSettings().build();
deleteBackupSettings = settingsBuilder.deleteBackupSettings().build();
listBackupsSettings = settingsBuilder.listBackupsSettings().build();
- restoreDatabaseSettings = settingsBuilder.restoreDatabaseSettings().build();
- restoreDatabaseOperationSettings = settingsBuilder.restoreDatabaseOperationSettings().build();
listDatabaseOperationsSettings = settingsBuilder.listDatabaseOperationsSettings().build();
listBackupOperationsSettings = settingsBuilder.listBackupOperationsSettings().build();
}
@@ -623,20 +623,28 @@ public ApiFuture getFuturePagedResponse(
public static class Builder extends StubSettings.Builder {
private final ImmutableList> unaryMethodSettingsBuilders;
- private final PagedCallSettings.Builder<
- ListDatabasesRequest, ListDatabasesResponse, ListDatabasesPagedResponse>
- listDatabasesSettings;
private final UnaryCallSettings.Builder
createDatabaseSettings;
private final OperationCallSettings.Builder<
CreateDatabaseRequest, Database, CreateDatabaseMetadata>
createDatabaseOperationSettings;
- private final UnaryCallSettings.Builder getDatabaseSettings;
private final UnaryCallSettings.Builder
updateDatabaseDdlSettings;
private final OperationCallSettings.Builder<
UpdateDatabaseDdlRequest, Empty, UpdateDatabaseDdlMetadata>
updateDatabaseDdlOperationSettings;
+ private final UnaryCallSettings.Builder createBackupSettings;
+ private final OperationCallSettings.Builder
+ createBackupOperationSettings;
+ private final UnaryCallSettings.Builder
+ restoreDatabaseSettings;
+ private final OperationCallSettings.Builder<
+ RestoreDatabaseRequest, Database, RestoreDatabaseMetadata>
+ restoreDatabaseOperationSettings;
+ private final PagedCallSettings.Builder<
+ ListDatabasesRequest, ListDatabasesResponse, ListDatabasesPagedResponse>
+ listDatabasesSettings;
+ private final UnaryCallSettings.Builder getDatabaseSettings;
private final UnaryCallSettings.Builder dropDatabaseSettings;
private final UnaryCallSettings.Builder
getDatabaseDdlSettings;
@@ -644,20 +652,12 @@ public static class Builder extends StubSettings.Builder getIamPolicySettings;
private final UnaryCallSettings.Builder
testIamPermissionsSettings;
- private final UnaryCallSettings.Builder createBackupSettings;
- private final OperationCallSettings.Builder
- createBackupOperationSettings;
private final UnaryCallSettings.Builder getBackupSettings;
private final UnaryCallSettings.Builder updateBackupSettings;
private final UnaryCallSettings.Builder deleteBackupSettings;
private final PagedCallSettings.Builder<
ListBackupsRequest, ListBackupsResponse, ListBackupsPagedResponse>
listBackupsSettings;
- private final UnaryCallSettings.Builder
- restoreDatabaseSettings;
- private final OperationCallSettings.Builder<
- RestoreDatabaseRequest, Database, RestoreDatabaseMetadata>
- restoreDatabaseOperationSettings;
private final PagedCallSettings.Builder<
ListDatabaseOperationsRequest,
ListDatabaseOperationsResponse,
@@ -676,11 +676,20 @@ public static class Builder extends StubSettings.Builder> definitions =
ImmutableMap.builder();
definitions.put(
- "idempotent",
+ "retry_policy_1_codes",
+ ImmutableSet.copyOf(
+ Lists.newArrayList(
+ StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED)));
+ definitions.put(
+ "no_retry_2_codes", ImmutableSet.copyOf(Lists.newArrayList()));
+ definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList()));
+ definitions.put(
+ "retry_policy_2_codes",
ImmutableSet.copyOf(
Lists.newArrayList(
- StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
- definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList()));
+ StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED)));
+ definitions.put(
+ "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
@@ -694,12 +703,41 @@ public static class Builder extends StubSettings.Builder>of(
- listDatabasesSettings,
createDatabaseSettings,
- getDatabaseSettings,
updateDatabaseDdlSettings,
+ createBackupSettings,
+ restoreDatabaseSettings,
+ listDatabasesSettings,
+ getDatabaseSettings,
dropDatabaseSettings,
getDatabaseDdlSettings,
setIamPolicySettings,
getIamPolicySettings,
testIamPermissionsSettings,
- createBackupSettings,
getBackupSettings,
updateBackupSettings,
deleteBackupSettings,
listBackupsSettings,
- restoreDatabaseSettings,
listDatabaseOperationsSettings,
listBackupOperationsSettings);
@@ -789,96 +827,96 @@ private static Builder createDefault() {
private static Builder initDefaults(Builder builder) {
builder
- .listDatabasesSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .createDatabaseSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
builder
- .createDatabaseSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .updateDatabaseDdlSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
- .getDatabaseSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .createBackupSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
builder
- .updateDatabaseDdlSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .restoreDatabaseSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
+
+ builder
+ .listDatabasesSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
+
+ builder
+ .getDatabaseSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.dropDatabaseSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.getDatabaseDdlSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.setIamPolicySettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params"));
builder
.getIamPolicySettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
builder
.testIamPermissionsSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
-
- builder
- .createBackupSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .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("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.updateBackupSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
builder
.deleteBackupSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.listBackupsSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
-
- builder
- .restoreDatabaseSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.listDatabaseOperationsSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.listBackupOperationsSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.createDatabaseOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Database.class))
@@ -900,8 +938,8 @@ private static Builder initDefaults(Builder builder) {
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Empty.class))
@@ -924,8 +962,8 @@ private static Builder initDefaults(Builder builder) {
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Backup.class))
@@ -947,8 +985,8 @@ private static Builder initDefaults(Builder builder) {
.setInitialCallSettings(
UnaryCallSettings
.newUnaryCallSettingsBuilder()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Database.class))
@@ -972,45 +1010,45 @@ private static Builder initDefaults(Builder builder) {
protected Builder(DatabaseAdminStubSettings settings) {
super(settings);
- listDatabasesSettings = settings.listDatabasesSettings.toBuilder();
createDatabaseSettings = settings.createDatabaseSettings.toBuilder();
createDatabaseOperationSettings = settings.createDatabaseOperationSettings.toBuilder();
- getDatabaseSettings = settings.getDatabaseSettings.toBuilder();
updateDatabaseDdlSettings = settings.updateDatabaseDdlSettings.toBuilder();
updateDatabaseDdlOperationSettings = settings.updateDatabaseDdlOperationSettings.toBuilder();
+ createBackupSettings = settings.createBackupSettings.toBuilder();
+ createBackupOperationSettings = settings.createBackupOperationSettings.toBuilder();
+ restoreDatabaseSettings = settings.restoreDatabaseSettings.toBuilder();
+ restoreDatabaseOperationSettings = settings.restoreDatabaseOperationSettings.toBuilder();
+ listDatabasesSettings = settings.listDatabasesSettings.toBuilder();
+ getDatabaseSettings = settings.getDatabaseSettings.toBuilder();
dropDatabaseSettings = settings.dropDatabaseSettings.toBuilder();
getDatabaseDdlSettings = settings.getDatabaseDdlSettings.toBuilder();
setIamPolicySettings = settings.setIamPolicySettings.toBuilder();
getIamPolicySettings = settings.getIamPolicySettings.toBuilder();
testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder();
- createBackupSettings = settings.createBackupSettings.toBuilder();
- createBackupOperationSettings = settings.createBackupOperationSettings.toBuilder();
getBackupSettings = settings.getBackupSettings.toBuilder();
updateBackupSettings = settings.updateBackupSettings.toBuilder();
deleteBackupSettings = settings.deleteBackupSettings.toBuilder();
listBackupsSettings = settings.listBackupsSettings.toBuilder();
- restoreDatabaseSettings = settings.restoreDatabaseSettings.toBuilder();
- restoreDatabaseOperationSettings = settings.restoreDatabaseOperationSettings.toBuilder();
listDatabaseOperationsSettings = settings.listDatabaseOperationsSettings.toBuilder();
listBackupOperationsSettings = settings.listBackupOperationsSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
- listDatabasesSettings,
createDatabaseSettings,
- getDatabaseSettings,
updateDatabaseDdlSettings,
+ createBackupSettings,
+ restoreDatabaseSettings,
+ listDatabasesSettings,
+ getDatabaseSettings,
dropDatabaseSettings,
getDatabaseDdlSettings,
setIamPolicySettings,
getIamPolicySettings,
testIamPermissionsSettings,
- createBackupSettings,
getBackupSettings,
updateBackupSettings,
deleteBackupSettings,
listBackupsSettings,
- restoreDatabaseSettings,
listDatabaseOperationsSettings,
listBackupOperationsSettings);
}
@@ -1031,13 +1069,6 @@ public Builder applyToAllUnaryMethods(
return unaryMethodSettingsBuilders;
}
- /** Returns the builder for the settings used for calls to listDatabases. */
- public PagedCallSettings.Builder<
- ListDatabasesRequest, ListDatabasesResponse, ListDatabasesPagedResponse>
- listDatabasesSettings() {
- return listDatabasesSettings;
- }
-
/** Returns the builder for the settings used for calls to createDatabase. */
public UnaryCallSettings.Builder createDatabaseSettings() {
return createDatabaseSettings;
@@ -1051,11 +1082,6 @@ public UnaryCallSettings.Builder createDatabas
return createDatabaseOperationSettings;
}
- /** Returns the builder for the settings used for calls to getDatabase. */
- public UnaryCallSettings.Builder getDatabaseSettings() {
- return getDatabaseSettings;
- }
-
/** Returns the builder for the settings used for calls to updateDatabaseDdl. */
public UnaryCallSettings.Builder
updateDatabaseDdlSettings() {
@@ -1070,6 +1096,44 @@ public UnaryCallSettings.Builder getDatabaseSettin
return updateDatabaseDdlOperationSettings;
}
+ /** Returns the builder for the settings used for calls to createBackup. */
+ public UnaryCallSettings.Builder createBackupSettings() {
+ return createBackupSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to createBackup. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder
+ createBackupOperationSettings() {
+ return createBackupOperationSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to restoreDatabase. */
+ public UnaryCallSettings.Builder restoreDatabaseSettings() {
+ return restoreDatabaseSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to restoreDatabase. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder
+ restoreDatabaseOperationSettings() {
+ return restoreDatabaseOperationSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to listDatabases. */
+ public PagedCallSettings.Builder<
+ ListDatabasesRequest, ListDatabasesResponse, ListDatabasesPagedResponse>
+ listDatabasesSettings() {
+ return listDatabasesSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to getDatabase. */
+ public UnaryCallSettings.Builder getDatabaseSettings() {
+ return getDatabaseSettings;
+ }
+
/** Returns the builder for the settings used for calls to dropDatabase. */
public UnaryCallSettings.Builder dropDatabaseSettings() {
return dropDatabaseSettings;
@@ -1097,19 +1161,6 @@ public UnaryCallSettings.Builder getIamPolicySettin
return testIamPermissionsSettings;
}
- /** Returns the builder for the settings used for calls to createBackup. */
- public UnaryCallSettings.Builder createBackupSettings() {
- return createBackupSettings;
- }
-
- /** Returns the builder for the settings used for calls to createBackup. */
- @BetaApi(
- "The surface for use by generated code is not stable yet and may change in the future.")
- public OperationCallSettings.Builder
- createBackupOperationSettings() {
- return createBackupOperationSettings;
- }
-
/** Returns the builder for the settings used for calls to getBackup. */
public UnaryCallSettings.Builder getBackupSettings() {
return getBackupSettings;
@@ -1132,19 +1183,6 @@ public UnaryCallSettings.Builder deleteBackupSetting
return listBackupsSettings;
}
- /** Returns the builder for the settings used for calls to restoreDatabase. */
- public UnaryCallSettings.Builder restoreDatabaseSettings() {
- return restoreDatabaseSettings;
- }
-
- /** Returns the builder for the settings used for calls to restoreDatabase. */
- @BetaApi(
- "The surface for use by generated code is not stable yet and may change in the future.")
- public OperationCallSettings.Builder
- restoreDatabaseOperationSettings() {
- return restoreDatabaseOperationSettings;
- }
-
/** Returns the builder for the settings used for calls to listDatabaseOperations. */
public PagedCallSettings.Builder<
ListDatabaseOperationsRequest,
diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/GrpcDatabaseAdminStub.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/GrpcDatabaseAdminStub.java
index aaf318ca90..c3d8b39713 100644
--- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/GrpcDatabaseAdminStub.java
+++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/admin/database/v1/stub/GrpcDatabaseAdminStub.java
@@ -80,16 +80,6 @@
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public class GrpcDatabaseAdminStub extends DatabaseAdminStub {
- private static final MethodDescriptor
- listDatabasesMethodDescriptor =
- MethodDescriptor.newBuilder()
- .setType(MethodDescriptor.MethodType.UNARY)
- .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases")
- .setRequestMarshaller(
- ProtoUtils.marshaller(ListDatabasesRequest.getDefaultInstance()))
- .setResponseMarshaller(
- ProtoUtils.marshaller(ListDatabasesResponse.getDefaultInstance()))
- .build();
private static final MethodDescriptor
createDatabaseMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -99,13 +89,6 @@ public class GrpcDatabaseAdminStub extends DatabaseAdminStub {
ProtoUtils.marshaller(CreateDatabaseRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
- private static final MethodDescriptor getDatabaseMethodDescriptor =
- MethodDescriptor.newBuilder()
- .setType(MethodDescriptor.MethodType.UNARY)
- .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/GetDatabase")
- .setRequestMarshaller(ProtoUtils.marshaller(GetDatabaseRequest.getDefaultInstance()))
- .setResponseMarshaller(ProtoUtils.marshaller(Database.getDefaultInstance()))
- .build();
private static final MethodDescriptor
updateDatabaseDdlMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -115,6 +98,40 @@ public class GrpcDatabaseAdminStub extends DatabaseAdminStub {
ProtoUtils.marshaller(UpdateDatabaseDdlRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
.build();
+ private static final MethodDescriptor
+ createBackupMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/CreateBackup")
+ .setRequestMarshaller(ProtoUtils.marshaller(CreateBackupRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
+ .build();
+ private static final MethodDescriptor
+ restoreDatabaseMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/RestoreDatabase")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(RestoreDatabaseRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
+ .build();
+ private static final MethodDescriptor
+ listDatabasesMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/ListDatabases")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(ListDatabasesRequest.getDefaultInstance()))
+ .setResponseMarshaller(
+ ProtoUtils.marshaller(ListDatabasesResponse.getDefaultInstance()))
+ .build();
+ private static final MethodDescriptor getDatabaseMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/GetDatabase")
+ .setRequestMarshaller(ProtoUtils.marshaller(GetDatabaseRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Database.getDefaultInstance()))
+ .build();
private static final MethodDescriptor dropDatabaseMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
@@ -157,14 +174,6 @@ public class GrpcDatabaseAdminStub extends DatabaseAdminStub {
.setResponseMarshaller(
ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance()))
.build();
- private static final MethodDescriptor
- createBackupMethodDescriptor =
- MethodDescriptor.newBuilder()
- .setType(MethodDescriptor.MethodType.UNARY)
- .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/CreateBackup")
- .setRequestMarshaller(ProtoUtils.marshaller(CreateBackupRequest.getDefaultInstance()))
- .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
- .build();
private static final MethodDescriptor getBackupMethodDescriptor =
MethodDescriptor.newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
@@ -195,15 +204,6 @@ public class GrpcDatabaseAdminStub extends DatabaseAdminStub {
.setResponseMarshaller(
ProtoUtils.marshaller(ListBackupsResponse.getDefaultInstance()))
.build();
- private static final MethodDescriptor
- restoreDatabaseMethodDescriptor =
- MethodDescriptor.newBuilder()
- .setType(MethodDescriptor.MethodType.UNARY)
- .setFullMethodName("google.spanner.admin.database.v1.DatabaseAdmin/RestoreDatabase")
- .setRequestMarshaller(
- ProtoUtils.marshaller(RestoreDatabaseRequest.getDefaultInstance()))
- .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
- .build();
private static final MethodDescriptor<
ListDatabaseOperationsRequest, ListDatabaseOperationsResponse>
listDatabaseOperationsMethodDescriptor =
@@ -232,34 +232,34 @@ public class GrpcDatabaseAdminStub extends DatabaseAdminStub {
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
- private final UnaryCallable listDatabasesCallable;
- private final UnaryCallable
- listDatabasesPagedCallable;
private final UnaryCallable createDatabaseCallable;
private final OperationCallable
createDatabaseOperationCallable;
- private final UnaryCallable getDatabaseCallable;
private final UnaryCallable updateDatabaseDdlCallable;
private final OperationCallable
updateDatabaseDdlOperationCallable;
+ private final UnaryCallable createBackupCallable;
+ private final OperationCallable
+ createBackupOperationCallable;
+ private final UnaryCallable restoreDatabaseCallable;
+ private final OperationCallable
+ restoreDatabaseOperationCallable;
+ private final UnaryCallable listDatabasesCallable;
+ private final UnaryCallable
+ listDatabasesPagedCallable;
+ private final UnaryCallable getDatabaseCallable;
private final UnaryCallable dropDatabaseCallable;
private final UnaryCallable getDatabaseDdlCallable;
private final UnaryCallable setIamPolicyCallable;
private final UnaryCallable getIamPolicyCallable;
private final UnaryCallable
testIamPermissionsCallable;
- private final UnaryCallable createBackupCallable;
- private final OperationCallable
- createBackupOperationCallable;
private final UnaryCallable getBackupCallable;
private final UnaryCallable updateBackupCallable;
private final UnaryCallable deleteBackupCallable;
private final UnaryCallable listBackupsCallable;
private final UnaryCallable
listBackupsPagedCallable;
- private final UnaryCallable restoreDatabaseCallable;
- private final OperationCallable
- restoreDatabaseOperationCallable;
private final UnaryCallable
listDatabaseOperationsCallable;
private final UnaryCallable
@@ -309,54 +309,80 @@ protected GrpcDatabaseAdminStub(
this.callableFactory = callableFactory;
this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
- GrpcCallSettings listDatabasesTransportSettings =
- GrpcCallSettings.newBuilder()
- .setMethodDescriptor(listDatabasesMethodDescriptor)
+ GrpcCallSettings createDatabaseTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(createDatabaseMethodDescriptor)
.setParamsExtractor(
- new RequestParamsExtractor() {
+ new RequestParamsExtractor() {
@Override
- public Map extract(ListDatabasesRequest request) {
+ public Map