Class CloudMemcacheClient
- java.lang.Object
-
- com.google.cloud.memcache.v1.CloudMemcacheClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class CloudMemcacheClient extends Object implements com.google.api.gax.core.BackgroundResource
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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns 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 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CloudMemcacheClient.ListInstancesFixedSizeCollection
static class
CloudMemcacheClient.ListInstancesPage
static class
CloudMemcacheClient.ListInstancesPagedResponse
static class
CloudMemcacheClient.ListLocationsFixedSizeCollection
static class
CloudMemcacheClient.ListLocationsPage
static class
CloudMemcacheClient.ListLocationsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
CloudMemcacheClient(CloudMemcacheSettings settings)
Constructs an instance of CloudMemcacheClient, using the given settings.protected
CloudMemcacheClient(CloudMemcacheStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.api.gax.longrunning.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.com.google.api.gax.longrunning.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.com.google.api.gax.longrunning.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.com.google.api.gax.rpc.UnaryCallable<ApplyParametersRequest,com.google.longrunning.Operation>
applyParametersCallable()
`ApplyParameters` restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached Instance.com.google.api.gax.rpc.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.boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static CloudMemcacheClient
create()
Constructs an instance of CloudMemcacheClient with default settings.static CloudMemcacheClient
create(CloudMemcacheSettings settings)
Constructs an instance of CloudMemcacheClient, using the given settings.static CloudMemcacheClient
create(CloudMemcacheStub stub)
Constructs an instance of CloudMemcacheClient, using the given stub for making calls.com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata>
createInstanceAsync(CreateInstanceRequest request)
Creates a new Instance in a given location.com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata>
createInstanceAsync(LocationName parent, Instance instance, String instanceId)
Creates a new Instance in a given location.com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata>
createInstanceAsync(String parent, Instance instance, String instanceId)
Creates a new Instance in a given location.com.google.api.gax.rpc.UnaryCallable<CreateInstanceRequest,com.google.longrunning.Operation>
createInstanceCallable()
Creates a new Instance in a given location.com.google.api.gax.rpc.OperationCallable<CreateInstanceRequest,Instance,OperationMetadata>
createInstanceOperationCallable()
Creates a new Instance in a given location.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata>
deleteInstanceAsync(DeleteInstanceRequest request)
Deletes a single Instance.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata>
deleteInstanceAsync(InstanceName name)
Deletes a single Instance.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata>
deleteInstanceAsync(String name)
Deletes a single Instance.com.google.api.gax.rpc.UnaryCallable<DeleteInstanceRequest,com.google.longrunning.Operation>
deleteInstanceCallable()
Deletes a single Instance.com.google.api.gax.rpc.OperationCallable<DeleteInstanceRequest,com.google.protobuf.Empty,OperationMetadata>
deleteInstanceOperationCallable()
Deletes a single Instance.com.google.api.gax.httpjson.longrunning.OperationsClient
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.Instance
getInstance(GetInstanceRequest request)
Gets details of a single Instance.Instance
getInstance(InstanceName name)
Gets details of a single Instance.Instance
getInstance(String name)
Gets details of a single Instance.com.google.api.gax.rpc.UnaryCallable<GetInstanceRequest,Instance>
getInstanceCallable()
Gets details of a single Instance.com.google.cloud.location.Location
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>
getLocationCallable()
Gets information about a location.com.google.longrunning.OperationsClient
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.CloudMemcacheSettings
getSettings()
CloudMemcacheStub
getStub()
boolean
isShutdown()
boolean
isTerminated()
CloudMemcacheClient.ListInstancesPagedResponse
listInstances(ListInstancesRequest request)
Lists Instances in a given location.CloudMemcacheClient.ListInstancesPagedResponse
listInstances(LocationName parent)
Lists Instances in a given location.CloudMemcacheClient.ListInstancesPagedResponse
listInstances(String parent)
Lists Instances in a given location.com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,ListInstancesResponse>
listInstancesCallable()
Lists Instances in a given location.com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,CloudMemcacheClient.ListInstancesPagedResponse>
listInstancesPagedCallable()
Lists Instances in a given location.CloudMemcacheClient.ListLocationsPagedResponse
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>
listLocationsCallable()
Lists information about the supported locations for this service.com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,CloudMemcacheClient.ListLocationsPagedResponse>
listLocationsPagedCallable()
Lists information about the supported locations for this service.com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata>
rescheduleMaintenanceAsync(InstanceName instance, RescheduleMaintenanceRequest.RescheduleType rescheduleType, com.google.protobuf.Timestamp scheduleTime)
Reschedules upcoming maintenance event.com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata>
rescheduleMaintenanceAsync(RescheduleMaintenanceRequest request)
Reschedules upcoming maintenance event.com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata>
rescheduleMaintenanceAsync(String instance, RescheduleMaintenanceRequest.RescheduleType rescheduleType, com.google.protobuf.Timestamp scheduleTime)
Reschedules upcoming maintenance event.com.google.api.gax.rpc.UnaryCallable<RescheduleMaintenanceRequest,com.google.longrunning.Operation>
rescheduleMaintenanceCallable()
Reschedules upcoming maintenance event.com.google.api.gax.rpc.OperationCallable<RescheduleMaintenanceRequest,Instance,OperationMetadata>
rescheduleMaintenanceOperationCallable()
Reschedules upcoming maintenance event.void
shutdown()
void
shutdownNow()
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata>
updateInstanceAsync(Instance instance, com.google.protobuf.FieldMask updateMask)
Updates an existing Instance in a given project and location.com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata>
updateInstanceAsync(UpdateInstanceRequest request)
Updates an existing Instance in a given project and location.com.google.api.gax.rpc.UnaryCallable<UpdateInstanceRequest,com.google.longrunning.Operation>
updateInstanceCallable()
Updates an existing Instance in a given project and location.com.google.api.gax.rpc.OperationCallable<UpdateInstanceRequest,Instance,OperationMetadata>
updateInstanceOperationCallable()
Updates an existing Instance in a given project and location.com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata>
updateParametersAsync(InstanceName name, com.google.protobuf.FieldMask updateMask, MemcacheParameters parameters)
Updates the defined Memcached parameters for an existing instance.com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata>
updateParametersAsync(UpdateParametersRequest request)
Updates the defined Memcached parameters for an existing instance.com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata>
updateParametersAsync(String name, com.google.protobuf.FieldMask updateMask, MemcacheParameters parameters)
Updates the defined Memcached parameters for an existing instance.com.google.api.gax.rpc.UnaryCallable<UpdateParametersRequest,com.google.longrunning.Operation>
updateParametersCallable()
Updates the defined Memcached parameters for an existing instance.com.google.api.gax.rpc.OperationCallable<UpdateParametersRequest,Instance,OperationMetadata>
updateParametersOperationCallable()
Updates the defined Memcached parameters for an existing instance.
-
-
-
Constructor Detail
-
CloudMemcacheClient
protected CloudMemcacheClient(CloudMemcacheSettings settings) throws IOException
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.- Throws:
IOException
-
CloudMemcacheClient
protected CloudMemcacheClient(CloudMemcacheStub stub)
-
-
Method Detail
-
create
public static final CloudMemcacheClient create() throws IOException
Constructs an instance of CloudMemcacheClient with default settings.- Throws:
IOException
-
create
public static final CloudMemcacheClient create(CloudMemcacheSettings settings) throws IOException
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.- Throws:
IOException
-
create
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).
-
getSettings
public final CloudMemcacheSettings getSettings()
-
getStub
public CloudMemcacheStub getStub()
-
getOperationsClient
public final com.google.longrunning.OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
getHttpJsonOperationsClient
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
listInstances
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); } }
- Parameters:
parent
- 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- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listInstances
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); } }
- Parameters:
parent
- 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- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listInstances
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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listInstancesPagedCallable
public final com.google.api.gax.rpc.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); } }
-
listInstancesCallable
public final com.google.api.gax.rpc.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.getInstancesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } }
-
getInstance
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); }
- Parameters:
name
- 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- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getInstance
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); }
- Parameters:
name
- 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- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getInstance
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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getInstanceCallable
public final com.google.api.gax.rpc.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(); }
-
createInstanceAsync
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> createInstanceAsync(LocationName parent, Instance instance, String instanceId)
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]"); Instance instance = Instance.newBuilder().build(); String instanceId = "instanceId902024336"; Instance response = cloudMemcacheClient.createInstanceAsync(parent, instance, instanceId).get(); }
- Parameters:
parent
- Required. The resource name of the instance location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP regioninstance
- Required. A Memcached InstanceinstanceId
- 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.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createInstanceAsync
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> createInstanceAsync(String parent, Instance instance, String instanceId)
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(); Instance instance = Instance.newBuilder().build(); String instanceId = "instanceId902024336"; Instance response = cloudMemcacheClient.createInstanceAsync(parent, instance, instanceId).get(); }
- Parameters:
parent
- Required. The resource name of the instance location using the form: `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP regioninstance
- Required. A Memcached InstanceinstanceId
- 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.
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createInstanceAsync
public final com.google.api.gax.longrunning.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") .setInstance(Instance.newBuilder().build()) .build(); Instance response = cloudMemcacheClient.createInstanceAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createInstanceOperationCallable
public final com.google.api.gax.rpc.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") .setInstance(Instance.newBuilder().build()) .build(); OperationFuture<Instance, OperationMetadata> future = cloudMemcacheClient.createInstanceOperationCallable().futureCall(request); // Do something. Instance response = future.get(); }
-
createInstanceCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateInstanceRequest,com.google.longrunning.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") .setInstance(Instance.newBuilder().build()) .build(); ApiFuture<Operation> future = cloudMemcacheClient.createInstanceCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
updateInstanceAsync
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> updateInstanceAsync(Instance instance, com.google.protobuf.FieldMask updateMask)
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()) { Instance instance = Instance.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Instance response = cloudMemcacheClient.updateInstanceAsync(instance, updateMask).get(); }
- Parameters:
instance
- Required. A Memcached Instance. Only fields specified in update_mask are updated.updateMask
- Required. Mask of fields to update.* `displayName`
- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateInstanceAsync
public final com.google.api.gax.longrunning.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()) .setInstance(Instance.newBuilder().build()) .build(); Instance response = cloudMemcacheClient.updateInstanceAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateInstanceOperationCallable
public final com.google.api.gax.rpc.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()) .setInstance(Instance.newBuilder().build()) .build(); OperationFuture<Instance, OperationMetadata> future = cloudMemcacheClient.updateInstanceOperationCallable().futureCall(request); // Do something. Instance response = future.get(); }
-
updateInstanceCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateInstanceRequest,com.google.longrunning.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()) .setInstance(Instance.newBuilder().build()) .build(); ApiFuture<Operation> future = cloudMemcacheClient.updateInstanceCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
updateParametersAsync
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> updateParametersAsync(InstanceName name, com.google.protobuf.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
- Required. Resource name of the Memcached instance for which the parameters should be updated.updateMask
- Required. Mask of fields to update.parameters
- The parameters to apply to the instance.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateParametersAsync
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> updateParametersAsync(String name, com.google.protobuf.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
- Required. Resource name of the Memcached instance for which the parameters should be updated.updateMask
- Required. Mask of fields to update.parameters
- The parameters to apply to the instance.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateParametersAsync
public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateParametersOperationCallable
public final com.google.api.gax.rpc.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(); }
-
updateParametersCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateParametersRequest,com.google.longrunning.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(); }
-
deleteInstanceAsync
public final com.google.api.gax.longrunning.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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) { InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); cloudMemcacheClient.deleteInstanceAsync(name).get(); }
- Parameters:
name
- 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- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteInstanceAsync
public final com.google.api.gax.longrunning.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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) { String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); cloudMemcacheClient.deleteInstanceAsync(name).get(); }
- Parameters:
name
- 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- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteInstanceAsync
public final com.google.api.gax.longrunning.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 (CloudMemcacheClient cloudMemcacheClient = CloudMemcacheClient.create()) { DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder() .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) .build(); cloudMemcacheClient.deleteInstanceAsync(request).get(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteInstanceOperationCallable
public final com.google.api.gax.rpc.OperationCallable<DeleteInstanceRequest,com.google.protobuf.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(); }
-
deleteInstanceCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteInstanceRequest,com.google.longrunning.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(); }
-
applyParametersAsync
public final com.google.api.gax.longrunning.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
- Required. Resource name of the Memcached instance for which parameter group updates should be applied.nodeIds
- Nodes to which the instance-level parameter group is applied.applyAll
- 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.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
applyParametersAsync
public final com.google.api.gax.longrunning.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
- Required. Resource name of the Memcached instance for which parameter group updates should be applied.nodeIds
- Nodes to which the instance-level parameter group is applied.applyAll
- 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.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
applyParametersAsync
public final com.google.api.gax.longrunning.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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
applyParametersOperationCallable
public final com.google.api.gax.rpc.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(); }
-
applyParametersCallable
public final com.google.api.gax.rpc.UnaryCallable<ApplyParametersRequest,com.google.longrunning.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(); }
-
rescheduleMaintenanceAsync
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> rescheduleMaintenanceAsync(InstanceName instance, 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 (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:
instance
- 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
- Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.scheduleTime
- 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`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
rescheduleMaintenanceAsync
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> rescheduleMaintenanceAsync(String instance, 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 (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:
instance
- 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
- Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.scheduleTime
- 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`.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
rescheduleMaintenanceAsync
public final com.google.api.gax.longrunning.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 (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(); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
rescheduleMaintenanceOperationCallable
public final com.google.api.gax.rpc.OperationCallable<RescheduleMaintenanceRequest,Instance,OperationMetadata> rescheduleMaintenanceOperationCallable()
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 (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(); }
-
rescheduleMaintenanceCallable
public final com.google.api.gax.rpc.UnaryCallable<RescheduleMaintenanceRequest,com.google.longrunning.Operation> 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 (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(); }
-
listLocations
public final CloudMemcacheClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.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); } }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listLocationsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.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); } }
-
listLocationsCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.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; } } }
-
getLocation
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.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); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getLocationCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.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(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-