Class MemorystoreClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
Instance response = memorystoreClient.getInstance(name);
}
Note: close() needs to be called on the MemorystoreClient 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 |
|---|---|---|
ListInstances |
Lists Instances in a given project and location. |
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.
|
GetInstance |
Gets details of a single Instance. |
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.
|
CreateInstance |
Creates a new Instance in a given project and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateInstance |
Updates the parameters of a single Instance. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteInstance |
Deletes a single Instance. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetCertificateAuthority |
Gets details about the certificate authority for an Instance. |
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.
|
GetSharedRegionalCertificateAuthority |
Gets the details of shared regional certificate authority information for Memorystore instance. |
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.
|
RescheduleMaintenance |
Reschedules upcoming maintenance event. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListBackupCollections |
Lists all backup collections owned by a consumer project in either the specified location (region) or all locations. If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated. |
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.
|
GetBackupCollection |
Get a backup collection. |
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 owned by a backup collection. |
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 |
Gets the details of a specific 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.
|
DeleteBackup |
Deletes a specific backup. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ExportBackup |
Exports a specific backup to a customer target Cloud Storage URI. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
BackupInstance |
Backup Instance. If this is the first time a backup is being created, a backup collection will be created at the backend, and this backup belongs to this collection. Both collection and backup will have a resource name. Backup will be executed for each shard. A replica (primary if nonHA) will be selected to perform the execution. Backup call will be rejected if there is an ongoing backup or update operation. Be aware that during preview, if the instance's internal software version is too old, critical update will be performed before actual backup. Once the internal software version is updated to the minimum version required by the backup feature, subsequent backups will not require critical update. After preview, there will be no critical update needed for backup. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
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 MemorystoreSettings 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
MemorystoreSettings memorystoreSettings =
MemorystoreSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
MemorystoreClient memorystoreClient = MemorystoreClient.create(memorystoreSettings);
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
MemorystoreSettings memorystoreSettings =
MemorystoreSettings.newBuilder().setEndpoint(myEndpoint).build();
MemorystoreClient memorystoreClient = MemorystoreClient.create(memorystoreSettings);
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
MemorystoreSettings memorystoreSettings = MemorystoreSettings.newHttpJsonBuilder().build();
MemorystoreClient memorystoreClient = MemorystoreClient.create(memorystoreSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMemorystoreClient(MemorystoreSettings settings) Constructs an instance of MemorystoreClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) backupInstanceAsync(BackupInstanceRequest request) Backup Instance.Backup Instance.backupInstanceAsync(String name) Backup Instance.Backup Instance.Backup Instance.final voidclose()static final MemorystoreClientcreate()Constructs an instance of MemorystoreClient with default settings.static final MemorystoreClientcreate(MemorystoreSettings settings) Constructs an instance of MemorystoreClient, using the given settings.static final MemorystoreClientcreate(MemorystoreStub stub) Constructs an instance of MemorystoreClient, using the given stub for making calls.createInstanceAsync(CreateInstanceRequest request) Creates a new Instance in a given project and location.createInstanceAsync(LocationName parent, Instance instance, String instanceId) Creates a new Instance in a given project and location.createInstanceAsync(String parent, Instance instance, String instanceId) Creates a new Instance in a given project and location.Creates a new Instance in a given project and location.Creates a new Instance in a given project and location.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteBackupAsync(BackupName name) Deletes a specific backup.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteBackupAsync(DeleteBackupRequest request) Deletes a specific backup.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteBackupAsync(String name) Deletes a specific backup.Deletes a specific backup.final OperationCallable<DeleteBackupRequest,com.google.protobuf.Empty, OperationMetadata> Deletes a specific backup.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteInstanceAsync(DeleteInstanceRequest request) Deletes a single Instance.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> Deletes a single Instance.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteInstanceAsync(String name) Deletes a single Instance.Deletes a single Instance.final OperationCallable<DeleteInstanceRequest,com.google.protobuf.Empty, OperationMetadata> Deletes a single Instance.exportBackupAsync(ExportBackupRequest request) Exports a specific backup to a customer target Cloud Storage URI.Exports a specific backup to a customer target Cloud Storage URI.Exports a specific backup to a customer target Cloud Storage URI.final BackupgetBackup(BackupName name) Gets the details of a specific backup.final BackupgetBackup(GetBackupRequest request) Gets the details of a specific backup.final BackupGets the details of a specific backup.final UnaryCallable<GetBackupRequest,Backup> Gets the details of a specific backup.final BackupCollectionGet a backup collection.final BackupCollectionGet a backup collection.final BackupCollectiongetBackupCollection(String name) Get a backup collection.Get a backup collection.final CertificateAuthorityGets details about the certificate authority for an Instance.final CertificateAuthorityGets details about the certificate authority for an Instance.final CertificateAuthorityGets details about the certificate authority for an Instance.Gets details about the certificate authority for an Instance.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final InstancegetInstance(GetInstanceRequest request) Gets details of a single Instance.final InstancegetInstance(InstanceName name) Gets details of a single Instance.final InstancegetInstance(String name) Gets details of a single Instance.Gets details of a single Instance.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final MemorystoreSettingsGets the details of shared regional certificate authority information for Memorystore instance.Gets the details of shared regional certificate authority information for Memorystore instance.Gets the details of shared regional certificate authority information for Memorystore instance.final UnaryCallable<GetSharedRegionalCertificateAuthorityRequest,SharedRegionalCertificateAuthority> Gets the details of shared regional certificate authority information for Memorystore instance.getStub()booleanbooleanLists all backup collections owned by a consumer project in either the specified location (region) or all locations.listBackupCollections(LocationName parent) Lists all backup collections owned by a consumer project in either the specified location (region) or all locations.listBackupCollections(String parent) Lists all backup collections owned by a consumer project in either the specified location (region) or all locations.Lists all backup collections owned by a consumer project in either the specified location (region) or all locations.final UnaryCallable<ListBackupCollectionsRequest,MemorystoreClient.ListBackupCollectionsPagedResponse> Lists all backup collections owned by a consumer project in either the specified location (region) or all locations.listBackups(BackupCollectionName parent) Lists all backups owned by a backup collection.listBackups(ListBackupsRequest request) Lists all backups owned by a backup collection.listBackups(String parent) Lists all backups owned by a backup collection.Lists all backups owned by a backup collection.Lists all backups owned by a backup collection.listInstances(ListInstancesRequest request) Lists Instances in a given project and location.listInstances(LocationName parent) Lists Instances in a given project and location.listInstances(String parent) Lists Instances in a given project and location.Lists Instances in a given project and location.Lists Instances in a given project and location.listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.rescheduleMaintenanceAsync(InstanceName name, RescheduleMaintenanceRequest.RescheduleType rescheduleType, com.google.protobuf.Timestamp scheduleTime) Reschedules upcoming maintenance event.Reschedules upcoming maintenance event.rescheduleMaintenanceAsync(String name, RescheduleMaintenanceRequest.RescheduleType rescheduleType, com.google.protobuf.Timestamp scheduleTime) Reschedules upcoming maintenance event.Reschedules upcoming maintenance event.Reschedules upcoming maintenance event.voidshutdown()voidupdateInstanceAsync(Instance instance, com.google.protobuf.FieldMask updateMask) Updates the parameters of a single Instance.updateInstanceAsync(UpdateInstanceRequest request) Updates the parameters of a single Instance.Updates the parameters of a single Instance.Updates the parameters of a single Instance.
-
Constructor Details
-
MemorystoreClient
Constructs an instance of MemorystoreClient, 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.- Throws:
IOException
-
MemorystoreClient
-
-
Method Details
-
create
Constructs an instance of MemorystoreClient with default settings.- Throws:
IOException
-
create
Constructs an instance of MemorystoreClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of MemorystoreClient, using the given stub for making calls. This is for advanced usage - prefer using create(MemorystoreSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
getHttpJsonOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
listInstances
Lists Instances in a given project and location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Instance element : memorystoreClient.listInstances(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent to list instances from. Format: projects/{project}/locations/{location}- Throws:
ApiException- if the remote call fails
-
listInstances
Lists Instances in a given project and location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Instance element : memorystoreClient.listInstances(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent to list instances from. Format: projects/{project}/locations/{location}- Throws:
ApiException- if the remote call fails
-
listInstances
public final MemorystoreClient.ListInstancesPagedResponse listInstances(ListInstancesRequest request) Lists Instances in a given project and location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListInstancesRequest request = ListInstancesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); for (Instance element : memorystoreClient.listInstances(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listInstancesPagedCallable
public final UnaryCallable<ListInstancesRequest,MemorystoreClient.ListInstancesPagedResponse> listInstancesPagedCallable()Lists Instances in a given project and location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListInstancesRequest request = ListInstancesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); ApiFuture<Instance> future = memorystoreClient.listInstancesPagedCallable().futureCall(request); // Do something. for (Instance element : future.get().iterateAll()) { // doThingsWith(element); } } -
listInstancesCallable
Lists Instances in a given project and location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListInstancesRequest request = ListInstancesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .build(); while (true) { ListInstancesResponse response = memorystoreClient.listInstancesCallable().call(request); for (Instance element : response.getInstancesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getInstance
Gets details of a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); Instance response = memorystoreClient.getInstance(name); }- Parameters:
name- Required. The name of the instance to retrieve. Format: projects/{project}/locations/{location}/instances/{instance}- Throws:
ApiException- if the remote call fails
-
getInstance
Gets details of a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); Instance response = memorystoreClient.getInstance(name); }- Parameters:
name- Required. The name of the instance to retrieve. Format: projects/{project}/locations/{location}/instances/{instance}- Throws:
ApiException- if the remote call fails
-
getInstance
Gets details of a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { GetInstanceRequest request = GetInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .build(); Instance response = memorystoreClient.getInstance(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getInstanceCallable
Gets details of a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { GetInstanceRequest request = GetInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .build(); ApiFuture<Instance> future = memorystoreClient.getInstanceCallable().futureCall(request); // Do something. Instance response = future.get(); } -
createInstanceAsync
public final OperationFuture<Instance,OperationMetadata> createInstanceAsync(LocationName parent, Instance instance, String instanceId) Creates a new Instance in a given project and location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Instance instance = Instance.newBuilder().build(); String instanceId = "instanceId902024336"; Instance response = memorystoreClient.createInstanceAsync(parent, instance, instanceId).get(); }- Parameters:
parent- Required. The parent resource where this instance will be created. Format: projects/{project}/locations/{location}instance- Required. The instance to create.instanceId- Required. The ID to use for the instance, which will become the final component of the instance's resource name.This value is subject to the following restrictions:
- Must be 4-63 characters in length
- Must begin with a letter or digit
- Must contain only lowercase letters, digits, and hyphens
- Must not end with a hyphen
- Must be unique within a location
- Throws:
ApiException- if the remote call fails
-
createInstanceAsync
public final OperationFuture<Instance,OperationMetadata> createInstanceAsync(String parent, Instance instance, String instanceId) Creates a new Instance in a given project and location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Instance instance = Instance.newBuilder().build(); String instanceId = "instanceId902024336"; Instance response = memorystoreClient.createInstanceAsync(parent, instance, instanceId).get(); }- Parameters:
parent- Required. The parent resource where this instance will be created. Format: projects/{project}/locations/{location}instance- Required. The instance to create.instanceId- Required. The ID to use for the instance, which will become the final component of the instance's resource name.This value is subject to the following restrictions:
- Must be 4-63 characters in length
- Must begin with a letter or digit
- Must contain only lowercase letters, digits, and hyphens
- Must not end with a hyphen
- Must be unique within a location
- Throws:
ApiException- if the remote call fails
-
createInstanceAsync
public final OperationFuture<Instance,OperationMetadata> createInstanceAsync(CreateInstanceRequest request) Creates a new Instance in a given project and location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { CreateInstanceRequest request = CreateInstanceRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setInstanceId("instanceId902024336") .setInstance(Instance.newBuilder().build()) .setRequestId("requestId693933066") .build(); Instance response = memorystoreClient.createInstanceAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createInstanceOperationCallable
public final OperationCallable<CreateInstanceRequest,Instance, createInstanceOperationCallable()OperationMetadata> Creates a new Instance in a given project and location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { CreateInstanceRequest request = CreateInstanceRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setInstanceId("instanceId902024336") .setInstance(Instance.newBuilder().build()) .setRequestId("requestId693933066") .build(); OperationFuture<Instance, OperationMetadata> future = memorystoreClient.createInstanceOperationCallable().futureCall(request); // Do something. Instance response = future.get(); } -
createInstanceCallable
Creates a new Instance in a given project and location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { CreateInstanceRequest request = CreateInstanceRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setInstanceId("instanceId902024336") .setInstance(Instance.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = memorystoreClient.createInstanceCallable().futureCall(request); // Do something. Operation response = future.get(); } -
updateInstanceAsync
public final OperationFuture<Instance,OperationMetadata> updateInstanceAsync(Instance instance, com.google.protobuf.FieldMask updateMask) Updates the parameters of a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { Instance instance = Instance.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Instance response = memorystoreClient.updateInstanceAsync(instance, updateMask).get(); }- Parameters:
instance- Required. The instance to update.updateMask- Optional. The list of fields to be updated on the instance. At least one field must be specified.- Throws:
ApiException- if the remote call fails
-
updateInstanceAsync
public final OperationFuture<Instance,OperationMetadata> updateInstanceAsync(UpdateInstanceRequest request) Updates the parameters of a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setInstance(Instance.newBuilder().build()) .setRequestId("requestId693933066") .build(); Instance response = memorystoreClient.updateInstanceAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateInstanceOperationCallable
public final OperationCallable<UpdateInstanceRequest,Instance, updateInstanceOperationCallable()OperationMetadata> Updates the parameters of a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setInstance(Instance.newBuilder().build()) .setRequestId("requestId693933066") .build(); OperationFuture<Instance, OperationMetadata> future = memorystoreClient.updateInstanceOperationCallable().futureCall(request); // Do something. Instance response = future.get(); } -
updateInstanceCallable
Updates the parameters of a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder() .setUpdateMask(FieldMask.newBuilder().build()) .setInstance(Instance.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = memorystoreClient.updateInstanceCallable().futureCall(request); // Do something. Operation response = future.get(); } -
deleteInstanceAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteInstanceAsync(InstanceName name) Deletes a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); memorystoreClient.deleteInstanceAsync(name).get(); }- Parameters:
name- Required. The name of the instance to delete. Format: projects/{project}/locations/{location}/instances/{instance}- Throws:
ApiException- if the remote call fails
-
deleteInstanceAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteInstanceAsync(String name) Deletes a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); memorystoreClient.deleteInstanceAsync(name).get(); }- Parameters:
name- Required. The name of the instance to delete. Format: projects/{project}/locations/{location}/instances/{instance}- Throws:
ApiException- if the remote call fails
-
deleteInstanceAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteInstanceAsync(DeleteInstanceRequest request) Deletes a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .setRequestId("requestId693933066") .build(); memorystoreClient.deleteInstanceAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteInstanceOperationCallable
public final OperationCallable<DeleteInstanceRequest,com.google.protobuf.Empty, deleteInstanceOperationCallable()OperationMetadata> Deletes a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .setRequestId("requestId693933066") .build(); OperationFuture<Empty, OperationMetadata> future = memorystoreClient.deleteInstanceOperationCallable().futureCall(request); // Do something. future.get(); } -
deleteInstanceCallable
Deletes a single Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = memorystoreClient.deleteInstanceCallable().futureCall(request); // Do something. future.get(); } -
getCertificateAuthority
Gets details about the certificate authority for an Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); CertificateAuthority response = memorystoreClient.getCertificateAuthority(name); }- Parameters:
name- Required. The name of the certificate authority. Format: projects/{project}/locations/{location}/instances/{instance}/certificateAuthority- Throws:
ApiException- if the remote call fails
-
getCertificateAuthority
Gets details about the certificate authority for an Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); CertificateAuthority response = memorystoreClient.getCertificateAuthority(name); }- Parameters:
name- Required. The name of the certificate authority. Format: projects/{project}/locations/{location}/instances/{instance}/certificateAuthority- Throws:
ApiException- if the remote call fails
-
getCertificateAuthority
Gets details about the certificate authority for an Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { GetCertificateAuthorityRequest request = GetCertificateAuthorityRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .build(); CertificateAuthority response = memorystoreClient.getCertificateAuthority(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getCertificateAuthorityCallable
public final UnaryCallable<GetCertificateAuthorityRequest,CertificateAuthority> getCertificateAuthorityCallable()Gets details about the certificate authority for an Instance.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { GetCertificateAuthorityRequest request = GetCertificateAuthorityRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .build(); ApiFuture<CertificateAuthority> future = memorystoreClient.getCertificateAuthorityCallable().futureCall(request); // Do something. CertificateAuthority response = future.get(); } -
rescheduleMaintenanceAsync
public final OperationFuture<Instance,OperationMetadata> rescheduleMaintenanceAsync(InstanceName name, RescheduleMaintenanceRequest.RescheduleType rescheduleType, com.google.protobuf.Timestamp scheduleTime) Reschedules upcoming maintenance event.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); RescheduleMaintenanceRequest.RescheduleType rescheduleType = RescheduleMaintenanceRequest.RescheduleType.forNumber(0); Timestamp scheduleTime = Timestamp.newBuilder().build(); Instance response = memorystoreClient.rescheduleMaintenanceAsync(name, rescheduleType, scheduleTime).get(); }- Parameters:
name- Required. Name of the instance to reschedule maintenance for: `projects/{project}/locations/{location_id}/instances/{instance}`rescheduleType- Required. If reschedule type is SPECIFIC_TIME, schedule_time must be set.scheduleTime- Optional. Timestamp when the maintenance shall be rescheduled to if reschedule_type=SPECIFIC_TIME, in RFC 3339 format. Example: `2012-11-15T16:19:00.094Z`.- Throws:
ApiException- if the remote call fails
-
rescheduleMaintenanceAsync
public final OperationFuture<Instance,OperationMetadata> rescheduleMaintenanceAsync(String name, RescheduleMaintenanceRequest.RescheduleType rescheduleType, com.google.protobuf.Timestamp scheduleTime) Reschedules upcoming maintenance event.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); RescheduleMaintenanceRequest.RescheduleType rescheduleType = RescheduleMaintenanceRequest.RescheduleType.forNumber(0); Timestamp scheduleTime = Timestamp.newBuilder().build(); Instance response = memorystoreClient.rescheduleMaintenanceAsync(name, rescheduleType, scheduleTime).get(); }- Parameters:
name- Required. Name of the instance to reschedule maintenance for: `projects/{project}/locations/{location_id}/instances/{instance}`rescheduleType- Required. If reschedule type is SPECIFIC_TIME, schedule_time must be set.scheduleTime- Optional. Timestamp when the maintenance shall be rescheduled to if reschedule_type=SPECIFIC_TIME, in RFC 3339 format. Example: `2012-11-15T16:19:00.094Z`.- Throws:
ApiException- if the remote call fails
-
rescheduleMaintenanceAsync
public final OperationFuture<Instance,OperationMetadata> rescheduleMaintenanceAsync(RescheduleMaintenanceRequest request) Reschedules upcoming maintenance event.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { RescheduleMaintenanceRequest request = RescheduleMaintenanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .setScheduleTime(Timestamp.newBuilder().build()) .build(); Instance response = memorystoreClient.rescheduleMaintenanceAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
rescheduleMaintenanceOperationCallable
public final OperationCallable<RescheduleMaintenanceRequest,Instance, rescheduleMaintenanceOperationCallable()OperationMetadata> Reschedules upcoming maintenance event.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { RescheduleMaintenanceRequest request = RescheduleMaintenanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .setScheduleTime(Timestamp.newBuilder().build()) .build(); OperationFuture<Instance, OperationMetadata> future = memorystoreClient.rescheduleMaintenanceOperationCallable().futureCall(request); // Do something. Instance response = future.get(); } -
rescheduleMaintenanceCallable
Reschedules upcoming maintenance event.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { RescheduleMaintenanceRequest request = RescheduleMaintenanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .setScheduleTime(Timestamp.newBuilder().build()) .build(); ApiFuture<Operation> future = memorystoreClient.rescheduleMaintenanceCallable().futureCall(request); // Do something. Operation response = future.get(); } -
listBackupCollections
public final MemorystoreClient.ListBackupCollectionsPagedResponse listBackupCollections(LocationName parent) Lists all backup collections owned by a consumer project in either the specified location (region) or all locations.If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (BackupCollection element : memorystoreClient.listBackupCollections(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the backupCollection location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a Google Cloud region.- Throws:
ApiException- if the remote call fails
-
listBackupCollections
public final MemorystoreClient.ListBackupCollectionsPagedResponse listBackupCollections(String parent) Lists all backup collections owned by a consumer project in either the specified location (region) or all locations.If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (BackupCollection element : memorystoreClient.listBackupCollections(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the backupCollection location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a Google Cloud region.- Throws:
ApiException- if the remote call fails
-
listBackupCollections
public final MemorystoreClient.ListBackupCollectionsPagedResponse listBackupCollections(ListBackupCollectionsRequest request) Lists all backup collections owned by a consumer project in either the specified location (region) or all locations.If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListBackupCollectionsRequest request = ListBackupCollectionsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (BackupCollection element : memorystoreClient.listBackupCollections(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listBackupCollectionsPagedCallable
public final UnaryCallable<ListBackupCollectionsRequest,MemorystoreClient.ListBackupCollectionsPagedResponse> listBackupCollectionsPagedCallable()Lists all backup collections owned by a consumer project in either the specified location (region) or all locations.If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListBackupCollectionsRequest request = ListBackupCollectionsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<BackupCollection> future = memorystoreClient.listBackupCollectionsPagedCallable().futureCall(request); // Do something. for (BackupCollection element : future.get().iterateAll()) { // doThingsWith(element); } } -
listBackupCollectionsCallable
public final UnaryCallable<ListBackupCollectionsRequest,ListBackupCollectionsResponse> listBackupCollectionsCallable()Lists all backup collections owned by a consumer project in either the specified location (region) or all locations.If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListBackupCollectionsRequest request = ListBackupCollectionsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListBackupCollectionsResponse response = memorystoreClient.listBackupCollectionsCallable().call(request); for (BackupCollection element : response.getBackupCollectionsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getBackupCollection
Get a backup collection.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { BackupCollectionName name = BackupCollectionName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]"); BackupCollection response = memorystoreClient.getBackupCollection(name); }- Parameters:
name- Required. Instance backupCollection resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}` where `location_id` refers to a Google Cloud region.- Throws:
ApiException- if the remote call fails
-
getBackupCollection
Get a backup collection.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String name = BackupCollectionName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]").toString(); BackupCollection response = memorystoreClient.getBackupCollection(name); }- Parameters:
name- Required. Instance backupCollection resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}` where `location_id` refers to a Google Cloud region.- Throws:
ApiException- if the remote call fails
-
getBackupCollection
Get a backup collection.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { GetBackupCollectionRequest request = GetBackupCollectionRequest.newBuilder() .setName( BackupCollectionName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]") .toString()) .build(); BackupCollection response = memorystoreClient.getBackupCollection(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getBackupCollectionCallable
public final UnaryCallable<GetBackupCollectionRequest,BackupCollection> getBackupCollectionCallable()Get a backup collection.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { GetBackupCollectionRequest request = GetBackupCollectionRequest.newBuilder() .setName( BackupCollectionName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]") .toString()) .build(); ApiFuture<BackupCollection> future = memorystoreClient.getBackupCollectionCallable().futureCall(request); // Do something. BackupCollection response = future.get(); } -
listBackups
Lists all backups owned by a backup collection.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { BackupCollectionName parent = BackupCollectionName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]"); for (Backup element : memorystoreClient.listBackups(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the backupCollection using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`- Throws:
ApiException- if the remote call fails
-
listBackups
Lists all backups owned by a backup collection.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String parent = BackupCollectionName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]").toString(); for (Backup element : memorystoreClient.listBackups(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the backupCollection using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}`- Throws:
ApiException- if the remote call fails
-
listBackups
Lists all backups owned by a backup collection.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListBackupsRequest request = ListBackupsRequest.newBuilder() .setParent( BackupCollectionName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]") .toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Backup element : memorystoreClient.listBackups(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listBackupsPagedCallable
public final UnaryCallable<ListBackupsRequest,MemorystoreClient.ListBackupsPagedResponse> listBackupsPagedCallable()Lists all backups owned by a backup collection.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListBackupsRequest request = ListBackupsRequest.newBuilder() .setParent( BackupCollectionName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]") .toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Backup> future = memorystoreClient.listBackupsPagedCallable().futureCall(request); // Do something. for (Backup element : future.get().iterateAll()) { // doThingsWith(element); } } -
listBackupsCallable
Lists all backups owned by a backup collection.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListBackupsRequest request = ListBackupsRequest.newBuilder() .setParent( BackupCollectionName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]") .toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListBackupsResponse response = memorystoreClient.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; } } } -
getBackup
Gets the details of a specific 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { BackupName name = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]"); Backup response = memorystoreClient.getBackup(name); }- Parameters:
name- Required. Instance backup resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`- Throws:
ApiException- if the remote call fails
-
getBackup
Gets the details of a specific 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String name = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]").toString(); Backup response = memorystoreClient.getBackup(name); }- Parameters:
name- Required. Instance backup resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`- Throws:
ApiException- if the remote call fails
-
getBackup
Gets the details of a specific 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { GetBackupRequest request = GetBackupRequest.newBuilder() .setName( BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]") .toString()) .build(); Backup response = memorystoreClient.getBackup(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getBackupCallable
Gets the details of a specific 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { GetBackupRequest request = GetBackupRequest.newBuilder() .setName( BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]") .toString()) .build(); ApiFuture<Backup> future = memorystoreClient.getBackupCallable().futureCall(request); // Do something. Backup response = future.get(); } -
deleteBackupAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteBackupAsync(BackupName name) Deletes a specific 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { BackupName name = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]"); memorystoreClient.deleteBackupAsync(name).get(); }- Parameters:
name- Required. Instance backup resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`- Throws:
ApiException- if the remote call fails
-
deleteBackupAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteBackupAsync(String name) Deletes a specific 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String name = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]").toString(); memorystoreClient.deleteBackupAsync(name).get(); }- Parameters:
name- Required. Instance backup resource name using the form: `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}`- Throws:
ApiException- if the remote call fails
-
deleteBackupAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteBackupAsync(DeleteBackupRequest request) Deletes a specific 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { DeleteBackupRequest request = DeleteBackupRequest.newBuilder() .setName( BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]") .toString()) .setRequestId("requestId693933066") .build(); memorystoreClient.deleteBackupAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteBackupOperationCallable
public final OperationCallable<DeleteBackupRequest,com.google.protobuf.Empty, deleteBackupOperationCallable()OperationMetadata> Deletes a specific 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { DeleteBackupRequest request = DeleteBackupRequest.newBuilder() .setName( BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]") .toString()) .setRequestId("requestId693933066") .build(); OperationFuture<Empty, OperationMetadata> future = memorystoreClient.deleteBackupOperationCallable().futureCall(request); // Do something. future.get(); } -
deleteBackupCallable
Deletes a specific 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { DeleteBackupRequest request = DeleteBackupRequest.newBuilder() .setName( BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]") .toString()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = memorystoreClient.deleteBackupCallable().futureCall(request); // Do something. future.get(); } -
exportBackupAsync
public final OperationFuture<Backup,OperationMetadata> exportBackupAsync(ExportBackupRequest request) Exports a specific backup to a customer target Cloud Storage URI.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ExportBackupRequest request = ExportBackupRequest.newBuilder() .setName( BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]") .toString()) .build(); Backup response = memorystoreClient.exportBackupAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
exportBackupOperationCallable
public final OperationCallable<ExportBackupRequest,Backup, exportBackupOperationCallable()OperationMetadata> Exports a specific backup to a customer target Cloud Storage URI.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ExportBackupRequest request = ExportBackupRequest.newBuilder() .setName( BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]") .toString()) .build(); OperationFuture<Backup, OperationMetadata> future = memorystoreClient.exportBackupOperationCallable().futureCall(request); // Do something. Backup response = future.get(); } -
exportBackupCallable
Exports a specific backup to a customer target Cloud Storage URI.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ExportBackupRequest request = ExportBackupRequest.newBuilder() .setName( BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP_COLLECTION]", "[BACKUP]") .toString()) .build(); ApiFuture<Operation> future = memorystoreClient.exportBackupCallable().futureCall(request); // Do something. Operation response = future.get(); } -
backupInstanceAsync
Backup Instance. If this is the first time a backup is being created, a backup collection will be created at the backend, and this backup belongs to this collection. Both collection and backup will have a resource name. Backup will be executed for each shard. A replica (primary if nonHA) will be selected to perform the execution. Backup call will be rejected if there is an ongoing backup or update operation. Be aware that during preview, if the instance's internal software version is too old, critical update will be performed before actual backup. Once the internal software version is updated to the minimum version required by the backup feature, subsequent backups will not require critical update. After preview, there will be no critical update needed for 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); Instance response = memorystoreClient.backupInstanceAsync(name).get(); }- Parameters:
name- Required. Instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a Google Cloud region.- Throws:
ApiException- if the remote call fails
-
backupInstanceAsync
Backup Instance. If this is the first time a backup is being created, a backup collection will be created at the backend, and this backup belongs to this collection. Both collection and backup will have a resource name. Backup will be executed for each shard. A replica (primary if nonHA) will be selected to perform the execution. Backup call will be rejected if there is an ongoing backup or update operation. Be aware that during preview, if the instance's internal software version is too old, critical update will be performed before actual backup. Once the internal software version is updated to the minimum version required by the backup feature, subsequent backups will not require critical update. After preview, there will be no critical update needed for 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); Instance response = memorystoreClient.backupInstanceAsync(name).get(); }- Parameters:
name- Required. Instance resource name using the form: `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id` refers to a Google Cloud region.- Throws:
ApiException- if the remote call fails
-
backupInstanceAsync
public final OperationFuture<Instance,OperationMetadata> backupInstanceAsync(BackupInstanceRequest request) Backup Instance. If this is the first time a backup is being created, a backup collection will be created at the backend, and this backup belongs to this collection. Both collection and backup will have a resource name. Backup will be executed for each shard. A replica (primary if nonHA) will be selected to perform the execution. Backup call will be rejected if there is an ongoing backup or update operation. Be aware that during preview, if the instance's internal software version is too old, critical update will be performed before actual backup. Once the internal software version is updated to the minimum version required by the backup feature, subsequent backups will not require critical update. After preview, there will be no critical update needed for 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { BackupInstanceRequest request = BackupInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .setTtl(Duration.newBuilder().build()) .setBackupId("backupId2121930365") .build(); Instance response = memorystoreClient.backupInstanceAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
backupInstanceOperationCallable
public final OperationCallable<BackupInstanceRequest,Instance, backupInstanceOperationCallable()OperationMetadata> Backup Instance. If this is the first time a backup is being created, a backup collection will be created at the backend, and this backup belongs to this collection. Both collection and backup will have a resource name. Backup will be executed for each shard. A replica (primary if nonHA) will be selected to perform the execution. Backup call will be rejected if there is an ongoing backup or update operation. Be aware that during preview, if the instance's internal software version is too old, critical update will be performed before actual backup. Once the internal software version is updated to the minimum version required by the backup feature, subsequent backups will not require critical update. After preview, there will be no critical update needed for 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { BackupInstanceRequest request = BackupInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .setTtl(Duration.newBuilder().build()) .setBackupId("backupId2121930365") .build(); OperationFuture<Instance, OperationMetadata> future = memorystoreClient.backupInstanceOperationCallable().futureCall(request); // Do something. Instance response = future.get(); } -
backupInstanceCallable
Backup Instance. If this is the first time a backup is being created, a backup collection will be created at the backend, and this backup belongs to this collection. Both collection and backup will have a resource name. Backup will be executed for each shard. A replica (primary if nonHA) will be selected to perform the execution. Backup call will be rejected if there is an ongoing backup or update operation. Be aware that during preview, if the instance's internal software version is too old, critical update will be performed before actual backup. Once the internal software version is updated to the minimum version required by the backup feature, subsequent backups will not require critical update. After preview, there will be no critical update needed for 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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { BackupInstanceRequest request = BackupInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .setTtl(Duration.newBuilder().build()) .setBackupId("backupId2121930365") .build(); ApiFuture<Operation> future = memorystoreClient.backupInstanceCallable().futureCall(request); // Do something. Operation response = future.get(); } -
listLocations
public final MemorystoreClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Location element : memorystoreClient.listLocations(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listLocationsPagedCallable
public final UnaryCallable<ListLocationsRequest,MemorystoreClient.ListLocationsPagedResponse> listLocationsPagedCallable()Lists information about the supported locations for this service.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Location> future = memorystoreClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } } -
listLocationsCallable
Lists information about the supported locations for this service.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListLocationsResponse response = memorystoreClient.listLocationsCallable().call(request); for (Location element : response.getLocationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getLocation
Gets information about a location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = memorystoreClient.getLocation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getLocationCallable
Gets information about a location.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 (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = memorystoreClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-