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: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + * Instance response = memorystoreClient.getInstance(name); + * } + * }+ * + *
Note: close() needs to be called on the MemorystoreClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *
Method | + *Description | + *Method Variants | + *
---|---|---|
ListInstances |
+ * Lists Instances in a given project and location. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
GetInstance |
+ * Gets details of a single Instance. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
CreateInstance |
+ * Creates a new Instance in a given project and location. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
UpdateInstance |
+ * Updates the parameters of a single Instance. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
DeleteInstance |
+ * Deletes a single Instance. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
GetCertificateAuthority |
+ * Gets details about the certificate authority for an Instance. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
ListLocations |
+ * Lists information about the supported locations for this service. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
GetLocation |
+ * Gets information about a location. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
See the individual methods for example code. + * + *
Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *
This class can be customized by passing in a custom instance of MemorystoreSettings to + * create(). For example: + * + *
To customize credentials: + * + *
{@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 + * MemorystoreSettings memorystoreSettings = + * MemorystoreSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * MemorystoreClient memorystoreClient = MemorystoreClient.create(memorystoreSettings); + * }+ * + *
To customize the endpoint: + * + *
{@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 + * MemorystoreSettings memorystoreSettings = + * MemorystoreSettings.newBuilder().setEndpoint(myEndpoint).build(); + * MemorystoreClient memorystoreClient = MemorystoreClient.create(memorystoreSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class MemorystoreClient implements BackgroundResource { + private final MemorystoreSettings settings; + private final MemorystoreStub stub; + private final OperationsClient httpJsonOperationsClient; + + /** Constructs an instance of MemorystoreClient with default settings. */ + public static final MemorystoreClient create() throws IOException { + return create(MemorystoreSettings.newBuilder().build()); + } + + /** + * Constructs an instance of MemorystoreClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final MemorystoreClient create(MemorystoreSettings settings) throws IOException { + return new MemorystoreClient(settings); + } + + /** + * Constructs an instance of MemorystoreClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(MemorystoreSettings). + */ + public static final MemorystoreClient create(MemorystoreStub stub) { + return new MemorystoreClient(stub); + } + + /** + * Constructs an instance of MemorystoreClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected MemorystoreClient(MemorystoreSettings settings) throws IOException { + this.settings = settings; + this.stub = ((MemorystoreStubSettings) settings.getStubSettings()).createStub(); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected MemorystoreClient(MemorystoreStub stub) { + this.settings = null; + this.stub = stub; + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final MemorystoreSettings getSettings() { + return settings; + } + + public MemorystoreStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Instances in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (Instance element : memorystoreClient.listInstances(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The parent to list instances from. Format: + * projects/{project}/locations/{location} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListInstancesPagedResponse listInstances(LocationName parent) { + ListInstancesRequest request = + ListInstancesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Instances in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * for (Instance element : memorystoreClient.listInstances(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The parent to list instances from. Format: + * projects/{project}/locations/{location} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListInstancesPagedResponse listInstances(String parent) { + ListInstancesRequest request = ListInstancesRequest.newBuilder().setParent(parent).build(); + return listInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Instances in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * ListInstancesRequest request = + * ListInstancesRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (Instance element : memorystoreClient.listInstances(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param 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 + */ + public final ListInstancesPagedResponse listInstances(ListInstancesRequest request) { + return listInstancesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Instances in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * ListInstancesRequest request = + * ListInstancesRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * memorystoreClient.listInstancesPagedCallable().futureCall(request); + * // Do something. + * for (Instance element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * ListInstancesRequest request = + * ListInstancesRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * while (true) { + * ListInstancesResponse response = memorystoreClient.listInstancesCallable().call(request); + * for (Instance element : response.getInstancesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + * Instance response = memorystoreClient.getInstance(name); + * } + * }+ * + * @param name Required. The name of the instance to retrieve. Format: + * projects/{project}/locations/{location}/instances/{instance} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Instance getInstance(InstanceName name) { + GetInstanceRequest request = + GetInstanceRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); + * Instance response = memorystoreClient.getInstance(name); + * } + * }+ * + * @param name Required. The name of the instance to retrieve. Format: + * projects/{project}/locations/{location}/instances/{instance} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Instance getInstance(String name) { + GetInstanceRequest request = GetInstanceRequest.newBuilder().setName(name).build(); + return getInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * GetInstanceRequest request = + * GetInstanceRequest.newBuilder() + * .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + * .build(); + * Instance response = memorystoreClient.getInstance(request); + * } + * }+ * + * @param 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 + */ + public final Instance getInstance(GetInstanceRequest request) { + return getInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * GetInstanceRequest request = + * GetInstanceRequest.newBuilder() + * .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = memorystoreClient.getInstanceCallable().futureCall(request); + * // Do something. + * Instance response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * Instance instance = Instance.newBuilder().build(); + * String instanceId = "instanceId902024336"; + * Instance response = memorystoreClient.createInstanceAsync(parent, instance, instanceId).get(); + * } + * }+ * + * @param parent Required. The parent resource where this instance will be created. Format: + * projects/{project}/locations/{location} + * @param instance Required. The instance to create. + * @param instanceId Required. The ID to use for the instance, which will become the final + * component of the instance's resource name. + *
This value is subject to the following restrictions: + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * Instance instance = Instance.newBuilder().build(); + * String instanceId = "instanceId902024336"; + * Instance response = memorystoreClient.createInstanceAsync(parent, instance, instanceId).get(); + * } + * }+ * + * @param parent Required. The parent resource where this instance will be created. Format: + * projects/{project}/locations/{location} + * @param instance Required. The instance to create. + * @param instanceId Required. The ID to use for the instance, which will become the final + * component of the instance's resource name. + *
This value is subject to the following restrictions: + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * CreateInstanceRequest request = + * CreateInstanceRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setInstanceId("instanceId902024336") + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * Instance response = memorystoreClient.createInstanceAsync(request).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * CreateInstanceRequest request = + * CreateInstanceRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setInstanceId("instanceId902024336") + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * memorystoreClient.createInstanceOperationCallable().futureCall(request); + * // Do something. + * Instance response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * CreateInstanceRequest request = + * CreateInstanceRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setInstanceId("instanceId902024336") + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = memorystoreClient.createInstanceCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * Instance instance = Instance.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Instance response = memorystoreClient.updateInstanceAsync(instance, updateMask).get(); + * } + * }+ * + * @param instance Required. The instance to update. + * @param updateMask Optional. The list of fields to be updated on the instance. At least one + * field must be specified. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * UpdateInstanceRequest request = + * UpdateInstanceRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * Instance response = memorystoreClient.updateInstanceAsync(request).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * UpdateInstanceRequest request = + * UpdateInstanceRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * memorystoreClient.updateInstanceOperationCallable().futureCall(request); + * // Do something. + * Instance response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * UpdateInstanceRequest request = + * UpdateInstanceRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = memorystoreClient.updateInstanceCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + * memorystoreClient.deleteInstanceAsync(name).get(); + * } + * }+ * + * @param name Required. The name of the instance to delete. Format: + * projects/{project}/locations/{location}/instances/{instance} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); + * memorystoreClient.deleteInstanceAsync(name).get(); + * } + * }+ * + * @param name Required. The name of the instance to delete. Format: + * projects/{project}/locations/{location}/instances/{instance} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * DeleteInstanceRequest request = + * DeleteInstanceRequest.newBuilder() + * .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .build(); + * memorystoreClient.deleteInstanceAsync(request).get(); + * } + * }+ * + * @param 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 + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * DeleteInstanceRequest request = + * DeleteInstanceRequest.newBuilder() + * .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * memorystoreClient.deleteInstanceOperationCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * DeleteInstanceRequest request = + * DeleteInstanceRequest.newBuilder() + * .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = memorystoreClient.deleteInstanceCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + * CertificateAuthority response = memorystoreClient.getCertificateAuthority(name); + * } + * }+ * + * @param name Required. The name of the certificate authority. Format: + * projects/{project}/locations/{location}/instances/{instance}/certificateAuthority + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CertificateAuthority getCertificateAuthority(InstanceName name) { + GetCertificateAuthorityRequest request = + GetCertificateAuthorityRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getCertificateAuthority(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details about the certificate authority for an Instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString(); + * CertificateAuthority response = memorystoreClient.getCertificateAuthority(name); + * } + * }+ * + * @param name Required. The name of the certificate authority. Format: + * projects/{project}/locations/{location}/instances/{instance}/certificateAuthority + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final CertificateAuthority getCertificateAuthority(String name) { + GetCertificateAuthorityRequest request = + GetCertificateAuthorityRequest.newBuilder().setName(name).build(); + return getCertificateAuthority(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details about the certificate authority for an Instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * GetCertificateAuthorityRequest request = + * GetCertificateAuthorityRequest.newBuilder() + * .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + * .build(); + * CertificateAuthority response = memorystoreClient.getCertificateAuthority(request); + * } + * }+ * + * @param 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 + */ + public final CertificateAuthority getCertificateAuthority( + GetCertificateAuthorityRequest request) { + return getCertificateAuthorityCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details about the certificate authority for an Instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * GetCertificateAuthorityRequest request = + * GetCertificateAuthorityRequest.newBuilder() + * .setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * memorystoreClient.getCertificateAuthorityCallable().futureCall(request); + * // Do something. + * CertificateAuthority response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Location element : memorystoreClient.listLocations(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param 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 + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * memorystoreClient.listLocationsPagedCallable().futureCall(request); + * // Do something. + * for (Location element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListLocationsResponse response = memorystoreClient.listLocationsCallable().call(request); + * for (Location element : response.getLocationsList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + * Location response = memorystoreClient.getLocation(request); + * } + * }+ * + * @param 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 + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) { + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + * ApiFuture+ */ + public final UnaryCallablefuture = memorystoreClient.getLocationCallable().futureCall(request); + * // Do something. + * Location response = future.get(); + * } + * }
The default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of getInstance: + * + *
{@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 + * MemorystoreSettings.Builder memorystoreSettingsBuilder = MemorystoreSettings.newBuilder(); + * memorystoreSettingsBuilder + * .getInstanceSettings() + * .setRetrySettings( + * memorystoreSettingsBuilder + * .getInstanceSettings() + * .getRetrySettings() + * .toBuilder() + * .setInitialRetryDelayDuration(Duration.ofSeconds(1)) + * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5)) + * .setMaxAttempts(5) + * .setMaxRetryDelayDuration(Duration.ofSeconds(30)) + * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60)) + * .setRetryDelayMultiplier(1.3) + * .setRpcTimeoutMultiplier(1.5) + * .setTotalTimeoutDuration(Duration.ofSeconds(300)) + * .build()); + * MemorystoreSettings memorystoreSettings = memorystoreSettingsBuilder.build(); + * }+ * + * Please refer to the [Client Side Retry + * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for + * additional support in setting retries. + * + *
To configure the RetrySettings of a Long Running Operation method, create an + * OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to + * configure the RetrySettings for createInstance: + * + *
{@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 + * MemorystoreSettings.Builder memorystoreSettingsBuilder = MemorystoreSettings.newBuilder(); + * TimedRetryAlgorithm timedRetryAlgorithm = + * OperationalTimedPollAlgorithm.create( + * RetrySettings.newBuilder() + * .setInitialRetryDelayDuration(Duration.ofMillis(500)) + * .setRetryDelayMultiplier(1.5) + * .setMaxRetryDelayDuration(Duration.ofMillis(5000)) + * .setTotalTimeoutDuration(Duration.ofHours(24)) + * .build()); + * memorystoreSettingsBuilder + * .createClusterOperationSettings() + * .setPollingAlgorithm(timedRetryAlgorithm) + * .build(); + * }+ */ +@Generated("by gapic-generator-java") +public class MemorystoreSettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction The interfaces provided are listed below, along with usage samples.
+ *
+ * ======================= MemorystoreClient =======================
+ *
+ * Service Description: Service describing handlers for resources
+ *
+ * Sample for MemorystoreClient:
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class HttpJsonMemorystoreCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class HttpJsonMemorystoreStub extends MemorystoreStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(Empty.getDescriptor())
+ .add(Instance.getDescriptor())
+ .add(OperationMetadata.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class MemorystoreStub implements BackgroundResource {
+
+ public OperationsStub getHttpJsonOperationsStub() {
+ throw new UnsupportedOperationException("Not implemented: getHttpJsonOperationsStub()");
+ }
+
+ public UnaryCallable The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the
+ * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
+ * of getInstance:
+ *
+ * To configure the RetrySettings of a Long Running Operation method, create an
+ * OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to
+ * configure the RetrySettings for createInstance:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (MemorystoreClient memorystoreClient = MemorystoreClient.create()) {
+ * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ * Instance response = memorystoreClient.getInstance(name);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package com.google.cloud.memorystore.v1;
+
+import javax.annotation.Generated;
diff --git a/java-valkey/google-cloud-valkey/src/main/java/com/google/cloud/memorystore/v1/stub/HttpJsonMemorystoreCallableFactory.java b/java-valkey/google-cloud-valkey/src/main/java/com/google/cloud/memorystore/v1/stub/HttpJsonMemorystoreCallableFactory.java
new file mode 100644
index 000000000000..20630bdac854
--- /dev/null
+++ b/java-valkey/google-cloud-valkey/src/main/java/com/google/cloud/memorystore/v1/stub/HttpJsonMemorystoreCallableFactory.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.memorystore.v1.stub;
+
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the Memorystore service API.
+ *
+ *
+ *
+ *
+ * {@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
+ * MemorystoreStubSettings.Builder memorystoreSettingsBuilder =
+ * MemorystoreStubSettings.newBuilder();
+ * memorystoreSettingsBuilder
+ * .getInstanceSettings()
+ * .setRetrySettings(
+ * memorystoreSettingsBuilder
+ * .getInstanceSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ * .setMaxAttempts(5)
+ * .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ * .setRetryDelayMultiplier(1.3)
+ * .setRpcTimeoutMultiplier(1.5)
+ * .setTotalTimeoutDuration(Duration.ofSeconds(300))
+ * .build());
+ * MemorystoreStubSettings memorystoreSettings = memorystoreSettingsBuilder.build();
+ * }
+ *
+ * Please refer to the [Client Side Retry
+ * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
+ * additional support in setting retries.
+ *
+ * {@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
+ * MemorystoreStubSettings.Builder memorystoreSettingsBuilder =
+ * MemorystoreStubSettings.newBuilder();
+ * TimedRetryAlgorithm timedRetryAlgorithm =
+ * OperationalTimedPollAlgorithm.create(
+ * RetrySettings.newBuilder()
+ * .setInitialRetryDelayDuration(Duration.ofMillis(500))
+ * .setRetryDelayMultiplier(1.5)
+ * .setMaxRetryDelayDuration(Duration.ofMillis(5000))
+ * .setTotalTimeoutDuration(Duration.ofHours(24))
+ * .build());
+ * memorystoreSettingsBuilder
+ * .createClusterOperationSettings()
+ * .setPollingAlgorithm(timedRetryAlgorithm)
+ * .build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class MemorystoreStubSettings extends StubSettings