diff --git a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/CloudRedisClient.java b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/CloudRedisClient.java
index 069727bb..3d2e4618 100644
--- a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/CloudRedisClient.java
+++ b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/CloudRedisClient.java
@@ -182,270 +182,6 @@ public final OperationsClient getOperationsClient() {
return operationsClient;
}
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * 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()) {
- * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @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
- */
- public final ListInstancesPagedResponse listInstances(LocationName parent) {
- ListInstancesRequest request =
- ListInstancesRequest.newBuilder()
- .setParent(parent == null ? null : parent.toString())
- .build();
- return listInstances(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists 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()) {
- * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * for (Instance element : cloudRedisClient.listInstances(parent.toString()).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- *
- * @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
- */
- public final ListInstancesPagedResponse listInstances(String parent) {
- ListInstancesRequest request = ListInstancesRequest.newBuilder().setParent(parent).build();
- return listInstances(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * 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()) {
- * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * ListInstancesRequest request = ListInstancesRequest.newBuilder()
- * .setParent(parent.toString())
- * .build();
- * 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
- */
- public final ListInstancesPagedResponse listInstances(ListInstancesRequest request) {
- return listInstancesPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * 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()) {
- * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * ListInstancesRequest request = ListInstancesRequest.newBuilder()
- * .setParent(parent.toString())
- * .build();
- * ApiFuture<ListInstancesPagedResponse> future = cloudRedisClient.listInstancesPagedCallable().futureCall(request);
- * // Do something
- * for (Instance element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable
- listInstancesPagedCallable() {
- return stub.listInstancesPagedCallable();
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * 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()) {
- * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- * ListInstancesRequest request = ListInstancesRequest.newBuilder()
- * .setParent(parent.toString())
- * .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;
- * }
- * }
- * }
- *
- */
- public final UnaryCallable listInstancesCallable() {
- return stub.listInstancesCallable();
- }
-
- // 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);
- * }
- *
- *
- * @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.
- *
- * Sample code:
- *
- *
- * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
- * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
- * Instance response = cloudRedisClient.getInstance(name.toString());
- * }
- *
- *
- * @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(String name) {
- GetInstanceRequest request = GetInstanceRequest.newBuilder().setName(name).build();
- return getInstance(request);
- }
-
- // 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]");
- * GetInstanceRequest request = GetInstanceRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * 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
- */
- public final Instance getInstance(GetInstanceRequest request) {
- return getInstanceCallable().call(request);
- }
-
- // 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]");
- * GetInstanceRequest request = GetInstanceRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * ApiFuture<Instance> future = cloudRedisClient.getInstanceCallable().futureCall(request);
- * // Do something
- * Instance response = future.get();
- * }
- *
- */
- public final UnaryCallable getInstanceCallable() {
- return stub.getInstanceCallable();
- }
-
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Creates a Redis instance based on the specified tier and memory size.
@@ -842,78 +578,362 @@ public final OperationFuture updateInstanceAsync(
* Instance instance = Instance.newBuilder()
* .setDisplayName(displayName)
* .setName(name)
- * .setMemorySizeGb(memorySizeGb)
- * .build();
- * UpdateInstanceRequest request = UpdateInstanceRequest.newBuilder()
- * .setUpdateMask(updateMask)
- * .setInstance(instance)
+ * .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();
+ * }
+ *
+ */
+ public final UnaryCallable updateInstanceCallable() {
+ return stub.updateInstanceCallable();
+ }
+
+ // 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.
+ *
+ *
Sample code:
+ *
+ *
+ * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+ * String name = "";
+ * InputConfig inputConfig = InputConfig.newBuilder().build();
+ * Instance response = cloudRedisClient.importInstanceAsync(name, inputConfig).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.
+ * @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);
+ }
+
+ // 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.
+ *
+ *
Sample code:
+ *
+ *
+ * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+ * String name = "";
+ * InputConfig inputConfig = InputConfig.newBuilder().build();
+ * ImportInstanceRequest request = ImportInstanceRequest.newBuilder()
+ * .setName(name)
+ * .setInputConfig(inputConfig)
+ * .build();
+ * Instance response = cloudRedisClient.importInstanceAsync(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
+ */
+ @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);
+ }
+
+ // 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.
+ *
+ *
Sample code:
+ *
+ *
+ * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+ * String name = "";
+ * InputConfig inputConfig = InputConfig.newBuilder().build();
+ * ImportInstanceRequest request = ImportInstanceRequest.newBuilder()
+ * .setName(name)
+ * .setInputConfig(inputConfig)
+ * .build();
+ * OperationFuture<Instance, OperationMetadata> 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
+ importInstanceOperationCallable() {
+ return stub.importInstanceOperationCallable();
+ }
+
+ // 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.
+ *
+ *
Sample code:
+ *
+ *
+ * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
+ * String name = "";
+ * InputConfig inputConfig = InputConfig.newBuilder().build();
+ * ImportInstanceRequest request = ImportInstanceRequest.newBuilder()
+ * .setName(name)
+ * .setInputConfig(inputConfig)
+ * .build();
+ * ApiFuture<Operation> future = cloudRedisClient.importInstanceCallable().futureCall(request);
+ * // Do something
+ * Operation response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallable importInstanceCallable() {
+ return stub.importInstanceCallable();
+ }
+
+ // 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();
+ * Instance response = cloudRedisClient.exportInstanceAsync(name, outputConfig).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);
+ }
+
+ // 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();
+ * Instance response = cloudRedisClient.exportInstanceAsync(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
+ */
+ @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);
+ }
+
+ // 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();
+ * OperationFuture<Instance, OperationMetadata> 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
+ 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.updateInstanceCallable().futureCall(request);
+ * ApiFuture<Operation> future = cloudRedisClient.exportInstanceCallable().futureCall(request);
* // Do something
* Operation response = future.get();
* }
*
*/
- public final UnaryCallable updateInstanceCallable() {
- return stub.updateInstanceCallable();
+ public final UnaryCallable exportInstanceCallable() {
+ return stub.exportInstanceCallable();
}
// 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, 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(
+ 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.
+ * Initiates a failover of the master node to current replica node for a specific STANDARD tier
+ * Cloud Memorystore for 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.
+ *
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]");
+ * 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 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 failoverInstanceAsync(
+ String name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode) {
+ FailoverInstanceRequest request =
+ FailoverInstanceRequest.newBuilder()
+ .setName(name)
+ .setDataProtectionMode(dataProtectionMode)
+ .build();
+ return failoverInstanceAsync(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.
*
* 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();
* }
*
*
@@ -922,127 +942,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, OperationMetadata> future = cloudRedisClient.importInstanceOperationCallable().futureCall(request);
+ * OperationFuture<Instance, OperationMetadata> 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();
* }
*
*
@@ -1051,224 +1067,239 @@ 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, OperationMetadata> future = cloudRedisClient.exportInstanceOperationCallable().futureCall(request);
+ * OperationFuture<Empty, OperationMetadata> 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, OperationMetadata> 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);
* }
*
*
@@ -1277,24 +1308,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());
* }
*
*
@@ -1303,83 +1332,54 @@ public final OperationFuture deleteInstanceAsync(Insta
* 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, OperationMetadata> 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();
}
@Override
diff --git a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/CloudRedisSettings.java b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/CloudRedisSettings.java
index e1039828..955fb37b 100644
--- a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/CloudRedisSettings.java
+++ b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/CloudRedisSettings.java
@@ -70,17 +70,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();
@@ -159,6 +148,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();
+ }
+
public static final CloudRedisSettings create(CloudRedisStubSettings stub) throws IOException {
return new CloudRedisSettings.Builder(stub.toBuilder()).build();
}
@@ -255,18 +255,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();
@@ -346,6 +334,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();
+ }
+
@Override
public CloudRedisSettings build() throws IOException {
return new CloudRedisSettings(this);
diff --git a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/CloudRedisStub.java b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/CloudRedisStub.java
index 85c68195..e38e17bf 100644
--- a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/CloudRedisStub.java
+++ b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/CloudRedisStub.java
@@ -52,19 +52,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() {
@@ -125,6 +112,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()");
+ }
+
@Override
public abstract void close();
}
diff --git a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/CloudRedisStubSettings.java b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/CloudRedisStubSettings.java
index 05d5d77c..7308ca6d 100644
--- a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/CloudRedisStubSettings.java
+++ b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/CloudRedisStubSettings.java
@@ -103,10 +103,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;
@@ -125,17 +121,10 @@ public class CloudRedisStubSettings extends StubSettings
private final UnaryCallSettings deleteInstanceSettings;
private final OperationCallSettings
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;
- }
+ private final PagedCallSettings<
+ ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse>
+ listInstancesSettings;
+ private final UnaryCallSettings getInstanceSettings;
/** Returns the object with the settings used for calls to createInstance. */
public UnaryCallSettings createInstanceSettings() {
@@ -209,6 +198,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;
+ }
+
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public CloudRedisStub createStub() throws IOException {
if (getTransportChannelProvider()
@@ -278,8 +278,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();
@@ -292,6 +290,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();
}
private static final PagedListDescriptor
@@ -351,10 +351,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
@@ -380,6 +376,10 @@ public static class Builder extends StubSettings.Builder
deleteInstanceOperationSettings;
+ private final PagedCallSettings.Builder<
+ ListInstancesRequest, ListInstancesResponse, ListInstancesPagedResponse>
+ listInstancesSettings;
+ private final UnaryCallSettings.Builder getInstanceSettings;
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
@@ -387,12 +387,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();
}
@@ -401,17 +398,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();
}
@@ -422,10 +418,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();
@@ -450,16 +442,20 @@ protected Builder(ClientContext clientContext) {
deleteInstanceOperationSettings = OperationCallSettings.newBuilder();
+ listInstancesSettings = PagedCallSettings.newBuilder(LIST_INSTANCES_PAGE_STR_FACT);
+
+ getInstanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+
unaryMethodSettingsBuilders =
ImmutableList.>of(
- listInstancesSettings,
- getInstanceSettings,
createInstanceSettings,
updateInstanceSettings,
importInstanceSettings,
exportInstanceSettings,
failoverInstanceSettings,
- deleteInstanceSettings);
+ deleteInstanceSettings,
+ listInstancesSettings,
+ getInstanceSettings);
initDefaults(this);
}
@@ -475,52 +471,52 @@ 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
.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))
@@ -542,8 +538,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))
@@ -565,8 +561,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))
@@ -588,8 +584,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))
@@ -611,8 +607,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))
@@ -634,8 +630,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))
@@ -659,8 +655,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();
@@ -673,17 +667,19 @@ protected Builder(CloudRedisStubSettings settings) {
failoverInstanceOperationSettings = settings.failoverInstanceOperationSettings.toBuilder();
deleteInstanceSettings = settings.deleteInstanceSettings.toBuilder();
deleteInstanceOperationSettings = settings.deleteInstanceOperationSettings.toBuilder();
+ listInstancesSettings = settings.listInstancesSettings.toBuilder();
+ getInstanceSettings = settings.getInstanceSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
- listInstancesSettings,
- getInstanceSettings,
createInstanceSettings,
updateInstanceSettings,
importInstanceSettings,
exportInstanceSettings,
failoverInstanceSettings,
- deleteInstanceSettings);
+ deleteInstanceSettings,
+ listInstancesSettings,
+ getInstanceSettings);
}
// NEXT_MAJOR_VER: remove 'throws Exception'
@@ -702,18 +698,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;
@@ -793,6 +777,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;
+ }
+
@Override
public CloudRedisStubSettings build() throws IOException {
return new CloudRedisStubSettings(this);
diff --git a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/GrpcCloudRedisStub.java b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/GrpcCloudRedisStub.java
index 07dec401..d389b3f3 100644
--- a/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/GrpcCloudRedisStub.java
+++ b/google-cloud-redis/src/main/java/com/google/cloud/redis/v1/stub/GrpcCloudRedisStub.java
@@ -58,23 +58,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.v1.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.v1.CloudRedis/GetInstance")
- .setRequestMarshaller(ProtoUtils.marshaller(GetInstanceRequest.getDefaultInstance()))
- .setResponseMarshaller(ProtoUtils.marshaller(Instance.getDefaultInstance()))
- .build();
private static final MethodDescriptor
createInstanceMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -129,14 +112,27 @@ 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.v1.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.v1.CloudRedis/GetInstance")
+ .setRequestMarshaller(ProtoUtils.marshaller(GetInstanceRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Instance.getDefaultInstance()))
+ .build();
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;
@@ -155,6 +151,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 GrpcStubCallableFactory callableFactory;
@@ -196,32 +196,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)
@@ -300,16 +274,33 @@ 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();
- 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);
@@ -364,6 +355,15 @@ public Map extract(DeleteInstanceRequest 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);
backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
@@ -373,19 +373,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() {
@@ -446,6 +433,19 @@ public UnaryCallable deleteInstanceCallable()
return deleteInstanceCallable;
}
+ public UnaryCallable
+ listInstancesPagedCallable() {
+ return listInstancesPagedCallable;
+ }
+
+ public UnaryCallable listInstancesCallable() {
+ return listInstancesCallable;
+ }
+
+ public UnaryCallable getInstanceCallable() {
+ return getInstanceCallable;
+ }
+
@Override
public final void close() {
shutdown();
diff --git a/google-cloud-redis/src/test/java/com/google/cloud/redis/v1/CloudRedisClientTest.java b/google-cloud-redis/src/test/java/com/google/cloud/redis/v1/CloudRedisClientTest.java
index 1208774c..c2b69091 100644
--- a/google-cloud-redis/src/test/java/com/google/cloud/redis/v1/CloudRedisClientTest.java
+++ b/google-cloud-redis/src/test/java/com/google/cloud/redis/v1/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 {
@@ -658,4 +544,118 @@ public void deleteInstanceExceptionTest() throws Exception {
Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
}
}
+
+ @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
+ }
+ }
}
diff --git a/synth.metadata b/synth.metadata
index 84933b5b..076734d6 100644
--- a/synth.metadata
+++ b/synth.metadata
@@ -4,23 +4,23 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-redis.git",
- "sha": "bd8af38050ebf166f54ec07cf531237fa6356a29"
+ "sha": "fd6d8f1069286aa7bb1b0a8a188e3afa9c2a4b83"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
- "sha": "8be3770465a6cf19bea97a84b3e82b113b0239b6",
- "internalRef": "314442049"
+ "sha": "1174f4ab1ef1cb75e0674c9244f7608fdf9e37f7",
+ "internalRef": "316514980"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
- "sha": "8be3770465a6cf19bea97a84b3e82b113b0239b6",
- "internalRef": "314442049"
+ "sha": "1174f4ab1ef1cb75e0674c9244f7608fdf9e37f7",
+ "internalRef": "316514980"
}
},
{