public static List<String> toStringList(List<InstanceName> values) { List<String> list = new ArrayList<String>(values.size()); for (InstanceName value : values) { if (value == null) { list.add(""); } else { list.add(value.toString()); } } return list; }
public static String format(String project, String location, String instance) { return newBuilder() .setProject(project) .setLocation(location) .setInstance(instance) .build() .toString(); }
/** * Gets the details of a specific Redis instance. * * <p>Sample code: * * <pre><code> * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) { * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); * Instance response = cloudRedisClient.getInstance(name); * } * </code></pre> * * @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); }
/** * Deletes a specific Redis instance. Instance stops serving and data is deleted. * * <p>Sample code: * * <pre><code> * try (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) { * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]"); * Empty response = cloudRedisClient.deleteInstanceAsync(name).get(); * } * </code></pre> * * @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<Empty, OperationMetadata> deleteInstanceAsync(InstanceName name) { DeleteInstanceRequest request = DeleteInstanceRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return deleteInstanceAsync(request); }