| GitHub Repository | Product Reference |
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:
// 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Backup backup = Backup.newBuilder().build();
Operation response = sqlBackupsServiceClient.createBackup(parent, backup);
}
Note: close() needs to be called on the SqlBackupsServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
CreateBackup |
Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetBackup |
Retrieves a resource containing information about a backup. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListBackups |
Lists all backups associated with the project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateBackup |
Updates the retention period and the description of the backup. You can use this API to update final backups only. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteBackup |
Deletes the backup. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 SqlBackupsServiceSettings to create(). For example:
To customize credentials:
// 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
SqlBackupsServiceSettings sqlBackupsServiceSettings =
SqlBackupsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SqlBackupsServiceClient sqlBackupsServiceClient =
SqlBackupsServiceClient.create(sqlBackupsServiceSettings);
To customize the endpoint:
// 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
SqlBackupsServiceSettings sqlBackupsServiceSettings =
SqlBackupsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
SqlBackupsServiceClient sqlBackupsServiceClient =
SqlBackupsServiceClient.create(sqlBackupsServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
SqlBackupsServiceSettings sqlBackupsServiceSettings =
SqlBackupsServiceSettings.newHttpJsonBuilder().build();
SqlBackupsServiceClient sqlBackupsServiceClient =
SqlBackupsServiceClient.create(sqlBackupsServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final SqlBackupsServiceClient create()Constructs an instance of SqlBackupsServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
SqlBackupsServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(SqlBackupsServiceSettings settings)
public static final SqlBackupsServiceClient create(SqlBackupsServiceSettings settings)Constructs an instance of SqlBackupsServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
SqlBackupsServiceSettings |
| Returns | |
|---|---|
| Type | Description |
SqlBackupsServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(SqlBackupsServiceStub stub)
public static final SqlBackupsServiceClient create(SqlBackupsServiceStub stub)Constructs an instance of SqlBackupsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(SqlBackupsServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
SqlBackupsServiceStub |
| Returns | |
|---|---|
| Type | Description |
SqlBackupsServiceClient |
|
Constructors
SqlBackupsServiceClient(SqlBackupsServiceSettings settings)
protected SqlBackupsServiceClient(SqlBackupsServiceSettings settings)Constructs an instance of SqlBackupsServiceClient, 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.
| Parameter | |
|---|---|
| Name | Description |
settings |
SqlBackupsServiceSettings |
SqlBackupsServiceClient(SqlBackupsServiceStub stub)
protected SqlBackupsServiceClient(SqlBackupsServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
SqlBackupsServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
public final void close()createBackup(@Nullable ProjectName parent, Backup backup)
public final Operation createBackup(@Nullable ProjectName parent, Backup backup)Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Backup backup = Backup.newBuilder().build();
Operation response = sqlBackupsServiceClient.createBackup(parent, backup);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.sql.v1beta4.ProjectNameRequired. The parent resource where this backup is created. Format: projects/{project} |
backup |
BackupRequired. The Backup to create. |
| Returns | |
|---|---|
| Type | Description |
Operation |
|
createBackup(CreateBackupRequest request)
public final Operation createBackup(CreateBackupRequest request)Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
CreateBackupRequest request =
CreateBackupRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setBackup(Backup.newBuilder().build())
.build();
Operation response = sqlBackupsServiceClient.createBackup(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateBackupRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Operation |
|
createBackup(String parent, Backup backup)
public final Operation createBackup(String parent, Backup backup)Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
Backup backup = Backup.newBuilder().build();
Operation response = sqlBackupsServiceClient.createBackup(parent, backup);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent resource where this backup is created. Format: projects/{project} |
backup |
BackupRequired. The Backup to create. |
| Returns | |
|---|---|
| Type | Description |
Operation |
|
createBackupCallable()
public final UnaryCallable<CreateBackupRequest,Operation> createBackupCallable()Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
CreateBackupRequest request =
CreateBackupRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setBackup(Backup.newBuilder().build())
.build();
ApiFuture<Operation> future =
sqlBackupsServiceClient.createBackupCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateBackupRequest,Operation> |
|
deleteBackup(@Nullable BackupName name)
public final Operation deleteBackup(@Nullable BackupName name)Deletes the backup.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
BackupName name = BackupName.of("[PROJECT]", "[BACKUP]");
Operation response = sqlBackupsServiceClient.deleteBackup(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.sql.v1beta4.BackupNameRequired. The name of the backup to delete. Format: projects/{project}/backups/{backup} |
| Returns | |
|---|---|
| Type | Description |
Operation |
|
deleteBackup(DeleteBackupRequest request)
public final Operation deleteBackup(DeleteBackupRequest request)Deletes the backup.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
DeleteBackupRequest request =
DeleteBackupRequest.newBuilder()
.setName(BackupName.of("[PROJECT]", "[BACKUP]").toString())
.build();
Operation response = sqlBackupsServiceClient.deleteBackup(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteBackupRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Operation |
|
deleteBackup(String name)
public final Operation deleteBackup(String name)Deletes the backup.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
String name = BackupName.of("[PROJECT]", "[BACKUP]").toString();
Operation response = sqlBackupsServiceClient.deleteBackup(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The name of the backup to delete. Format: projects/{project}/backups/{backup} |
| Returns | |
|---|---|
| Type | Description |
Operation |
|
deleteBackupCallable()
public final UnaryCallable<DeleteBackupRequest,Operation> deleteBackupCallable()Deletes the backup.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
DeleteBackupRequest request =
DeleteBackupRequest.newBuilder()
.setName(BackupName.of("[PROJECT]", "[BACKUP]").toString())
.build();
ApiFuture<Operation> future =
sqlBackupsServiceClient.deleteBackupCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteBackupRequest,Operation> |
|
getBackup(@Nullable BackupName name)
public final Backup getBackup(@Nullable BackupName name)Retrieves a resource containing information about a backup.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
BackupName name = BackupName.of("[PROJECT]", "[BACKUP]");
Backup response = sqlBackupsServiceClient.getBackup(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.sql.v1beta4.BackupNameRequired. The name of the backup to retrieve. Format: projects/{project}/backups/{backup} |
| Returns | |
|---|---|
| Type | Description |
Backup |
|
getBackup(GetBackupRequest request)
public final Backup getBackup(GetBackupRequest request)Retrieves a resource containing information about a backup.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
GetBackupRequest request =
GetBackupRequest.newBuilder()
.setName(BackupName.of("[PROJECT]", "[BACKUP]").toString())
.build();
Backup response = sqlBackupsServiceClient.getBackup(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetBackupRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Backup |
|
getBackup(String name)
public final Backup getBackup(String name)Retrieves a resource containing information about a backup.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
String name = BackupName.of("[PROJECT]", "[BACKUP]").toString();
Backup response = sqlBackupsServiceClient.getBackup(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The name of the backup to retrieve. Format: projects/{project}/backups/{backup} |
| Returns | |
|---|---|
| Type | Description |
Backup |
|
getBackupCallable()
public final UnaryCallable<GetBackupRequest,Backup> getBackupCallable()Retrieves a resource containing information about a backup.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
GetBackupRequest request =
GetBackupRequest.newBuilder()
.setName(BackupName.of("[PROJECT]", "[BACKUP]").toString())
.build();
ApiFuture<Backup> future = sqlBackupsServiceClient.getBackupCallable().futureCall(request);
// Do something.
Backup response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetBackupRequest,Backup> |
|
getSettings()
public final @Nullable SqlBackupsServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.cloud.sql.v1beta4.SqlBackupsServiceSettings |
|
getStub()
public SqlBackupsServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
SqlBackupsServiceStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listBackups(@Nullable ProjectName parent)
public final SqlBackupsServiceClient.ListBackupsPagedResponse listBackups(@Nullable ProjectName parent)Lists all backups associated with the project.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
for (Backup element : sqlBackupsServiceClient.listBackups(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.sql.v1beta4.ProjectNameRequired. The parent that owns this collection of backups. Format: projects/{project} |
| Returns | |
|---|---|
| Type | Description |
SqlBackupsServiceClient.ListBackupsPagedResponse |
|
listBackups(ListBackupsRequest request)
public final SqlBackupsServiceClient.ListBackupsPagedResponse listBackups(ListBackupsRequest request)Lists all backups associated with the project.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
ListBackupsRequest request =
ListBackupsRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (Backup element : sqlBackupsServiceClient.listBackups(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListBackupsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
SqlBackupsServiceClient.ListBackupsPagedResponse |
|
listBackups(String parent)
public final SqlBackupsServiceClient.ListBackupsPagedResponse listBackups(String parent)Lists all backups associated with the project.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
for (Backup element : sqlBackupsServiceClient.listBackups(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The parent that owns this collection of backups. Format: projects/{project} |
| Returns | |
|---|---|
| Type | Description |
SqlBackupsServiceClient.ListBackupsPagedResponse |
|
listBackupsCallable()
public final UnaryCallable<ListBackupsRequest,ListBackupsResponse> listBackupsCallable()Lists all backups associated with the project.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
ListBackupsRequest request =
ListBackupsRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListBackupsResponse response = sqlBackupsServiceClient.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;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListBackupsRequest,ListBackupsResponse> |
|
listBackupsPagedCallable()
public final UnaryCallable<ListBackupsRequest,SqlBackupsServiceClient.ListBackupsPagedResponse> listBackupsPagedCallable()Lists all backups associated with the project.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
ListBackupsRequest request =
ListBackupsRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<Backup> future =
sqlBackupsServiceClient.listBackupsPagedCallable().futureCall(request);
// Do something.
for (Backup element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListBackupsRequest,ListBackupsPagedResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()updateBackup(Backup backup, FieldMask updateMask)
public final Operation updateBackup(Backup backup, FieldMask updateMask)Updates the retention period and the description of the backup. You can use this API to update final backups only.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
Backup backup = Backup.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Operation response = sqlBackupsServiceClient.updateBackup(backup, updateMask);
}
| Parameters | |
|---|---|
| Name | Description |
backup |
BackupRequired. The backup to update. The backup’s |
updateMask |
FieldMaskThe list of fields that you can update. You can update only the description and retention period of the final backup. |
| Returns | |
|---|---|
| Type | Description |
Operation |
|
updateBackup(UpdateBackupRequest request)
public final Operation updateBackup(UpdateBackupRequest request)Updates the retention period and the description of the backup. You can use this API to update final backups only.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
UpdateBackupRequest request =
UpdateBackupRequest.newBuilder()
.setBackup(Backup.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Operation response = sqlBackupsServiceClient.updateBackup(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateBackupRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Operation |
|
updateBackupCallable()
public final UnaryCallable<UpdateBackupRequest,Operation> updateBackupCallable()Updates the retention period and the description of the backup. You can use this API to update final backups only.
Sample 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 (SqlBackupsServiceClient sqlBackupsServiceClient = SqlBackupsServiceClient.create()) {
UpdateBackupRequest request =
UpdateBackupRequest.newBuilder()
.setBackup(Backup.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future =
sqlBackupsServiceClient.updateBackupCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateBackupRequest,Operation> |
|