Class CloudMemcacheClient (2.45.0)

GitHub RepositoryProduct Reference

Service Description: Configures and manages Cloud Memorystore for Memcached instances.

The memcache.googleapis.com service implements the Google Cloud Memorystore for Memcached API and defines the following resource model for managing Memorystore Memcached (also called Memcached below) instances:

  • The service works with a collection of cloud projects, named: /projects/*
  • Each project has a collection of available locations, named: /locations/*
  • Each location has a collection of Memcached instances, named: /instances/*
  • As such, Memcached instances are resources of the form: /projects/{project_id}/locations/{location_id}/instances/{instance_id}

Note that location_id must be a GCP region; for example:

  • projects/my-memcached-project/locations/us-central1/instances/my-memcached

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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   Instance response = cloudMemcacheClient.getInstance(name);
 }
 

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

Methods
Method Description Method Variants

ListInstances

Lists Instances in a given location.

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

  • listInstances(ListInstancesRequest request)

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

  • listInstances(LocationName parent)

  • listInstances(String parent)

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

  • listInstancesPagedCallable()

  • listInstancesCallable()

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.

  • getInstance(GetInstanceRequest request)

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

  • getInstance(InstanceName name)

  • getInstance(String name)

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

  • getInstanceCallable()

CreateInstance

Creates a new Instance in a given location.

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

  • createInstanceAsync(CreateInstanceRequest request)

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

  • createInstanceAsync(LocationName parent, String instanceId, Instance resource)

  • createInstanceAsync(String parent, String instanceId, Instance resource)

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

  • createInstanceOperationCallable()

  • createInstanceCallable()

UpdateInstance

Updates an existing 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.

  • updateInstanceAsync(UpdateInstanceRequest request)

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

  • updateInstanceAsync(FieldMask updateMask, Instance resource)

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

  • updateInstanceOperationCallable()

  • updateInstanceCallable()

UpdateParameters

Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by ApplyParameters to apply the parameters to nodes of the Memcached instance.

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

  • updateParametersAsync(UpdateParametersRequest request)

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

  • updateParametersAsync(InstanceName name, FieldMask updateMask, MemcacheParameters parameters)

  • updateParametersAsync(String name, FieldMask updateMask, MemcacheParameters parameters)

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

  • updateParametersOperationCallable()

  • updateParametersCallable()

DeleteInstance

Deletes a single Instance.

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

  • deleteInstanceAsync(DeleteInstanceRequest request)

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

  • deleteInstanceAsync(InstanceName name)

  • deleteInstanceAsync(String name)

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

  • deleteInstanceOperationCallable()

  • deleteInstanceCallable()

ApplyParameters

ApplyParameters restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached Instance.

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

  • applyParametersAsync(ApplyParametersRequest request)

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

  • applyParametersAsync(InstanceName name, List<String> nodeIds, boolean applyAll)

  • applyParametersAsync(String name, List<String> nodeIds, boolean applyAll)

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

  • applyParametersOperationCallable()

  • applyParametersCallable()

ApplySoftwareUpdate

Updates software on the selected nodes of the Instance.

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

  • applySoftwareUpdateAsync(ApplySoftwareUpdateRequest request)

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

  • applySoftwareUpdateAsync(InstanceName instance, List<String> nodeIds, boolean applyAll)

  • applySoftwareUpdateAsync(String instance, List<String> nodeIds, boolean applyAll)

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

  • applySoftwareUpdateOperationCallable()

  • applySoftwareUpdateCallable()

RescheduleMaintenance

Performs the apply phase of the RescheduleMaintenance verb.

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

  • rescheduleMaintenanceAsync(RescheduleMaintenanceRequest request)

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

  • rescheduleMaintenanceAsync(InstanceName instance, RescheduleMaintenanceRequest.RescheduleType rescheduleType, Timestamp scheduleTime)

  • rescheduleMaintenanceAsync(String instance, RescheduleMaintenanceRequest.RescheduleType rescheduleType, Timestamp scheduleTime)

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

  • rescheduleMaintenanceOperationCallable()

  • rescheduleMaintenanceCallable()

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.

  • listLocations(ListLocationsRequest request)

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

  • listLocationsPagedCallable()

  • listLocationsCallable()

GetLocation

Gets information about a location.

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

  • getLocation(GetLocationRequest request)

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

  • getLocationCallable()

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 CloudMemcacheSettings 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
 CloudMemcacheSettings cloudMemcacheSettings =
     CloudMemcacheSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create(cloudMemcacheSettings);
 

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
 CloudMemcacheSettings cloudMemcacheSettings =
     CloudMemcacheSettings.newBuilder().setEndpoint(myEndpoint).build();
 CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create(cloudMemcacheSettings);
 

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
 CloudMemcacheSettings cloudMemcacheSettings =
     CloudMemcacheSettings.newHttpJsonBuilder().build();
 CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create(cloudMemcacheSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > CloudMemcacheClient

Static Methods

create()

public static final CloudMemcacheClient create()

Constructs an instance of CloudMemcacheClient with default settings.

Returns
Type Description
CloudMemcacheClient
Exceptions
Type Description
IOException

create(CloudMemcacheSettings settings)

public static final CloudMemcacheClient create(CloudMemcacheSettings settings)

Constructs an instance of CloudMemcacheClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings CloudMemcacheSettings
Returns
Type Description
CloudMemcacheClient
Exceptions
Type Description
IOException

create(CloudMemcacheStub stub)

public static final CloudMemcacheClient create(CloudMemcacheStub stub)

Constructs an instance of CloudMemcacheClient, using the given stub for making calls. This is for advanced usage - prefer using create(CloudMemcacheSettings).

Parameter
Name Description
stub CloudMemcacheStub
Returns
Type Description
CloudMemcacheClient

Constructors

CloudMemcacheClient(CloudMemcacheSettings settings)

protected CloudMemcacheClient(CloudMemcacheSettings settings)

Constructs an instance of CloudMemcacheClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings CloudMemcacheSettings

CloudMemcacheClient(CloudMemcacheStub stub)

protected CloudMemcacheClient(CloudMemcacheStub stub)
Parameter
Name Description
stub CloudMemcacheStub

Methods

applyParametersAsync(ApplyParametersRequest request)

public final OperationFuture<Instance,OperationMetadata> applyParametersAsync(ApplyParametersRequest request)

ApplyParameters restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   ApplyParametersRequest request =
       ApplyParametersRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .addAllNodeIds(new ArrayList<String>())
           .setApplyAll(true)
           .build();
   Instance response = cloudMemcacheClient.applyParametersAsync(request).get();
 }
 
Parameter
Name Description
request ApplyParametersRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

applyParametersAsync(InstanceName name, List<String> nodeIds, boolean applyAll)

public final OperationFuture<Instance,OperationMetadata> applyParametersAsync(InstanceName name, List<String> nodeIds, boolean applyAll)

ApplyParameters restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   List<String> nodeIds = new ArrayList<>();
   boolean applyAll = true;
   Instance response = cloudMemcacheClient.applyParametersAsync(name, nodeIds, applyAll).get();
 }
 
Parameters
Name Description
name InstanceName

Required. Resource name of the Memcached instance for which parameter group updates should be applied.

nodeIds List<String>

Nodes to which the instance-level parameter group is applied.

applyAll boolean

Whether to apply instance-level parameter group to all nodes. If set to true, users are restricted from specifying individual nodes, and ApplyParameters updates all nodes within the instance.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

applyParametersAsync(String name, List<String> nodeIds, boolean applyAll)

public final OperationFuture<Instance,OperationMetadata> applyParametersAsync(String name, List<String> nodeIds, boolean applyAll)

ApplyParameters restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
   List<String> nodeIds = new ArrayList<>();
   boolean applyAll = true;
   Instance response = cloudMemcacheClient.applyParametersAsync(name, nodeIds, applyAll).get();
 }
 
Parameters
Name Description
name String

Required. Resource name of the Memcached instance for which parameter group updates should be applied.

nodeIds List<String>

Nodes to which the instance-level parameter group is applied.

applyAll boolean

Whether to apply instance-level parameter group to all nodes. If set to true, users are restricted from specifying individual nodes, and ApplyParameters updates all nodes within the instance.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

applyParametersCallable()

public final UnaryCallable<ApplyParametersRequest,Operation> applyParametersCallable()

ApplyParameters restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   ApplyParametersRequest request =
       ApplyParametersRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .addAllNodeIds(new ArrayList<String>())
           .setApplyAll(true)
           .build();
   ApiFuture<Operation> future =
       cloudMemcacheClient.applyParametersCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<ApplyParametersRequest,Operation>

applyParametersOperationCallable()

public final OperationCallable<ApplyParametersRequest,Instance,OperationMetadata> applyParametersOperationCallable()

ApplyParameters restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   ApplyParametersRequest request =
       ApplyParametersRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .addAllNodeIds(new ArrayList<String>())
           .setApplyAll(true)
           .build();
   OperationFuture<Instance, OperationMetadata> future =
       cloudMemcacheClient.applyParametersOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
Type Description
OperationCallable<ApplyParametersRequest,Instance,OperationMetadata>

applySoftwareUpdateAsync(ApplySoftwareUpdateRequest request)

public final OperationFuture<Instance,OperationMetadata> applySoftwareUpdateAsync(ApplySoftwareUpdateRequest request)

Updates software on the selected nodes of the 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   ApplySoftwareUpdateRequest request =
       ApplySoftwareUpdateRequest.newBuilder()
           .setInstance(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .addAllNodeIds(new ArrayList<String>())
           .setApplyAll(true)
           .build();
   Instance response = cloudMemcacheClient.applySoftwareUpdateAsync(request).get();
 }
 
Parameter
Name Description
request ApplySoftwareUpdateRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

applySoftwareUpdateAsync(InstanceName instance, List<String> nodeIds, boolean applyAll)

public final OperationFuture<Instance,OperationMetadata> applySoftwareUpdateAsync(InstanceName instance, List<String> nodeIds, boolean applyAll)

Updates software on the selected nodes of the 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   InstanceName instance = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   List<String> nodeIds = new ArrayList<>();
   boolean applyAll = true;
   Instance response =
       cloudMemcacheClient.applySoftwareUpdateAsync(instance, nodeIds, applyAll).get();
 }
 
Parameters
Name Description
instance InstanceName

Required. Resource name of the Memcached instance for which software update should be applied.

nodeIds List<String>

Nodes to which we should apply the update to. Note all the selected nodes are updated in parallel.

applyAll boolean

Whether to apply the update to all nodes. If set to true, will explicitly restrict users from specifying any nodes, and apply software update to all nodes (where applicable) within the instance.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

applySoftwareUpdateAsync(String instance, List<String> nodeIds, boolean applyAll)

public final OperationFuture<Instance,OperationMetadata> applySoftwareUpdateAsync(String instance, List<String> nodeIds, boolean applyAll)

Updates software on the selected nodes of the 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   String instance = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
   List<String> nodeIds = new ArrayList<>();
   boolean applyAll = true;
   Instance response =
       cloudMemcacheClient.applySoftwareUpdateAsync(instance, nodeIds, applyAll).get();
 }
 
Parameters
Name Description
instance String

Required. Resource name of the Memcached instance for which software update should be applied.

nodeIds List<String>

Nodes to which we should apply the update to. Note all the selected nodes are updated in parallel.

applyAll boolean

Whether to apply the update to all nodes. If set to true, will explicitly restrict users from specifying any nodes, and apply software update to all nodes (where applicable) within the instance.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

applySoftwareUpdateCallable()

public final UnaryCallable<ApplySoftwareUpdateRequest,Operation> applySoftwareUpdateCallable()

Updates software on the selected nodes of the 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   ApplySoftwareUpdateRequest request =
       ApplySoftwareUpdateRequest.newBuilder()
           .setInstance(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .addAllNodeIds(new ArrayList<String>())
           .setApplyAll(true)
           .build();
   ApiFuture<Operation> future =
       cloudMemcacheClient.applySoftwareUpdateCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<ApplySoftwareUpdateRequest,Operation>

applySoftwareUpdateOperationCallable()

public final OperationCallable<ApplySoftwareUpdateRequest,Instance,OperationMetadata> applySoftwareUpdateOperationCallable()

Updates software on the selected nodes of the 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   ApplySoftwareUpdateRequest request =
       ApplySoftwareUpdateRequest.newBuilder()
           .setInstance(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .addAllNodeIds(new ArrayList<String>())
           .setApplyAll(true)
           .build();
   OperationFuture<Instance, OperationMetadata> future =
       cloudMemcacheClient.applySoftwareUpdateOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
Type Description
OperationCallable<ApplySoftwareUpdateRequest,Instance,OperationMetadata>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

createInstanceAsync(CreateInstanceRequest request)

public final OperationFuture<Instance,OperationMetadata> createInstanceAsync(CreateInstanceRequest request)

Creates a new Instance in a given 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setInstanceId("instanceId902024336")
           .setResource(Instance.newBuilder().build())
           .build();
   Instance response = cloudMemcacheClient.createInstanceAsync(request).get();
 }
 
Parameter
Name Description
request CreateInstanceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

createInstanceAsync(LocationName parent, String instanceId, Instance resource)

public final OperationFuture<Instance,OperationMetadata> createInstanceAsync(LocationName parent, String instanceId, Instance resource)

Creates a new Instance in a given 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   String instanceId = "instanceId902024336";
   Instance resource = Instance.newBuilder().build();
   Instance response =
       cloudMemcacheClient.createInstanceAsync(parent, instanceId, resource).get();
 }
 
Parameters
Name Description
parent LocationName

Required. The resource name of the instance location using the form: projects/{project_id}/locations/{location_id} where location_id refers to a GCP region

instanceId String

Required. The logical name of the Memcached instance in the user project with the following restrictions:

  • Must contain only lowercase letters, numbers, and hyphens.
  • Must start with a letter.
  • Must be between 1-40 characters.
  • Must end with a number or a letter.
  • Must be unique within the user project / location.

If any of the above are not met, the API raises an invalid argument error.

resource Instance

Required. A Memcached [Instance] resource

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

createInstanceAsync(String parent, String instanceId, Instance resource)

public final OperationFuture<Instance,OperationMetadata> createInstanceAsync(String parent, String instanceId, Instance resource)

Creates a new Instance in a given 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   String instanceId = "instanceId902024336";
   Instance resource = Instance.newBuilder().build();
   Instance response =
       cloudMemcacheClient.createInstanceAsync(parent, instanceId, resource).get();
 }
 
Parameters
Name Description
parent String

Required. The resource name of the instance location using the form: projects/{project_id}/locations/{location_id} where location_id refers to a GCP region

instanceId String

Required. The logical name of the Memcached instance in the user project with the following restrictions:

  • Must contain only lowercase letters, numbers, and hyphens.
  • Must start with a letter.
  • Must be between 1-40 characters.
  • Must end with a number or a letter.
  • Must be unique within the user project / location.

If any of the above are not met, the API raises an invalid argument error.

resource Instance

Required. A Memcached [Instance] resource

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

createInstanceCallable()

public final UnaryCallable<CreateInstanceRequest,Operation> createInstanceCallable()

Creates a new Instance in a given 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setInstanceId("instanceId902024336")
           .setResource(Instance.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       cloudMemcacheClient.createInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateInstanceRequest,Operation>

createInstanceOperationCallable()

public final OperationCallable<CreateInstanceRequest,Instance,OperationMetadata> createInstanceOperationCallable()

Creates a new Instance in a given 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   CreateInstanceRequest request =
       CreateInstanceRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setInstanceId("instanceId902024336")
           .setResource(Instance.newBuilder().build())
           .build();
   OperationFuture<Instance, OperationMetadata> future =
       cloudMemcacheClient.createInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateInstanceRequest,Instance,OperationMetadata>

deleteInstanceAsync(DeleteInstanceRequest request)

public final OperationFuture<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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .build();
   cloudMemcacheClient.deleteInstanceAsync(request).get();
 }
 
Parameter
Name Description
request DeleteInstanceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteInstanceAsync(InstanceName name)

public final OperationFuture<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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   cloudMemcacheClient.deleteInstanceAsync(name).get();
 }
 
Parameter
Name Description
name InstanceName

Required. Memcached instance resource name in the format: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteInstanceAsync(String name)

public final OperationFuture<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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
   cloudMemcacheClient.deleteInstanceAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. Memcached instance resource name in the format: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region

Returns
Type Description
OperationFuture<Empty,OperationMetadata>

deleteInstanceCallable()

public final UnaryCallable<DeleteInstanceRequest,Operation> 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .build();
   ApiFuture<Operation> future =
       cloudMemcacheClient.deleteInstanceCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteInstanceRequest,Operation>

deleteInstanceOperationCallable()

public final OperationCallable<DeleteInstanceRequest,Empty,OperationMetadata> deleteInstanceOperationCallable()

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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .build();
   OperationFuture<Empty, OperationMetadata> future =
       cloudMemcacheClient.deleteInstanceOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
OperationCallable<DeleteInstanceRequest,Empty,OperationMetadata>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getInstance(GetInstanceRequest request)

public final Instance getInstance(GetInstanceRequest request)

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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   GetInstanceRequest request =
       GetInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .build();
   Instance response = cloudMemcacheClient.getInstance(request);
 }
 
Parameter
Name Description
request GetInstanceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Instance

getInstance(InstanceName name)

public final Instance getInstance(InstanceName name)

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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   Instance response = cloudMemcacheClient.getInstance(name);
 }
 
Parameter
Name Description
name InstanceName

Required. Memcached instance resource name in the format: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region

Returns
Type Description
Instance

getInstance(String name)

public final Instance getInstance(String name)

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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
   Instance response = cloudMemcacheClient.getInstance(name);
 }
 
Parameter
Name Description
name String

Required. Memcached instance resource name in the format: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region

Returns
Type Description
Instance

getInstanceCallable()

public final UnaryCallable<GetInstanceRequest,Instance> 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   GetInstanceRequest request =
       GetInstanceRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .build();
   ApiFuture<Instance> future = cloudMemcacheClient.getInstanceCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetInstanceRequest,Instance>

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = cloudMemcacheClient.getLocation(request);
 }
 
Parameter
Name Description
request com.google.cloud.location.GetLocationRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,Location> 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future = cloudMemcacheClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getSettings()

public final CloudMemcacheSettings getSettings()
Returns
Type Description
CloudMemcacheSettings

getStub()

public CloudMemcacheStub getStub()
Returns
Type Description
CloudMemcacheStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listInstances(ListInstancesRequest request)

public final CloudMemcacheClient.ListInstancesPagedResponse listInstances(ListInstancesRequest request)

Lists Instances in a given 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.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 : cloudMemcacheClient.listInstances(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListInstancesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
CloudMemcacheClient.ListInstancesPagedResponse

listInstances(LocationName parent)

public final CloudMemcacheClient.ListInstancesPagedResponse listInstances(LocationName parent)

Lists Instances in a given 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Instance element : cloudMemcacheClient.listInstances(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. The resource name of the instance location using the form: projects/{project_id}/locations/{location_id} where location_id refers to a GCP region

Returns
Type Description
CloudMemcacheClient.ListInstancesPagedResponse

listInstances(String parent)

public final CloudMemcacheClient.ListInstancesPagedResponse listInstances(String parent)

Lists Instances in a given 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Instance element : cloudMemcacheClient.listInstances(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The resource name of the instance location using the form: projects/{project_id}/locations/{location_id} where location_id refers to a GCP region

Returns
Type Description
CloudMemcacheClient.ListInstancesPagedResponse

listInstancesCallable()

public final UnaryCallable<ListInstancesRequest,ListInstancesResponse> listInstancesCallable()

Lists Instances in a given 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.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 = cloudMemcacheClient.listInstancesCallable().call(request);
     for (Instance element : response.getResourcesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstancesRequest,ListInstancesResponse>

listInstancesPagedCallable()

public final UnaryCallable<ListInstancesRequest,CloudMemcacheClient.ListInstancesPagedResponse> listInstancesPagedCallable()

Lists Instances in a given 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.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 =
       cloudMemcacheClient.listInstancesPagedCallable().futureCall(request);
   // Do something.
   for (Instance element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListInstancesRequest,ListInstancesPagedResponse>

listLocations(ListLocationsRequest request)

public final CloudMemcacheClient.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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : cloudMemcacheClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request com.google.cloud.location.ListLocationsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
CloudMemcacheClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response = cloudMemcacheClient.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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,CloudMemcacheClient.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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future =
       cloudMemcacheClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

rescheduleMaintenanceAsync(InstanceName instance, RescheduleMaintenanceRequest.RescheduleType rescheduleType, Timestamp scheduleTime)

public final OperationFuture<Instance,OperationMetadata> rescheduleMaintenanceAsync(InstanceName instance, RescheduleMaintenanceRequest.RescheduleType rescheduleType, Timestamp scheduleTime)

Performs the apply phase of the RescheduleMaintenance verb.

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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   InstanceName instance = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   RescheduleMaintenanceRequest.RescheduleType rescheduleType =
       RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
   Timestamp scheduleTime = Timestamp.newBuilder().build();
   Instance response =
       cloudMemcacheClient
           .rescheduleMaintenanceAsync(instance, rescheduleType, scheduleTime)
           .get();
 }
 
Parameters
Name Description
instance InstanceName

Required. Memcache instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.

rescheduleType RescheduleMaintenanceRequest.RescheduleType

Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.

scheduleTime Timestamp

Timestamp when the maintenance shall be rescheduled to if reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

rescheduleMaintenanceAsync(RescheduleMaintenanceRequest request)

public final OperationFuture<Instance,OperationMetadata> rescheduleMaintenanceAsync(RescheduleMaintenanceRequest request)

Performs the apply phase of the RescheduleMaintenance verb.

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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   RescheduleMaintenanceRequest request =
       RescheduleMaintenanceRequest.newBuilder()
           .setInstance(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setScheduleTime(Timestamp.newBuilder().build())
           .build();
   Instance response = cloudMemcacheClient.rescheduleMaintenanceAsync(request).get();
 }
 
Parameter
Name Description
request RescheduleMaintenanceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

rescheduleMaintenanceAsync(String instance, RescheduleMaintenanceRequest.RescheduleType rescheduleType, Timestamp scheduleTime)

public final OperationFuture<Instance,OperationMetadata> rescheduleMaintenanceAsync(String instance, RescheduleMaintenanceRequest.RescheduleType rescheduleType, Timestamp scheduleTime)

Performs the apply phase of the RescheduleMaintenance verb.

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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   String instance = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
   RescheduleMaintenanceRequest.RescheduleType rescheduleType =
       RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
   Timestamp scheduleTime = Timestamp.newBuilder().build();
   Instance response =
       cloudMemcacheClient
           .rescheduleMaintenanceAsync(instance, rescheduleType, scheduleTime)
           .get();
 }
 
Parameters
Name Description
instance String

Required. Memcache instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.

rescheduleType RescheduleMaintenanceRequest.RescheduleType

Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.

scheduleTime Timestamp

Timestamp when the maintenance shall be rescheduled to if reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

rescheduleMaintenanceCallable()

public final UnaryCallable<RescheduleMaintenanceRequest,Operation> rescheduleMaintenanceCallable()

Performs the apply phase of the RescheduleMaintenance verb.

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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   RescheduleMaintenanceRequest request =
       RescheduleMaintenanceRequest.newBuilder()
           .setInstance(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setScheduleTime(Timestamp.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       cloudMemcacheClient.rescheduleMaintenanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<RescheduleMaintenanceRequest,Operation>

rescheduleMaintenanceOperationCallable()

public final OperationCallable<RescheduleMaintenanceRequest,Instance,OperationMetadata> rescheduleMaintenanceOperationCallable()

Performs the apply phase of the RescheduleMaintenance verb.

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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   RescheduleMaintenanceRequest request =
       RescheduleMaintenanceRequest.newBuilder()
           .setInstance(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setScheduleTime(Timestamp.newBuilder().build())
           .build();
   OperationFuture<Instance, OperationMetadata> future =
       cloudMemcacheClient.rescheduleMaintenanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
Type Description
OperationCallable<RescheduleMaintenanceRequest,Instance,OperationMetadata>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateInstanceAsync(UpdateInstanceRequest request)

public final OperationFuture<Instance,OperationMetadata> updateInstanceAsync(UpdateInstanceRequest request)

Updates an existing 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setResource(Instance.newBuilder().build())
           .build();
   Instance response = cloudMemcacheClient.updateInstanceAsync(request).get();
 }
 
Parameter
Name Description
request UpdateInstanceRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

updateInstanceAsync(FieldMask updateMask, Instance resource)

public final OperationFuture<Instance,OperationMetadata> updateInstanceAsync(FieldMask updateMask, Instance resource)

Updates an existing 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   FieldMask updateMask = FieldMask.newBuilder().build();
   Instance resource = Instance.newBuilder().build();
   Instance response = cloudMemcacheClient.updateInstanceAsync(updateMask, resource).get();
 }
 
Parameters
Name Description
updateMask FieldMask

Required. Mask of fields to update.

* displayName

resource Instance

Required. A Memcached [Instance] resource. Only fields specified in update_mask are updated.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

updateInstanceCallable()

public final UnaryCallable<UpdateInstanceRequest,Operation> updateInstanceCallable()

Updates an existing 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setResource(Instance.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       cloudMemcacheClient.updateInstanceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateInstanceRequest,Operation>

updateInstanceOperationCallable()

public final OperationCallable<UpdateInstanceRequest,Instance,OperationMetadata> updateInstanceOperationCallable()

Updates an existing 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setResource(Instance.newBuilder().build())
           .build();
   OperationFuture<Instance, OperationMetadata> future =
       cloudMemcacheClient.updateInstanceOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdateInstanceRequest,Instance,OperationMetadata>

updateParametersAsync(InstanceName name, FieldMask updateMask, MemcacheParameters parameters)

public final OperationFuture<Instance,OperationMetadata> updateParametersAsync(InstanceName name, FieldMask updateMask, MemcacheParameters parameters)

Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by ApplyParameters to apply the parameters to nodes of the Memcached 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
   FieldMask updateMask = FieldMask.newBuilder().build();
   MemcacheParameters parameters = MemcacheParameters.newBuilder().build();
   Instance response =
       cloudMemcacheClient.updateParametersAsync(name, updateMask, parameters).get();
 }
 
Parameters
Name Description
name InstanceName

Required. Resource name of the Memcached instance for which the parameters should be updated.

updateMask FieldMask

Required. Mask of fields to update.

parameters MemcacheParameters

The parameters to apply to the instance.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

updateParametersAsync(UpdateParametersRequest request)

public final OperationFuture<Instance,OperationMetadata> updateParametersAsync(UpdateParametersRequest request)

Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by ApplyParameters to apply the parameters to nodes of the Memcached 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   UpdateParametersRequest request =
       UpdateParametersRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setParameters(MemcacheParameters.newBuilder().build())
           .build();
   Instance response = cloudMemcacheClient.updateParametersAsync(request).get();
 }
 
Parameter
Name Description
request UpdateParametersRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

updateParametersAsync(String name, FieldMask updateMask, MemcacheParameters parameters)

public final OperationFuture<Instance,OperationMetadata> updateParametersAsync(String name, FieldMask updateMask, MemcacheParameters parameters)

Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by ApplyParameters to apply the parameters to nodes of the Memcached 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
   FieldMask updateMask = FieldMask.newBuilder().build();
   MemcacheParameters parameters = MemcacheParameters.newBuilder().build();
   Instance response =
       cloudMemcacheClient.updateParametersAsync(name, updateMask, parameters).get();
 }
 
Parameters
Name Description
name String

Required. Resource name of the Memcached instance for which the parameters should be updated.

updateMask FieldMask

Required. Mask of fields to update.

parameters MemcacheParameters

The parameters to apply to the instance.

Returns
Type Description
OperationFuture<Instance,OperationMetadata>

updateParametersCallable()

public final UnaryCallable<UpdateParametersRequest,Operation> updateParametersCallable()

Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by ApplyParameters to apply the parameters to nodes of the Memcached 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   UpdateParametersRequest request =
       UpdateParametersRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setParameters(MemcacheParameters.newBuilder().build())
           .build();
   ApiFuture<Operation> future =
       cloudMemcacheClient.updateParametersCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateParametersRequest,Operation>

updateParametersOperationCallable()

public final OperationCallable<UpdateParametersRequest,Instance,OperationMetadata> updateParametersOperationCallable()

Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by ApplyParameters to apply the parameters to nodes of the Memcached 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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) {
   UpdateParametersRequest request =
       UpdateParametersRequest.newBuilder()
           .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
           .setUpdateMask(FieldMask.newBuilder().build())
           .setParameters(MemcacheParameters.newBuilder().build())
           .build();
   OperationFuture<Instance, OperationMetadata> future =
       cloudMemcacheClient.updateParametersOperationCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
Type Description
OperationCallable<UpdateParametersRequest,Instance,OperationMetadata>