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 createInstanceAsync( + LocationName parent, String instanceId, Instance instance) { + CreateInstanceRequest request = + CreateInstanceRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) + .setInstanceId(instanceId) + .setInstance(instance) .build(); - return listInstances(request); + return createInstanceAsync(request); } // 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.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 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(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 createInstanceAsync( + String parent, String instanceId, Instance instance) { + CreateInstanceRequest request = + CreateInstanceRequest.newBuilder() + .setParent(parent) + .setInstanceId(instanceId) + .setInstance(instance) + .build(); + return createInstanceAsync(request); } // 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]");
-   *   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();
    * }
    * 
* * @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 createInstanceAsync(CreateInstanceRequest request) { + return createInstanceOperationCallable().futureCall(request); } // 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]");
-   *   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 - listInstancesPagedCallable() { - return stub.listInstancesPagedCallable(); + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public final OperationCallable + createInstanceOperationCallable() { + return stub.createInstanceOperationCallable(); } // 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]");
-   *   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();
    * }
    * 
*/ - public final UnaryCallable listInstancesCallable() { - return stub.listInstancesCallable(); + public final UnaryCallable createInstanceCallable() { + return stub.createInstanceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Gets the details of a specific Redis instance. - * - *

Sample code: - * - *


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

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: * *


    * 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 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]: + *

* `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 updateInstanceAsync( + FieldMask updateMask, Instance instance) { + UpdateInstanceRequest request = + UpdateInstanceRequest.newBuilder().setUpdateMask(updateMask).setInstance(instance).build(); + return updateInstanceAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Gets the details of a specific Redis instance. + * Updates the metadata and configuration of a specific Redis instance. + * + *

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: * *


    * 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();
    * }
    * 
* * @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 updateInstanceAsync(UpdateInstanceRequest request) { + return updateInstanceOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Gets the details of a specific Redis instance. + * Updates the metadata and configuration of a specific Redis instance. + * + *

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: * *


    * 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();
    * }
    * 
*/ - public final UnaryCallable getInstanceCallable() { - return stub.getInstanceCallable(); + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") + public final OperationCallable + updateInstanceOperationCallable() { + return stub.updateInstanceOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Creates a Redis instance based on the specified tier and memory size. - * - *

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: * *


    * 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: - *

* 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 createInstanceAsync( - LocationName parent, String instanceId, Instance instance) { - CreateInstanceRequest request = - CreateInstanceRequest.newBuilder() - .setParent(parent == null ? null : parent.toString()) - .setInstanceId(instanceId) - .setInstance(instance) - .build(); - return createInstanceAsync(request); + public final UnaryCallable updateInstanceCallable() { + return stub.updateInstanceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Creates a Redis instance based on the specified tier and memory size. - * - *

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 createInstanceAsync( * *


    * 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();
    * }
    * 
* - * @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 + * @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 createInstanceAsync( - String parent, String instanceId, Instance instance) { - CreateInstanceRequest request = - CreateInstanceRequest.newBuilder() - .setParent(parent) - .setInstanceId(instanceId) - .setInstance(instance) - .build(); - return createInstanceAsync(request); + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture importInstanceAsync( + String name, InputConfig inputConfig) { + ImportInstanceRequest request = + ImportInstanceRequest.newBuilder().setName(name).setInputConfig(inputConfig).build(); + return importInstanceAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Creates a Redis instance based on the specified tier and memory size. - * - *

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 createInstanceAsync( * *


    * 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();
    * }
    * 
* @@ -596,21 +657,16 @@ public final OperationFuture createInstanceAsync( */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture createInstanceAsync(CreateInstanceRequest request) { - return createInstanceOperationCallable().futureCall(request); + public final OperationFuture importInstanceAsync(ImportInstanceRequest request) { + return importInstanceOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Creates a Redis instance based on the specified tier and memory size. - * - *

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 createInstanceAsync(CreateInstanceRe * *


    * 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();
    * }
    * 
*/ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public final OperationCallable - createInstanceOperationCallable() { - return stub.createInstanceOperationCallable(); + public final OperationCallable + importInstanceOperationCallable() { + return stub.importInstanceOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Creates a Redis instance based on the specified tier and memory size. - * - *

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 createInstanceAsync(CreateInstanceRe * *


    * 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();
    * }
    * 
*/ - public final UnaryCallable createInstanceCallable() { - return stub.createInstanceCallable(); + public final UnaryCallable importInstanceCallable() { + return stub.importInstanceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Updates the metadata and configuration of a specific Redis instance. + * Export Redis instance data into a Redis RDB format file in Cloud Storage. * - *

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: * *


    * 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();
    * }
    * 
* - * @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]: - *

* `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 updateInstanceAsync( - FieldMask updateMask, Instance instance) { - UpdateInstanceRequest request = - UpdateInstanceRequest.newBuilder().setUpdateMask(updateMask).setInstance(instance).build(); - return updateInstanceAsync(request); + public final OperationFuture exportInstanceAsync( + String name, OutputConfig outputConfig) { + ExportInstanceRequest request = + ExportInstanceRequest.newBuilder().setName(name).setOutputConfig(outputConfig).build(); + return exportInstanceAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Updates the metadata and configuration of a specific Redis instance. + * Export Redis instance data into a Redis RDB format file in Cloud Storage. * - *

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: * *


    * 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();
    * }
    * 
* @@ -771,148 +785,152 @@ public final OperationFuture updateInstanceAsync( */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture updateInstanceAsync(UpdateInstanceRequest request) { - return updateInstanceOperationCallable().futureCall(request); + public final OperationFuture exportInstanceAsync(ExportInstanceRequest request) { + return exportInstanceOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Updates the metadata and configuration of a specific Redis instance. + * Export Redis instance data into a Redis RDB format file in Cloud Storage. * - *

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: * *


    * 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();
    * }
    * 
*/ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public final OperationCallable - updateInstanceOperationCallable() { - return stub.updateInstanceOperationCallable(); + public final OperationCallable + exportInstanceOperationCallable() { + return stub.exportInstanceOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Export Redis instance data into a Redis RDB format file in Cloud Storage. + * + *

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: + * + *


+   * 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();
+   * }
+   * 
+ */ + public final UnaryCallable exportInstanceCallable() { + return stub.exportInstanceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Updates the metadata and configuration of a specific Redis instance. - * - *

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: * *


    * 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 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 updateInstanceCallable() { - return stub.updateInstanceCallable(); + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture failoverInstanceAsync( + InstanceName name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode) { + FailoverInstanceRequest request = + FailoverInstanceRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setDataProtectionMode(dataProtectionMode) + .build(); + return failoverInstanceAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. - * - *

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: * *


    * 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();
    * }
    * 
* * @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 importInstanceAsync( - String name, InputConfig inputConfig) { - ImportInstanceRequest request = - ImportInstanceRequest.newBuilder().setName(name).setInputConfig(inputConfig).build(); - return importInstanceAsync(request); + public final OperationFuture failoverInstanceAsync( + String name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode) { + FailoverInstanceRequest request = + FailoverInstanceRequest.newBuilder() + .setName(name) + .setDataProtectionMode(dataProtectionMode) + .build(); + return failoverInstanceAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. - * - *

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: * *


    * 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();
    * }
    * 
* @@ -921,126 +939,123 @@ public final OperationFuture importInstanceAsync( */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture importInstanceAsync(ImportInstanceRequest request) { - return importInstanceOperationCallable().futureCall(request); + public final OperationFuture failoverInstanceAsync( + FailoverInstanceRequest request) { + return failoverInstanceOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. - * - *

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: * *


    * 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();
    * }
    * 
*/ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public final OperationCallable - importInstanceOperationCallable() { - return stub.importInstanceOperationCallable(); + public final OperationCallable + failoverInstanceOperationCallable() { + return stub.failoverInstanceOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. - * - *

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: * *


    * 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();
    * }
    * 
*/ - public final UnaryCallable importInstanceCallable() { - return stub.importInstanceCallable(); + public final UnaryCallable failoverInstanceCallable() { + return stub.failoverInstanceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Export Redis instance data into a Redis RDB format file in Cloud Storage. - * - *

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: * *


    * 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. - * @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 exportInstanceAsync( - String name, OutputConfig outputConfig) { - ExportInstanceRequest request = - ExportInstanceRequest.newBuilder().setName(name).setOutputConfig(outputConfig).build(); - return exportInstanceAsync(request); + public final OperationFuture deleteInstanceAsync(InstanceName name) { + DeleteInstanceRequest request = + DeleteInstanceRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return deleteInstanceAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Export Redis instance data into a Redis RDB format file in Cloud Storage. + * Deletes a specific Redis instance. Instance stops serving and data is deleted. * - *

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. + *


+   * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+   *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
+   *   cloudRedisClient.deleteInstanceAsync(name.toString()).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 deleteInstanceAsync(String name) { + DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder().setName(name).build(); + return deleteInstanceAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a specific Redis instance. Instance stops serving and data is deleted. * *

Sample code: * *


    * 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();
    * }
    * 
* @@ -1049,223 +1064,238 @@ public final OperationFuture exportInstanceAsync( */ @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") - public final OperationFuture exportInstanceAsync(ExportInstanceRequest request) { - return exportInstanceOperationCallable().futureCall(request); + public final OperationFuture deleteInstanceAsync(DeleteInstanceRequest request) { + return deleteInstanceOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Export Redis instance data into a Redis RDB format file in Cloud Storage. - * - *

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: * *


    * 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();
    * }
    * 
*/ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public final OperationCallable - exportInstanceOperationCallable() { - return stub.exportInstanceOperationCallable(); + public final OperationCallable + deleteInstanceOperationCallable() { + return stub.deleteInstanceOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Export Redis instance data into a Redis RDB format file in Cloud Storage. - * - *

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: * *


    * 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();
    * }
    * 
*/ - public final UnaryCallable exportInstanceCallable() { - return stub.exportInstanceCallable(); + public final UnaryCallable deleteInstanceCallable() { + return stub.deleteInstanceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Initiates a failover of the master node to current replica node for a specific STANDARD tier - * Cloud Memorystore for Redis instance. + * Lists all Redis instances owned by a project in either the specified location (region) or all + * locations. + * + *

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: * *


    * 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 failoverInstanceAsync( - InstanceName name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode) { - FailoverInstanceRequest request = - FailoverInstanceRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .setDataProtectionMode(dataProtectionMode) + public final ListInstancesPagedResponse listInstances(LocationName parent) { + ListInstancesRequest request = + ListInstancesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) .build(); - return failoverInstanceAsync(request); + return listInstances(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Initiates a failover of the master node to current replica node for a specific STANDARD tier - * Cloud Memorystore for Redis instance. + * Lists all Redis instances owned by a project in either the specified location (region) or all + * locations. + * + *

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: * *


    * 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 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 failoverInstanceAsync( - String name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode) { - FailoverInstanceRequest request = - FailoverInstanceRequest.newBuilder() - .setName(name) - .setDataProtectionMode(dataProtectionMode) - .build(); - return failoverInstanceAsync(request); + public final ListInstancesPagedResponse listInstances(String parent) { + ListInstancesRequest request = ListInstancesRequest.newBuilder().setParent(parent).build(); + return listInstances(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Initiates a failover of the master node to current replica node for a specific STANDARD tier - * Cloud Memorystore for Redis instance. + * Lists all Redis instances owned by a project in either the specified location (region) or all + * locations. + * + *

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: * *


    * 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);
+   *   }
    * }
    * 
* * @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 failoverInstanceAsync( - FailoverInstanceRequest request) { - return failoverInstanceOperationCallable().futureCall(request); + public final ListInstancesPagedResponse listInstances(ListInstancesRequest request) { + return listInstancesPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Initiates a failover of the master node to current replica node for a specific STANDARD tier - * Cloud Memorystore for Redis instance. + * Lists all Redis instances owned by a project in either the specified location (region) or all + * locations. + * + *

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: * *


    * 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);
+   *   }
    * }
    * 
*/ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public final OperationCallable - failoverInstanceOperationCallable() { - return stub.failoverInstanceOperationCallable(); + public final UnaryCallable + listInstancesPagedCallable() { + return stub.listInstancesPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Initiates a failover of the master node to current replica node for a specific STANDARD tier - * Cloud Memorystore for Redis instance. + * Lists all Redis instances owned by a project in either the specified location (region) or all + * locations. + * + *

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: * *


    * 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;
+   *     }
+   *   }
    * }
    * 
*/ - public final UnaryCallable failoverInstanceCallable() { - return stub.failoverInstanceCallable(); + public final UnaryCallable listInstancesCallable() { + return stub.listInstancesCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Deletes a specific Redis instance. Instance stops serving and data is deleted. + * Gets the details of a specific Redis instance. * *

Sample code: * *


    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
-   *   cloudRedisClient.deleteInstanceAsync(name).get();
+   *   Instance response = cloudRedisClient.getInstance(name);
    * }
    * 
* @@ -1274,24 +1304,22 @@ public final UnaryCallable failoverInstanceC * 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 deleteInstanceAsync(InstanceName name) { - DeleteInstanceRequest request = - DeleteInstanceRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - return deleteInstanceAsync(request); + 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 /** - * Deletes a specific Redis instance. Instance stops serving and data is deleted. + * Gets the details of a specific Redis instance. * *

Sample code: * *


    * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
    *   InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
-   *   cloudRedisClient.deleteInstanceAsync(name.toString()).get();
+   *   Instance response = cloudRedisClient.getInstance(name.toString());
    * }
    * 
* @@ -1300,82 +1328,54 @@ public final OperationFuture deleteInstanceAsync(InstanceName name) * 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 deleteInstanceAsync(String name) { - DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder().setName(name).build(); - return deleteInstanceAsync(request); + public final Instance getInstance(String name) { + GetInstanceRequest request = GetInstanceRequest.newBuilder().setName(name).build(); + return getInstance(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Deletes a specific Redis instance. Instance stops serving and data is deleted. + * Gets the details of a specific Redis instance. * *

Sample code: * *


    * 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);
    * }
    * 
* * @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 deleteInstanceAsync(DeleteInstanceRequest request) { - return deleteInstanceOperationCallable().futureCall(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD - /** - * Deletes a specific Redis instance. Instance stops serving and data is deleted. - * - *

Sample code: - * - *


-   * 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();
-   * }
-   * 
- */ - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") - public final OperationCallable - deleteInstanceOperationCallable() { - return stub.deleteInstanceOperationCallable(); + public final Instance getInstance(GetInstanceRequest request) { + return getInstanceCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD /** - * Deletes a specific Redis instance. Instance stops serving and data is deleted. + * Gets the details of a specific Redis instance. * *

Sample code: * *


    * 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();
    * }
    * 
*/ - public final UnaryCallable deleteInstanceCallable() { - return stub.deleteInstanceCallable(); + public final UnaryCallable getInstanceCallable() { + return stub.getInstanceCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD diff --git a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/CloudRedisSettings.java b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/CloudRedisSettings.java index 10a87819..6aa5ceda 100644 --- a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/CloudRedisSettings.java +++ b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/CloudRedisSettings.java @@ -71,17 +71,6 @@ @Generated("by gapic-generator") @BetaApi public class CloudRedisSettings extends ClientSettings { - /** Returns the object with the settings used for calls to listInstances. */ - public PagedCallSettings - listInstancesSettings() { - return ((CloudRedisStubSettings) getStubSettings()).listInstancesSettings(); - } - - /** Returns the object with the settings used for calls to getInstance. */ - public UnaryCallSettings getInstanceSettings() { - return ((CloudRedisStubSettings) getStubSettings()).getInstanceSettings(); - } - /** Returns the object with the settings used for calls to createInstance. */ public UnaryCallSettings createInstanceSettings() { return ((CloudRedisStubSettings) getStubSettings()).createInstanceSettings(); @@ -160,6 +149,17 @@ public UnaryCallSettings deleteInstanceSetting return ((CloudRedisStubSettings) getStubSettings()).deleteInstanceOperationSettings(); } + /** Returns the object with the settings used for calls to listInstances. */ + public PagedCallSettings + listInstancesSettings() { + return ((CloudRedisStubSettings) getStubSettings()).listInstancesSettings(); + } + + /** Returns the object with the settings used for calls to getInstance. */ + public UnaryCallSettings getInstanceSettings() { + return ((CloudRedisStubSettings) getStubSettings()).getInstanceSettings(); + } + /** Returns the object with the settings used for calls to upgradeInstance. */ public UnaryCallSettings upgradeInstanceSettings() { return ((CloudRedisStubSettings) getStubSettings()).upgradeInstanceSettings(); @@ -269,18 +269,6 @@ public Builder applyToAllUnaryMethods( return this; } - /** Returns the builder for the settings used for calls to listInstances. */ - public PagedCallSettings.Builder< - ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse> - listInstancesSettings() { - return getStubSettingsBuilder().listInstancesSettings(); - } - - /** Returns the builder for the settings used for calls to getInstance. */ - public UnaryCallSettings.Builder getInstanceSettings() { - return getStubSettingsBuilder().getInstanceSettings(); - } - /** Returns the builder for the settings used for calls to createInstance. */ public UnaryCallSettings.Builder createInstanceSettings() { return getStubSettingsBuilder().createInstanceSettings(); @@ -360,6 +348,18 @@ public UnaryCallSettings.Builder deleteInstanc return getStubSettingsBuilder().deleteInstanceOperationSettings(); } + /** Returns the builder for the settings used for calls to listInstances. */ + public PagedCallSettings.Builder< + ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse> + listInstancesSettings() { + return getStubSettingsBuilder().listInstancesSettings(); + } + + /** Returns the builder for the settings used for calls to getInstance. */ + public UnaryCallSettings.Builder getInstanceSettings() { + return getStubSettingsBuilder().getInstanceSettings(); + } + /** Returns the builder for the settings used for calls to upgradeInstance. */ public UnaryCallSettings.Builder upgradeInstanceSettings() { return getStubSettingsBuilder().upgradeInstanceSettings(); diff --git a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/CloudRedisStub.java b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/CloudRedisStub.java index 19a35a7f..942391f0 100644 --- a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/CloudRedisStub.java +++ b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/CloudRedisStub.java @@ -53,19 +53,6 @@ public OperationsStub getOperationsStub() { throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); } - public UnaryCallable - listInstancesPagedCallable() { - throw new UnsupportedOperationException("Not implemented: listInstancesPagedCallable()"); - } - - public UnaryCallable listInstancesCallable() { - throw new UnsupportedOperationException("Not implemented: listInstancesCallable()"); - } - - public UnaryCallable getInstanceCallable() { - throw new UnsupportedOperationException("Not implemented: getInstanceCallable()"); - } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable createInstanceOperationCallable() { throw new UnsupportedOperationException("Not implemented: createInstanceOperationCallable()"); @@ -121,6 +108,19 @@ public UnaryCallable deleteInstanceCallable() throw new UnsupportedOperationException("Not implemented: deleteInstanceCallable()"); } + public UnaryCallable + listInstancesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listInstancesPagedCallable()"); + } + + public UnaryCallable listInstancesCallable() { + throw new UnsupportedOperationException("Not implemented: listInstancesCallable()"); + } + + public UnaryCallable getInstanceCallable() { + throw new UnsupportedOperationException("Not implemented: getInstanceCallable()"); + } + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable upgradeInstanceOperationCallable() { diff --git a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java index 17cd4bba..7cc28280 100644 --- a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java +++ b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/CloudRedisStubSettings.java @@ -104,10 +104,6 @@ public class CloudRedisStubSettings extends StubSettings private static final ImmutableList DEFAULT_SERVICE_SCOPES = ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); - private final PagedCallSettings< - ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse> - listInstancesSettings; - private final UnaryCallSettings getInstanceSettings; private final UnaryCallSettings createInstanceSettings; private final OperationCallSettings createInstanceOperationSettings; @@ -126,21 +122,14 @@ public class CloudRedisStubSettings extends StubSettings private final UnaryCallSettings deleteInstanceSettings; private final OperationCallSettings deleteInstanceOperationSettings; + private final PagedCallSettings< + ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse> + listInstancesSettings; + private final UnaryCallSettings getInstanceSettings; private final UnaryCallSettings upgradeInstanceSettings; private final OperationCallSettings upgradeInstanceOperationSettings; - /** Returns the object with the settings used for calls to listInstances. */ - public PagedCallSettings - listInstancesSettings() { - return listInstancesSettings; - } - - /** Returns the object with the settings used for calls to getInstance. */ - public UnaryCallSettings getInstanceSettings() { - return getInstanceSettings; - } - /** Returns the object with the settings used for calls to createInstance. */ public UnaryCallSettings createInstanceSettings() { return createInstanceSettings; @@ -213,6 +202,17 @@ public UnaryCallSettings deleteInstanceSetting return deleteInstanceOperationSettings; } + /** Returns the object with the settings used for calls to listInstances. */ + public PagedCallSettings + listInstancesSettings() { + return listInstancesSettings; + } + + /** Returns the object with the settings used for calls to getInstance. */ + public UnaryCallSettings getInstanceSettings() { + return getInstanceSettings; + } + /** Returns the object with the settings used for calls to upgradeInstance. */ public UnaryCallSettings upgradeInstanceSettings() { return upgradeInstanceSettings; @@ -294,8 +294,6 @@ public Builder toBuilder() { protected CloudRedisStubSettings(Builder settingsBuilder) throws IOException { super(settingsBuilder); - listInstancesSettings = settingsBuilder.listInstancesSettings().build(); - getInstanceSettings = settingsBuilder.getInstanceSettings().build(); createInstanceSettings = settingsBuilder.createInstanceSettings().build(); createInstanceOperationSettings = settingsBuilder.createInstanceOperationSettings().build(); updateInstanceSettings = settingsBuilder.updateInstanceSettings().build(); @@ -308,6 +306,8 @@ protected CloudRedisStubSettings(Builder settingsBuilder) throws IOException { failoverInstanceOperationSettings = settingsBuilder.failoverInstanceOperationSettings().build(); deleteInstanceSettings = settingsBuilder.deleteInstanceSettings().build(); deleteInstanceOperationSettings = settingsBuilder.deleteInstanceOperationSettings().build(); + listInstancesSettings = settingsBuilder.listInstancesSettings().build(); + getInstanceSettings = settingsBuilder.getInstanceSettings().build(); upgradeInstanceSettings = settingsBuilder.upgradeInstanceSettings().build(); upgradeInstanceOperationSettings = settingsBuilder.upgradeInstanceOperationSettings().build(); } @@ -369,10 +369,6 @@ public ApiFuture getFuturePagedResponse( public static class Builder extends StubSettings.Builder { private final ImmutableList> unaryMethodSettingsBuilders; - private final PagedCallSettings.Builder< - ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse> - listInstancesSettings; - private final UnaryCallSettings.Builder getInstanceSettings; private final UnaryCallSettings.Builder createInstanceSettings; private final OperationCallSettings.Builder @@ -397,6 +393,10 @@ public static class Builder extends StubSettings.Builder deleteInstanceOperationSettings; + private final PagedCallSettings.Builder< + ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse> + listInstancesSettings; + private final UnaryCallSettings.Builder getInstanceSettings; private final UnaryCallSettings.Builder upgradeInstanceSettings; private final OperationCallSettings.Builder @@ -408,12 +408,9 @@ public static class Builder extends StubSettings.Builder> definitions = ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); definitions.put( - "idempotent", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); - definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } @@ -422,17 +419,16 @@ public static class Builder extends StubSettings.Builder definitions = ImmutableMap.builder(); RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); settings = RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setInitialRpcTimeout(Duration.ofMillis(600000L)) .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setMaxRpcTimeout(Duration.ofMillis(600000L)) .setTotalTimeout(Duration.ofMillis(600000L)) .build(); - definitions.put("default", settings); + definitions.put("no_retry_1_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } @@ -443,10 +439,6 @@ protected Builder() { protected Builder(ClientContext clientContext) { super(clientContext); - listInstancesSettings = PagedCallSettings.newBuilder(LIST_INSTANCES_PAGE_STR_FACT); - - getInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - createInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); createInstanceOperationSettings = OperationCallSettings.newBuilder(); @@ -471,20 +463,24 @@ protected Builder(ClientContext clientContext) { deleteInstanceOperationSettings = OperationCallSettings.newBuilder(); + listInstancesSettings = PagedCallSettings.newBuilder(LIST_INSTANCES_PAGE_STR_FACT); + + getInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + upgradeInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); upgradeInstanceOperationSettings = OperationCallSettings.newBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( - listInstancesSettings, - getInstanceSettings, createInstanceSettings, updateInstanceSettings, importInstanceSettings, exportInstanceSettings, failoverInstanceSettings, deleteInstanceSettings, + listInstancesSettings, + getInstanceSettings, upgradeInstanceSettings); initDefaults(this); @@ -501,57 +497,57 @@ private static Builder createDefault() { private static Builder initDefaults(Builder builder) { - builder - .listInstancesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - - builder - .getInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); - builder .createInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .updateInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .importInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .exportInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .failoverInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .deleteInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .listInstancesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .getInstanceSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .upgradeInstanceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); builder .createInstanceOperationSettings() .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Instance.class)) @@ -572,8 +568,8 @@ private static Builder initDefaults(Builder builder) { .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Instance.class)) @@ -594,8 +590,8 @@ private static Builder initDefaults(Builder builder) { .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Instance.class)) @@ -616,8 +612,8 @@ private static Builder initDefaults(Builder builder) { .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Instance.class)) @@ -638,8 +634,8 @@ private static Builder initDefaults(Builder builder) { .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Instance.class)) @@ -660,8 +656,8 @@ private static Builder initDefaults(Builder builder) { .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Empty.class)) @@ -682,8 +678,8 @@ private static Builder initDefaults(Builder builder) { .setInitialCallSettings( UnaryCallSettings .newUnaryCallSettingsBuilder() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")) + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Instance.class)) @@ -706,8 +702,6 @@ private static Builder initDefaults(Builder builder) { protected Builder(CloudRedisStubSettings settings) { super(settings); - listInstancesSettings = settings.listInstancesSettings.toBuilder(); - getInstanceSettings = settings.getInstanceSettings.toBuilder(); createInstanceSettings = settings.createInstanceSettings.toBuilder(); createInstanceOperationSettings = settings.createInstanceOperationSettings.toBuilder(); updateInstanceSettings = settings.updateInstanceSettings.toBuilder(); @@ -720,19 +714,21 @@ protected Builder(CloudRedisStubSettings settings) { failoverInstanceOperationSettings = settings.failoverInstanceOperationSettings.toBuilder(); deleteInstanceSettings = settings.deleteInstanceSettings.toBuilder(); deleteInstanceOperationSettings = settings.deleteInstanceOperationSettings.toBuilder(); + listInstancesSettings = settings.listInstancesSettings.toBuilder(); + getInstanceSettings = settings.getInstanceSettings.toBuilder(); upgradeInstanceSettings = settings.upgradeInstanceSettings.toBuilder(); upgradeInstanceOperationSettings = settings.upgradeInstanceOperationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( - listInstancesSettings, - getInstanceSettings, createInstanceSettings, updateInstanceSettings, importInstanceSettings, exportInstanceSettings, failoverInstanceSettings, deleteInstanceSettings, + listInstancesSettings, + getInstanceSettings, upgradeInstanceSettings); } @@ -752,18 +748,6 @@ public Builder applyToAllUnaryMethods( return unaryMethodSettingsBuilders; } - /** Returns the builder for the settings used for calls to listInstances. */ - public PagedCallSettings.Builder< - ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse> - listInstancesSettings() { - return listInstancesSettings; - } - - /** Returns the builder for the settings used for calls to getInstance. */ - public UnaryCallSettings.Builder getInstanceSettings() { - return getInstanceSettings; - } - /** Returns the builder for the settings used for calls to createInstance. */ public UnaryCallSettings.Builder createInstanceSettings() { return createInstanceSettings; @@ -843,6 +827,18 @@ public UnaryCallSettings.Builder deleteInstanc return deleteInstanceOperationSettings; } + /** Returns the builder for the settings used for calls to listInstances. */ + public PagedCallSettings.Builder< + ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse> + listInstancesSettings() { + return listInstancesSettings; + } + + /** Returns the builder for the settings used for calls to getInstance. */ + public UnaryCallSettings.Builder getInstanceSettings() { + return getInstanceSettings; + } + /** Returns the builder for the settings used for calls to upgradeInstance. */ public UnaryCallSettings.Builder upgradeInstanceSettings() { return upgradeInstanceSettings; diff --git a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/GrpcCloudRedisStub.java b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/GrpcCloudRedisStub.java index 02a7f651..e0260441 100644 --- a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/GrpcCloudRedisStub.java +++ b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1beta1/stub/GrpcCloudRedisStub.java @@ -59,23 +59,6 @@ @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public class GrpcCloudRedisStub extends CloudRedisStub { - private static final MethodDescriptor - listInstancesMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.redis.v1beta1.CloudRedis/ListInstances") - .setRequestMarshaller( - ProtoUtils.marshaller(ListInstancesRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ListInstancesResponse.getDefaultInstance())) - .build(); - private static final MethodDescriptor getInstanceMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.redis.v1beta1.CloudRedis/GetInstance") - .setRequestMarshaller(ProtoUtils.marshaller(GetInstanceRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Instance.getDefaultInstance())) - .build(); private static final MethodDescriptor createInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -130,6 +113,23 @@ public class GrpcCloudRedisStub extends CloudRedisStub { ProtoUtils.marshaller(DeleteInstanceRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) .build(); + private static final MethodDescriptor + listInstancesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.redis.v1beta1.CloudRedis/ListInstances") + .setRequestMarshaller( + ProtoUtils.marshaller(ListInstancesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListInstancesResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor getInstanceMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.redis.v1beta1.CloudRedis/GetInstance") + .setRequestMarshaller(ProtoUtils.marshaller(GetInstanceRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Instance.getDefaultInstance())) + .build(); private static final MethodDescriptor upgradeInstanceMethodDescriptor = MethodDescriptor.newBuilder() @@ -143,10 +143,6 @@ public class GrpcCloudRedisStub extends CloudRedisStub { private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; - private final UnaryCallable listInstancesCallable; - private final UnaryCallable - listInstancesPagedCallable; - private final UnaryCallable getInstanceCallable; private final UnaryCallable createInstanceCallable; private final OperationCallable createInstanceOperationCallable; @@ -165,6 +161,10 @@ public class GrpcCloudRedisStub extends CloudRedisStub { private final UnaryCallable deleteInstanceCallable; private final OperationCallable deleteInstanceOperationCallable; + private final UnaryCallable listInstancesCallable; + private final UnaryCallable + listInstancesPagedCallable; + private final UnaryCallable getInstanceCallable; private final UnaryCallable upgradeInstanceCallable; private final OperationCallable upgradeInstanceOperationCallable; @@ -209,32 +209,6 @@ protected GrpcCloudRedisStub( this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); - GrpcCallSettings listInstancesTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(listInstancesMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(ListInstancesRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - } - }) - .build(); - GrpcCallSettings getInstanceTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getInstanceMethodDescriptor) - .setParamsExtractor( - new RequestParamsExtractor() { - @Override - public Map extract(GetInstanceRequest request) { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - } - }) - .build(); GrpcCallSettings createInstanceTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createInstanceMethodDescriptor) @@ -313,6 +287,32 @@ public Map extract(DeleteInstanceRequest request) { } }) .build(); + GrpcCallSettings listInstancesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listInstancesMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListInstancesRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getInstanceTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getInstanceMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetInstanceRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); GrpcCallSettings upgradeInstanceTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(upgradeInstanceMethodDescriptor) @@ -327,15 +327,6 @@ public Map extract(UpgradeInstanceRequest request) { }) .build(); - this.listInstancesCallable = - callableFactory.createUnaryCallable( - listInstancesTransportSettings, settings.listInstancesSettings(), clientContext); - this.listInstancesPagedCallable = - callableFactory.createPagedCallable( - listInstancesTransportSettings, settings.listInstancesSettings(), clientContext); - this.getInstanceCallable = - callableFactory.createUnaryCallable( - getInstanceTransportSettings, settings.getInstanceSettings(), clientContext); this.createInstanceCallable = callableFactory.createUnaryCallable( createInstanceTransportSettings, settings.createInstanceSettings(), clientContext); @@ -390,6 +381,15 @@ public Map extract(UpgradeInstanceRequest request) { settings.deleteInstanceOperationSettings(), clientContext, this.operationsStub); + this.listInstancesCallable = + callableFactory.createUnaryCallable( + listInstancesTransportSettings, settings.listInstancesSettings(), clientContext); + this.listInstancesPagedCallable = + callableFactory.createPagedCallable( + listInstancesTransportSettings, settings.listInstancesSettings(), clientContext); + this.getInstanceCallable = + callableFactory.createUnaryCallable( + getInstanceTransportSettings, settings.getInstanceSettings(), clientContext); this.upgradeInstanceCallable = callableFactory.createUnaryCallable( upgradeInstanceTransportSettings, settings.upgradeInstanceSettings(), clientContext); @@ -408,19 +408,6 @@ public GrpcOperationsStub getOperationsStub() { return operationsStub; } - public UnaryCallable - listInstancesPagedCallable() { - return listInstancesPagedCallable; - } - - public UnaryCallable listInstancesCallable() { - return listInstancesCallable; - } - - public UnaryCallable getInstanceCallable() { - return getInstanceCallable; - } - @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable createInstanceOperationCallable() { return createInstanceOperationCallable; @@ -476,6 +463,19 @@ public UnaryCallable deleteInstanceCallable() return deleteInstanceCallable; } + public UnaryCallable + listInstancesPagedCallable() { + return listInstancesPagedCallable; + } + + public UnaryCallable listInstancesCallable() { + return listInstancesCallable; + } + + public UnaryCallable getInstanceCallable() { + return getInstanceCallable; + } + @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallable upgradeInstanceOperationCallable() { diff --git a/google-cloud-redis/src/test/java/com/google/cloud/redis/v1beta1/CloudRedisClientTest.java b/google-cloud-redis/src/test/java/com/google/cloud/redis/v1beta1/CloudRedisClientTest.java index 05137664..f859d995 100644 --- a/google-cloud-redis/src/test/java/com/google/cloud/redis/v1beta1/CloudRedisClientTest.java +++ b/google-cloud-redis/src/test/java/com/google/cloud/redis/v1beta1/CloudRedisClientTest.java @@ -83,120 +83,6 @@ public void tearDown() throws Exception { client.close(); } - @Test - @SuppressWarnings("all") - public void listInstancesTest() { - String nextPageToken = ""; - Instance instancesElement = Instance.newBuilder().build(); - List instances = Arrays.asList(instancesElement); - ListInstancesResponse expectedResponse = - ListInstancesResponse.newBuilder() - .setNextPageToken(nextPageToken) - .addAllInstances(instances) - .build(); - mockCloudRedis.addResponse(expectedResponse); - - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - - ListInstancesPagedResponse pagedListResponse = client.listInstances(parent); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getInstancesList().get(0), resources.get(0)); - - List actualRequests = mockCloudRedis.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListInstancesRequest actualRequest = (ListInstancesRequest) actualRequests.get(0); - - Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - @SuppressWarnings("all") - public void listInstancesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockCloudRedis.addException(exception); - - try { - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - - client.listInstances(parent); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception - } - } - - @Test - @SuppressWarnings("all") - public void getInstanceTest() { - InstanceName name2 = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); - String displayName = "displayName1615086568"; - String locationId = "locationId552319461"; - String alternativeLocationId = "alternativeLocationId-718920621"; - String redisVersion = "redisVersion-685310444"; - String reservedIpRange = "reservedIpRange-1082940580"; - String host = "host3208616"; - int port = 3446913; - String currentLocationId = "currentLocationId1312712735"; - String statusMessage = "statusMessage-239442758"; - int memorySizeGb = 34199707; - String authorizedNetwork = "authorizedNetwork-1733809270"; - String persistenceIamIdentity = "persistenceIamIdentity1061944584"; - Instance expectedResponse = - Instance.newBuilder() - .setName(name2.toString()) - .setDisplayName(displayName) - .setLocationId(locationId) - .setAlternativeLocationId(alternativeLocationId) - .setRedisVersion(redisVersion) - .setReservedIpRange(reservedIpRange) - .setHost(host) - .setPort(port) - .setCurrentLocationId(currentLocationId) - .setStatusMessage(statusMessage) - .setMemorySizeGb(memorySizeGb) - .setAuthorizedNetwork(authorizedNetwork) - .setPersistenceIamIdentity(persistenceIamIdentity) - .build(); - mockCloudRedis.addResponse(expectedResponse); - - InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); - - Instance actualResponse = client.getInstance(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockCloudRedis.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - GetInstanceRequest actualRequest = (GetInstanceRequest) actualRequests.get(0); - - Assert.assertEquals(name, InstanceName.parse(actualRequest.getName())); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - @SuppressWarnings("all") - public void getInstanceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); - mockCloudRedis.addException(exception); - - try { - InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); - - client.getInstance(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception - } - } - @Test @SuppressWarnings("all") public void createInstanceTest() throws Exception { @@ -659,6 +545,120 @@ public void deleteInstanceExceptionTest() throws Exception { } } + @Test + @SuppressWarnings("all") + public void listInstancesTest() { + String nextPageToken = ""; + Instance instancesElement = Instance.newBuilder().build(); + List instances = Arrays.asList(instancesElement); + ListInstancesResponse expectedResponse = + ListInstancesResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllInstances(instances) + .build(); + mockCloudRedis.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListInstancesPagedResponse pagedListResponse = client.listInstances(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getInstancesList().get(0), resources.get(0)); + + List actualRequests = mockCloudRedis.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListInstancesRequest actualRequest = (ListInstancesRequest) actualRequests.get(0); + + Assert.assertEquals(parent, LocationName.parse(actualRequest.getParent())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listInstancesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudRedis.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + client.listInstances(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getInstanceTest() { + InstanceName name2 = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + String displayName = "displayName1615086568"; + String locationId = "locationId552319461"; + String alternativeLocationId = "alternativeLocationId-718920621"; + String redisVersion = "redisVersion-685310444"; + String reservedIpRange = "reservedIpRange-1082940580"; + String host = "host3208616"; + int port = 3446913; + String currentLocationId = "currentLocationId1312712735"; + String statusMessage = "statusMessage-239442758"; + int memorySizeGb = 34199707; + String authorizedNetwork = "authorizedNetwork-1733809270"; + String persistenceIamIdentity = "persistenceIamIdentity1061944584"; + Instance expectedResponse = + Instance.newBuilder() + .setName(name2.toString()) + .setDisplayName(displayName) + .setLocationId(locationId) + .setAlternativeLocationId(alternativeLocationId) + .setRedisVersion(redisVersion) + .setReservedIpRange(reservedIpRange) + .setHost(host) + .setPort(port) + .setCurrentLocationId(currentLocationId) + .setStatusMessage(statusMessage) + .setMemorySizeGb(memorySizeGb) + .setAuthorizedNetwork(authorizedNetwork) + .setPersistenceIamIdentity(persistenceIamIdentity) + .build(); + mockCloudRedis.addResponse(expectedResponse); + + InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + + Instance actualResponse = client.getInstance(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCloudRedis.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetInstanceRequest actualRequest = (GetInstanceRequest) actualRequests.get(0); + + Assert.assertEquals(name, InstanceName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getInstanceExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudRedis.addException(exception); + + try { + InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); + + client.getInstance(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + @Test @SuppressWarnings("all") public void upgradeInstanceTest() throws Exception { diff --git a/synth.metadata b/synth.metadata index 8db5e555..a571ff86 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,23 +4,23 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-redis.git", - "sha": "1fa5b80e71397323a2b24a5fb17957e9a5f3ea26" + "sha": "4ddd6276ecaccb7a8852070a31fbf0f4ed6a3044" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "1174f4ab1ef1cb75e0674c9244f7608fdf9e37f7", - "internalRef": "316514980" + "sha": "57e72ebf709dc5ebbd27a746d6b92b05c054dea2", + "internalRef": "316690171" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "1174f4ab1ef1cb75e0674c9244f7608fdf9e37f7", - "internalRef": "316514980" + "sha": "57e72ebf709dc5ebbd27a746d6b92b05c054dea2", + "internalRef": "316690171" } }, {