diff --git a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/CloudRedisClient.java b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/CloudRedisClient.java index af86c20c..d8c9f654 100644 --- a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/CloudRedisClient.java +++ b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/CloudRedisClient.java @@ -185,333 +185,420 @@ public final OperationsClient getOperationsClient() { // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Lists all Redis instances owned by a project in either the specified location (region) or all - * locations. + * Creates a Redis instance based on the specified tier and memory size. * - *
The location should have the following format: + *
By default, the instance is accessible from the project's [default + * network](https://cloud.google.com/vpc/docs/vpc). * - *
* `projects/{project_id}/locations/{location_id}` + *
The creation is executed asynchronously and callers may check the returned operation to + * track its progress. Once the operation is completed the Redis instance will be fully + * functional. Completed longrunning.Operation will contain the new instance object in the + * response field. * - *
If `location_id` is specified as `-` (wildcard), then all regions available to the project - * are queried, and the results are aggregated. + *
The returned operation is automatically deleted after a few hours, so there is no need to + * call DeleteOperation. * *
Sample code: * *
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
- * // doThingsWith(element);
- * }
+ * String instanceId = "test_instance";
+ * Instance.Tier tier = Instance.Tier.BASIC;
+ * int memorySizeGb = 1;
+ * Instance instance = Instance.newBuilder()
+ * .setTier(tier)
+ * .setMemorySizeGb(memorySizeGb)
+ * .build();
+ * Instance response = cloudRedisClient.createInstanceAsync(parent, instanceId, instance).get();
* }
*
*
* @param parent Required. The resource name of the instance location using the form:
* `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
+ * @param instanceId Required. The logical name of the Redis instance in the customer project with
+ * the following restrictions:
+ * * Must contain only lowercase letters, numbers, and hyphens. * Must start with a
+ * letter. * Must be between 1-40 characters. * Must end with a number or a letter.
+ * * Must be unique within the customer project / location
+ * @param instance Required. A Redis [Instance] resource
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final ListInstancesPagedResponse listInstances(LocationName parent) {
- ListInstancesRequest request =
- ListInstancesRequest.newBuilder()
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture The location should have the following format:
+ * By default, the instance is accessible from the project's [default
+ * network](https://cloud.google.com/vpc/docs/vpc).
*
- * * `projects/{project_id}/locations/{location_id}`
+ * The creation is executed asynchronously and callers may check the returned operation to
+ * track its progress. Once the operation is completed the Redis instance will be fully
+ * functional. Completed longrunning.Operation will contain the new instance object in the
+ * response field.
*
- * If `location_id` is specified as `-` (wildcard), then all regions available to the project
- * are queried, and the results are aggregated.
+ * The returned operation is automatically deleted after a few hours, so there is no need to
+ * call DeleteOperation.
*
* Sample code:
*
* * Must contain only lowercase letters, numbers, and hyphens. * Must start with a
+ * letter. * Must be between 1-40 characters. * Must end with a number or a letter.
+ * * Must be unique within the customer project / location
+ * @param instance Required. A Redis [Instance] resource
* @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);
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture The location should have the following format:
+ * By default, the instance is accessible from the project's [default
+ * network](https://cloud.google.com/vpc/docs/vpc).
*
- * * `projects/{project_id}/locations/{location_id}`
+ * The creation is executed asynchronously and callers may check the returned operation to
+ * track its progress. Once the operation is completed the Redis instance will be fully
+ * functional. Completed longrunning.Operation will contain the new instance object in the
+ * response field.
*
- * If `location_id` is specified as `-` (wildcard), then all regions available to the project
- * are queried, and the results are aggregated.
+ * The returned operation is automatically deleted after a few hours, so there is no need to
+ * call DeleteOperation.
*
* Sample code:
*
* The location should have the following format:
+ * By default, the instance is accessible from the project's [default
+ * network](https://cloud.google.com/vpc/docs/vpc).
*
- * * `projects/{project_id}/locations/{location_id}`
+ * The creation is executed asynchronously and callers may check the returned operation to
+ * track its progress. Once the operation is completed the Redis instance will be fully
+ * functional. Completed longrunning.Operation will contain the new instance object in the
+ * response field.
*
- * If `location_id` is specified as `-` (wildcard), then all regions available to the project
- * are queried, and the results are aggregated.
+ * The returned operation is automatically deleted after a few hours, so there is no need to
+ * call DeleteOperation.
*
* Sample code:
*
* The location should have the following format:
+ * By default, the instance is accessible from the project's [default
+ * network](https://cloud.google.com/vpc/docs/vpc).
*
- * * `projects/{project_id}/locations/{location_id}`
+ * The creation is executed asynchronously and callers may check the returned operation to
+ * track its progress. Once the operation is completed the Redis instance will be fully
+ * functional. Completed longrunning.Operation will contain the new instance object in the
+ * response field.
*
- * If `location_id` is specified as `-` (wildcard), then all regions available to the project
- * are queried, and the results are aggregated.
+ * The returned operation is automatically deleted after a few hours, so there is no need to
+ * call DeleteOperation.
*
* Sample code:
*
* Sample code:
- *
- * Completed longrunning.Operation will contain the new instance object in the response field.
+ * The returned operation is automatically deleted after a few hours, so there is no need to call
+ * DeleteOperation.
*
* Sample code:
*
* * `displayName` * `labels` * `memorySizeGb` * `redisConfig`
+ * @param instance Required. Update description. Only fields specified in update_mask are updated.
* @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);
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture Completed longrunning.Operation will contain the new instance object in the response field.
+ * The returned operation is automatically deleted after a few hours, so there is no need to call
+ * DeleteOperation.
*
* Sample code:
*
* Completed longrunning.Operation will contain the new instance object in the response field.
+ * The returned operation is automatically deleted after a few hours, so there is no need to call
+ * DeleteOperation.
*
* Sample code:
*
* By default, the instance is accessible from the project's [default
- * network](https://cloud.google.com/vpc/docs/vpc).
- *
- * The creation is executed asynchronously and callers may check the returned operation to
- * track its progress. Once the operation is completed the Redis instance will be fully
- * functional. Completed longrunning.Operation will contain the new instance object in the
- * response field.
+ * Updates the metadata and configuration of a specific Redis instance.
*
- * The returned operation is automatically deleted after a few hours, so there is no need to
- * call DeleteOperation.
+ * Completed longrunning.Operation will contain the new instance object in the response field.
+ * The returned operation is automatically deleted after a few hours, so there is no need to call
+ * DeleteOperation.
*
* Sample code:
*
* * Must contain only lowercase letters, numbers, and hyphens. * Must start with a
- * letter. * Must be between 1-40 characters. * Must end with a number or a letter.
- * * Must be unique within the customer project / location
- * @param instance Required. A Redis [Instance] resource
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture By default, the instance is accessible from the project's [default
- * network](https://cloud.google.com/vpc/docs/vpc).
+ * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
*
- * The creation is executed asynchronously and callers may check the returned operation to
- * track its progress. Once the operation is completed the Redis instance will be fully
- * functional. Completed longrunning.Operation will contain the new instance object in the
- * response field.
+ * Redis may stop serving during this operation. Instance state will be IMPORTING for entire
+ * operation. When complete, the instance will contain only data from the imported file.
*
* The returned operation is automatically deleted after a few hours, so there is no need to
* call DeleteOperation.
@@ -520,52 +607,33 @@ public final OperationFuture * Must contain only lowercase letters, numbers, and hyphens. * Must start with a
- * letter. * Must be between 1-40 characters. * Must end with a number or a letter.
- * * Must be unique within the customer project / location
- * @param instance Required. A Redis [Instance] resource
+ * @param name Required. Redis instance resource name using the form:
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
+ * refers to a GCP region.
+ * @param inputConfig Required. Specify data to be imported.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture By default, the instance is accessible from the project's [default
- * network](https://cloud.google.com/vpc/docs/vpc).
+ * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
*
- * The creation is executed asynchronously and callers may check the returned operation to
- * track its progress. Once the operation is completed the Redis instance will be fully
- * functional. Completed longrunning.Operation will contain the new instance object in the
- * response field.
+ * Redis may stop serving during this operation. Instance state will be IMPORTING for entire
+ * operation. When complete, the instance will contain only data from the imported file.
*
* The returned operation is automatically deleted after a few hours, so there is no need to
* call DeleteOperation.
@@ -574,20 +642,13 @@ public final OperationFuture By default, the instance is accessible from the project's [default
- * network](https://cloud.google.com/vpc/docs/vpc).
+ * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
*
- * The creation is executed asynchronously and callers may check the returned operation to
- * track its progress. Once the operation is completed the Redis instance will be fully
- * functional. Completed longrunning.Operation will contain the new instance object in the
- * response field.
+ * Redis may stop serving during this operation. Instance state will be IMPORTING for entire
+ * operation. When complete, the instance will contain only data from the imported file.
*
* The returned operation is automatically deleted after a few hours, so there is no need to
* call DeleteOperation.
@@ -619,42 +675,30 @@ public final OperationFuture By default, the instance is accessible from the project's [default
- * network](https://cloud.google.com/vpc/docs/vpc).
+ * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
*
- * The creation is executed asynchronously and callers may check the returned operation to
- * track its progress. Once the operation is completed the Redis instance will be fully
- * functional. Completed longrunning.Operation will contain the new instance object in the
- * response field.
+ * Redis may stop serving during this operation. Instance state will be IMPORTING for entire
+ * operation. When complete, the instance will contain only data from the imported file.
*
* The returned operation is automatically deleted after a few hours, so there is no need to
* call DeleteOperation.
@@ -663,106 +707,76 @@ public final OperationFuture Completed longrunning.Operation will contain the new instance object in the response field.
- * The returned operation is automatically deleted after a few hours, so there is no need to call
- * DeleteOperation.
+ * Redis will continue serving during this operation.
+ *
+ * The returned operation is automatically deleted after a few hours, so there is no need to
+ * call DeleteOperation.
*
* Sample code:
*
* * `displayName` * `labels` * `memorySizeGb` * `redisConfig`
- * @param instance Required. Update description. Only fields specified in update_mask are updated.
+ * @param name Required. Redis instance resource name using the form:
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
+ * refers to a GCP region.
+ * @param outputConfig Required. Specify data to be exported.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture Completed longrunning.Operation will contain the new instance object in the response field.
- * The returned operation is automatically deleted after a few hours, so there is no need to call
- * DeleteOperation.
+ * Redis will continue serving during this operation.
+ *
+ * The returned operation is automatically deleted after a few hours, so there is no need to
+ * call DeleteOperation.
*
* Sample code:
*
* Completed longrunning.Operation will contain the new instance object in the response field.
- * The returned operation is automatically deleted after a few hours, so there is no need to call
- * DeleteOperation.
+ * Redis will continue serving during this operation.
+ *
+ * The returned operation is automatically deleted after a few hours, so there is no need to
+ * call DeleteOperation.
*
* Sample code:
*
* Redis will continue serving during this operation.
+ *
+ * The returned operation is automatically deleted after a few hours, so there is no need to
+ * call DeleteOperation.
+ *
+ * Sample code:
+ *
+ * Completed longrunning.Operation will contain the new instance object in the response field.
- * The returned operation is automatically deleted after a few hours, so there is no need to call
- * DeleteOperation.
+ * Initiates a failover of the master node to current replica node for a specific STANDARD tier
+ * Cloud Memorystore for Redis instance.
*
* Sample code:
*
* Redis may stop serving during this operation. Instance state will be IMPORTING for entire
- * operation. When complete, the instance will contain only data from the imported file.
- *
- * The returned operation is automatically deleted after a few hours, so there is no need to
- * call DeleteOperation.
+ * Initiates a failover of the master node to current replica node for a specific STANDARD tier
+ * Cloud Memorystore for Redis instance.
*
* Sample code:
*
* Redis may stop serving during this operation. Instance state will be IMPORTING for entire
- * operation. When complete, the instance will contain only data from the imported file.
- *
- * The returned operation is automatically deleted after a few hours, so there is no need to
- * call DeleteOperation.
+ * Initiates a failover of the master node to current replica node for a specific STANDARD tier
+ * Cloud Memorystore for Redis instance.
*
* Sample code:
*
* Redis may stop serving during this operation. Instance state will be IMPORTING for entire
- * operation. When complete, the instance will contain only data from the imported file.
- *
- * The returned operation is automatically deleted after a few hours, so there is no need to
- * call DeleteOperation.
+ * Initiates a failover of the master node to current replica node for a specific STANDARD tier
+ * Cloud Memorystore for Redis instance.
*
* Sample code:
*
* Redis may stop serving during this operation. Instance state will be IMPORTING for entire
- * operation. When complete, the instance will contain only data from the imported file.
- *
- * The returned operation is automatically deleted after a few hours, so there is no need to
- * call DeleteOperation.
+ * Initiates a failover of the master node to current replica node for a specific STANDARD tier
+ * Cloud Memorystore for Redis instance.
*
* Sample code:
*
* Redis will continue serving during this operation.
- *
- * The returned operation is automatically deleted after a few hours, so there is no need to
- * call DeleteOperation.
+ * Deletes a specific Redis instance. Instance stops serving and data is deleted.
*
* Sample code:
*
* Redis will continue serving during this operation.
+ * Sample code:
*
- * The returned operation is automatically deleted after a few hours, so there is no need to
- * call DeleteOperation.
+ * Sample code:
*
* Redis will continue serving during this operation.
- *
- * The returned operation is automatically deleted after a few hours, so there is no need to
- * call DeleteOperation.
+ * Deletes a specific Redis instance. Instance stops serving and data is deleted.
*
* Sample code:
*
* Redis will continue serving during this operation.
- *
- * The returned operation is automatically deleted after a few hours, so there is no need to
- * call DeleteOperation.
+ * Deletes a specific Redis instance. Instance stops serving and data is deleted.
*
* Sample code:
*
* The location should have the following format:
+ *
+ * * `projects/{project_id}/locations/{location_id}`
+ *
+ * If `location_id` is specified as `-` (wildcard), then all regions available to the project
+ * are queried, and the results are aggregated.
*
* Sample code:
*
* The location should have the following format:
+ *
+ * * `projects/{project_id}/locations/{location_id}`
+ *
+ * If `location_id` is specified as `-` (wildcard), then all regions available to the project
+ * are queried, and the results are aggregated.
*
* Sample code:
*
* The location should have the following format:
+ *
+ * * `projects/{project_id}/locations/{location_id}`
+ *
+ * If `location_id` is specified as `-` (wildcard), then all regions available to the project
+ * are queried, and the results are aggregated.
*
* Sample code:
*
* The location should have the following format:
+ *
+ * * `projects/{project_id}/locations/{location_id}`
+ *
+ * If `location_id` is specified as `-` (wildcard), then all regions available to the project
+ * are queried, and the results are aggregated.
*
* Sample code:
*
* The location should have the following format:
+ *
+ * * `projects/{project_id}/locations/{location_id}`
+ *
+ * If `location_id` is specified as `-` (wildcard), then all regions available to the project
+ * are queried, and the results are aggregated.
*
* Sample code:
*
* Sample code:
*
* Sample code:
*
* Sample code:
*
* Sample code:
- *
- * Sample code:
*
*
*
* @param parent Required. The resource name of the instance location using the form:
* `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
+ * @param instanceId Required. The logical name of the Redis instance in the customer project with
+ * the following restrictions:
+ *
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * for (Instance element : cloudRedisClient.listInstances(parent.toString()).iterateAll()) {
- * // doThingsWith(element);
- * }
+ * String instanceId = "test_instance";
+ * Instance.Tier tier = Instance.Tier.BASIC;
+ * int memorySizeGb = 1;
+ * Instance instance = Instance.newBuilder()
+ * .setTier(tier)
+ * .setMemorySizeGb(memorySizeGb)
+ * .build();
+ * Instance response = cloudRedisClient.createInstanceAsync(parent.toString(), instanceId, instance).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 ListInstancesPagedResponse listInstances(ListInstancesRequest request) {
- return listInstancesPagedCallable().call(request);
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * ListInstancesRequest request = ListInstancesRequest.newBuilder()
+ * String instanceId = "test_instance";
+ * Instance.Tier tier = Instance.Tier.BASIC;
+ * int memorySizeGb = 1;
+ * Instance instance = Instance.newBuilder()
+ * .setTier(tier)
+ * .setMemorySizeGb(memorySizeGb)
+ * .build();
+ * CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
* .setParent(parent.toString())
+ * .setInstanceId(instanceId)
+ * .setInstance(instance)
* .build();
- * for (Instance element : cloudRedisClient.listInstances(request).iterateAll()) {
- * // doThingsWith(element);
- * }
+ * Instance response = cloudRedisClient.createInstanceAsync(request).get();
* }
*
*/
- public final UnaryCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * ListInstancesRequest request = ListInstancesRequest.newBuilder()
+ * String instanceId = "test_instance";
+ * Instance.Tier tier = Instance.Tier.BASIC;
+ * int memorySizeGb = 1;
+ * Instance instance = Instance.newBuilder()
+ * .setTier(tier)
+ * .setMemorySizeGb(memorySizeGb)
+ * .build();
+ * CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
* .setParent(parent.toString())
+ * .setInstanceId(instanceId)
+ * .setInstance(instance)
* .build();
- * ApiFuture<ListInstancesPagedResponse> future = cloudRedisClient.listInstancesPagedCallable().futureCall(request);
+ * OperationFuture<Instance, Any> future = cloudRedisClient.createInstanceOperationCallable().futureCall(request);
* // Do something
- * for (Instance element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
+ * Instance response = future.get();
* }
*
*/
- public final UnaryCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * ListInstancesRequest request = ListInstancesRequest.newBuilder()
+ * String instanceId = "test_instance";
+ * Instance.Tier tier = Instance.Tier.BASIC;
+ * int memorySizeGb = 1;
+ * Instance instance = Instance.newBuilder()
+ * .setTier(tier)
+ * .setMemorySizeGb(memorySizeGb)
+ * .build();
+ * CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
* .setParent(parent.toString())
+ * .setInstanceId(instanceId)
+ * .setInstance(instance)
* .build();
- * while (true) {
- * ListInstancesResponse response = cloudRedisClient.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;
- * }
- * }
+ * ApiFuture<Operation> future = cloudRedisClient.createInstanceCallable().futureCall(request);
+ * // Do something
+ * Operation response = future.get();
* }
*
+ * Updates the metadata and configuration of a specific Redis instance.
*
- * @param name Required. Redis instance resource name using the form:
- * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
- * refers to a GCP region.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- 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 the details of a specific Redis instance.
+ *
- * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * Instance response = cloudRedisClient.getInstance(name);
- * }
- *
*
- * @param name Required. Redis instance resource name using the form:
- * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
- * refers to a GCP region.
+ * @param updateMask Required. Mask of fields to update. At least one path must be supplied in
+ * this field. The elements of the repeated paths field may only include these fields from
+ * [Instance][google.cloud.redis.v1beta1.Instance]:
+ *
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * Instance response = cloudRedisClient.getInstance(name.toString());
+ * String pathsElement = "display_name";
+ * String pathsElement2 = "memory_size_gb";
+ * List<String> paths = Arrays.asList(pathsElement, pathsElement2);
+ * FieldMask updateMask = FieldMask.newBuilder()
+ * .addAllPaths(paths)
+ * .build();
+ * String displayName = "UpdatedDisplayName";
+ * String name = "projects/<project-name>/locations/<location>/instances/<instance>";
+ * int memorySizeGb = 4;
+ * Instance instance = Instance.newBuilder()
+ * .setDisplayName(displayName)
+ * .setName(name)
+ * .setMemorySizeGb(memorySizeGb)
+ * .build();
+ * Instance response = cloudRedisClient.updateInstanceAsync(updateMask, instance).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 Instance getInstance(GetInstanceRequest request) {
- return getInstanceCallable().call(request);
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * GetInstanceRequest request = GetInstanceRequest.newBuilder()
- * .setName(name.toString())
+ * String pathsElement = "display_name";
+ * String pathsElement2 = "memory_size_gb";
+ * List<String> paths = Arrays.asList(pathsElement, pathsElement2);
+ * FieldMask updateMask = FieldMask.newBuilder()
+ * .addAllPaths(paths)
* .build();
- * Instance response = cloudRedisClient.getInstance(request);
+ * String displayName = "UpdatedDisplayName";
+ * String name = "projects/<project-name>/locations/<location>/instances/<instance>";
+ * int memorySizeGb = 4;
+ * Instance instance = Instance.newBuilder()
+ * .setDisplayName(displayName)
+ * .setName(name)
+ * .setMemorySizeGb(memorySizeGb)
+ * .build();
+ * UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder()
+ * .setUpdateMask(updateMask)
+ * .setInstance(instance)
+ * .build();
+ * Instance response = cloudRedisClient.updateInstanceAsync(request).get();
* }
*
*/
- public final UnaryCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * GetInstanceRequest request = GetInstanceRequest.newBuilder()
- * .setName(name.toString())
+ * String pathsElement = "display_name";
+ * String pathsElement2 = "memory_size_gb";
+ * List<String> paths = Arrays.asList(pathsElement, pathsElement2);
+ * FieldMask updateMask = FieldMask.newBuilder()
+ * .addAllPaths(paths)
* .build();
- * ApiFuture<Instance> future = cloudRedisClient.getInstanceCallable().futureCall(request);
+ * String displayName = "UpdatedDisplayName";
+ * String name = "projects/<project-name>/locations/<location>/instances/<instance>";
+ * int memorySizeGb = 4;
+ * Instance instance = Instance.newBuilder()
+ * .setDisplayName(displayName)
+ * .setName(name)
+ * .setMemorySizeGb(memorySizeGb)
+ * .build();
+ * UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder()
+ * .setUpdateMask(updateMask)
+ * .setInstance(instance)
+ * .build();
+ * OperationFuture<Instance, Any> future = cloudRedisClient.updateInstanceOperationCallable().futureCall(request);
* // Do something
* Instance response = future.get();
* }
*
- *
- * @param parent Required. The resource name of the instance location using the form:
- * `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
- * @param instanceId Required. The logical name of the Redis instance in the customer project with
- * the following restrictions:
- *
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * String instanceId = "test_instance";
- * Instance.Tier tier = Instance.Tier.BASIC;
- * int memorySizeGb = 1;
+ * String pathsElement = "display_name";
+ * String pathsElement2 = "memory_size_gb";
+ * List<String> paths = Arrays.asList(pathsElement, pathsElement2);
+ * FieldMask updateMask = FieldMask.newBuilder()
+ * .addAllPaths(paths)
+ * .build();
+ * String displayName = "UpdatedDisplayName";
+ * String name = "projects/<project-name>/locations/<location>/instances/<instance>";
+ * int memorySizeGb = 4;
* Instance instance = Instance.newBuilder()
- * .setTier(tier)
+ * .setDisplayName(displayName)
+ * .setName(name)
* .setMemorySizeGb(memorySizeGb)
* .build();
- * Instance response = cloudRedisClient.createInstanceAsync(parent, instanceId, instance).get();
+ * UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder()
+ * .setUpdateMask(updateMask)
+ * .setInstance(instance)
+ * .build();
+ * ApiFuture<Operation> future = cloudRedisClient.updateInstanceCallable().futureCall(request);
+ * // Do something
+ * Operation response = future.get();
* }
*
*
- * @param parent Required. The resource name of the instance location using the form:
- * `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
- * @param instanceId Required. The logical name of the Redis instance in the customer project with
- * the following restrictions:
- *
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * String instanceId = "test_instance";
- * Instance.Tier tier = Instance.Tier.BASIC;
- * int memorySizeGb = 1;
- * Instance instance = Instance.newBuilder()
- * .setTier(tier)
- * .setMemorySizeGb(memorySizeGb)
- * .build();
- * Instance response = cloudRedisClient.createInstanceAsync(parent.toString(), instanceId, instance).get();
+ * String name = "";
+ * InputConfig inputConfig = InputConfig.newBuilder().build();
+ * Instance response = cloudRedisClient.importInstanceAsync(name, inputConfig).get();
* }
*
*
@@ -596,21 +657,16 @@ public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * String instanceId = "test_instance";
- * Instance.Tier tier = Instance.Tier.BASIC;
- * int memorySizeGb = 1;
- * Instance instance = Instance.newBuilder()
- * .setTier(tier)
- * .setMemorySizeGb(memorySizeGb)
- * .build();
- * CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
- * .setParent(parent.toString())
- * .setInstanceId(instanceId)
- * .setInstance(instance)
+ * String name = "";
+ * InputConfig inputConfig = InputConfig.newBuilder().build();
+ * ImportInstanceRequest request = ImportInstanceRequest.newBuilder()
+ * .setName(name)
+ * .setInputConfig(inputConfig)
* .build();
- * Instance response = cloudRedisClient.createInstanceAsync(request).get();
+ * Instance response = cloudRedisClient.importInstanceAsync(request).get();
* }
*
*/
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public final OperationCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * String instanceId = "test_instance";
- * Instance.Tier tier = Instance.Tier.BASIC;
- * int memorySizeGb = 1;
- * Instance instance = Instance.newBuilder()
- * .setTier(tier)
- * .setMemorySizeGb(memorySizeGb)
- * .build();
- * CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
- * .setParent(parent.toString())
- * .setInstanceId(instanceId)
- * .setInstance(instance)
+ * String name = "";
+ * InputConfig inputConfig = InputConfig.newBuilder().build();
+ * ImportInstanceRequest request = ImportInstanceRequest.newBuilder()
+ * .setName(name)
+ * .setInputConfig(inputConfig)
* .build();
- * OperationFuture<Instance, Any> future = cloudRedisClient.createInstanceOperationCallable().futureCall(request);
+ * OperationFuture<Instance, Any> future = cloudRedisClient.importInstanceOperationCallable().futureCall(request);
* // Do something
* Instance response = future.get();
* }
*
*/
- public final UnaryCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * String instanceId = "test_instance";
- * Instance.Tier tier = Instance.Tier.BASIC;
- * int memorySizeGb = 1;
- * Instance instance = Instance.newBuilder()
- * .setTier(tier)
- * .setMemorySizeGb(memorySizeGb)
- * .build();
- * CreateInstanceRequest request = CreateInstanceRequest.newBuilder()
- * .setParent(parent.toString())
- * .setInstanceId(instanceId)
- * .setInstance(instance)
+ * String name = "";
+ * InputConfig inputConfig = InputConfig.newBuilder().build();
+ * ImportInstanceRequest request = ImportInstanceRequest.newBuilder()
+ * .setName(name)
+ * .setInputConfig(inputConfig)
* .build();
- * ApiFuture<Operation> future = cloudRedisClient.createInstanceCallable().futureCall(request);
+ * ApiFuture<Operation> future = cloudRedisClient.importInstanceCallable().futureCall(request);
* // Do something
* Operation response = future.get();
* }
*
*
- * @param updateMask Required. Mask of fields to update. At least one path must be supplied in
- * this field. The elements of the repeated paths field may only include these fields from
- * [Instance][google.cloud.redis.v1beta1.Instance]:
- *
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String pathsElement = "display_name";
- * String pathsElement2 = "memory_size_gb";
- * List<String> paths = Arrays.asList(pathsElement, pathsElement2);
- * FieldMask updateMask = FieldMask.newBuilder()
- * .addAllPaths(paths)
- * .build();
- * String displayName = "UpdatedDisplayName";
- * String name = "projects/<project-name>/locations/<location>/instances/<instance>";
- * int memorySizeGb = 4;
- * Instance instance = Instance.newBuilder()
- * .setDisplayName(displayName)
- * .setName(name)
- * .setMemorySizeGb(memorySizeGb)
- * .build();
- * Instance response = cloudRedisClient.updateInstanceAsync(updateMask, instance).get();
+ * String name = "";
+ * OutputConfig outputConfig = OutputConfig.newBuilder().build();
+ * Instance response = cloudRedisClient.exportInstanceAsync(name, outputConfig).get();
* }
*
*
@@ -771,148 +785,152 @@ public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String pathsElement = "display_name";
- * String pathsElement2 = "memory_size_gb";
- * List<String> paths = Arrays.asList(pathsElement, pathsElement2);
- * FieldMask updateMask = FieldMask.newBuilder()
- * .addAllPaths(paths)
- * .build();
- * String displayName = "UpdatedDisplayName";
- * String name = "projects/<project-name>/locations/<location>/instances/<instance>";
- * int memorySizeGb = 4;
- * Instance instance = Instance.newBuilder()
- * .setDisplayName(displayName)
+ * String name = "";
+ * OutputConfig outputConfig = OutputConfig.newBuilder().build();
+ * ExportInstanceRequest request = ExportInstanceRequest.newBuilder()
* .setName(name)
- * .setMemorySizeGb(memorySizeGb)
- * .build();
- * UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder()
- * .setUpdateMask(updateMask)
- * .setInstance(instance)
+ * .setOutputConfig(outputConfig)
* .build();
- * Instance response = cloudRedisClient.updateInstanceAsync(request).get();
+ * Instance response = cloudRedisClient.exportInstanceAsync(request).get();
* }
*
*/
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public final OperationCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String pathsElement = "display_name";
- * String pathsElement2 = "memory_size_gb";
- * List<String> paths = Arrays.asList(pathsElement, pathsElement2);
- * FieldMask updateMask = FieldMask.newBuilder()
- * .addAllPaths(paths)
- * .build();
- * String displayName = "UpdatedDisplayName";
- * String name = "projects/<project-name>/locations/<location>/instances/<instance>";
- * int memorySizeGb = 4;
- * Instance instance = Instance.newBuilder()
- * .setDisplayName(displayName)
+ * String name = "";
+ * OutputConfig outputConfig = OutputConfig.newBuilder().build();
+ * ExportInstanceRequest request = ExportInstanceRequest.newBuilder()
* .setName(name)
- * .setMemorySizeGb(memorySizeGb)
- * .build();
- * UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder()
- * .setUpdateMask(updateMask)
- * .setInstance(instance)
+ * .setOutputConfig(outputConfig)
* .build();
- * OperationFuture<Instance, Any> future = cloudRedisClient.updateInstanceOperationCallable().futureCall(request);
+ * OperationFuture<Instance, Any> future = cloudRedisClient.exportInstanceOperationCallable().futureCall(request);
* // Do something
* Instance response = future.get();
* }
*
+ */
+ public final UnaryCallable
+ * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+ * String name = "";
+ * OutputConfig outputConfig = OutputConfig.newBuilder().build();
+ * ExportInstanceRequest request = ExportInstanceRequest.newBuilder()
+ * .setName(name)
+ * .setOutputConfig(outputConfig)
+ * .build();
+ * ApiFuture<Operation> future = cloudRedisClient.exportInstanceCallable().futureCall(request);
+ * // Do something
+ * Operation response = future.get();
+ * }
+ *
+ *
+ * @param name Required. Redis instance resource name using the form:
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
+ * refers to a GCP region.
+ * @param dataProtectionMode Optional. Available data protection modes that the user can choose.
+ * If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final UnaryCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String pathsElement = "display_name";
- * String pathsElement2 = "memory_size_gb";
- * List<String> paths = Arrays.asList(pathsElement, pathsElement2);
- * FieldMask updateMask = FieldMask.newBuilder()
- * .addAllPaths(paths)
- * .build();
- * String displayName = "UpdatedDisplayName";
- * String name = "projects/<project-name>/locations/<location>/instances/<instance>";
- * int memorySizeGb = 4;
- * Instance instance = Instance.newBuilder()
- * .setDisplayName(displayName)
- * .setName(name)
- * .setMemorySizeGb(memorySizeGb)
- * .build();
- * UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder()
- * .setUpdateMask(updateMask)
- * .setInstance(instance)
- * .build();
- * ApiFuture<Operation> future = cloudRedisClient.updateInstanceCallable().futureCall(request);
- * // Do something
- * Operation response = future.get();
+ * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ * FailoverInstanceRequest.DataProtectionMode dataProtectionMode = FailoverInstanceRequest.DataProtectionMode.DATA_PROTECTION_MODE_UNSPECIFIED;
+ * Instance response = cloudRedisClient.failoverInstanceAsync(name, dataProtectionMode).get();
* }
*
*
* @param name Required. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
* refers to a GCP region.
- * @param inputConfig Required. Specify data to be imported.
+ * @param dataProtectionMode Optional. Available data protection modes that the user can choose.
+ * If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String name = "";
- * InputConfig inputConfig = InputConfig.newBuilder().build();
- * Instance response = cloudRedisClient.importInstanceAsync(name, inputConfig).get();
+ * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ * FailoverInstanceRequest.DataProtectionMode dataProtectionMode = FailoverInstanceRequest.DataProtectionMode.DATA_PROTECTION_MODE_UNSPECIFIED;
+ * Instance response = cloudRedisClient.failoverInstanceAsync(name.toString(), dataProtectionMode).get();
* }
*
*
@@ -921,126 +939,123 @@ public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String name = "";
- * InputConfig inputConfig = InputConfig.newBuilder().build();
- * ImportInstanceRequest request = ImportInstanceRequest.newBuilder()
- * .setName(name)
- * .setInputConfig(inputConfig)
+ * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ * FailoverInstanceRequest request = FailoverInstanceRequest.newBuilder()
+ * .setName(name.toString())
* .build();
- * Instance response = cloudRedisClient.importInstanceAsync(request).get();
+ * Instance response = cloudRedisClient.failoverInstanceAsync(request).get();
* }
*
*/
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public final OperationCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String name = "";
- * InputConfig inputConfig = InputConfig.newBuilder().build();
- * ImportInstanceRequest request = ImportInstanceRequest.newBuilder()
- * .setName(name)
- * .setInputConfig(inputConfig)
+ * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ * FailoverInstanceRequest request = FailoverInstanceRequest.newBuilder()
+ * .setName(name.toString())
* .build();
- * OperationFuture<Instance, Any> future = cloudRedisClient.importInstanceOperationCallable().futureCall(request);
+ * OperationFuture<Instance, Any> future = cloudRedisClient.failoverInstanceOperationCallable().futureCall(request);
* // Do something
* Instance response = future.get();
* }
*
*/
- public final UnaryCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String name = "";
- * InputConfig inputConfig = InputConfig.newBuilder().build();
- * ImportInstanceRequest request = ImportInstanceRequest.newBuilder()
- * .setName(name)
- * .setInputConfig(inputConfig)
+ * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ * FailoverInstanceRequest request = FailoverInstanceRequest.newBuilder()
+ * .setName(name.toString())
* .build();
- * ApiFuture<Operation> future = cloudRedisClient.importInstanceCallable().futureCall(request);
+ * ApiFuture<Operation> future = cloudRedisClient.failoverInstanceCallable().futureCall(request);
* // Do something
* Operation response = future.get();
* }
*
*
* @param name Required. Redis instance resource name using the form:
* `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
* refers to a GCP region.
- * @param outputConfig Required. Specify data to be exported.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String name = "";
- * OutputConfig outputConfig = OutputConfig.newBuilder().build();
- * Instance response = cloudRedisClient.exportInstanceAsync(name, outputConfig).get();
+ * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ * cloudRedisClient.deleteInstanceAsync(name).get();
* }
*
+ *
+ * @param name Required. Redis instance resource name using the form:
+ * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
+ * refers to a GCP region.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+ * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ * cloudRedisClient.deleteInstanceAsync(name.toString()).get();
+ * }
+ *
*
@@ -1049,223 +1064,238 @@ public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String name = "";
- * OutputConfig outputConfig = OutputConfig.newBuilder().build();
- * ExportInstanceRequest request = ExportInstanceRequest.newBuilder()
- * .setName(name)
- * .setOutputConfig(outputConfig)
+ * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ * DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
+ * .setName(name.toString())
* .build();
- * Instance response = cloudRedisClient.exportInstanceAsync(request).get();
+ * cloudRedisClient.deleteInstanceAsync(request).get();
* }
*
*/
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public final OperationCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String name = "";
- * OutputConfig outputConfig = OutputConfig.newBuilder().build();
- * ExportInstanceRequest request = ExportInstanceRequest.newBuilder()
- * .setName(name)
- * .setOutputConfig(outputConfig)
+ * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ * DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
+ * .setName(name.toString())
* .build();
- * OperationFuture<Instance, Any> future = cloudRedisClient.exportInstanceOperationCallable().futureCall(request);
+ * OperationFuture<Empty, Any> future = cloudRedisClient.deleteInstanceOperationCallable().futureCall(request);
* // Do something
- * Instance response = future.get();
+ * future.get();
* }
*
*/
- public final UnaryCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * String name = "";
- * OutputConfig outputConfig = OutputConfig.newBuilder().build();
- * ExportInstanceRequest request = ExportInstanceRequest.newBuilder()
- * .setName(name)
- * .setOutputConfig(outputConfig)
+ * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+ * DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
+ * .setName(name.toString())
* .build();
- * ApiFuture<Operation> future = cloudRedisClient.exportInstanceCallable().futureCall(request);
+ * ApiFuture<Operation> future = cloudRedisClient.deleteInstanceCallable().futureCall(request);
* // Do something
- * Operation response = future.get();
+ * future.get();
* }
*
*
- * @param name Required. Redis instance resource name using the form:
- * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
- * refers to a GCP region.
- * @param dataProtectionMode Optional. Available data protection modes that the user can choose.
- * If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
+ * @param parent Required. The resource name of the instance location using the form:
+ * `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * FailoverInstanceRequest.DataProtectionMode dataProtectionMode = FailoverInstanceRequest.DataProtectionMode.DATA_PROTECTION_MODE_UNSPECIFIED;
- * Instance response = cloudRedisClient.failoverInstanceAsync(name, dataProtectionMode).get();
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
* }
*
*
- * @param name Required. Redis instance resource name using the form:
- * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
- * refers to a GCP region.
- * @param dataProtectionMode Optional. Available data protection modes that the user can choose.
- * If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
+ * @param parent Required. The resource name of the instance location using the form:
+ * `projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * FailoverInstanceRequest.DataProtectionMode dataProtectionMode = FailoverInstanceRequest.DataProtectionMode.DATA_PROTECTION_MODE_UNSPECIFIED;
- * Instance response = cloudRedisClient.failoverInstanceAsync(name.toString(), dataProtectionMode).get();
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * for (Instance element : cloudRedisClient.listInstances(parent.toString()).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
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * FailoverInstanceRequest request = FailoverInstanceRequest.newBuilder()
- * .setName(name.toString())
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * ListInstancesRequest request = ListInstancesRequest.newBuilder()
+ * .setParent(parent.toString())
* .build();
- * Instance response = cloudRedisClient.failoverInstanceAsync(request).get();
+ * for (Instance element : cloudRedisClient.listInstances(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
* }
*
*/
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public final OperationCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * FailoverInstanceRequest request = FailoverInstanceRequest.newBuilder()
- * .setName(name.toString())
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * ListInstancesRequest request = ListInstancesRequest.newBuilder()
+ * .setParent(parent.toString())
* .build();
- * OperationFuture<Instance, Any> future = cloudRedisClient.failoverInstanceOperationCallable().futureCall(request);
+ * ApiFuture<ListInstancesPagedResponse> future = cloudRedisClient.listInstancesPagedCallable().futureCall(request);
* // Do something
- * Instance response = future.get();
+ * for (Instance element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
* }
*
*/
- public final UnaryCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * FailoverInstanceRequest request = FailoverInstanceRequest.newBuilder()
- * .setName(name.toString())
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * ListInstancesRequest request = ListInstancesRequest.newBuilder()
+ * .setParent(parent.toString())
* .build();
- * ApiFuture<Operation> future = cloudRedisClient.failoverInstanceCallable().futureCall(request);
- * // Do something
- * Operation response = future.get();
+ * while (true) {
+ * ListInstancesResponse response = cloudRedisClient.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;
+ * }
+ * }
* }
*
*
@@ -1274,24 +1304,22 @@ public final UnaryCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
* InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * cloudRedisClient.deleteInstanceAsync(name).get();
+ * Instance response = cloudRedisClient.getInstance(name);
* }
*
*
@@ -1300,82 +1328,54 @@ public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
* InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * cloudRedisClient.deleteInstanceAsync(name.toString()).get();
+ * Instance response = cloudRedisClient.getInstance(name.toString());
* }
*
*
* @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
*/
- @BetaApi(
- "The surface for long-running operations is not stable yet and may change in the future.")
- public final OperationFuture
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
* InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
+ * GetInstanceRequest request = GetInstanceRequest.newBuilder()
* .setName(name.toString())
* .build();
- * cloudRedisClient.deleteInstanceAsync(request).get();
+ * Instance response = cloudRedisClient.getInstance(request);
* }
*
- */
- @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
- public final OperationCallable
- * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * OperationFuture<Empty, Any> future = cloudRedisClient.deleteInstanceOperationCallable().futureCall(request);
- * // Do something
- * future.get();
- * }
- *
*/
- public final UnaryCallable
* try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
* InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder()
+ * GetInstanceRequest request = GetInstanceRequest.newBuilder()
* .setName(name.toString())
* .build();
- * ApiFuture<Operation> future = cloudRedisClient.deleteInstanceCallable().futureCall(request);
+ * ApiFuture<Instance> future = cloudRedisClient.getInstanceCallable().futureCall(request);
* // Do something
- * future.get();
+ * Instance response = future.get();
* }
*