All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.spanner.admin.database.v1.DatabaseAdminClient Maven / Gradle / Ivy

There is a newer version: 6.81.1
Show newest version
/*
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.spanner.admin.database.v1;

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.api.resourcenames.ResourceName;
import com.google.cloud.spanner.admin.database.v1.stub.DatabaseAdminStub;
import com.google.cloud.spanner.admin.database.v1.stub.DatabaseAdminStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import com.google.protobuf.Timestamp;
import com.google.spanner.admin.database.v1.Backup;
import com.google.spanner.admin.database.v1.BackupName;
import com.google.spanner.admin.database.v1.BackupSchedule;
import com.google.spanner.admin.database.v1.BackupScheduleName;
import com.google.spanner.admin.database.v1.CopyBackupMetadata;
import com.google.spanner.admin.database.v1.CopyBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupMetadata;
import com.google.spanner.admin.database.v1.CreateBackupRequest;
import com.google.spanner.admin.database.v1.CreateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.CreateDatabaseMetadata;
import com.google.spanner.admin.database.v1.CreateDatabaseRequest;
import com.google.spanner.admin.database.v1.Database;
import com.google.spanner.admin.database.v1.DatabaseName;
import com.google.spanner.admin.database.v1.DatabaseRole;
import com.google.spanner.admin.database.v1.DeleteBackupRequest;
import com.google.spanner.admin.database.v1.DeleteBackupScheduleRequest;
import com.google.spanner.admin.database.v1.DropDatabaseRequest;
import com.google.spanner.admin.database.v1.GetBackupRequest;
import com.google.spanner.admin.database.v1.GetBackupScheduleRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.GetDatabaseDdlResponse;
import com.google.spanner.admin.database.v1.GetDatabaseRequest;
import com.google.spanner.admin.database.v1.InstanceName;
import com.google.spanner.admin.database.v1.ListBackupOperationsRequest;
import com.google.spanner.admin.database.v1.ListBackupOperationsResponse;
import com.google.spanner.admin.database.v1.ListBackupSchedulesRequest;
import com.google.spanner.admin.database.v1.ListBackupSchedulesResponse;
import com.google.spanner.admin.database.v1.ListBackupsRequest;
import com.google.spanner.admin.database.v1.ListBackupsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsRequest;
import com.google.spanner.admin.database.v1.ListDatabaseOperationsResponse;
import com.google.spanner.admin.database.v1.ListDatabaseRolesRequest;
import com.google.spanner.admin.database.v1.ListDatabaseRolesResponse;
import com.google.spanner.admin.database.v1.ListDatabasesRequest;
import com.google.spanner.admin.database.v1.ListDatabasesResponse;
import com.google.spanner.admin.database.v1.RestoreDatabaseMetadata;
import com.google.spanner.admin.database.v1.RestoreDatabaseRequest;
import com.google.spanner.admin.database.v1.UpdateBackupRequest;
import com.google.spanner.admin.database.v1.UpdateBackupScheduleRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
import com.google.spanner.admin.database.v1.UpdateDatabaseMetadata;
import com.google.spanner.admin.database.v1.UpdateDatabaseRequest;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * Service Description: Cloud Spanner Database Admin API
 *
 * 

The Cloud Spanner Database Admin API can be used to: * create, drop, and list databases * * update the schema of pre-existing databases * create, delete, copy and list backups for * a database * restore a database from an existing backup * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * *

{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
 *   DatabaseName name = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
 *   Database response = databaseAdminClient.getDatabase(name);
 * }
 * }
* *

Note: close() needs to be called on the DatabaseAdminClient object to clean up resources such * as threads. In the example above, try-with-resources is used, which automatically calls close(). * *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Methods
MethodDescriptionMethod Variants

ListDatabases

Lists Cloud Spanner databases.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listDatabases(ListDatabasesRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listDatabases(InstanceName parent) *

  • listDatabases(String parent) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listDatabasesPagedCallable() *

  • listDatabasesCallable() *

*

CreateDatabase

Creates a new Cloud Spanner database and starts to prepare it for serving. 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 preparation of the database. The [metadata][google.longrunning.Operation.metadata] field type is [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The [response][google.longrunning.Operation.response] field type is [Database][google.spanner.admin.database.v1.Database], if successful.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • createDatabaseAsync(CreateDatabaseRequest request) *

*

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

*
    *
  • createDatabaseAsync(InstanceName parent, String createStatement) *

  • createDatabaseAsync(String parent, String createStatement) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • createDatabaseOperationCallable() *

  • createDatabaseCallable() *

*

GetDatabase

Gets the state of a Cloud Spanner database.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getDatabase(GetDatabaseRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getDatabase(DatabaseName name) *

  • getDatabase(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getDatabaseCallable() *

*

UpdateDatabase

Updates a Cloud Spanner database. The returned [long-running operation][google.longrunning.Operation] can be used to track the progress of updating the database. If the named database does not exist, returns `NOT_FOUND`. *

While the operation is pending: *

* The database's [reconciling][google.spanner.admin.database.v1.Database.reconciling] field is set to true. * Cancelling the operation is best-effort. If the cancellation succeeds, the operation metadata's [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] is set, the updates are reverted, and the operation terminates with a `CANCELLED` status. * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error until the pending operation is done (returns successfully or with error). * Reading the database via the API continues to give the pre-request values. *

Upon completion of the returned operation: *

* The new values are in effect and readable via the API. * The database's [reconciling][google.spanner.admin.database.v1.Database.reconciling] field becomes false. *

The returned [long-running operation][google.longrunning.Operation] will have a name of the format `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>` and can be used to track the database modification. The [metadata][google.longrunning.Operation.metadata] field type is [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. The [response][google.longrunning.Operation.response] field type is [Database][google.spanner.admin.database.v1.Database], if successful.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • updateDatabaseAsync(UpdateDatabaseRequest request) *

*

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

*
    *
  • updateDatabaseAsync(Database database, FieldMask updateMask) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • updateDatabaseOperationCallable() *

  • updateDatabaseCallable() *

*

UpdateDatabaseDdl

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.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • updateDatabaseDdlAsync(UpdateDatabaseDdlRequest request) *

*

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

*
    *
  • updateDatabaseDdlAsync(DatabaseName database, List<String> statements) *

  • updateDatabaseDdlAsync(String database, List<String> statements) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • updateDatabaseDdlOperationCallable() *

  • updateDatabaseDdlCallable() *

*

DropDatabase

Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be retained according to their `expire_time`. Note: Cloud Spanner might continue to accept requests for a few seconds after the database has been deleted.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • dropDatabase(DropDatabaseRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • dropDatabase(DatabaseName database) *

  • dropDatabase(String database) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • dropDatabaseCallable() *

*

GetDatabaseDdl

Returns the schema of a Cloud Spanner database as a list of formatted DDL statements. This method does not show pending schema updates, those may be queried using the [Operations][google.longrunning.Operations] API.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getDatabaseDdl(GetDatabaseDdlRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getDatabaseDdl(DatabaseName database) *

  • getDatabaseDdl(String database) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getDatabaseDdlCallable() *

*

SetIamPolicy

Sets the access control policy on a database or backup resource. Replaces any existing policy. *

Authorization requires `spanner.databases.setIamPolicy` permission on [resource][google.iam.v1.SetIamPolicyRequest.resource]. For backups, authorization requires `spanner.backups.setIamPolicy` permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • setIamPolicy(SetIamPolicyRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • setIamPolicy(ResourceName resource, Policy policy) *

  • setIamPolicy(String resource, Policy policy) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • setIamPolicyCallable() *

*

GetIamPolicy

Gets the access control policy for a database or backup resource. Returns an empty policy if a database or backup exists but does not have a policy set. *

Authorization requires `spanner.databases.getIamPolicy` permission on [resource][google.iam.v1.GetIamPolicyRequest.resource]. For backups, authorization requires `spanner.backups.getIamPolicy` permission on [resource][google.iam.v1.GetIamPolicyRequest.resource].

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getIamPolicy(GetIamPolicyRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getIamPolicy(ResourceName resource) *

  • getIamPolicy(String resource) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getIamPolicyCallable() *

*

TestIamPermissions

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.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • testIamPermissions(TestIamPermissionsRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • testIamPermissions(ResourceName resource, List<String> permissions) *

  • testIamPermissions(String resource, List<String> permissions) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • testIamPermissionsCallable() *

*

CreateBackup

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.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • createBackupAsync(CreateBackupRequest request) *

*

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

*
    *
  • createBackupAsync(InstanceName parent, Backup backup, String backupId) *

  • createBackupAsync(String parent, Backup backup, String backupId) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • createBackupOperationCallable() *

  • createBackupCallable() *

*

CopyBackup

Starts copying a 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 copying of the backup. The operation is associated with the destination backup. The [metadata][google.longrunning.Operation.metadata] field type is [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. 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 copying and delete the destination backup. Concurrent CopyBackup requests can run on the same source backup.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • copyBackupAsync(CopyBackupRequest request) *

*

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

*
    *
  • copyBackupAsync(InstanceName parent, String backupId, BackupName sourceBackup, Timestamp expireTime) *

  • copyBackupAsync(InstanceName parent, String backupId, String sourceBackup, Timestamp expireTime) *

  • copyBackupAsync(String parent, String backupId, BackupName sourceBackup, Timestamp expireTime) *

  • copyBackupAsync(String parent, String backupId, String sourceBackup, Timestamp expireTime) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • copyBackupOperationCallable() *

  • copyBackupCallable() *

*

GetBackup

Gets metadata on a pending or completed [Backup][google.spanner.admin.database.v1.Backup].

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getBackup(GetBackupRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getBackup(BackupName name) *

  • getBackup(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getBackupCallable() *

*

UpdateBackup

Updates a pending or completed [Backup][google.spanner.admin.database.v1.Backup].

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • updateBackup(UpdateBackupRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • updateBackup(Backup backup, FieldMask updateMask) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • updateBackupCallable() *

*

DeleteBackup

Deletes a pending or completed [Backup][google.spanner.admin.database.v1.Backup].

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • deleteBackup(DeleteBackupRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • deleteBackup(BackupName name) *

  • deleteBackup(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • deleteBackupCallable() *

*

ListBackups

Lists completed and pending backups. Backups returned are ordered by `create_time` in descending order, starting from the most recent `create_time`.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listBackups(ListBackupsRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listBackups(InstanceName parent) *

  • listBackups(String parent) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listBackupsPagedCallable() *

  • listBackupsCallable() *

*

RestoreDatabase

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.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • restoreDatabaseAsync(RestoreDatabaseRequest request) *

*

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

*
    *
  • restoreDatabaseAsync(InstanceName parent, String databaseId, BackupName backup) *

  • restoreDatabaseAsync(InstanceName parent, String databaseId, String backup) *

  • restoreDatabaseAsync(String parent, String databaseId, BackupName backup) *

  • restoreDatabaseAsync(String parent, String databaseId, String backup) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • restoreDatabaseOperationCallable() *

  • restoreDatabaseCallable() *

*

ListDatabaseOperations

Lists database [longrunning-operations][google.longrunning.Operation]. A database operation has a name of the form `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`. The long-running operation [metadata][google.longrunning.Operation.metadata] field type `metadata.type_url` describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listDatabaseOperations(ListDatabaseOperationsRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listDatabaseOperations(InstanceName parent) *

  • listDatabaseOperations(String parent) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listDatabaseOperationsPagedCallable() *

  • listDatabaseOperationsCallable() *

*

ListBackupOperations

Lists the backup [long-running operations][google.longrunning.Operation] in the given instance. A backup operation has a name of the form `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`. The long-running operation [metadata][google.longrunning.Operation.metadata] field type `metadata.type_url` describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by `operation.metadata.value.progress.start_time` in descending order starting from the most recently started operation.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listBackupOperations(ListBackupOperationsRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listBackupOperations(InstanceName parent) *

  • listBackupOperations(String parent) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listBackupOperationsPagedCallable() *

  • listBackupOperationsCallable() *

*

ListDatabaseRoles

Lists Cloud Spanner database roles.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listDatabaseRoles(ListDatabaseRolesRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listDatabaseRoles(DatabaseName parent) *

  • listDatabaseRoles(String parent) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listDatabaseRolesPagedCallable() *

  • listDatabaseRolesCallable() *

*

CreateBackupSchedule

Creates a new backup schedule.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • createBackupSchedule(CreateBackupScheduleRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • createBackupSchedule(DatabaseName parent, BackupSchedule backupSchedule, String backupScheduleId) *

  • createBackupSchedule(String parent, BackupSchedule backupSchedule, String backupScheduleId) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • createBackupScheduleCallable() *

*

GetBackupSchedule

Gets backup schedule for the input schedule name.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • getBackupSchedule(GetBackupScheduleRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getBackupSchedule(BackupScheduleName name) *

  • getBackupSchedule(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getBackupScheduleCallable() *

*

UpdateBackupSchedule

Updates a backup schedule.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • updateBackupSchedule(UpdateBackupScheduleRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • updateBackupSchedule(BackupSchedule backupSchedule, FieldMask updateMask) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • updateBackupScheduleCallable() *

*

DeleteBackupSchedule

Deletes a backup schedule.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • deleteBackupSchedule(DeleteBackupScheduleRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • deleteBackupSchedule(BackupScheduleName name) *

  • deleteBackupSchedule(String name) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • deleteBackupScheduleCallable() *

*

ListBackupSchedules

Lists all the backup schedules for the database.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • listBackupSchedules(ListBackupSchedulesRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listBackupSchedules(DatabaseName parent) *

  • listBackupSchedules(String parent) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listBackupSchedulesPagedCallable() *

  • listBackupSchedulesCallable() *

*
* *

See the individual methods for example code. * *

Many parameters require resource names to be formatted in a particular way. To assist with * these names, this class includes a format method for each type of name, and additionally a parse * method to extract the individual identifiers contained within names that are returned. * *

This class can be customized by passing in a custom instance of DatabaseAdminSettings to * create(). For example: * *

To customize credentials: * *

{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * DatabaseAdminSettings databaseAdminSettings =
 *     DatabaseAdminSettings.newBuilder()
 *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
 *         .build();
 * DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create(databaseAdminSettings);
 * }
* *

To customize the endpoint: * *

{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * DatabaseAdminSettings databaseAdminSettings =
 *     DatabaseAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
 * DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create(databaseAdminSettings);
 * }
* *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over * the wire: * *

{@code
 * // This snippet has been automatically generated and should be regarded as a code template only.
 * // It will require modifications to work:
 * // - It may require correct/in-range values for request initialization.
 * // - It may require specifying regional endpoints when creating the service client as shown in
 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 * DatabaseAdminSettings databaseAdminSettings =
 *     DatabaseAdminSettings.newHttpJsonBuilder().build();
 * DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create(databaseAdminSettings);
 * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class DatabaseAdminClient implements BackgroundResource { private final DatabaseAdminSettings settings; private final DatabaseAdminStub stub; private final OperationsClient httpJsonOperationsClient; private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of DatabaseAdminClient with default settings. */ public static final DatabaseAdminClient create() throws IOException { return create(DatabaseAdminSettings.newBuilder().build()); } /** * Constructs an instance of DatabaseAdminClient, using the given settings. The channels are * created based on the settings passed in, or defaults for any settings that are not set. */ public static final DatabaseAdminClient create(DatabaseAdminSettings settings) throws IOException { return new DatabaseAdminClient(settings); } /** * Constructs an instance of DatabaseAdminClient, using the given stub for making calls. This is * for advanced usage - prefer using create(DatabaseAdminSettings). */ public static final DatabaseAdminClient create(DatabaseAdminStub stub) { return new DatabaseAdminClient(stub); } /** * Constructs an instance of DatabaseAdminClient, using the given settings. This is protected so * that it is easy to make a subclass, but otherwise, the static factory methods should be * preferred. */ protected DatabaseAdminClient(DatabaseAdminSettings settings) throws IOException { this.settings = settings; this.stub = ((DatabaseAdminStubSettings) settings.getStubSettings()).createStub(); this.operationsClient = com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected DatabaseAdminClient(DatabaseAdminStub stub) { this.settings = null; this.stub = stub; this.operationsClient = com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final DatabaseAdminSettings getSettings() { return settings; } public DatabaseAdminStub getStub() { return stub; } /** * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } /** * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ @BetaApi public final OperationsClient getHttpJsonOperationsClient() { return httpJsonOperationsClient; } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Cloud Spanner databases. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   *   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(String parent) { ListDatabasesRequest request = ListDatabasesRequest.newBuilder().setParent(parent).build(); return listDatabases(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Cloud Spanner databases. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListDatabasesRequest request =
   *       ListDatabasesRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListDatabasesRequest request =
   *       ListDatabasesRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListDatabasesRequest request =
   *       ListDatabasesRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .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 * [long-running operation][google.longrunning.Operation] will have a name of the format * `<database_name>/operations/<operation_id>` and can be used to track preparation of * the database. The [metadata][google.longrunning.Operation.metadata] field type is * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The * [response][google.longrunning.Operation.response] field type is * [Database][google.spanner.admin.database.v1.Database], if successful. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   *   String createStatement = "createStatement744686547";
   *   Database response = databaseAdminClient.createDatabaseAsync(parent, createStatement).get();
   * }
   * }
* * @param parent Required. The name of the instance that will serve the new database. Values are * of the form `projects/<project>/instances/<instance>`. * @param createStatement Required. A `CREATE DATABASE` statement, which specifies the ID of the * new database. The database ID must conform to the regular expression * `[a-z][a-z0-9_\\-]*[a-z0-9]` and be between 2 and 30 characters in length. If the * database ID is a reserved word or if it contains a hyphen, the database ID must be enclosed * in backticks (`` ` ``). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture createDatabaseAsync( InstanceName parent, String createStatement) { CreateDatabaseRequest request = CreateDatabaseRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setCreateStatement(createStatement) .build(); return createDatabaseAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new Cloud Spanner database and starts to prepare it for serving. 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 preparation of * the database. The [metadata][google.longrunning.Operation.metadata] field type is * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The * [response][google.longrunning.Operation.response] field type is * [Database][google.spanner.admin.database.v1.Database], if successful. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   *   String createStatement = "createStatement744686547";
   *   Database response = databaseAdminClient.createDatabaseAsync(parent, createStatement).get();
   * }
   * }
* * @param parent Required. The name of the instance that will serve the new database. Values are * of the form `projects/<project>/instances/<instance>`. * @param createStatement Required. A `CREATE DATABASE` statement, which specifies the ID of the * new database. The database ID must conform to the regular expression * `[a-z][a-z0-9_\\-]*[a-z0-9]` and be between 2 and 30 characters in length. If the * database ID is a reserved word or if it contains a hyphen, the database ID must be enclosed * in backticks (`` ` ``). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture createDatabaseAsync( String parent, String createStatement) { CreateDatabaseRequest request = CreateDatabaseRequest.newBuilder() .setParent(parent) .setCreateStatement(createStatement) .build(); return createDatabaseAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new Cloud Spanner database and starts to prepare it for serving. 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 preparation of * the database. The [metadata][google.longrunning.Operation.metadata] field type is * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The * [response][google.longrunning.Operation.response] field type is * [Database][google.spanner.admin.database.v1.Database], if successful. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   CreateDatabaseRequest request =
   *       CreateDatabaseRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setCreateStatement("createStatement744686547")
   *           .addAllExtraStatements(new ArrayList())
   *           .setEncryptionConfig(EncryptionConfig.newBuilder().build())
   *           .setDatabaseDialect(DatabaseDialect.forNumber(0))
   *           .setProtoDescriptors(ByteString.EMPTY)
   *           .build();
   *   Database response = databaseAdminClient.createDatabaseAsync(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 */ public final OperationFuture createDatabaseAsync( CreateDatabaseRequest request) { return createDatabaseOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new Cloud Spanner database and starts to prepare it for serving. 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 preparation of * the database. The [metadata][google.longrunning.Operation.metadata] field type is * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The * [response][google.longrunning.Operation.response] field type is * [Database][google.spanner.admin.database.v1.Database], if successful. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   CreateDatabaseRequest request =
   *       CreateDatabaseRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setCreateStatement("createStatement744686547")
   *           .addAllExtraStatements(new ArrayList())
   *           .setEncryptionConfig(EncryptionConfig.newBuilder().build())
   *           .setDatabaseDialect(DatabaseDialect.forNumber(0))
   *           .setProtoDescriptors(ByteString.EMPTY)
   *           .build();
   *   OperationFuture future =
   *       databaseAdminClient.createDatabaseOperationCallable().futureCall(request);
   *   // Do something.
   *   Database response = future.get();
   * }
   * }
*/ public final OperationCallable createDatabaseOperationCallable() { return stub.createDatabaseOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new Cloud Spanner database and starts to prepare it for serving. 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 preparation of * the database. The [metadata][google.longrunning.Operation.metadata] field type is * [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata]. The * [response][google.longrunning.Operation.response] field type is * [Database][google.spanner.admin.database.v1.Database], if successful. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   CreateDatabaseRequest request =
   *       CreateDatabaseRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setCreateStatement("createStatement744686547")
   *           .addAllExtraStatements(new ArrayList())
   *           .setEncryptionConfig(EncryptionConfig.newBuilder().build())
   *           .setDatabaseDialect(DatabaseDialect.forNumber(0))
   *           .setProtoDescriptors(ByteString.EMPTY)
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.createDatabaseCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }
*/ public final UnaryCallable createDatabaseCallable() { return stub.createDatabaseCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the state of a Cloud Spanner database. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String name = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
   *   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(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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   GetDatabaseRequest request =
   *       GetDatabaseRequest.newBuilder()
   *           .setName(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   GetDatabaseRequest request =
   *       GetDatabaseRequest.newBuilder()
   *           .setName(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .build();
   *   ApiFuture future = databaseAdminClient.getDatabaseCallable().futureCall(request);
   *   // Do something.
   *   Database response = future.get();
   * }
   * }
*/ public final UnaryCallable getDatabaseCallable() { return stub.getDatabaseCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a Cloud Spanner database. The returned [long-running * operation][google.longrunning.Operation] can be used to track the progress of updating the * database. If the named database does not exist, returns `NOT_FOUND`. * *

While the operation is pending: * *

* The database's [reconciling][google.spanner.admin.database.v1.Database.reconciling] * field is set to true. * Cancelling the operation is best-effort. If the cancellation * succeeds, the operation metadata's * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] is set, the * updates are reverted, and the operation terminates with a `CANCELLED` status. * New * UpdateDatabase requests will return a `FAILED_PRECONDITION` error until the pending operation * is done (returns successfully or with error). * Reading the database via the API continues * to give the pre-request values. * *

Upon completion of the returned operation: * *

* The new values are in effect and readable via the API. * The database's * [reconciling][google.spanner.admin.database.v1.Database.reconciling] field becomes false. * *

The returned [long-running operation][google.longrunning.Operation] will have a name of the * format * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>` * and can be used to track the database modification. The * [metadata][google.longrunning.Operation.metadata] field type is * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. The * [response][google.longrunning.Operation.response] field type is * [Database][google.spanner.admin.database.v1.Database], if successful. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   Database database = Database.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   Database response = databaseAdminClient.updateDatabaseAsync(database, updateMask).get();
   * }
   * }
* * @param database Required. The database to update. The `name` field of the database is of the * form `projects/<project>/instances/<instance>/databases/<database>`. * @param updateMask Required. The list of fields to update. Currently, only * `enable_drop_protection` field can be updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture updateDatabaseAsync( Database database, FieldMask updateMask) { UpdateDatabaseRequest request = UpdateDatabaseRequest.newBuilder().setDatabase(database).setUpdateMask(updateMask).build(); return updateDatabaseAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a Cloud Spanner database. The returned [long-running * operation][google.longrunning.Operation] can be used to track the progress of updating the * database. If the named database does not exist, returns `NOT_FOUND`. * *

While the operation is pending: * *

* The database's [reconciling][google.spanner.admin.database.v1.Database.reconciling] * field is set to true. * Cancelling the operation is best-effort. If the cancellation * succeeds, the operation metadata's * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] is set, the * updates are reverted, and the operation terminates with a `CANCELLED` status. * New * UpdateDatabase requests will return a `FAILED_PRECONDITION` error until the pending operation * is done (returns successfully or with error). * Reading the database via the API continues * to give the pre-request values. * *

Upon completion of the returned operation: * *

* The new values are in effect and readable via the API. * The database's * [reconciling][google.spanner.admin.database.v1.Database.reconciling] field becomes false. * *

The returned [long-running operation][google.longrunning.Operation] will have a name of the * format * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>` * and can be used to track the database modification. The * [metadata][google.longrunning.Operation.metadata] field type is * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. The * [response][google.longrunning.Operation.response] field type is * [Database][google.spanner.admin.database.v1.Database], if successful. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   UpdateDatabaseRequest request =
   *       UpdateDatabaseRequest.newBuilder()
   *           .setDatabase(Database.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   Database response = databaseAdminClient.updateDatabaseAsync(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 */ public final OperationFuture updateDatabaseAsync( UpdateDatabaseRequest request) { return updateDatabaseOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a Cloud Spanner database. The returned [long-running * operation][google.longrunning.Operation] can be used to track the progress of updating the * database. If the named database does not exist, returns `NOT_FOUND`. * *

While the operation is pending: * *

* The database's [reconciling][google.spanner.admin.database.v1.Database.reconciling] * field is set to true. * Cancelling the operation is best-effort. If the cancellation * succeeds, the operation metadata's * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] is set, the * updates are reverted, and the operation terminates with a `CANCELLED` status. * New * UpdateDatabase requests will return a `FAILED_PRECONDITION` error until the pending operation * is done (returns successfully or with error). * Reading the database via the API continues * to give the pre-request values. * *

Upon completion of the returned operation: * *

* The new values are in effect and readable via the API. * The database's * [reconciling][google.spanner.admin.database.v1.Database.reconciling] field becomes false. * *

The returned [long-running operation][google.longrunning.Operation] will have a name of the * format * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>` * and can be used to track the database modification. The * [metadata][google.longrunning.Operation.metadata] field type is * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. The * [response][google.longrunning.Operation.response] field type is * [Database][google.spanner.admin.database.v1.Database], if successful. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   UpdateDatabaseRequest request =
   *       UpdateDatabaseRequest.newBuilder()
   *           .setDatabase(Database.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   OperationFuture future =
   *       databaseAdminClient.updateDatabaseOperationCallable().futureCall(request);
   *   // Do something.
   *   Database response = future.get();
   * }
   * }
*/ public final OperationCallable updateDatabaseOperationCallable() { return stub.updateDatabaseOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a Cloud Spanner database. The returned [long-running * operation][google.longrunning.Operation] can be used to track the progress of updating the * database. If the named database does not exist, returns `NOT_FOUND`. * *

While the operation is pending: * *

* The database's [reconciling][google.spanner.admin.database.v1.Database.reconciling] * field is set to true. * Cancelling the operation is best-effort. If the cancellation * succeeds, the operation metadata's * [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time] is set, the * updates are reverted, and the operation terminates with a `CANCELLED` status. * New * UpdateDatabase requests will return a `FAILED_PRECONDITION` error until the pending operation * is done (returns successfully or with error). * Reading the database via the API continues * to give the pre-request values. * *

Upon completion of the returned operation: * *

* The new values are in effect and readable via the API. * The database's * [reconciling][google.spanner.admin.database.v1.Database.reconciling] field becomes false. * *

The returned [long-running operation][google.longrunning.Operation] will have a name of the * format * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>` * and can be used to track the database modification. The * [metadata][google.longrunning.Operation.metadata] field type is * [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata]. The * [response][google.longrunning.Operation.response] field type is * [Database][google.spanner.admin.database.v1.Database], if successful. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   UpdateDatabaseRequest request =
   *       UpdateDatabaseRequest.newBuilder()
   *           .setDatabase(Database.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.updateDatabaseCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }
*/ public final UnaryCallable updateDatabaseCallable() { return stub.updateDatabaseCallable(); } // 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DatabaseName database = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
   *   List statements = new ArrayList<>();
   *   databaseAdminClient.updateDatabaseDdlAsync(database, statements).get();
   * }
   * }
* * @param database Required. The database to update. * @param statements Required. DDL statements to be applied to the database. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture updateDatabaseDdlAsync( DatabaseName database, List statements) { UpdateDatabaseDdlRequest request = UpdateDatabaseDdlRequest.newBuilder() .setDatabase(database == null ? null : database.toString()) .addAllStatements(statements) .build(); return updateDatabaseDdlAsync(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. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String database = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
   *   List statements = new ArrayList<>();
   *   databaseAdminClient.updateDatabaseDdlAsync(database, statements).get();
   * }
   * }
* * @param database Required. The database to update. * @param statements Required. DDL statements to be applied to the database. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture updateDatabaseDdlAsync( String database, List statements) { UpdateDatabaseDdlRequest request = UpdateDatabaseDdlRequest.newBuilder() .setDatabase(database) .addAllStatements(statements) .build(); return updateDatabaseDdlAsync(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. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   UpdateDatabaseDdlRequest request =
   *       UpdateDatabaseDdlRequest.newBuilder()
   *           .setDatabase(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .addAllStatements(new ArrayList())
   *           .setOperationId("operationId129704162")
   *           .setProtoDescriptors(ByteString.EMPTY)
   *           .build();
   *   databaseAdminClient.updateDatabaseDdlAsync(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 */ public final OperationFuture updateDatabaseDdlAsync( UpdateDatabaseDdlRequest request) { return updateDatabaseDdlOperationCallable().futureCall(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. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   UpdateDatabaseDdlRequest request =
   *       UpdateDatabaseDdlRequest.newBuilder()
   *           .setDatabase(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .addAllStatements(new ArrayList())
   *           .setOperationId("operationId129704162")
   *           .setProtoDescriptors(ByteString.EMPTY)
   *           .build();
   *   OperationFuture future =
   *       databaseAdminClient.updateDatabaseDdlOperationCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   UpdateDatabaseDdlRequest request =
   *       UpdateDatabaseDdlRequest.newBuilder()
   *           .setDatabase(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .addAllStatements(new ArrayList())
   *           .setOperationId("operationId129704162")
   *           .setProtoDescriptors(ByteString.EMPTY)
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.updateDatabaseDdlCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable updateDatabaseDdlCallable() { return stub.updateDatabaseDdlCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be * retained according to their `expire_time`. Note: Cloud Spanner might continue to accept * requests for a few seconds after the database has been deleted. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DatabaseName database = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
   *   databaseAdminClient.dropDatabase(database);
   * }
   * }
* * @param database Required. The database to be dropped. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void dropDatabase(DatabaseName database) { DropDatabaseRequest request = DropDatabaseRequest.newBuilder() .setDatabase(database == null ? null : database.toString()) .build(); dropDatabase(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be * retained according to their `expire_time`. Note: Cloud Spanner might continue to accept * requests for a few seconds after the database has been deleted. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String database = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
   *   databaseAdminClient.dropDatabase(database);
   * }
   * }
* * @param database Required. The database to be dropped. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void dropDatabase(String database) { DropDatabaseRequest request = DropDatabaseRequest.newBuilder().setDatabase(database).build(); dropDatabase(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be * retained according to their `expire_time`. Note: Cloud Spanner might continue to accept * requests for a few seconds after the database has been deleted. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DropDatabaseRequest request =
   *       DropDatabaseRequest.newBuilder()
   *           .setDatabase(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .build();
   *   databaseAdminClient.dropDatabase(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 void dropDatabase(DropDatabaseRequest request) { dropDatabaseCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be * retained according to their `expire_time`. Note: Cloud Spanner might continue to accept * requests for a few seconds after the database has been deleted. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DropDatabaseRequest request =
   *       DropDatabaseRequest.newBuilder()
   *           .setDatabase(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .build();
   *   ApiFuture future = databaseAdminClient.dropDatabaseCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable dropDatabaseCallable() { return stub.dropDatabaseCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the schema of a Cloud Spanner database as a list of formatted DDL statements. This * method does not show pending schema updates, those may be queried using the * [Operations][google.longrunning.Operations] API. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DatabaseName database = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
   *   GetDatabaseDdlResponse response = databaseAdminClient.getDatabaseDdl(database);
   * }
   * }
* * @param database Required. The database whose schema we wish to get. 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 GetDatabaseDdlResponse getDatabaseDdl(DatabaseName database) { GetDatabaseDdlRequest request = GetDatabaseDdlRequest.newBuilder() .setDatabase(database == null ? null : database.toString()) .build(); return getDatabaseDdl(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the schema of a Cloud Spanner database as a list of formatted DDL statements. This * method does not show pending schema updates, those may be queried using the * [Operations][google.longrunning.Operations] API. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String database = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
   *   GetDatabaseDdlResponse response = databaseAdminClient.getDatabaseDdl(database);
   * }
   * }
* * @param database Required. The database whose schema we wish to get. 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 GetDatabaseDdlResponse getDatabaseDdl(String database) { GetDatabaseDdlRequest request = GetDatabaseDdlRequest.newBuilder().setDatabase(database).build(); return getDatabaseDdl(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the schema of a Cloud Spanner database as a list of formatted DDL statements. This * method does not show pending schema updates, those may be queried using the * [Operations][google.longrunning.Operations] API. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   GetDatabaseDdlRequest request =
   *       GetDatabaseDdlRequest.newBuilder()
   *           .setDatabase(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .build();
   *   GetDatabaseDdlResponse response = databaseAdminClient.getDatabaseDdl(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 GetDatabaseDdlResponse getDatabaseDdl(GetDatabaseDdlRequest request) { return getDatabaseDdlCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns the schema of a Cloud Spanner database as a list of formatted DDL statements. This * method does not show pending schema updates, those may be queried using the * [Operations][google.longrunning.Operations] API. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   GetDatabaseDdlRequest request =
   *       GetDatabaseDdlRequest.newBuilder()
   *           .setDatabase(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.getDatabaseDdlCallable().futureCall(request);
   *   // Do something.
   *   GetDatabaseDdlResponse response = future.get();
   * }
   * }
*/ public final UnaryCallable getDatabaseDdlCallable() { return stub.getDatabaseDdlCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on a database or backup resource. Replaces any existing policy. * *

Authorization requires `spanner.databases.setIamPolicy` permission on * [resource][google.iam.v1.SetIamPolicyRequest.resource]. For backups, authorization requires * `spanner.backups.setIamPolicy` permission on * [resource][google.iam.v1.SetIamPolicyRequest.resource]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ResourceName resource = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
   *   Policy policy = Policy.newBuilder().build();
   *   Policy response = databaseAdminClient.setIamPolicy(resource, policy);
   * }
   * }
* * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud * Platform services (such as Projects) might reject them. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy setIamPolicy(ResourceName resource, Policy policy) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource(resource == null ? null : resource.toString()) .setPolicy(policy) .build(); return setIamPolicy(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on a database or backup resource. Replaces any existing policy. * *

Authorization requires `spanner.databases.setIamPolicy` permission on * [resource][google.iam.v1.SetIamPolicyRequest.resource]. For backups, authorization requires * `spanner.backups.setIamPolicy` permission on * [resource][google.iam.v1.SetIamPolicyRequest.resource]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String resource = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString();
   *   Policy policy = Policy.newBuilder().build();
   *   Policy response = databaseAdminClient.setIamPolicy(resource, policy);
   * }
   * }
* * @param resource REQUIRED: The resource for which the policy is being specified. See the * operation documentation for the appropriate value for this field. * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud * Platform services (such as Projects) might reject them. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy setIamPolicy(String resource, Policy policy) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); return setIamPolicy(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on a database or backup resource. Replaces any existing policy. * *

Authorization requires `spanner.databases.setIamPolicy` permission on * [resource][google.iam.v1.SetIamPolicyRequest.resource]. For backups, authorization requires * `spanner.backups.setIamPolicy` permission on * [resource][google.iam.v1.SetIamPolicyRequest.resource]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   SetIamPolicyRequest request =
   *       SetIamPolicyRequest.newBuilder()
   *           .setResource(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .setPolicy(Policy.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   Policy response = databaseAdminClient.setIamPolicy(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 Policy setIamPolicy(SetIamPolicyRequest request) { return setIamPolicyCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on a database or backup resource. Replaces any existing policy. * *

Authorization requires `spanner.databases.setIamPolicy` permission on * [resource][google.iam.v1.SetIamPolicyRequest.resource]. For backups, authorization requires * `spanner.backups.setIamPolicy` permission on * [resource][google.iam.v1.SetIamPolicyRequest.resource]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   SetIamPolicyRequest request =
   *       SetIamPolicyRequest.newBuilder()
   *           .setResource(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .setPolicy(Policy.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture future = databaseAdminClient.setIamPolicyCallable().futureCall(request);
   *   // Do something.
   *   Policy response = future.get();
   * }
   * }
*/ public final UnaryCallable setIamPolicyCallable() { return stub.setIamPolicyCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a database or backup resource. Returns an empty policy if a * database or backup exists but does not have a policy set. * *

Authorization requires `spanner.databases.getIamPolicy` permission on * [resource][google.iam.v1.GetIamPolicyRequest.resource]. For backups, authorization requires * `spanner.backups.getIamPolicy` permission on * [resource][google.iam.v1.GetIamPolicyRequest.resource]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ResourceName resource = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
   *   Policy response = databaseAdminClient.getIamPolicy(resource);
   * }
   * }
* * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy getIamPolicy(ResourceName resource) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource(resource == null ? null : resource.toString()) .build(); return getIamPolicy(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a database or backup resource. Returns an empty policy if a * database or backup exists but does not have a policy set. * *

Authorization requires `spanner.databases.getIamPolicy` permission on * [resource][google.iam.v1.GetIamPolicyRequest.resource]. For backups, authorization requires * `spanner.backups.getIamPolicy` permission on * [resource][google.iam.v1.GetIamPolicyRequest.resource]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String resource = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString();
   *   Policy response = databaseAdminClient.getIamPolicy(resource);
   * }
   * }
* * @param resource REQUIRED: The resource for which the policy is being requested. See the * operation documentation for the appropriate value for this field. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Policy getIamPolicy(String resource) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); return getIamPolicy(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a database or backup resource. Returns an empty policy if a * database or backup exists but does not have a policy set. * *

Authorization requires `spanner.databases.getIamPolicy` permission on * [resource][google.iam.v1.GetIamPolicyRequest.resource]. For backups, authorization requires * `spanner.backups.getIamPolicy` permission on * [resource][google.iam.v1.GetIamPolicyRequest.resource]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   GetIamPolicyRequest request =
   *       GetIamPolicyRequest.newBuilder()
   *           .setResource(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .setOptions(GetPolicyOptions.newBuilder().build())
   *           .build();
   *   Policy response = databaseAdminClient.getIamPolicy(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 Policy getIamPolicy(GetIamPolicyRequest request) { return getIamPolicyCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a database or backup resource. Returns an empty policy if a * database or backup exists but does not have a policy set. * *

Authorization requires `spanner.databases.getIamPolicy` permission on * [resource][google.iam.v1.GetIamPolicyRequest.resource]. For backups, authorization requires * `spanner.backups.getIamPolicy` permission on * [resource][google.iam.v1.GetIamPolicyRequest.resource]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   GetIamPolicyRequest request =
   *       GetIamPolicyRequest.newBuilder()
   *           .setResource(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .setOptions(GetPolicyOptions.newBuilder().build())
   *           .build();
   *   ApiFuture future = databaseAdminClient.getIamPolicyCallable().futureCall(request);
   *   // Do something.
   *   Policy response = future.get();
   * }
   * }
*/ public final UnaryCallable getIamPolicyCallable() { return stub.getIamPolicyCallable(); } // 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ResourceName resource = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
   *   List permissions = new ArrayList<>();
   *   TestIamPermissionsResponse response =
   *       databaseAdminClient.testIamPermissions(resource, permissions);
   * }
   * }
* * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. * @param permissions The set of permissions to check for the `resource`. Permissions with * wildcards (such as '*' or 'storage.*') are not allowed. For more information see * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final TestIamPermissionsResponse testIamPermissions( ResourceName resource, List permissions) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource(resource == null ? null : resource.toString()) .addAllPermissions(permissions) .build(); return testIamPermissions(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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String resource = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString();
   *   List permissions = new ArrayList<>();
   *   TestIamPermissionsResponse response =
   *       databaseAdminClient.testIamPermissions(resource, permissions);
   * }
   * }
* * @param resource REQUIRED: The resource for which the policy detail is being requested. See the * operation documentation for the appropriate value for this field. * @param permissions The set of permissions to check for the `resource`. Permissions with * wildcards (such as '*' or 'storage.*') are not allowed. For more information see * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final TestIamPermissionsResponse testIamPermissions( String resource, List permissions) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource(resource) .addAllPermissions(permissions) .build(); return testIamPermissions(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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   TestIamPermissionsRequest request =
   *       TestIamPermissionsRequest.newBuilder()
   *           .setResource(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .addAllPermissions(new ArrayList())
   *           .build();
   *   TestIamPermissionsResponse response = databaseAdminClient.testIamPermissions(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 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   TestIamPermissionsRequest request =
   *       TestIamPermissionsRequest.newBuilder()
   *           .setResource(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .addAllPermissions(new ArrayList())
   *           .build();
   *   ApiFuture 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   *   Backup backup = Backup.newBuilder().build();
   *   String backupId = "backupId2121930365";
   *   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 */ 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   *   Backup backup = Backup.newBuilder().build();
   *   String backupId = "backupId2121930365";
   *   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 */ 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   CreateBackupRequest request =
   *       CreateBackupRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setBackupId("backupId2121930365")
   *           .setBackup(Backup.newBuilder().build())
   *           .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
   *           .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 */ 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   CreateBackupRequest request =
   *       CreateBackupRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setBackupId("backupId2121930365")
   *           .setBackup(Backup.newBuilder().build())
   *           .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
   *           .build();
   *   OperationFuture future =
   *       databaseAdminClient.createBackupOperationCallable().futureCall(request);
   *   // Do something.
   *   Backup response = future.get();
   * }
   * }
*/ 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   CreateBackupRequest request =
   *       CreateBackupRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setBackupId("backupId2121930365")
   *           .setBackup(Backup.newBuilder().build())
   *           .setEncryptionConfig(CreateBackupEncryptionConfig.newBuilder().build())
   *           .build();
   *   ApiFuture future = databaseAdminClient.createBackupCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }
*/ public final UnaryCallable createBackupCallable() { return stub.createBackupCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts copying a 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 copying of the backup. The operation is associated with the * destination backup. The [metadata][google.longrunning.Operation.metadata] field type is * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. 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 copying and delete the destination backup. Concurrent CopyBackup * requests can run on the same source backup. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   *   String backupId = "backupId2121930365";
   *   BackupName sourceBackup = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
   *   Timestamp expireTime = Timestamp.newBuilder().build();
   *   Backup response =
   *       databaseAdminClient.copyBackupAsync(parent, backupId, sourceBackup, expireTime).get();
   * }
   * }
* * @param parent Required. The name of the destination instance that will contain the backup copy. * Values are of the form: `projects/<project>/instances/<instance>`. * @param backupId Required. The id of the backup copy. The `backup_id` appended to `parent` forms * the full backup_uri of the form * `projects/<project>/instances/<instance>/backups/<backup>`. * @param sourceBackup Required. The source backup to be copied. The source backup needs to be in * READY state for it to be copied. Once CopyBackup is in progress, the source backup cannot * be deleted or cleaned up on expiration until CopyBackup is finished. Values are of the * form: `projects/<project>/instances/<instance>/backups/<backup>`. * @param expireTime Required. The expiration time of the backup in microsecond granularity. The * expiration time must be at least 6 hours and at most 366 days from the `create_time` of the * source backup. Once the `expire_time` has passed, the backup is eligible to be * automatically deleted by Cloud Spanner to free the resources used by the backup. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture copyBackupAsync( InstanceName parent, String backupId, BackupName sourceBackup, Timestamp expireTime) { CopyBackupRequest request = CopyBackupRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setBackupId(backupId) .setSourceBackup(sourceBackup == null ? null : sourceBackup.toString()) .setExpireTime(expireTime) .build(); return copyBackupAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts copying a 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 copying of the backup. The operation is associated with the * destination backup. The [metadata][google.longrunning.Operation.metadata] field type is * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. 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 copying and delete the destination backup. Concurrent CopyBackup * requests can run on the same source backup. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   *   String backupId = "backupId2121930365";
   *   String sourceBackup = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString();
   *   Timestamp expireTime = Timestamp.newBuilder().build();
   *   Backup response =
   *       databaseAdminClient.copyBackupAsync(parent, backupId, sourceBackup, expireTime).get();
   * }
   * }
* * @param parent Required. The name of the destination instance that will contain the backup copy. * Values are of the form: `projects/<project>/instances/<instance>`. * @param backupId Required. The id of the backup copy. The `backup_id` appended to `parent` forms * the full backup_uri of the form * `projects/<project>/instances/<instance>/backups/<backup>`. * @param sourceBackup Required. The source backup to be copied. The source backup needs to be in * READY state for it to be copied. Once CopyBackup is in progress, the source backup cannot * be deleted or cleaned up on expiration until CopyBackup is finished. Values are of the * form: `projects/<project>/instances/<instance>/backups/<backup>`. * @param expireTime Required. The expiration time of the backup in microsecond granularity. The * expiration time must be at least 6 hours and at most 366 days from the `create_time` of the * source backup. Once the `expire_time` has passed, the backup is eligible to be * automatically deleted by Cloud Spanner to free the resources used by the backup. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture copyBackupAsync( InstanceName parent, String backupId, String sourceBackup, Timestamp expireTime) { CopyBackupRequest request = CopyBackupRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setBackupId(backupId) .setSourceBackup(sourceBackup) .setExpireTime(expireTime) .build(); return copyBackupAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts copying a 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 copying of the backup. The operation is associated with the * destination backup. The [metadata][google.longrunning.Operation.metadata] field type is * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. 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 copying and delete the destination backup. Concurrent CopyBackup * requests can run on the same source backup. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   *   String backupId = "backupId2121930365";
   *   BackupName sourceBackup = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
   *   Timestamp expireTime = Timestamp.newBuilder().build();
   *   Backup response =
   *       databaseAdminClient.copyBackupAsync(parent, backupId, sourceBackup, expireTime).get();
   * }
   * }
* * @param parent Required. The name of the destination instance that will contain the backup copy. * Values are of the form: `projects/<project>/instances/<instance>`. * @param backupId Required. The id of the backup copy. The `backup_id` appended to `parent` forms * the full backup_uri of the form * `projects/<project>/instances/<instance>/backups/<backup>`. * @param sourceBackup Required. The source backup to be copied. The source backup needs to be in * READY state for it to be copied. Once CopyBackup is in progress, the source backup cannot * be deleted or cleaned up on expiration until CopyBackup is finished. Values are of the * form: `projects/<project>/instances/<instance>/backups/<backup>`. * @param expireTime Required. The expiration time of the backup in microsecond granularity. The * expiration time must be at least 6 hours and at most 366 days from the `create_time` of the * source backup. Once the `expire_time` has passed, the backup is eligible to be * automatically deleted by Cloud Spanner to free the resources used by the backup. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture copyBackupAsync( String parent, String backupId, BackupName sourceBackup, Timestamp expireTime) { CopyBackupRequest request = CopyBackupRequest.newBuilder() .setParent(parent) .setBackupId(backupId) .setSourceBackup(sourceBackup == null ? null : sourceBackup.toString()) .setExpireTime(expireTime) .build(); return copyBackupAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts copying a 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 copying of the backup. The operation is associated with the * destination backup. The [metadata][google.longrunning.Operation.metadata] field type is * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. 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 copying and delete the destination backup. Concurrent CopyBackup * requests can run on the same source backup. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   *   String backupId = "backupId2121930365";
   *   String sourceBackup = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString();
   *   Timestamp expireTime = Timestamp.newBuilder().build();
   *   Backup response =
   *       databaseAdminClient.copyBackupAsync(parent, backupId, sourceBackup, expireTime).get();
   * }
   * }
* * @param parent Required. The name of the destination instance that will contain the backup copy. * Values are of the form: `projects/<project>/instances/<instance>`. * @param backupId Required. The id of the backup copy. The `backup_id` appended to `parent` forms * the full backup_uri of the form * `projects/<project>/instances/<instance>/backups/<backup>`. * @param sourceBackup Required. The source backup to be copied. The source backup needs to be in * READY state for it to be copied. Once CopyBackup is in progress, the source backup cannot * be deleted or cleaned up on expiration until CopyBackup is finished. Values are of the * form: `projects/<project>/instances/<instance>/backups/<backup>`. * @param expireTime Required. The expiration time of the backup in microsecond granularity. The * expiration time must be at least 6 hours and at most 366 days from the `create_time` of the * source backup. Once the `expire_time` has passed, the backup is eligible to be * automatically deleted by Cloud Spanner to free the resources used by the backup. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture copyBackupAsync( String parent, String backupId, String sourceBackup, Timestamp expireTime) { CopyBackupRequest request = CopyBackupRequest.newBuilder() .setParent(parent) .setBackupId(backupId) .setSourceBackup(sourceBackup) .setExpireTime(expireTime) .build(); return copyBackupAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts copying a 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 copying of the backup. The operation is associated with the * destination backup. The [metadata][google.longrunning.Operation.metadata] field type is * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. 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 copying and delete the destination backup. Concurrent CopyBackup * requests can run on the same source backup. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   CopyBackupRequest request =
   *       CopyBackupRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setBackupId("backupId2121930365")
   *           .setSourceBackup(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .setExpireTime(Timestamp.newBuilder().build())
   *           .setEncryptionConfig(CopyBackupEncryptionConfig.newBuilder().build())
   *           .build();
   *   Backup response = databaseAdminClient.copyBackupAsync(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 */ public final OperationFuture copyBackupAsync( CopyBackupRequest request) { return copyBackupOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts copying a 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 copying of the backup. The operation is associated with the * destination backup. The [metadata][google.longrunning.Operation.metadata] field type is * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. 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 copying and delete the destination backup. Concurrent CopyBackup * requests can run on the same source backup. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   CopyBackupRequest request =
   *       CopyBackupRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setBackupId("backupId2121930365")
   *           .setSourceBackup(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .setExpireTime(Timestamp.newBuilder().build())
   *           .setEncryptionConfig(CopyBackupEncryptionConfig.newBuilder().build())
   *           .build();
   *   OperationFuture future =
   *       databaseAdminClient.copyBackupOperationCallable().futureCall(request);
   *   // Do something.
   *   Backup response = future.get();
   * }
   * }
*/ public final OperationCallable copyBackupOperationCallable() { return stub.copyBackupOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Starts copying a 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 copying of the backup. The operation is associated with the * destination backup. The [metadata][google.longrunning.Operation.metadata] field type is * [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata]. 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 copying and delete the destination backup. Concurrent CopyBackup * requests can run on the same source backup. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   CopyBackupRequest request =
   *       CopyBackupRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setBackupId("backupId2121930365")
   *           .setSourceBackup(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .setExpireTime(Timestamp.newBuilder().build())
   *           .setEncryptionConfig(CopyBackupEncryptionConfig.newBuilder().build())
   *           .build();
   *   ApiFuture future = databaseAdminClient.copyBackupCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }
*/ public final UnaryCallable copyBackupCallable() { return stub.copyBackupCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata on a pending or completed [Backup][google.spanner.admin.database.v1.Backup]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
   *   Backup response = databaseAdminClient.getBackup(name);
   * }
   * }
* * @param name Required. Name of the backup. Values are of the form * `projects/<project>/instances/<instance>/backups/<backup>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Backup getBackup(BackupName name) { GetBackupRequest request = GetBackupRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getBackup(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata on a pending or completed [Backup][google.spanner.admin.database.v1.Backup]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String name = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString();
   *   Backup response = databaseAdminClient.getBackup(name);
   * }
   * }
* * @param name Required. Name of the backup. Values are of the form * `projects/<project>/instances/<instance>/backups/<backup>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Backup getBackup(String name) { GetBackupRequest request = GetBackupRequest.newBuilder().setName(name).build(); return getBackup(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata on a pending or completed [Backup][google.spanner.admin.database.v1.Backup]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   GetBackupRequest request =
   *       GetBackupRequest.newBuilder()
   *           .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .build();
   *   Backup response = databaseAdminClient.getBackup(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 Backup getBackup(GetBackupRequest request) { return getBackupCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets metadata on a pending or completed [Backup][google.spanner.admin.database.v1.Backup]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   GetBackupRequest request =
   *       GetBackupRequest.newBuilder()
   *           .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .build();
   *   ApiFuture future = databaseAdminClient.getBackupCallable().futureCall(request);
   *   // Do something.
   *   Backup response = future.get();
   * }
   * }
*/ public final UnaryCallable getBackupCallable() { return stub.getBackupCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a pending or completed [Backup][google.spanner.admin.database.v1.Backup]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   Backup backup = Backup.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   Backup response = databaseAdminClient.updateBackup(backup, updateMask);
   * }
   * }
* * @param backup Required. The backup to update. `backup.name`, and the fields to be updated as * specified by `update_mask` are required. Other fields are ignored. Update is only supported * for the following fields: * `backup.expire_time`. * @param updateMask Required. A mask specifying which fields (e.g. `expire_time`) in the Backup * resource should be updated. This mask is relative to the Backup resource, not to the * request message. The field mask must always be specified; this prevents any future fields * from being erased accidentally by clients that do not know about them. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Backup updateBackup(Backup backup, FieldMask updateMask) { UpdateBackupRequest request = UpdateBackupRequest.newBuilder().setBackup(backup).setUpdateMask(updateMask).build(); return updateBackup(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a pending or completed [Backup][google.spanner.admin.database.v1.Backup]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   UpdateBackupRequest request =
   *       UpdateBackupRequest.newBuilder()
   *           .setBackup(Backup.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   Backup response = databaseAdminClient.updateBackup(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 Backup updateBackup(UpdateBackupRequest request) { return updateBackupCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a pending or completed [Backup][google.spanner.admin.database.v1.Backup]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   UpdateBackupRequest request =
   *       UpdateBackupRequest.newBuilder()
   *           .setBackup(Backup.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture future = databaseAdminClient.updateBackupCallable().futureCall(request);
   *   // Do something.
   *   Backup response = future.get();
   * }
   * }
*/ public final UnaryCallable updateBackupCallable() { return stub.updateBackupCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a pending or completed [Backup][google.spanner.admin.database.v1.Backup]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   BackupName name = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]");
   *   databaseAdminClient.deleteBackup(name);
   * }
   * }
* * @param name Required. Name of the backup to delete. Values are of the form * `projects/<project>/instances/<instance>/backups/<backup>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteBackup(BackupName name) { DeleteBackupRequest request = DeleteBackupRequest.newBuilder().setName(name == null ? null : name.toString()).build(); deleteBackup(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a pending or completed [Backup][google.spanner.admin.database.v1.Backup]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String name = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString();
   *   databaseAdminClient.deleteBackup(name);
   * }
   * }
* * @param name Required. Name of the backup to delete. Values are of the form * `projects/<project>/instances/<instance>/backups/<backup>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteBackup(String name) { DeleteBackupRequest request = DeleteBackupRequest.newBuilder().setName(name).build(); deleteBackup(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a pending or completed [Backup][google.spanner.admin.database.v1.Backup]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DeleteBackupRequest request =
   *       DeleteBackupRequest.newBuilder()
   *           .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .build();
   *   databaseAdminClient.deleteBackup(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 void deleteBackup(DeleteBackupRequest request) { deleteBackupCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a pending or completed [Backup][google.spanner.admin.database.v1.Backup]. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DeleteBackupRequest request =
   *       DeleteBackupRequest.newBuilder()
   *           .setName(BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString())
   *           .build();
   *   ApiFuture future = databaseAdminClient.deleteBackupCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteBackupCallable() { return stub.deleteBackupCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists completed and pending backups. Backups returned are ordered by `create_time` in * descending order, starting from the most recent `create_time`. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   *   for (Backup element : databaseAdminClient.listBackups(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The instance to list backups from. Values are of the form * `projects/<project>/instances/<instance>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListBackupsPagedResponse listBackups(InstanceName parent) { ListBackupsRequest request = ListBackupsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listBackups(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists completed and pending backups. Backups returned are ordered by `create_time` in * descending order, starting from the most recent `create_time`. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   *   for (Backup element : databaseAdminClient.listBackups(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The instance to list backups from. Values are of the form * `projects/<project>/instances/<instance>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListBackupsPagedResponse listBackups(String parent) { ListBackupsRequest request = ListBackupsRequest.newBuilder().setParent(parent).build(); return listBackups(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists completed and pending backups. Backups returned are ordered by `create_time` in * descending order, starting from the most recent `create_time`. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListBackupsRequest request =
   *       ListBackupsRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Backup element : databaseAdminClient.listBackups(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 ListBackupsPagedResponse listBackups(ListBackupsRequest request) { return listBackupsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists completed and pending backups. Backups returned are ordered by `create_time` in * descending order, starting from the most recent `create_time`. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListBackupsRequest request =
   *       ListBackupsRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future = databaseAdminClient.listBackupsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Backup element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listBackupsPagedCallable() { return stub.listBackupsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists completed and pending backups. Backups returned are ordered by `create_time` in * descending order, starting from the most recent `create_time`. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListBackupsRequest request =
   *       ListBackupsRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListBackupsResponse response = databaseAdminClient.listBackupsCallable().call(request);
   *     for (Backup element : response.getBackupsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listBackupsCallable() { 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   *   String databaseId = "databaseId1688905718";
   *   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 */ 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   *   String databaseId = "databaseId1688905718";
   *   String backup = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString();
   *   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 */ public final OperationFuture restoreDatabaseAsync( InstanceName parent, String databaseId, String backup) { RestoreDatabaseRequest request = RestoreDatabaseRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   *   String databaseId = "databaseId1688905718";
   *   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 */ public final OperationFuture restoreDatabaseAsync( String parent, String databaseId, BackupName backup) { RestoreDatabaseRequest request = RestoreDatabaseRequest.newBuilder() .setParent(parent) .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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   *   String databaseId = "databaseId1688905718";
   *   String backup = BackupName.of("[PROJECT]", "[INSTANCE]", "[BACKUP]").toString();
   *   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 */ 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   RestoreDatabaseRequest request =
   *       RestoreDatabaseRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setDatabaseId("databaseId1688905718")
   *           .setEncryptionConfig(RestoreDatabaseEncryptionConfig.newBuilder().build())
   *           .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 */ 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   RestoreDatabaseRequest request =
   *       RestoreDatabaseRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setDatabaseId("databaseId1688905718")
   *           .setEncryptionConfig(RestoreDatabaseEncryptionConfig.newBuilder().build())
   *           .build();
   *   OperationFuture future =
   *       databaseAdminClient.restoreDatabaseOperationCallable().futureCall(request);
   *   // Do something.
   *   Database response = future.get();
   * }
   * }
*/ 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: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   RestoreDatabaseRequest request =
   *       RestoreDatabaseRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setDatabaseId("databaseId1688905718")
   *           .setEncryptionConfig(RestoreDatabaseEncryptionConfig.newBuilder().build())
   *           .build();
   *   ApiFuture 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 * a name of the form * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`. * The long-running operation [metadata][google.longrunning.Operation.metadata] field type * `metadata.type_url` describes the type of the metadata. Operations returned include those that * have completed/failed/canceled within the last 7 days, and pending operations. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   *   for (Operation element : databaseAdminClient.listDatabaseOperations(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The instance of the database operations. Values are of the form * `projects/<project>/instances/<instance>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListDatabaseOperationsPagedResponse listDatabaseOperations(InstanceName parent) { ListDatabaseOperationsRequest request = ListDatabaseOperationsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listDatabaseOperations(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists database [longrunning-operations][google.longrunning.Operation]. A database operation has * a name of the form * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`. * The long-running operation [metadata][google.longrunning.Operation.metadata] field type * `metadata.type_url` describes the type of the metadata. Operations returned include those that * have completed/failed/canceled within the last 7 days, and pending operations. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   *   for (Operation element : databaseAdminClient.listDatabaseOperations(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The instance of the database operations. Values are of the form * `projects/<project>/instances/<instance>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListDatabaseOperationsPagedResponse listDatabaseOperations(String parent) { ListDatabaseOperationsRequest request = ListDatabaseOperationsRequest.newBuilder().setParent(parent).build(); return listDatabaseOperations(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists database [longrunning-operations][google.longrunning.Operation]. A database operation has * a name of the form * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`. * The long-running operation [metadata][google.longrunning.Operation.metadata] field type * `metadata.type_url` describes the type of the metadata. Operations returned include those that * have completed/failed/canceled within the last 7 days, and pending operations. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListDatabaseOperationsRequest request =
   *       ListDatabaseOperationsRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Operation element : databaseAdminClient.listDatabaseOperations(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 ListDatabaseOperationsPagedResponse listDatabaseOperations( ListDatabaseOperationsRequest request) { return listDatabaseOperationsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists database [longrunning-operations][google.longrunning.Operation]. A database operation has * a name of the form * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`. * The long-running operation [metadata][google.longrunning.Operation.metadata] field type * `metadata.type_url` describes the type of the metadata. Operations returned include those that * have completed/failed/canceled within the last 7 days, and pending operations. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListDatabaseOperationsRequest request =
   *       ListDatabaseOperationsRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.listDatabaseOperationsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Operation element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listDatabaseOperationsPagedCallable() { return stub.listDatabaseOperationsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists database [longrunning-operations][google.longrunning.Operation]. A database operation has * a name of the form * `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`. * The long-running operation [metadata][google.longrunning.Operation.metadata] field type * `metadata.type_url` describes the type of the metadata. Operations returned include those that * have completed/failed/canceled within the last 7 days, and pending operations. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListDatabaseOperationsRequest request =
   *       ListDatabaseOperationsRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListDatabaseOperationsResponse response =
   *         databaseAdminClient.listDatabaseOperationsCallable().call(request);
   *     for (Operation element : response.getOperationsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listDatabaseOperationsCallable() { return stub.listDatabaseOperationsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the backup [long-running operations][google.longrunning.Operation] in the given instance. * A backup operation has a name of the form * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`. * The long-running operation [metadata][google.longrunning.Operation.metadata] field type * `metadata.type_url` describes the type of the metadata. Operations returned include those that * have completed/failed/canceled within the last 7 days, and pending operations. Operations * returned are ordered by `operation.metadata.value.progress.start_time` in descending order * starting from the most recently started operation. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
   *   for (Operation element : databaseAdminClient.listBackupOperations(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The instance of the backup operations. Values are of the form * `projects/<project>/instances/<instance>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListBackupOperationsPagedResponse listBackupOperations(InstanceName parent) { ListBackupOperationsRequest request = ListBackupOperationsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listBackupOperations(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the backup [long-running operations][google.longrunning.Operation] in the given instance. * A backup operation has a name of the form * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`. * The long-running operation [metadata][google.longrunning.Operation.metadata] field type * `metadata.type_url` describes the type of the metadata. Operations returned include those that * have completed/failed/canceled within the last 7 days, and pending operations. Operations * returned are ordered by `operation.metadata.value.progress.start_time` in descending order * starting from the most recently started operation. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
   *   for (Operation element : databaseAdminClient.listBackupOperations(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The instance of the backup operations. Values are of the form * `projects/<project>/instances/<instance>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListBackupOperationsPagedResponse listBackupOperations(String parent) { ListBackupOperationsRequest request = ListBackupOperationsRequest.newBuilder().setParent(parent).build(); return listBackupOperations(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the backup [long-running operations][google.longrunning.Operation] in the given instance. * A backup operation has a name of the form * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`. * The long-running operation [metadata][google.longrunning.Operation.metadata] field type * `metadata.type_url` describes the type of the metadata. Operations returned include those that * have completed/failed/canceled within the last 7 days, and pending operations. Operations * returned are ordered by `operation.metadata.value.progress.start_time` in descending order * starting from the most recently started operation. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListBackupOperationsRequest request =
   *       ListBackupOperationsRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Operation element : databaseAdminClient.listBackupOperations(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 ListBackupOperationsPagedResponse listBackupOperations( ListBackupOperationsRequest request) { return listBackupOperationsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the backup [long-running operations][google.longrunning.Operation] in the given instance. * A backup operation has a name of the form * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`. * The long-running operation [metadata][google.longrunning.Operation.metadata] field type * `metadata.type_url` describes the type of the metadata. Operations returned include those that * have completed/failed/canceled within the last 7 days, and pending operations. Operations * returned are ordered by `operation.metadata.value.progress.start_time` in descending order * starting from the most recently started operation. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListBackupOperationsRequest request =
   *       ListBackupOperationsRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.listBackupOperationsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Operation element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listBackupOperationsPagedCallable() { return stub.listBackupOperationsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists the backup [long-running operations][google.longrunning.Operation] in the given instance. * A backup operation has a name of the form * `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`. * The long-running operation [metadata][google.longrunning.Operation.metadata] field type * `metadata.type_url` describes the type of the metadata. Operations returned include those that * have completed/failed/canceled within the last 7 days, and pending operations. Operations * returned are ordered by `operation.metadata.value.progress.start_time` in descending order * starting from the most recently started operation. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListBackupOperationsRequest request =
   *       ListBackupOperationsRequest.newBuilder()
   *           .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListBackupOperationsResponse response =
   *         databaseAdminClient.listBackupOperationsCallable().call(request);
   *     for (Operation element : response.getOperationsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listBackupOperationsCallable() { return stub.listBackupOperationsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Cloud Spanner database roles. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
   *   for (DatabaseRole element : databaseAdminClient.listDatabaseRoles(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The database whose roles should be listed. 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 ListDatabaseRolesPagedResponse listDatabaseRoles(DatabaseName parent) { ListDatabaseRolesRequest request = ListDatabaseRolesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listDatabaseRoles(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Cloud Spanner database roles. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
   *   for (DatabaseRole element : databaseAdminClient.listDatabaseRoles(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The database whose roles should be listed. 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 ListDatabaseRolesPagedResponse listDatabaseRoles(String parent) { ListDatabaseRolesRequest request = ListDatabaseRolesRequest.newBuilder().setParent(parent).build(); return listDatabaseRoles(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Cloud Spanner database roles. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListDatabaseRolesRequest request =
   *       ListDatabaseRolesRequest.newBuilder()
   *           .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (DatabaseRole element : databaseAdminClient.listDatabaseRoles(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 ListDatabaseRolesPagedResponse listDatabaseRoles(ListDatabaseRolesRequest request) { return listDatabaseRolesPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Cloud Spanner database roles. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListDatabaseRolesRequest request =
   *       ListDatabaseRolesRequest.newBuilder()
   *           .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.listDatabaseRolesPagedCallable().futureCall(request);
   *   // Do something.
   *   for (DatabaseRole element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listDatabaseRolesPagedCallable() { return stub.listDatabaseRolesPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists Cloud Spanner database roles. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListDatabaseRolesRequest request =
   *       ListDatabaseRolesRequest.newBuilder()
   *           .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListDatabaseRolesResponse response =
   *         databaseAdminClient.listDatabaseRolesCallable().call(request);
   *     for (DatabaseRole element : response.getDatabaseRolesList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listDatabaseRolesCallable() { return stub.listDatabaseRolesCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new backup schedule. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
   *   BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
   *   String backupScheduleId = "backupScheduleId1704974708";
   *   BackupSchedule response =
   *       databaseAdminClient.createBackupSchedule(parent, backupSchedule, backupScheduleId);
   * }
   * }
* * @param parent Required. The name of the database that this backup schedule applies to. * @param backupSchedule Required. The backup schedule to create. * @param backupScheduleId Required. The Id to use for the backup schedule. The * `backup_schedule_id` appended to `parent` forms the full backup schedule name of the form * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BackupSchedule createBackupSchedule( DatabaseName parent, BackupSchedule backupSchedule, String backupScheduleId) { CreateBackupScheduleRequest request = CreateBackupScheduleRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setBackupSchedule(backupSchedule) .setBackupScheduleId(backupScheduleId) .build(); return createBackupSchedule(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new backup schedule. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
   *   BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
   *   String backupScheduleId = "backupScheduleId1704974708";
   *   BackupSchedule response =
   *       databaseAdminClient.createBackupSchedule(parent, backupSchedule, backupScheduleId);
   * }
   * }
* * @param parent Required. The name of the database that this backup schedule applies to. * @param backupSchedule Required. The backup schedule to create. * @param backupScheduleId Required. The Id to use for the backup schedule. The * `backup_schedule_id` appended to `parent` forms the full backup schedule name of the form * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BackupSchedule createBackupSchedule( String parent, BackupSchedule backupSchedule, String backupScheduleId) { CreateBackupScheduleRequest request = CreateBackupScheduleRequest.newBuilder() .setParent(parent) .setBackupSchedule(backupSchedule) .setBackupScheduleId(backupScheduleId) .build(); return createBackupSchedule(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new backup schedule. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   CreateBackupScheduleRequest request =
   *       CreateBackupScheduleRequest.newBuilder()
   *           .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .setBackupScheduleId("backupScheduleId1704974708")
   *           .setBackupSchedule(BackupSchedule.newBuilder().build())
   *           .build();
   *   BackupSchedule response = databaseAdminClient.createBackupSchedule(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 BackupSchedule createBackupSchedule(CreateBackupScheduleRequest request) { return createBackupScheduleCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new backup schedule. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   CreateBackupScheduleRequest request =
   *       CreateBackupScheduleRequest.newBuilder()
   *           .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .setBackupScheduleId("backupScheduleId1704974708")
   *           .setBackupSchedule(BackupSchedule.newBuilder().build())
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.createBackupScheduleCallable().futureCall(request);
   *   // Do something.
   *   BackupSchedule response = future.get();
   * }
   * }
*/ public final UnaryCallable createBackupScheduleCallable() { return stub.createBackupScheduleCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets backup schedule for the input schedule name. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   BackupScheduleName name =
   *       BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
   *   BackupSchedule response = databaseAdminClient.getBackupSchedule(name);
   * }
   * }
* * @param name Required. The name of the schedule to retrieve. Values are of the form * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BackupSchedule getBackupSchedule(BackupScheduleName name) { GetBackupScheduleRequest request = GetBackupScheduleRequest.newBuilder() .setName(name == null ? null : name.toString()) .build(); return getBackupSchedule(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets backup schedule for the input schedule name. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String name =
   *       BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]").toString();
   *   BackupSchedule response = databaseAdminClient.getBackupSchedule(name);
   * }
   * }
* * @param name Required. The name of the schedule to retrieve. Values are of the form * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BackupSchedule getBackupSchedule(String name) { GetBackupScheduleRequest request = GetBackupScheduleRequest.newBuilder().setName(name).build(); return getBackupSchedule(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets backup schedule for the input schedule name. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   GetBackupScheduleRequest request =
   *       GetBackupScheduleRequest.newBuilder()
   *           .setName(
   *               BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
   *                   .toString())
   *           .build();
   *   BackupSchedule response = databaseAdminClient.getBackupSchedule(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 BackupSchedule getBackupSchedule(GetBackupScheduleRequest request) { return getBackupScheduleCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets backup schedule for the input schedule name. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   GetBackupScheduleRequest request =
   *       GetBackupScheduleRequest.newBuilder()
   *           .setName(
   *               BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
   *                   .toString())
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.getBackupScheduleCallable().futureCall(request);
   *   // Do something.
   *   BackupSchedule response = future.get();
   * }
   * }
*/ public final UnaryCallable getBackupScheduleCallable() { return stub.getBackupScheduleCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a backup schedule. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   BackupSchedule response =
   *       databaseAdminClient.updateBackupSchedule(backupSchedule, updateMask);
   * }
   * }
* * @param backupSchedule Required. The backup schedule to update. `backup_schedule.name`, and the * fields to be updated as specified by `update_mask` are required. Other fields are ignored. * @param updateMask Required. A mask specifying which fields in the BackupSchedule resource * should be updated. This mask is relative to the BackupSchedule resource, not to the request * message. The field mask must always be specified; this prevents any future fields from * being erased accidentally. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BackupSchedule updateBackupSchedule( BackupSchedule backupSchedule, FieldMask updateMask) { UpdateBackupScheduleRequest request = UpdateBackupScheduleRequest.newBuilder() .setBackupSchedule(backupSchedule) .setUpdateMask(updateMask) .build(); return updateBackupSchedule(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a backup schedule. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   UpdateBackupScheduleRequest request =
   *       UpdateBackupScheduleRequest.newBuilder()
   *           .setBackupSchedule(BackupSchedule.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   BackupSchedule response = databaseAdminClient.updateBackupSchedule(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 BackupSchedule updateBackupSchedule(UpdateBackupScheduleRequest request) { return updateBackupScheduleCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a backup schedule. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   UpdateBackupScheduleRequest request =
   *       UpdateBackupScheduleRequest.newBuilder()
   *           .setBackupSchedule(BackupSchedule.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.updateBackupScheduleCallable().futureCall(request);
   *   // Do something.
   *   BackupSchedule response = future.get();
   * }
   * }
*/ public final UnaryCallable updateBackupScheduleCallable() { return stub.updateBackupScheduleCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a backup schedule. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   BackupScheduleName name =
   *       BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]");
   *   databaseAdminClient.deleteBackupSchedule(name);
   * }
   * }
* * @param name Required. The name of the schedule to delete. Values are of the form * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteBackupSchedule(BackupScheduleName name) { DeleteBackupScheduleRequest request = DeleteBackupScheduleRequest.newBuilder() .setName(name == null ? null : name.toString()) .build(); deleteBackupSchedule(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a backup schedule. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String name =
   *       BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]").toString();
   *   databaseAdminClient.deleteBackupSchedule(name);
   * }
   * }
* * @param name Required. The name of the schedule to delete. Values are of the form * `projects/<project>/instances/<instance>/databases/<database>/backupSchedules/<backup_schedule_id>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteBackupSchedule(String name) { DeleteBackupScheduleRequest request = DeleteBackupScheduleRequest.newBuilder().setName(name).build(); deleteBackupSchedule(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a backup schedule. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DeleteBackupScheduleRequest request =
   *       DeleteBackupScheduleRequest.newBuilder()
   *           .setName(
   *               BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
   *                   .toString())
   *           .build();
   *   databaseAdminClient.deleteBackupSchedule(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 void deleteBackupSchedule(DeleteBackupScheduleRequest request) { deleteBackupScheduleCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a backup schedule. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DeleteBackupScheduleRequest request =
   *       DeleteBackupScheduleRequest.newBuilder()
   *           .setName(
   *               BackupScheduleName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SCHEDULE]")
   *                   .toString())
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.deleteBackupScheduleCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteBackupScheduleCallable() { return stub.deleteBackupScheduleCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the backup schedules for the database. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   DatabaseName parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]");
   *   for (BackupSchedule element : databaseAdminClient.listBackupSchedules(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. Database is the parent resource whose backup schedules should be * listed. 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 ListBackupSchedulesPagedResponse listBackupSchedules(DatabaseName parent) { ListBackupSchedulesRequest request = ListBackupSchedulesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listBackupSchedules(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the backup schedules for the database. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   String parent = DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString();
   *   for (BackupSchedule element : databaseAdminClient.listBackupSchedules(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. Database is the parent resource whose backup schedules should be * listed. 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 ListBackupSchedulesPagedResponse listBackupSchedules(String parent) { ListBackupSchedulesRequest request = ListBackupSchedulesRequest.newBuilder().setParent(parent).build(); return listBackupSchedules(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the backup schedules for the database. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListBackupSchedulesRequest request =
   *       ListBackupSchedulesRequest.newBuilder()
   *           .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (BackupSchedule element : databaseAdminClient.listBackupSchedules(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 ListBackupSchedulesPagedResponse listBackupSchedules( ListBackupSchedulesRequest request) { return listBackupSchedulesPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the backup schedules for the database. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListBackupSchedulesRequest request =
   *       ListBackupSchedulesRequest.newBuilder()
   *           .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future =
   *       databaseAdminClient.listBackupSchedulesPagedCallable().futureCall(request);
   *   // Do something.
   *   for (BackupSchedule element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listBackupSchedulesPagedCallable() { return stub.listBackupSchedulesPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the backup schedules for the database. * *

Sample code: * *

{@code
   * // This snippet has been automatically generated and should be regarded as a code template only.
   * // It will require modifications to work:
   * // - It may require correct/in-range values for request initialization.
   * // - It may require specifying regional endpoints when creating the service client as shown in
   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
   * try (DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.create()) {
   *   ListBackupSchedulesRequest request =
   *       ListBackupSchedulesRequest.newBuilder()
   *           .setParent(DatabaseName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListBackupSchedulesResponse response =
   *         databaseAdminClient.listBackupSchedulesCallable().call(request);
   *     for (BackupSchedule element : response.getBackupSchedulesList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listBackupSchedulesCallable() { return stub.listBackupSchedulesCallable(); } @Override public final void close() { stub.close(); } @Override public void shutdown() { stub.shutdown(); } @Override public boolean isShutdown() { return stub.isShutdown(); } @Override public boolean isTerminated() { return stub.isTerminated(); } @Override public void shutdownNow() { stub.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } public static class ListDatabasesPagedResponse extends AbstractPagedListResponse< ListDatabasesRequest, ListDatabasesResponse, Database, ListDatabasesPage, ListDatabasesFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListDatabasesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListDatabasesPagedResponse(input), MoreExecutors.directExecutor()); } private ListDatabasesPagedResponse(ListDatabasesPage page) { super(page, ListDatabasesFixedSizeCollection.createEmptyCollection()); } } public static class ListDatabasesPage extends AbstractPage< ListDatabasesRequest, ListDatabasesResponse, Database, ListDatabasesPage> { private ListDatabasesPage( PageContext context, ListDatabasesResponse response) { super(context, response); } private static ListDatabasesPage createEmptyPage() { return new ListDatabasesPage(null, null); } @Override protected ListDatabasesPage createPage( PageContext context, ListDatabasesResponse response) { return new ListDatabasesPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListDatabasesFixedSizeCollection extends AbstractFixedSizeCollection< ListDatabasesRequest, ListDatabasesResponse, Database, ListDatabasesPage, ListDatabasesFixedSizeCollection> { private ListDatabasesFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static ListDatabasesFixedSizeCollection createEmptyCollection() { return new ListDatabasesFixedSizeCollection(null, 0); } @Override protected ListDatabasesFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListDatabasesFixedSizeCollection(pages, collectionSize); } } public static class ListBackupsPagedResponse extends AbstractPagedListResponse< ListBackupsRequest, ListBackupsResponse, Backup, ListBackupsPage, ListBackupsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListBackupsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListBackupsPagedResponse(input), MoreExecutors.directExecutor()); } private ListBackupsPagedResponse(ListBackupsPage page) { super(page, ListBackupsFixedSizeCollection.createEmptyCollection()); } } public static class ListBackupsPage extends AbstractPage { private ListBackupsPage( PageContext context, ListBackupsResponse response) { super(context, response); } private static ListBackupsPage createEmptyPage() { return new ListBackupsPage(null, null); } @Override protected ListBackupsPage createPage( PageContext context, ListBackupsResponse response) { return new ListBackupsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListBackupsFixedSizeCollection extends AbstractFixedSizeCollection< ListBackupsRequest, ListBackupsResponse, Backup, ListBackupsPage, ListBackupsFixedSizeCollection> { private ListBackupsFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static ListBackupsFixedSizeCollection createEmptyCollection() { return new ListBackupsFixedSizeCollection(null, 0); } @Override protected ListBackupsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListBackupsFixedSizeCollection(pages, collectionSize); } } public static class ListDatabaseOperationsPagedResponse extends AbstractPagedListResponse< ListDatabaseOperationsRequest, ListDatabaseOperationsResponse, Operation, ListDatabaseOperationsPage, ListDatabaseOperationsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListDatabaseOperationsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListDatabaseOperationsPagedResponse(input), MoreExecutors.directExecutor()); } private ListDatabaseOperationsPagedResponse(ListDatabaseOperationsPage page) { super(page, ListDatabaseOperationsFixedSizeCollection.createEmptyCollection()); } } public static class ListDatabaseOperationsPage extends AbstractPage< ListDatabaseOperationsRequest, ListDatabaseOperationsResponse, Operation, ListDatabaseOperationsPage> { private ListDatabaseOperationsPage( PageContext context, ListDatabaseOperationsResponse response) { super(context, response); } private static ListDatabaseOperationsPage createEmptyPage() { return new ListDatabaseOperationsPage(null, null); } @Override protected ListDatabaseOperationsPage createPage( PageContext context, ListDatabaseOperationsResponse response) { return new ListDatabaseOperationsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListDatabaseOperationsFixedSizeCollection extends AbstractFixedSizeCollection< ListDatabaseOperationsRequest, ListDatabaseOperationsResponse, Operation, ListDatabaseOperationsPage, ListDatabaseOperationsFixedSizeCollection> { private ListDatabaseOperationsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListDatabaseOperationsFixedSizeCollection createEmptyCollection() { return new ListDatabaseOperationsFixedSizeCollection(null, 0); } @Override protected ListDatabaseOperationsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListDatabaseOperationsFixedSizeCollection(pages, collectionSize); } } public static class ListBackupOperationsPagedResponse extends AbstractPagedListResponse< ListBackupOperationsRequest, ListBackupOperationsResponse, Operation, ListBackupOperationsPage, ListBackupOperationsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListBackupOperationsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListBackupOperationsPagedResponse(input), MoreExecutors.directExecutor()); } private ListBackupOperationsPagedResponse(ListBackupOperationsPage page) { super(page, ListBackupOperationsFixedSizeCollection.createEmptyCollection()); } } public static class ListBackupOperationsPage extends AbstractPage< ListBackupOperationsRequest, ListBackupOperationsResponse, Operation, ListBackupOperationsPage> { private ListBackupOperationsPage( PageContext context, ListBackupOperationsResponse response) { super(context, response); } private static ListBackupOperationsPage createEmptyPage() { return new ListBackupOperationsPage(null, null); } @Override protected ListBackupOperationsPage createPage( PageContext context, ListBackupOperationsResponse response) { return new ListBackupOperationsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListBackupOperationsFixedSizeCollection extends AbstractFixedSizeCollection< ListBackupOperationsRequest, ListBackupOperationsResponse, Operation, ListBackupOperationsPage, ListBackupOperationsFixedSizeCollection> { private ListBackupOperationsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListBackupOperationsFixedSizeCollection createEmptyCollection() { return new ListBackupOperationsFixedSizeCollection(null, 0); } @Override protected ListBackupOperationsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListBackupOperationsFixedSizeCollection(pages, collectionSize); } } public static class ListDatabaseRolesPagedResponse extends AbstractPagedListResponse< ListDatabaseRolesRequest, ListDatabaseRolesResponse, DatabaseRole, ListDatabaseRolesPage, ListDatabaseRolesFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListDatabaseRolesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListDatabaseRolesPagedResponse(input), MoreExecutors.directExecutor()); } private ListDatabaseRolesPagedResponse(ListDatabaseRolesPage page) { super(page, ListDatabaseRolesFixedSizeCollection.createEmptyCollection()); } } public static class ListDatabaseRolesPage extends AbstractPage< ListDatabaseRolesRequest, ListDatabaseRolesResponse, DatabaseRole, ListDatabaseRolesPage> { private ListDatabaseRolesPage( PageContext context, ListDatabaseRolesResponse response) { super(context, response); } private static ListDatabaseRolesPage createEmptyPage() { return new ListDatabaseRolesPage(null, null); } @Override protected ListDatabaseRolesPage createPage( PageContext context, ListDatabaseRolesResponse response) { return new ListDatabaseRolesPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListDatabaseRolesFixedSizeCollection extends AbstractFixedSizeCollection< ListDatabaseRolesRequest, ListDatabaseRolesResponse, DatabaseRole, ListDatabaseRolesPage, ListDatabaseRolesFixedSizeCollection> { private ListDatabaseRolesFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListDatabaseRolesFixedSizeCollection createEmptyCollection() { return new ListDatabaseRolesFixedSizeCollection(null, 0); } @Override protected ListDatabaseRolesFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListDatabaseRolesFixedSizeCollection(pages, collectionSize); } } public static class ListBackupSchedulesPagedResponse extends AbstractPagedListResponse< ListBackupSchedulesRequest, ListBackupSchedulesResponse, BackupSchedule, ListBackupSchedulesPage, ListBackupSchedulesFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListBackupSchedulesPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListBackupSchedulesPagedResponse(input), MoreExecutors.directExecutor()); } private ListBackupSchedulesPagedResponse(ListBackupSchedulesPage page) { super(page, ListBackupSchedulesFixedSizeCollection.createEmptyCollection()); } } public static class ListBackupSchedulesPage extends AbstractPage< ListBackupSchedulesRequest, ListBackupSchedulesResponse, BackupSchedule, ListBackupSchedulesPage> { private ListBackupSchedulesPage( PageContext context, ListBackupSchedulesResponse response) { super(context, response); } private static ListBackupSchedulesPage createEmptyPage() { return new ListBackupSchedulesPage(null, null); } @Override protected ListBackupSchedulesPage createPage( PageContext context, ListBackupSchedulesResponse response) { return new ListBackupSchedulesPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListBackupSchedulesFixedSizeCollection extends AbstractFixedSizeCollection< ListBackupSchedulesRequest, ListBackupSchedulesResponse, BackupSchedule, ListBackupSchedulesPage, ListBackupSchedulesFixedSizeCollection> { private ListBackupSchedulesFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListBackupSchedulesFixedSizeCollection createEmptyCollection() { return new ListBackupSchedulesFixedSizeCollection(null, 0); } @Override protected ListBackupSchedulesFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListBackupSchedulesFixedSizeCollection(pages, collectionSize); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy