Class CloudMemcacheClient (2.78.0)
Stay organized with collections
Save and categorize content based on your preferences.
- 2.78.0 (latest)
- 2.76.0
- 2.75.0
- 2.74.0
- 2.73.0
- 2.72.0
- 2.70.0
- 2.68.0
- 2.67.0
- 2.64.0
- 2.63.0
- 2.62.0
- 2.60.0
- 2.59.0
- 2.58.0
- 2.57.0
- 2.56.0
- 2.55.0
- 2.54.0
- 2.53.0
- 2.52.0
- 2.51.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.40.0
- 2.39.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.28.0
- 2.27.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.11.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.6
- 2.2.1
- 2.1.11
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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
Instanceresponse=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().
| 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.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetInstance |
Gets details of a single Instance. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateInstance |
Creates a new Instance in a given location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateInstance |
Updates 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.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateParameters |
Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteInstance |
Deletes a single Instance. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ApplyParameters |
|
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of 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
CloudMemcacheSettingscloudMemcacheSettings=
CloudMemcacheSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
CloudMemcacheClientcloudMemcacheClient=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
CloudMemcacheSettingscloudMemcacheSettings=
CloudMemcacheSettings.newBuilder().setEndpoint(myEndpoint).build();
CloudMemcacheClientcloudMemcacheClient=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
CloudMemcacheSettingscloudMemcacheSettings=
CloudMemcacheSettings.newHttpJsonBuilder().build();
CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create(cloudMemcacheSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
publicstaticfinalCloudMemcacheClientcreate()Constructs an instance of CloudMemcacheClient with default settings.
| Returns | |
|---|---|
| Type | Description |
CloudMemcacheClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(CloudMemcacheSettings settings)
publicstaticfinalCloudMemcacheClientcreate(CloudMemcacheSettingssettings)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)
publicstaticfinalCloudMemcacheClientcreate(CloudMemcacheStubstub)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)
protectedCloudMemcacheClient(CloudMemcacheSettingssettings)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)
protectedCloudMemcacheClient(CloudMemcacheStubstub)| Parameter | |
|---|---|
| Name | Description |
stub |
CloudMemcacheStub |
Methods
applyParametersAsync(ApplyParametersRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>applyParametersAsync(ApplyParametersRequestrequest)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ApplyParametersRequestrequest=
ApplyParametersRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.addAllNodeIds(newArrayList<String>())
.setApplyAll(true)
.build();
Instanceresponse=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)
publicfinalOperationFuture<Instance,OperationMetadata>applyParametersAsync(InstanceNamename,List<String>nodeIds,booleanapplyAll)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
List<String>nodeIds=newArrayList<>();
booleanapplyAll=true;
Instanceresponse=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 |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
applyParametersAsync(String name, List<String> nodeIds, boolean applyAll)
publicfinalOperationFuture<Instance,OperationMetadata>applyParametersAsync(Stringname,List<String>nodeIds,booleanapplyAll)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
Stringname=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
List<String>nodeIds=newArrayList<>();
booleanapplyAll=true;
Instanceresponse=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 |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
applyParametersCallable()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ApplyParametersRequestrequest=
ApplyParametersRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.addAllNodeIds(newArrayList<String>())
.setApplyAll(true)
.build();
ApiFuture<Operation>future=
cloudMemcacheClient.applyParametersCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ApplyParametersRequest,Operation> |
|
applyParametersOperationCallable()
publicfinalOperationCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ApplyParametersRequestrequest=
ApplyParametersRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.addAllNodeIds(newArrayList<String>())
.setApplyAll(true)
.build();
OperationFuture<Instance,OperationMetadata>future=
cloudMemcacheClient.applyParametersOperationCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<ApplyParametersRequest,Instance,OperationMetadata> |
|
applySoftwareUpdateAsync(ApplySoftwareUpdateRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>applySoftwareUpdateAsync(ApplySoftwareUpdateRequestrequest)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ApplySoftwareUpdateRequestrequest=
ApplySoftwareUpdateRequest.newBuilder()
.setInstance(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.addAllNodeIds(newArrayList<String>())
.setApplyAll(true)
.build();
Instanceresponse=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)
publicfinalOperationFuture<Instance,OperationMetadata>applySoftwareUpdateAsync(InstanceNameinstance,List<String>nodeIds,booleanapplyAll)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
InstanceNameinstance=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
List<String>nodeIds=newArrayList<>();
booleanapplyAll=true;
Instanceresponse=
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)
publicfinalOperationFuture<Instance,OperationMetadata>applySoftwareUpdateAsync(Stringinstance,List<String>nodeIds,booleanapplyAll)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
Stringinstance=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
List<String>nodeIds=newArrayList<>();
booleanapplyAll=true;
Instanceresponse=
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()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ApplySoftwareUpdateRequestrequest=
ApplySoftwareUpdateRequest.newBuilder()
.setInstance(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.addAllNodeIds(newArrayList<String>())
.setApplyAll(true)
.build();
ApiFuture<Operation>future=
cloudMemcacheClient.applySoftwareUpdateCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ApplySoftwareUpdateRequest,Operation> |
|
applySoftwareUpdateOperationCallable()
publicfinalOperationCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ApplySoftwareUpdateRequestrequest=
ApplySoftwareUpdateRequest.newBuilder()
.setInstance(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.addAllNodeIds(newArrayList<String>())
.setApplyAll(true)
.build();
OperationFuture<Instance,OperationMetadata>future=
cloudMemcacheClient.applySoftwareUpdateOperationCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<ApplySoftwareUpdateRequest,Instance,OperationMetadata> |
|
awaitTermination(long duration, TimeUnit unit)
publicbooleanawaitTermination(longduration,TimeUnitunit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
publicfinalvoidclose()createInstanceAsync(CreateInstanceRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>createInstanceAsync(CreateInstanceRequestrequest)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
CreateInstanceRequestrequest=
CreateInstanceRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setInstanceId("instanceId902024336")
.setResource(Instance.newBuilder().build())
.build();
Instanceresponse=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)
publicfinalOperationFuture<Instance,OperationMetadata>createInstanceAsync(LocationNameparent,StringinstanceId,Instanceresource)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
StringinstanceId="instanceId902024336";
Instanceresource=Instance.newBuilder().build();
Instanceresponse=
cloudMemcacheClient.createInstanceAsync(parent,instanceId,resource).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
LocationName Required. The resource name of the instance location using the form:
|
instanceId |
String Required. The logical name of the Memcached instance in the user project with the following restrictions:
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)
publicfinalOperationFuture<Instance,OperationMetadata>createInstanceAsync(Stringparent,StringinstanceId,Instanceresource)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
StringinstanceId="instanceId902024336";
Instanceresource=Instance.newBuilder().build();
Instanceresponse=
cloudMemcacheClient.createInstanceAsync(parent,instanceId,resource).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
String Required. The resource name of the instance location using the form:
|
instanceId |
String Required. The logical name of the Memcached instance in the user project with the following restrictions:
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()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
CreateInstanceRequestrequest=
CreateInstanceRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setInstanceId("instanceId902024336")
.setResource(Instance.newBuilder().build())
.build();
ApiFuture<Operation>future=
cloudMemcacheClient.createInstanceCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateInstanceRequest,Operation> |
|
createInstanceOperationCallable()
publicfinalOperationCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
CreateInstanceRequestrequest=
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.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<CreateInstanceRequest,Instance,OperationMetadata> |
|
deleteInstanceAsync(DeleteInstanceRequest request)
publicfinalOperationFuture<Empty,OperationMetadata>deleteInstanceAsync(DeleteInstanceRequestrequest)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
DeleteInstanceRequestrequest=
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)
publicfinalOperationFuture<Empty,OperationMetadata>deleteInstanceAsync(InstanceNamename)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
cloudMemcacheClient.deleteInstanceAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
InstanceName Required. Memcached instance resource name in the format:
|
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,OperationMetadata> |
|
deleteInstanceAsync(String name)
publicfinalOperationFuture<Empty,OperationMetadata>deleteInstanceAsync(Stringname)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
Stringname=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
cloudMemcacheClient.deleteInstanceAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
String Required. Memcached instance resource name in the format:
|
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,OperationMetadata> |
|
deleteInstanceCallable()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
DeleteInstanceRequestrequest=
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()
publicfinalOperationCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
DeleteInstanceRequestrequest=
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()
publicfinalOperationsClientgetHttpJsonOperationsClient()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)
publicfinalInstancegetInstance(GetInstanceRequestrequest)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
GetInstanceRequestrequest=
GetInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
Instanceresponse=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)
publicfinalInstancegetInstance(InstanceNamename)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
Instanceresponse=cloudMemcacheClient.getInstance(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
InstanceName Required. Memcached instance resource name in the format:
|
| Returns | |
|---|---|
| Type | Description |
Instance |
|
getInstance(String name)
publicfinalInstancegetInstance(Stringname)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
Stringname=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
Instanceresponse=cloudMemcacheClient.getInstance(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
String Required. Memcached instance resource name in the format:
|
| Returns | |
|---|---|
| Type | Description |
Instance |
|
getInstanceCallable()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
GetInstanceRequestrequest=
GetInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
ApiFuture<Instance>future=cloudMemcacheClient.getInstanceCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetInstanceRequest,Instance> |
|
getLocation(GetLocationRequest request)
publicfinalLocationgetLocation(GetLocationRequestrequest)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
GetLocationRequestrequest=GetLocationRequest.newBuilder().setName("name3373707").build();
Locationresponse=cloudMemcacheClient.getLocation(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.cloud.location.GetLocationRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
com.google.cloud.location.Location |
|
getLocationCallable()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
GetLocationRequestrequest=GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location>future=cloudMemcacheClient.getLocationCallable().futureCall(request);
// Do something.
Locationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
|
getOperationsClient()
publicfinalOperationsClientgetOperationsClient()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()
publicfinalCloudMemcacheSettingsgetSettings()| Returns | |
|---|---|
| Type | Description |
CloudMemcacheSettings |
|
getStub()
publicCloudMemcacheStubgetStub()| Returns | |
|---|---|
| Type | Description |
CloudMemcacheStub |
|
isShutdown()
publicbooleanisShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
publicbooleanisTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listInstances(ListInstancesRequest request)
publicfinalCloudMemcacheClient.ListInstancesPagedResponselistInstances(ListInstancesRequestrequest)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ListInstancesRequestrequest=
ListInstancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
for(Instanceelement: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)
publicfinalCloudMemcacheClient.ListInstancesPagedResponselistInstances(LocationNameparent)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
for(Instanceelement:cloudMemcacheClient.listInstances(parent).iterateAll()){
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
LocationName Required. The resource name of the instance location using the form:
|
| Returns | |
|---|---|
| Type | Description |
CloudMemcacheClient.ListInstancesPagedResponse |
|
listInstances(String parent)
publicfinalCloudMemcacheClient.ListInstancesPagedResponselistInstances(Stringparent)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
for(Instanceelement:cloudMemcacheClient.listInstances(parent).iterateAll()){
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
String Required. The resource name of the instance location using the form:
|
| Returns | |
|---|---|
| Type | Description |
CloudMemcacheClient.ListInstancesPagedResponse |
|
listInstancesCallable()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ListInstancesRequestrequest=
ListInstancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setOrderBy("orderBy-1207110587")
.build();
while(true){
ListInstancesResponseresponse=cloudMemcacheClient.listInstancesCallable().call(request);
for(Instanceelement:response.getResourcesList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListInstancesRequest,ListInstancesResponse> |
|
listInstancesPagedCallable()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ListInstancesRequestrequest=
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(Instanceelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListInstancesRequest,ListInstancesPagedResponse> |
|
listLocations(ListLocationsRequest request)
publicfinalCloudMemcacheClient.ListLocationsPagedResponselistLocations(ListLocationsRequestrequest)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for(Locationelement:cloudMemcacheClient.listLocations(request).iterateAll()){
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.cloud.location.ListLocationsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
CloudMemcacheClient.ListLocationsPagedResponse |
|
listLocationsCallable()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while(true){
ListLocationsResponseresponse=cloudMemcacheClient.listLocationsCallable().call(request);
for(Locationelement:response.getLocationsList()){
// doThingsWith(element);
}
StringnextPageToken=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()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location>future=
cloudMemcacheClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for(Locationelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse> |
|
rescheduleMaintenanceAsync(InstanceName instance, RescheduleMaintenanceRequest.RescheduleType rescheduleType, Timestamp scheduleTime)
publicfinalOperationFuture<Instance,OperationMetadata>rescheduleMaintenanceAsync(InstanceNameinstance,RescheduleMaintenanceRequest.RescheduleTyperescheduleType,TimestampscheduleTime)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
InstanceNameinstance=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
RescheduleMaintenanceRequest.RescheduleTyperescheduleType=
RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
TimestampscheduleTime=Timestamp.newBuilder().build();
Instanceresponse=
cloudMemcacheClient
.rescheduleMaintenanceAsync(instance,rescheduleType,scheduleTime)
.get();
}
| Parameters | |
|---|---|
| Name | Description |
instance |
InstanceName Required. Memcache instance resource name using the form:
|
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 |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
rescheduleMaintenanceAsync(RescheduleMaintenanceRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>rescheduleMaintenanceAsync(RescheduleMaintenanceRequestrequest)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
RescheduleMaintenanceRequestrequest=
RescheduleMaintenanceRequest.newBuilder()
.setInstance(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.setScheduleTime(Timestamp.newBuilder().build())
.build();
Instanceresponse=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)
publicfinalOperationFuture<Instance,OperationMetadata>rescheduleMaintenanceAsync(Stringinstance,RescheduleMaintenanceRequest.RescheduleTyperescheduleType,TimestampscheduleTime)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
Stringinstance=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
RescheduleMaintenanceRequest.RescheduleTyperescheduleType=
RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
TimestampscheduleTime=Timestamp.newBuilder().build();
Instanceresponse=
cloudMemcacheClient
.rescheduleMaintenanceAsync(instance,rescheduleType,scheduleTime)
.get();
}
| Parameters | |
|---|---|
| Name | Description |
instance |
String Required. Memcache instance resource name using the form:
|
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 |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
rescheduleMaintenanceCallable()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
RescheduleMaintenanceRequestrequest=
RescheduleMaintenanceRequest.newBuilder()
.setInstance(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.setScheduleTime(Timestamp.newBuilder().build())
.build();
ApiFuture<Operation>future=
cloudMemcacheClient.rescheduleMaintenanceCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<RescheduleMaintenanceRequest,Operation> |
|
rescheduleMaintenanceOperationCallable()
publicfinalOperationCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
RescheduleMaintenanceRequestrequest=
RescheduleMaintenanceRequest.newBuilder()
.setInstance(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.setScheduleTime(Timestamp.newBuilder().build())
.build();
OperationFuture<Instance,OperationMetadata>future=
cloudMemcacheClient.rescheduleMaintenanceOperationCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<RescheduleMaintenanceRequest,Instance,OperationMetadata> |
|
shutdown()
publicvoidshutdown()shutdownNow()
publicvoidshutdownNow()updateInstanceAsync(UpdateInstanceRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>updateInstanceAsync(UpdateInstanceRequestrequest)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
UpdateInstanceRequestrequest=
UpdateInstanceRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setResource(Instance.newBuilder().build())
.build();
Instanceresponse=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)
publicfinalOperationFuture<Instance,OperationMetadata>updateInstanceAsync(FieldMaskupdateMask,Instanceresource)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
FieldMaskupdateMask=FieldMask.newBuilder().build();
Instanceresource=Instance.newBuilder().build();
Instanceresponse=cloudMemcacheClient.updateInstanceAsync(updateMask,resource).get();
}
| Parameters | |
|---|---|
| Name | Description |
updateMask |
FieldMask Required. Mask of fields to update. * |
resource |
Instance Required. A Memcached [Instance] resource. Only fields specified in update_mask are updated. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
updateInstanceCallable()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
UpdateInstanceRequestrequest=
UpdateInstanceRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setResource(Instance.newBuilder().build())
.build();
ApiFuture<Operation>future=
cloudMemcacheClient.updateInstanceCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateInstanceRequest,Operation> |
|
updateInstanceOperationCallable()
publicfinalOperationCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
UpdateInstanceRequestrequest=
UpdateInstanceRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setResource(Instance.newBuilder().build())
.build();
OperationFuture<Instance,OperationMetadata>future=
cloudMemcacheClient.updateInstanceOperationCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<UpdateInstanceRequest,Instance,OperationMetadata> |
|
updateParametersAsync(InstanceName name, FieldMask updateMask, MemcacheParameters parameters)
publicfinalOperationFuture<Instance,OperationMetadata>updateParametersAsync(InstanceNamename,FieldMaskupdateMask,MemcacheParametersparameters)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
FieldMaskupdateMask=FieldMask.newBuilder().build();
MemcacheParametersparameters=MemcacheParameters.newBuilder().build();
Instanceresponse=
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)
publicfinalOperationFuture<Instance,OperationMetadata>updateParametersAsync(UpdateParametersRequestrequest)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
UpdateParametersRequestrequest=
UpdateParametersRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.setUpdateMask(FieldMask.newBuilder().build())
.setParameters(MemcacheParameters.newBuilder().build())
.build();
Instanceresponse=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)
publicfinalOperationFuture<Instance,OperationMetadata>updateParametersAsync(Stringname,FieldMaskupdateMask,MemcacheParametersparameters)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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
Stringname=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
FieldMaskupdateMask=FieldMask.newBuilder().build();
MemcacheParametersparameters=MemcacheParameters.newBuilder().build();
Instanceresponse=
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()
publicfinalUnaryCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
UpdateParametersRequestrequest=
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.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateParametersRequest,Operation> |
|
updateParametersOperationCallable()
publicfinalOperationCallable<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(CloudMemcacheClientcloudMemcacheClient=CloudMemcacheClient.create()){
UpdateParametersRequestrequest=
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.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<UpdateParametersRequest,Instance,OperationMetadata> |
|