This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ClusterName name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]"); + * Cluster response = alloyDBAdminClient.getCluster(name); + * } + * }+ * + *
Note: close() needs to be called on the AlloyDBAdminClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *
The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *
See the individual methods for example code. + * + *
Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *
This class can be customized by passing in a custom instance of AlloyDBAdminSettings to + * create(). For example: + * + *
To customize credentials: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * AlloyDBAdminSettings alloyDBAdminSettings = + * AlloyDBAdminSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create(alloyDBAdminSettings); + * }+ * + *
To customize the endpoint: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * AlloyDBAdminSettings alloyDBAdminSettings = + * AlloyDBAdminSettings.newBuilder().setEndpoint(myEndpoint).build(); + * AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create(alloyDBAdminSettings); + * }+ * + *
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * AlloyDBAdminSettings alloyDBAdminSettings = AlloyDBAdminSettings.newHttpJsonBuilder().build(); + * AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create(alloyDBAdminSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class AlloyDBAdminClient implements BackgroundResource { + private final AlloyDBAdminSettings settings; + private final AlloyDBAdminStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of AlloyDBAdminClient with default settings. */ + public static final AlloyDBAdminClient create() throws IOException { + return create(AlloyDBAdminSettings.newBuilder().build()); + } + + /** + * Constructs an instance of AlloyDBAdminClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final AlloyDBAdminClient create(AlloyDBAdminSettings settings) throws IOException { + return new AlloyDBAdminClient(settings); + } + + /** + * Constructs an instance of AlloyDBAdminClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(AlloyDBAdminSettings). + */ + public static final AlloyDBAdminClient create(AlloyDBAdminStub stub) { + return new AlloyDBAdminClient(stub); + } + + /** + * Constructs an instance of AlloyDBAdminClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected AlloyDBAdminClient(AlloyDBAdminSettings settings) throws IOException { + this.settings = settings; + this.stub = ((AlloyDBAdminStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected AlloyDBAdminClient(AlloyDBAdminStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final AlloyDBAdminSettings getSettings() { + return settings; + } + + public AlloyDBAdminStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final com.google.longrunning.OperationsClient getOperationsClient() { + return operationsClient; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Clusters in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (Cluster element : alloyDBAdminClient.listClusters(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an aggregated list + * operation by specifying a value with the following format: * + * projects/{project}/locations/- + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListClustersPagedResponse listClusters(LocationName parent) { + ListClustersRequest request = + ListClustersRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listClusters(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Clusters in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * for (Cluster element : alloyDBAdminClient.listClusters(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. Additionally, you can perform an aggregated list + * operation by specifying a value with the following format: * + * projects/{project}/locations/- + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListClustersPagedResponse listClusters(String parent) { + ListClustersRequest request = ListClustersRequest.newBuilder().setParent(parent).build(); + return listClusters(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Clusters in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListClustersRequest request = + * ListClustersRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (Cluster element : alloyDBAdminClient.listClusters(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 ListClustersPagedResponse listClusters(ListClustersRequest request) { + return listClustersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Clusters in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListClustersRequest request = + * ListClustersRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * alloyDBAdminClient.listClustersPagedCallable().futureCall(request); + * // Do something. + * for (Cluster element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListClustersRequest request = + * ListClustersRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * while (true) { + * ListClustersResponse response = alloyDBAdminClient.listClustersCallable().call(request); + * for (Cluster element : response.getClustersList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ClusterName name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]"); + * Cluster response = alloyDBAdminClient.getCluster(name); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Cluster.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Cluster getCluster(ClusterName name) { + GetClusterRequest request = + GetClusterRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getCluster(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Cluster. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString(); + * Cluster response = alloyDBAdminClient.getCluster(name); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Cluster.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Cluster getCluster(String name) { + GetClusterRequest request = GetClusterRequest.newBuilder().setName(name).build(); + return getCluster(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Cluster. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * GetClusterRequest request = + * GetClusterRequest.newBuilder() + * .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .build(); + * Cluster response = alloyDBAdminClient.getCluster(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 Cluster getCluster(GetClusterRequest request) { + return getClusterCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Cluster. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * GetClusterRequest request = + * GetClusterRequest.newBuilder() + * .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.getClusterCallable().futureCall(request); + * // Do something. + * Cluster response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * Cluster cluster = Cluster.newBuilder().build(); + * String clusterId = "clusterId561939637"; + * Cluster response = alloyDBAdminClient.createClusterAsync(parent, cluster, clusterId).get(); + * } + * }+ * + * @param parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @param cluster Required. The resource being created + * @param clusterId Required. ID of the requesting object. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * Cluster cluster = Cluster.newBuilder().build(); + * String clusterId = "clusterId561939637"; + * Cluster response = alloyDBAdminClient.createClusterAsync(parent, cluster, clusterId).get(); + * } + * }+ * + * @param parent Required. The name of the parent resource. For the required format, see the + * comment on the Cluster.name field. + * @param cluster Required. The resource being created + * @param clusterId Required. ID of the requesting object. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * CreateClusterRequest request = + * CreateClusterRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setClusterId("clusterId561939637") + * .setCluster(Cluster.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * Cluster response = alloyDBAdminClient.createClusterAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * CreateClusterRequest request = + * CreateClusterRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setClusterId("clusterId561939637") + * .setCluster(Cluster.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.createClusterOperationCallable().futureCall(request); + * // Do something. + * Cluster response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * CreateClusterRequest request = + * CreateClusterRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setClusterId("clusterId561939637") + * .setCluster(Cluster.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.createClusterCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * Cluster cluster = Cluster.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Cluster response = alloyDBAdminClient.updateClusterAsync(cluster, updateMask).get(); + * } + * }+ * + * @param cluster Required. The resource being updated + * @param updateMask Optional. Field mask is used to specify the fields to be overwritten in the + * Cluster resource by the update. The fields specified in the update_mask are relative to the + * resource, not the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * UpdateClusterRequest request = + * UpdateClusterRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setCluster(Cluster.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * Cluster response = alloyDBAdminClient.updateClusterAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * UpdateClusterRequest request = + * UpdateClusterRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setCluster(Cluster.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.updateClusterOperationCallable().futureCall(request); + * // Do something. + * Cluster response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * UpdateClusterRequest request = + * UpdateClusterRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setCluster(Cluster.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.updateClusterCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ClusterName name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]"); + * alloyDBAdminClient.deleteClusterAsync(name).get(); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Cluster.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString(); + * alloyDBAdminClient.deleteClusterAsync(name).get(); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Cluster.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * DeleteClusterRequest request = + * DeleteClusterRequest.newBuilder() + * .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setRequestId("requestId693933066") + * .setEtag("etag3123477") + * .setValidateOnly(true) + * .setForce(true) + * .build(); + * alloyDBAdminClient.deleteClusterAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * DeleteClusterRequest request = + * DeleteClusterRequest.newBuilder() + * .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setRequestId("requestId693933066") + * .setEtag("etag3123477") + * .setValidateOnly(true) + * .setForce(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.deleteClusterOperationCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * DeleteClusterRequest request = + * DeleteClusterRequest.newBuilder() + * .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setRequestId("requestId693933066") + * .setEtag("etag3123477") + * .setValidateOnly(true) + * .setForce(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.deleteClusterCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * RestoreClusterRequest request = + * RestoreClusterRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setClusterId("clusterId561939637") + * .setCluster(Cluster.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * Cluster response = alloyDBAdminClient.restoreClusterAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * RestoreClusterRequest request = + * RestoreClusterRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setClusterId("clusterId561939637") + * .setCluster(Cluster.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.restoreClusterOperationCallable().futureCall(request); + * // Do something. + * Cluster response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * RestoreClusterRequest request = + * RestoreClusterRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setClusterId("clusterId561939637") + * .setCluster(Cluster.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.restoreClusterCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ClusterName parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]"); + * for (Instance element : alloyDBAdminClient.listInstances(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an aggregated list + * operation by specifying a value with one of the following formats: * + * projects/{project}/locations/-/clusters/- * + * projects/{project}/locations/{region}/clusters/- + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListInstancesPagedResponse listInstances(ClusterName parent) { + ListInstancesRequest request = + ListInstancesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Instances in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString(); + * for (Instance element : alloyDBAdminClient.listInstances(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. Additionally, you can perform an aggregated list + * operation by specifying a value with one of the following formats: * + * projects/{project}/locations/-/clusters/- * + * projects/{project}/locations/{region}/clusters/- + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListInstancesPagedResponse listInstances(String parent) { + ListInstancesRequest request = ListInstancesRequest.newBuilder().setParent(parent).build(); + return listInstances(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Instances in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListInstancesRequest request = + * ListInstancesRequest.newBuilder() + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (Instance element : alloyDBAdminClient.listInstances(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListInstancesPagedResponse listInstances(ListInstancesRequest request) { + return listInstancesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Instances in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListInstancesRequest request = + * ListInstancesRequest.newBuilder() + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * alloyDBAdminClient.listInstancesPagedCallable().futureCall(request); + * // Do something. + * for (Instance element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListInstancesRequest request = + * ListInstancesRequest.newBuilder() + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * while (true) { + * ListInstancesResponse response = alloyDBAdminClient.listInstancesCallable().call(request); + * for (Instance element : response.getInstancesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]"); + * Instance response = alloyDBAdminClient.getInstance(name); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Instance.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Instance getInstance(InstanceName name) { + GetInstanceRequest request = + GetInstanceRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String name = + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString(); + * Instance response = alloyDBAdminClient.getInstance(name); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Instance.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Instance getInstance(String name) { + GetInstanceRequest request = GetInstanceRequest.newBuilder().setName(name).build(); + return getInstance(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * GetInstanceRequest request = + * GetInstanceRequest.newBuilder() + * .setName( + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString()) + * .setView(InstanceView.forNumber(0)) + * .build(); + * Instance response = alloyDBAdminClient.getInstance(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Instance getInstance(GetInstanceRequest request) { + return getInstanceCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Instance. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * GetInstanceRequest request = + * GetInstanceRequest.newBuilder() + * .setName( + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString()) + * .setView(InstanceView.forNumber(0)) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.getInstanceCallable().futureCall(request); + * // Do something. + * Instance response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ClusterName parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]"); + * Instance instance = Instance.newBuilder().build(); + * String instanceId = "instanceId902024336"; + * Instance response = + * alloyDBAdminClient.createInstanceAsync(parent, instance, instanceId).get(); + * } + * }+ * + * @param parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @param instance Required. The resource being created + * @param instanceId Required. ID of the requesting object. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String parent = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString(); + * Instance instance = Instance.newBuilder().build(); + * String instanceId = "instanceId902024336"; + * Instance response = + * alloyDBAdminClient.createInstanceAsync(parent, instance, instanceId).get(); + * } + * }+ * + * @param parent Required. The name of the parent resource. For the required format, see the + * comment on the Instance.name field. + * @param instance Required. The resource being created + * @param instanceId Required. ID of the requesting object. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * CreateInstanceRequest request = + * CreateInstanceRequest.newBuilder() + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setInstanceId("instanceId902024336") + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * Instance response = alloyDBAdminClient.createInstanceAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * CreateInstanceRequest request = + * CreateInstanceRequest.newBuilder() + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setInstanceId("instanceId902024336") + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.createInstanceOperationCallable().futureCall(request); + * // Do something. + * Instance response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * CreateInstanceRequest request = + * CreateInstanceRequest.newBuilder() + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setInstanceId("instanceId902024336") + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.createInstanceCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * BatchCreateInstancesRequest request = + * BatchCreateInstancesRequest.newBuilder() + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setRequests(CreateInstanceRequests.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * BatchCreateInstancesResponse response = + * alloyDBAdminClient.batchCreateInstancesAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * BatchCreateInstancesRequest request = + * BatchCreateInstancesRequest.newBuilder() + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setRequests(CreateInstanceRequests.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * OperationFuture+ */ + public final OperationCallable< + BatchCreateInstancesRequest, BatchCreateInstancesResponse, OperationMetadata> + batchCreateInstancesOperationCallable() { + return stub.batchCreateInstancesOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates new instances under the given project, location and cluster. There can be only one + * primary instance in a cluster. If the primary instance exists in the cluster as well as this + * request, then API will throw an error. The primary instance should exist before any read pool + * instance is created. If the primary instance is a part of the request payload, then the API + * will take care of creating instances in the correct order. This method is here to support + * Google-internal use cases, and is not meant for external customers to consume. Please do not + * start relying on it; its behavior is subject to change without notice. + * + *future = + * alloyDBAdminClient.batchCreateInstancesOperationCallable().futureCall(request); + * // Do something. + * BatchCreateInstancesResponse response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * BatchCreateInstancesRequest request = + * BatchCreateInstancesRequest.newBuilder() + * .setParent(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString()) + * .setRequests(CreateInstanceRequests.newBuilder().build()) + * .setRequestId("requestId693933066") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * alloyDBAdminClient.batchCreateInstancesCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * Instance instance = Instance.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Instance response = alloyDBAdminClient.updateInstanceAsync(instance, updateMask).get(); + * } + * }+ * + * @param instance Required. The resource being updated + * @param updateMask Optional. Field mask is used to specify the fields to be overwritten in the + * Instance resource by the update. The fields specified in the update_mask are relative to + * the resource, not the full request. A field will be overwritten if it is in the mask. If + * the user does not provide a mask then all fields will be overwritten. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * UpdateInstanceRequest request = + * UpdateInstanceRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * Instance response = alloyDBAdminClient.updateInstanceAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * UpdateInstanceRequest request = + * UpdateInstanceRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.updateInstanceOperationCallable().futureCall(request); + * // Do something. + * Instance response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * UpdateInstanceRequest request = + * UpdateInstanceRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setInstance(Instance.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.updateInstanceCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]"); + * alloyDBAdminClient.deleteInstanceAsync(name).get(); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Instance.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String name = + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString(); + * alloyDBAdminClient.deleteInstanceAsync(name).get(); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Instance.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * DeleteInstanceRequest request = + * DeleteInstanceRequest.newBuilder() + * .setName( + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .setEtag("etag3123477") + * .setValidateOnly(true) + * .build(); + * alloyDBAdminClient.deleteInstanceAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * DeleteInstanceRequest request = + * DeleteInstanceRequest.newBuilder() + * .setName( + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .setEtag("etag3123477") + * .setValidateOnly(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.deleteInstanceOperationCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * DeleteInstanceRequest request = + * DeleteInstanceRequest.newBuilder() + * .setName( + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .setEtag("etag3123477") + * .setValidateOnly(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.deleteInstanceCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]"); + * Instance response = alloyDBAdminClient.failoverInstanceAsync(name).get(); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Instance.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String name = + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString(); + * Instance response = alloyDBAdminClient.failoverInstanceAsync(name).get(); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Instance.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * FailoverInstanceRequest request = + * FailoverInstanceRequest.newBuilder() + * .setName( + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * Instance response = alloyDBAdminClient.failoverInstanceAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * FailoverInstanceRequest request = + * FailoverInstanceRequest.newBuilder() + * .setName( + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.failoverInstanceOperationCallable().futureCall(request); + * // Do something. + * Instance response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * FailoverInstanceRequest request = + * FailoverInstanceRequest.newBuilder() + * .setName( + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * alloyDBAdminClient.failoverInstanceCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]"); + * Instance response = alloyDBAdminClient.restartInstanceAsync(name).get(); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Instance.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String name = + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString(); + * Instance response = alloyDBAdminClient.restartInstanceAsync(name).get(); + * } + * }+ * + * @param name Required. The name of the resource. For the required format, see the comment on the + * Instance.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * RestartInstanceRequest request = + * RestartInstanceRequest.newBuilder() + * .setName( + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * Instance response = alloyDBAdminClient.restartInstanceAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * RestartInstanceRequest request = + * RestartInstanceRequest.newBuilder() + * .setName( + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.restartInstanceOperationCallable().futureCall(request); + * // Do something. + * Instance response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * RestartInstanceRequest request = + * RestartInstanceRequest.newBuilder() + * .setName( + * InstanceName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]", "[INSTANCE]").toString()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * alloyDBAdminClient.restartInstanceCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (Backup element : alloyDBAdminClient.listBackups(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent value for ListBackupsRequest + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListBackupsPagedResponse listBackups(LocationName parent) { + ListBackupsRequest request = + ListBackupsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listBackups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Backups in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * for (Backup element : alloyDBAdminClient.listBackups(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent value for ListBackupsRequest + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListBackupsPagedResponse listBackups(String parent) { + ListBackupsRequest request = ListBackupsRequest.newBuilder().setParent(parent).build(); + return listBackups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Backups in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListBackupsRequest request = + * ListBackupsRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * for (Backup element : alloyDBAdminClient.listBackups(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 ListBackupsPagedResponse listBackups(ListBackupsRequest request) { + return listBackupsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists Backups in a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListBackupsRequest request = + * ListBackupsRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.listBackupsPagedCallable().futureCall(request); + * // Do something. + * for (Backup element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListBackupsRequest request = + * ListBackupsRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .setFilter("filter-1274492040") + * .setOrderBy("orderBy-1207110587") + * .build(); + * while (true) { + * ListBackupsResponse response = alloyDBAdminClient.listBackupsCallable().call(request); + * for (Backup element : response.getBackupsList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * BackupName name = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]"); + * Backup response = alloyDBAdminClient.getBackup(name); + * } + * }+ * + * @param name Required. Name of the resource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Backup getBackup(BackupName name) { + GetBackupRequest request = + GetBackupRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getBackup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Backup. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String name = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString(); + * Backup response = alloyDBAdminClient.getBackup(name); + * } + * }+ * + * @param name Required. Name of the resource + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Backup getBackup(String name) { + GetBackupRequest request = GetBackupRequest.newBuilder().setName(name).build(); + return getBackup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Backup. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * GetBackupRequest request = + * GetBackupRequest.newBuilder() + * .setName(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString()) + * .build(); + * Backup response = alloyDBAdminClient.getBackup(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 Backup getBackup(GetBackupRequest request) { + return getBackupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets details of a single Backup. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * GetBackupRequest request = + * GetBackupRequest.newBuilder() + * .setName(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.getBackupCallable().futureCall(request); + * // Do something. + * Backup response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * Backup backup = Backup.newBuilder().build(); + * String backupId = "backupId2121930365"; + * Backup response = alloyDBAdminClient.createBackupAsync(parent, backup, backupId).get(); + * } + * }+ * + * @param parent Required. Value for parent. + * @param backup Required. The resource being created + * @param backupId Required. ID of the requesting object. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * Backup backup = Backup.newBuilder().build(); + * String backupId = "backupId2121930365"; + * Backup response = alloyDBAdminClient.createBackupAsync(parent, backup, backupId).get(); + * } + * }+ * + * @param parent Required. Value for parent. + * @param backup Required. The resource being created + * @param backupId Required. ID of the requesting object. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * CreateBackupRequest request = + * CreateBackupRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setBackupId("backupId2121930365") + * .setBackup(Backup.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * Backup response = alloyDBAdminClient.createBackupAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * CreateBackupRequest request = + * CreateBackupRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setBackupId("backupId2121930365") + * .setBackup(Backup.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.createBackupOperationCallable().futureCall(request); + * // Do something. + * Backup response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * CreateBackupRequest request = + * CreateBackupRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setBackupId("backupId2121930365") + * .setBackup(Backup.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.createBackupCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * Backup backup = Backup.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Backup response = alloyDBAdminClient.updateBackupAsync(backup, updateMask).get(); + * } + * }+ * + * @param backup Required. The resource being updated + * @param updateMask Optional. Field mask is used to specify the fields to be overwritten in the + * Backup resource by the update. The fields specified in the update_mask are relative to the + * resource, not the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * UpdateBackupRequest request = + * UpdateBackupRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setBackup(Backup.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * Backup response = alloyDBAdminClient.updateBackupAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * UpdateBackupRequest request = + * UpdateBackupRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setBackup(Backup.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.updateBackupOperationCallable().futureCall(request); + * // Do something. + * Backup response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * UpdateBackupRequest request = + * UpdateBackupRequest.newBuilder() + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setBackup(Backup.newBuilder().build()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.updateBackupCallable().futureCall(request); + * // Do something. + * Operation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * BackupName name = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]"); + * alloyDBAdminClient.deleteBackupAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the resource. For the required format, see the comment on the + * Backup.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String name = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString(); + * alloyDBAdminClient.deleteBackupAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the resource. For the required format, see the comment on the + * Backup.name field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * DeleteBackupRequest request = + * DeleteBackupRequest.newBuilder() + * .setName(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * alloyDBAdminClient.deleteBackupAsync(request).get(); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * DeleteBackupRequest request = + * DeleteBackupRequest.newBuilder() + * .setName(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * alloyDBAdminClient.deleteBackupOperationCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * DeleteBackupRequest request = + * DeleteBackupRequest.newBuilder() + * .setName(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString()) + * .setRequestId("requestId693933066") + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.deleteBackupCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (SupportedDatabaseFlag element : + * alloyDBAdminClient.listSupportedDatabaseFlags(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The name of the parent resource. The required format is: * + * projects/{project}/locations/{location} + *
Regardless of the parent specified here, as long it is contains a valid project and + * location, the service will return a static list of supported flags resources. Note that we + * do not yet support region-specific flags. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSupportedDatabaseFlagsPagedResponse listSupportedDatabaseFlags( + LocationName parent) { + ListSupportedDatabaseFlagsRequest request = + ListSupportedDatabaseFlagsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listSupportedDatabaseFlags(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists SupportedDatabaseFlags for a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * for (SupportedDatabaseFlag element : + * alloyDBAdminClient.listSupportedDatabaseFlags(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The name of the parent resource. The required format is: * + * projects/{project}/locations/{location} + *
Regardless of the parent specified here, as long it is contains a valid project and + * location, the service will return a static list of supported flags resources. Note that we + * do not yet support region-specific flags. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSupportedDatabaseFlagsPagedResponse listSupportedDatabaseFlags(String parent) { + ListSupportedDatabaseFlagsRequest request = + ListSupportedDatabaseFlagsRequest.newBuilder().setParent(parent).build(); + return listSupportedDatabaseFlags(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists SupportedDatabaseFlags for a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListSupportedDatabaseFlagsRequest request = + * ListSupportedDatabaseFlagsRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (SupportedDatabaseFlag element : + * alloyDBAdminClient.listSupportedDatabaseFlags(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 ListSupportedDatabaseFlagsPagedResponse listSupportedDatabaseFlags( + ListSupportedDatabaseFlagsRequest request) { + return listSupportedDatabaseFlagsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists SupportedDatabaseFlags for a given project and location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListSupportedDatabaseFlagsRequest request = + * ListSupportedDatabaseFlagsRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallable< + ListSupportedDatabaseFlagsRequest, ListSupportedDatabaseFlagsPagedResponse> + listSupportedDatabaseFlagsPagedCallable() { + return stub.listSupportedDatabaseFlagsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists SupportedDatabaseFlags for a given project and location. + * + *future = + * alloyDBAdminClient.listSupportedDatabaseFlagsPagedCallable().futureCall(request); + * // Do something. + * for (SupportedDatabaseFlag element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListSupportedDatabaseFlagsRequest request = + * ListSupportedDatabaseFlagsRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListSupportedDatabaseFlagsResponse response = + * alloyDBAdminClient.listSupportedDatabaseFlagsCallable().call(request); + * for (SupportedDatabaseFlag element : response.getSupportedDatabaseFlagsList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Location element : alloyDBAdminClient.listLocations(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * alloyDBAdminClient.listLocationsPagedCallable().futureCall(request); + * // Do something. + * for (Location element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListLocationsResponse response = alloyDBAdminClient.listLocationsCallable().call(request); + * for (Location element : response.getLocationsList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + * Location response = alloyDBAdminClient.getLocation(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *
Sample code: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) { + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + * ApiFuture+ */ + public final UnaryCallablefuture = alloyDBAdminClient.getLocationCallable().futureCall(request); + * // Do something. + * Location response = future.get(); + * } + * }
The default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the total timeout of getCluster to 30 seconds: + * + *
{@code + * // This snippet has been automatically generated and should be regarded as a code template only. + * // It will require modifications to work: + * // - It may require correct/in-range values for request initialization. + * // - It may require specifying regional endpoints when creating the service client as shown in + * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + * AlloyDBAdminSettings.Builder alloyDBAdminSettingsBuilder = AlloyDBAdminSettings.newBuilder(); + * alloyDBAdminSettingsBuilder + * .getClusterSettings() + * .setRetrySettings( + * alloyDBAdminSettingsBuilder + * .getClusterSettings() + * .getRetrySettings() + * .toBuilder() + * .setTotalTimeout(Duration.ofSeconds(30)) + * .build()); + * AlloyDBAdminSettings alloyDBAdminSettings = alloyDBAdminSettingsBuilder.build(); + * }+ */ +@Generated("by gapic-generator-java") +public class AlloyDBAdminSettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction The interfaces provided are listed below, along with usage samples.
+ *
+ * ======================= AlloyDBAdminClient =======================
+ *
+ * Service Description: Service describing handlers for resources
+ *
+ * Sample for AlloyDBAdminClient:
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class AlloyDBAdminStub implements BackgroundResource {
+
+ public OperationsStub getOperationsStub() {
+ return null;
+ }
+
+ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
+ return null;
+ }
+
+ public UnaryCallable The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of getCluster to 30 seconds:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (AlloyDBAdminClient alloyDBAdminClient = AlloyDBAdminClient.create()) {
+ * ClusterName name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
+ * Cluster response = alloyDBAdminClient.getCluster(name);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package com.google.cloud.alloydb.v1;
+
+import javax.annotation.Generated;
diff --git a/java-alloydb/google-cloud-alloydb/src/main/java/com/google/cloud/alloydb/v1/stub/AlloyDBAdminStub.java b/java-alloydb/google-cloud-alloydb/src/main/java/com/google/cloud/alloydb/v1/stub/AlloyDBAdminStub.java
new file mode 100644
index 000000000000..55ea0c8d4f52
--- /dev/null
+++ b/java-alloydb/google-cloud-alloydb/src/main/java/com/google/cloud/alloydb/v1/stub/AlloyDBAdminStub.java
@@ -0,0 +1,266 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.alloydb.v1.stub;
+
+import static com.google.cloud.alloydb.v1.AlloyDBAdminClient.ListBackupsPagedResponse;
+import static com.google.cloud.alloydb.v1.AlloyDBAdminClient.ListClustersPagedResponse;
+import static com.google.cloud.alloydb.v1.AlloyDBAdminClient.ListInstancesPagedResponse;
+import static com.google.cloud.alloydb.v1.AlloyDBAdminClient.ListLocationsPagedResponse;
+import static com.google.cloud.alloydb.v1.AlloyDBAdminClient.ListSupportedDatabaseFlagsPagedResponse;
+
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.alloydb.v1.Backup;
+import com.google.cloud.alloydb.v1.BatchCreateInstancesRequest;
+import com.google.cloud.alloydb.v1.BatchCreateInstancesResponse;
+import com.google.cloud.alloydb.v1.Cluster;
+import com.google.cloud.alloydb.v1.CreateBackupRequest;
+import com.google.cloud.alloydb.v1.CreateClusterRequest;
+import com.google.cloud.alloydb.v1.CreateInstanceRequest;
+import com.google.cloud.alloydb.v1.DeleteBackupRequest;
+import com.google.cloud.alloydb.v1.DeleteClusterRequest;
+import com.google.cloud.alloydb.v1.DeleteInstanceRequest;
+import com.google.cloud.alloydb.v1.FailoverInstanceRequest;
+import com.google.cloud.alloydb.v1.GetBackupRequest;
+import com.google.cloud.alloydb.v1.GetClusterRequest;
+import com.google.cloud.alloydb.v1.GetInstanceRequest;
+import com.google.cloud.alloydb.v1.Instance;
+import com.google.cloud.alloydb.v1.ListBackupsRequest;
+import com.google.cloud.alloydb.v1.ListBackupsResponse;
+import com.google.cloud.alloydb.v1.ListClustersRequest;
+import com.google.cloud.alloydb.v1.ListClustersResponse;
+import com.google.cloud.alloydb.v1.ListInstancesRequest;
+import com.google.cloud.alloydb.v1.ListInstancesResponse;
+import com.google.cloud.alloydb.v1.ListSupportedDatabaseFlagsRequest;
+import com.google.cloud.alloydb.v1.ListSupportedDatabaseFlagsResponse;
+import com.google.cloud.alloydb.v1.OperationMetadata;
+import com.google.cloud.alloydb.v1.RestartInstanceRequest;
+import com.google.cloud.alloydb.v1.RestoreClusterRequest;
+import com.google.cloud.alloydb.v1.UpdateBackupRequest;
+import com.google.cloud.alloydb.v1.UpdateClusterRequest;
+import com.google.cloud.alloydb.v1.UpdateInstanceRequest;
+import com.google.cloud.location.GetLocationRequest;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import com.google.protobuf.Empty;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Base stub class for the AlloyDBAdmin service API.
+ *
+ *
+ *
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * AlloyDBAdminStubSettings.Builder alloyDBAdminSettingsBuilder =
+ * AlloyDBAdminStubSettings.newBuilder();
+ * alloyDBAdminSettingsBuilder
+ * .getClusterSettings()
+ * .setRetrySettings(
+ * alloyDBAdminSettingsBuilder
+ * .getClusterSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * AlloyDBAdminStubSettings alloyDBAdminSettings = alloyDBAdminSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class AlloyDBAdminStubSettings extends StubSettings