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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationClusterName name = + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]"); + * WorkstationCluster response = workstationsClient.getWorkstationCluster(name); + * } + * }+ * + *
Note: close() needs to be called on the WorkstationsClient 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 WorkstationsSettings 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 + * WorkstationsSettings workstationsSettings = + * WorkstationsSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * WorkstationsClient workstationsClient = WorkstationsClient.create(workstationsSettings); + * }+ * + *
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 + * WorkstationsSettings workstationsSettings = + * WorkstationsSettings.newBuilder().setEndpoint(myEndpoint).build(); + * WorkstationsClient workstationsClient = WorkstationsClient.create(workstationsSettings); + * }+ * + *
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 + * WorkstationsSettings workstationsSettings = WorkstationsSettings.newHttpJsonBuilder().build(); + * WorkstationsClient workstationsClient = WorkstationsClient.create(workstationsSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class WorkstationsClient implements BackgroundResource { + private final WorkstationsSettings settings; + private final WorkstationsStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of WorkstationsClient with default settings. */ + public static final WorkstationsClient create() throws IOException { + return create(WorkstationsSettings.newBuilder().build()); + } + + /** + * Constructs an instance of WorkstationsClient, 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 WorkstationsClient create(WorkstationsSettings settings) throws IOException { + return new WorkstationsClient(settings); + } + + /** + * Constructs an instance of WorkstationsClient, using the given stub for making calls. This is + * for advanced usage - prefer using create(WorkstationsSettings). + */ + public static final WorkstationsClient create(WorkstationsStub stub) { + return new WorkstationsClient(stub); + } + + /** + * Constructs an instance of WorkstationsClient, 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 WorkstationsClient(WorkstationsSettings settings) throws IOException { + this.settings = settings; + this.stub = ((WorkstationsStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected WorkstationsClient(WorkstationsStub 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 WorkstationsSettings getSettings() { + return settings; + } + + public WorkstationsStub 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. + /** + * Returns the requested workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationClusterName name = + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]"); + * WorkstationCluster response = workstationsClient.getWorkstationCluster(name); + * } + * }+ * + * @param name Required. Name of the requested resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final WorkstationCluster getWorkstationCluster(WorkstationClusterName name) { + GetWorkstationClusterRequest request = + GetWorkstationClusterRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getWorkstationCluster(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String name = + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]").toString(); + * WorkstationCluster response = workstationsClient.getWorkstationCluster(name); + * } + * }+ * + * @param name Required. Name of the requested resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final WorkstationCluster getWorkstationCluster(String name) { + GetWorkstationClusterRequest request = + GetWorkstationClusterRequest.newBuilder().setName(name).build(); + return getWorkstationCluster(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * GetWorkstationClusterRequest request = + * GetWorkstationClusterRequest.newBuilder() + * .setName( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .build(); + * WorkstationCluster response = workstationsClient.getWorkstationCluster(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 WorkstationCluster getWorkstationCluster(GetWorkstationClusterRequest request) { + return getWorkstationClusterCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * GetWorkstationClusterRequest request = + * GetWorkstationClusterRequest.newBuilder() + * .setName( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.getWorkstationClusterCallable().futureCall(request); + * // Do something. + * WorkstationCluster 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (WorkstationCluster element : + * workstationsClient.listWorkstationClusters(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListWorkstationClustersPagedResponse listWorkstationClusters(LocationName parent) { + ListWorkstationClustersRequest request = + ListWorkstationClustersRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listWorkstationClusters(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all workstation clusters in the specified 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * for (WorkstationCluster element : + * workstationsClient.listWorkstationClusters(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListWorkstationClustersPagedResponse listWorkstationClusters(String parent) { + ListWorkstationClustersRequest request = + ListWorkstationClustersRequest.newBuilder().setParent(parent).build(); + return listWorkstationClusters(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all workstation clusters in the specified 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListWorkstationClustersRequest request = + * ListWorkstationClustersRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (WorkstationCluster element : + * workstationsClient.listWorkstationClusters(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 ListWorkstationClustersPagedResponse listWorkstationClusters( + ListWorkstationClustersRequest request) { + return listWorkstationClustersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all workstation clusters in the specified 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListWorkstationClustersRequest request = + * ListWorkstationClustersRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.listWorkstationClustersPagedCallable().futureCall(request); + * // Do something. + * for (WorkstationCluster 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListWorkstationClustersRequest request = + * ListWorkstationClustersRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListWorkstationClustersResponse response = + * workstationsClient.listWorkstationClustersCallable().call(request); + * for (WorkstationCluster element : response.getWorkstationClustersList()) { + * // 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * WorkstationCluster workstationCluster = WorkstationCluster.newBuilder().build(); + * String workstationClusterId = "workstationClusterId351421170"; + * WorkstationCluster response = + * workstationsClient + * .createWorkstationClusterAsync(parent, workstationCluster, workstationClusterId) + * .get(); + * } + * }+ * + * @param parent Required. Parent resource name. + * @param workstationCluster Required. Workstation cluster to create. + * @param workstationClusterId Required. ID to use for the workstation cluster. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * WorkstationCluster workstationCluster = WorkstationCluster.newBuilder().build(); + * String workstationClusterId = "workstationClusterId351421170"; + * WorkstationCluster response = + * workstationsClient + * .createWorkstationClusterAsync(parent, workstationCluster, workstationClusterId) + * .get(); + * } + * }+ * + * @param parent Required. Parent resource name. + * @param workstationCluster Required. Workstation cluster to create. + * @param workstationClusterId Required. ID to use for the workstation cluster. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * CreateWorkstationClusterRequest request = + * CreateWorkstationClusterRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setWorkstationClusterId("workstationClusterId351421170") + * .setWorkstationCluster(WorkstationCluster.newBuilder().build()) + * .setValidateOnly(true) + * .build(); + * WorkstationCluster response = workstationsClient.createWorkstationClusterAsync(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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * CreateWorkstationClusterRequest request = + * CreateWorkstationClusterRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setWorkstationClusterId("workstationClusterId351421170") + * .setWorkstationCluster(WorkstationCluster.newBuilder().build()) + * .setValidateOnly(true) + * .build(); + * OperationFuture+ */ + public final OperationCallable< + CreateWorkstationClusterRequest, WorkstationCluster, OperationMetadata> + createWorkstationClusterOperationCallable() { + return stub.createWorkstationClusterOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new workstation cluster. + * + *future = + * workstationsClient.createWorkstationClusterOperationCallable().futureCall(request); + * // Do something. + * WorkstationCluster 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * CreateWorkstationClusterRequest request = + * CreateWorkstationClusterRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setWorkstationClusterId("workstationClusterId351421170") + * .setWorkstationCluster(WorkstationCluster.newBuilder().build()) + * .setValidateOnly(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.createWorkstationClusterCallable().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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationCluster workstationCluster = WorkstationCluster.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * WorkstationCluster response = + * workstationsClient.updateWorkstationClusterAsync(workstationCluster, updateMask).get(); + * } + * }+ * + * @param workstationCluster Required. Workstation cluster to update. + * @param updateMask Required. Mask that specifies which fields in the workstation cluster should + * be updated. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * UpdateWorkstationClusterRequest request = + * UpdateWorkstationClusterRequest.newBuilder() + * .setWorkstationCluster(WorkstationCluster.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * WorkstationCluster response = workstationsClient.updateWorkstationClusterAsync(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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * UpdateWorkstationClusterRequest request = + * UpdateWorkstationClusterRequest.newBuilder() + * .setWorkstationCluster(WorkstationCluster.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * OperationFuture+ */ + public final OperationCallable< + UpdateWorkstationClusterRequest, WorkstationCluster, OperationMetadata> + updateWorkstationClusterOperationCallable() { + return stub.updateWorkstationClusterOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an existing workstation cluster. + * + *future = + * workstationsClient.updateWorkstationClusterOperationCallable().futureCall(request); + * // Do something. + * WorkstationCluster 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * UpdateWorkstationClusterRequest request = + * UpdateWorkstationClusterRequest.newBuilder() + * .setWorkstationCluster(WorkstationCluster.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.updateWorkstationClusterCallable().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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationClusterName name = + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]"); + * WorkstationCluster response = workstationsClient.deleteWorkstationClusterAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the workstation cluster to delete. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String name = + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]").toString(); + * WorkstationCluster response = workstationsClient.deleteWorkstationClusterAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the workstation cluster to delete. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * DeleteWorkstationClusterRequest request = + * DeleteWorkstationClusterRequest.newBuilder() + * .setName( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .setForce(true) + * .build(); + * WorkstationCluster response = workstationsClient.deleteWorkstationClusterAsync(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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * DeleteWorkstationClusterRequest request = + * DeleteWorkstationClusterRequest.newBuilder() + * .setName( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .setForce(true) + * .build(); + * OperationFuture+ */ + public final OperationCallable< + DeleteWorkstationClusterRequest, WorkstationCluster, OperationMetadata> + deleteWorkstationClusterOperationCallable() { + return stub.deleteWorkstationClusterOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the specified workstation cluster. + * + *future = + * workstationsClient.deleteWorkstationClusterOperationCallable().futureCall(request); + * // Do something. + * WorkstationCluster 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * DeleteWorkstationClusterRequest request = + * DeleteWorkstationClusterRequest.newBuilder() + * .setName( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .setForce(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.deleteWorkstationClusterCallable().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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationConfigName name = + * WorkstationConfigName.of( + * "[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]", "[WORKSTATION_CONFIG]"); + * WorkstationConfig response = workstationsClient.getWorkstationConfig(name); + * } + * }+ * + * @param name Required. Name of the requested resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final WorkstationConfig getWorkstationConfig(WorkstationConfigName name) { + GetWorkstationConfigRequest request = + GetWorkstationConfigRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getWorkstationConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested workstation configuration. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String name = + * WorkstationConfigName.of( + * "[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]", "[WORKSTATION_CONFIG]") + * .toString(); + * WorkstationConfig response = workstationsClient.getWorkstationConfig(name); + * } + * }+ * + * @param name Required. Name of the requested resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final WorkstationConfig getWorkstationConfig(String name) { + GetWorkstationConfigRequest request = + GetWorkstationConfigRequest.newBuilder().setName(name).build(); + return getWorkstationConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested workstation configuration. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * GetWorkstationConfigRequest request = + * GetWorkstationConfigRequest.newBuilder() + * .setName( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .build(); + * WorkstationConfig response = workstationsClient.getWorkstationConfig(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 WorkstationConfig getWorkstationConfig(GetWorkstationConfigRequest request) { + return getWorkstationConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested workstation configuration. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * GetWorkstationConfigRequest request = + * GetWorkstationConfigRequest.newBuilder() + * .setName( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.getWorkstationConfigCallable().futureCall(request); + * // Do something. + * WorkstationConfig 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationClusterName parent = + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]"); + * for (WorkstationConfig element : + * workstationsClient.listWorkstationConfigs(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListWorkstationConfigsPagedResponse listWorkstationConfigs( + WorkstationClusterName parent) { + ListWorkstationConfigsRequest request = + ListWorkstationConfigsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listWorkstationConfigs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all workstation configurations in the specified 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String parent = + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]").toString(); + * for (WorkstationConfig element : + * workstationsClient.listWorkstationConfigs(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListWorkstationConfigsPagedResponse listWorkstationConfigs(String parent) { + ListWorkstationConfigsRequest request = + ListWorkstationConfigsRequest.newBuilder().setParent(parent).build(); + return listWorkstationConfigs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all workstation configurations in the specified 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListWorkstationConfigsRequest request = + * ListWorkstationConfigsRequest.newBuilder() + * .setParent( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (WorkstationConfig element : + * workstationsClient.listWorkstationConfigs(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 ListWorkstationConfigsPagedResponse listWorkstationConfigs( + ListWorkstationConfigsRequest request) { + return listWorkstationConfigsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all workstation configurations in the specified 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListWorkstationConfigsRequest request = + * ListWorkstationConfigsRequest.newBuilder() + * .setParent( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.listWorkstationConfigsPagedCallable().futureCall(request); + * // Do something. + * for (WorkstationConfig 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListWorkstationConfigsRequest request = + * ListWorkstationConfigsRequest.newBuilder() + * .setParent( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListWorkstationConfigsResponse response = + * workstationsClient.listWorkstationConfigsCallable().call(request); + * for (WorkstationConfig element : response.getWorkstationConfigsList()) { + * // 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationClusterName parent = + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]"); + * for (WorkstationConfig element : + * workstationsClient.listUsableWorkstationConfigs(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListUsableWorkstationConfigsPagedResponse listUsableWorkstationConfigs( + WorkstationClusterName parent) { + ListUsableWorkstationConfigsRequest request = + ListUsableWorkstationConfigsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listUsableWorkstationConfigs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all workstation configurations in the specified cluster on which the caller has the + * "workstations.workstation.create" permission. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String parent = + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]").toString(); + * for (WorkstationConfig element : + * workstationsClient.listUsableWorkstationConfigs(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListUsableWorkstationConfigsPagedResponse listUsableWorkstationConfigs( + String parent) { + ListUsableWorkstationConfigsRequest request = + ListUsableWorkstationConfigsRequest.newBuilder().setParent(parent).build(); + return listUsableWorkstationConfigs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all workstation configurations in the specified cluster on which the caller has the + * "workstations.workstation.create" permission. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListUsableWorkstationConfigsRequest request = + * ListUsableWorkstationConfigsRequest.newBuilder() + * .setParent( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (WorkstationConfig element : + * workstationsClient.listUsableWorkstationConfigs(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 ListUsableWorkstationConfigsPagedResponse listUsableWorkstationConfigs( + ListUsableWorkstationConfigsRequest request) { + return listUsableWorkstationConfigsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all workstation configurations in the specified cluster on which the caller has the + * "workstations.workstation.create" permission. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListUsableWorkstationConfigsRequest request = + * ListUsableWorkstationConfigsRequest.newBuilder() + * .setParent( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallable< + ListUsableWorkstationConfigsRequest, ListUsableWorkstationConfigsPagedResponse> + listUsableWorkstationConfigsPagedCallable() { + return stub.listUsableWorkstationConfigsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all workstation configurations in the specified cluster on which the caller has the + * "workstations.workstation.create" permission. + * + *future = + * workstationsClient.listUsableWorkstationConfigsPagedCallable().futureCall(request); + * // Do something. + * for (WorkstationConfig 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListUsableWorkstationConfigsRequest request = + * ListUsableWorkstationConfigsRequest.newBuilder() + * .setParent( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListUsableWorkstationConfigsResponse response = + * workstationsClient.listUsableWorkstationConfigsCallable().call(request); + * for (WorkstationConfig element : response.getWorkstationConfigsList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable< + ListUsableWorkstationConfigsRequest, ListUsableWorkstationConfigsResponse> + listUsableWorkstationConfigsCallable() { + return stub.listUsableWorkstationConfigsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new workstation configuration. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationClusterName parent = + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]"); + * WorkstationConfig workstationConfig = WorkstationConfig.newBuilder().build(); + * String workstationConfigId = "workstationConfigId798542368"; + * WorkstationConfig response = + * workstationsClient + * .createWorkstationConfigAsync(parent, workstationConfig, workstationConfigId) + * .get(); + * } + * }+ * + * @param parent Required. Parent resource name. + * @param workstationConfig Required. Config to create. + * @param workstationConfigId Required. ID to use for the config. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String parent = + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]").toString(); + * WorkstationConfig workstationConfig = WorkstationConfig.newBuilder().build(); + * String workstationConfigId = "workstationConfigId798542368"; + * WorkstationConfig response = + * workstationsClient + * .createWorkstationConfigAsync(parent, workstationConfig, workstationConfigId) + * .get(); + * } + * }+ * + * @param parent Required. Parent resource name. + * @param workstationConfig Required. Config to create. + * @param workstationConfigId Required. ID to use for the config. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * CreateWorkstationConfigRequest request = + * CreateWorkstationConfigRequest.newBuilder() + * .setParent( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setWorkstationConfigId("workstationConfigId798542368") + * .setWorkstationConfig(WorkstationConfig.newBuilder().build()) + * .setValidateOnly(true) + * .build(); + * WorkstationConfig response = workstationsClient.createWorkstationConfigAsync(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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * CreateWorkstationConfigRequest request = + * CreateWorkstationConfigRequest.newBuilder() + * .setParent( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setWorkstationConfigId("workstationConfigId798542368") + * .setWorkstationConfig(WorkstationConfig.newBuilder().build()) + * .setValidateOnly(true) + * .build(); + * OperationFuture+ */ + public final OperationCallable< + CreateWorkstationConfigRequest, WorkstationConfig, OperationMetadata> + createWorkstationConfigOperationCallable() { + return stub.createWorkstationConfigOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new workstation configuration. + * + *future = + * workstationsClient.createWorkstationConfigOperationCallable().futureCall(request); + * // Do something. + * WorkstationConfig 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * CreateWorkstationConfigRequest request = + * CreateWorkstationConfigRequest.newBuilder() + * .setParent( + * WorkstationClusterName.of("[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]") + * .toString()) + * .setWorkstationConfigId("workstationConfigId798542368") + * .setWorkstationConfig(WorkstationConfig.newBuilder().build()) + * .setValidateOnly(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.createWorkstationConfigCallable().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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationConfig workstationConfig = WorkstationConfig.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * WorkstationConfig response = + * workstationsClient.updateWorkstationConfigAsync(workstationConfig, updateMask).get(); + * } + * }+ * + * @param workstationConfig Required. Config to update. + * @param updateMask Required. Mask specifying which fields in the config should be updated. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * UpdateWorkstationConfigRequest request = + * UpdateWorkstationConfigRequest.newBuilder() + * .setWorkstationConfig(WorkstationConfig.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * WorkstationConfig response = workstationsClient.updateWorkstationConfigAsync(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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * UpdateWorkstationConfigRequest request = + * UpdateWorkstationConfigRequest.newBuilder() + * .setWorkstationConfig(WorkstationConfig.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * OperationFuture+ */ + public final OperationCallable< + UpdateWorkstationConfigRequest, WorkstationConfig, OperationMetadata> + updateWorkstationConfigOperationCallable() { + return stub.updateWorkstationConfigOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an existing workstation configuration. + * + *future = + * workstationsClient.updateWorkstationConfigOperationCallable().futureCall(request); + * // Do something. + * WorkstationConfig 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * UpdateWorkstationConfigRequest request = + * UpdateWorkstationConfigRequest.newBuilder() + * .setWorkstationConfig(WorkstationConfig.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.updateWorkstationConfigCallable().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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationConfigName name = + * WorkstationConfigName.of( + * "[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]", "[WORKSTATION_CONFIG]"); + * WorkstationConfig response = workstationsClient.deleteWorkstationConfigAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the config to delete. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String name = + * WorkstationConfigName.of( + * "[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]", "[WORKSTATION_CONFIG]") + * .toString(); + * WorkstationConfig response = workstationsClient.deleteWorkstationConfigAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the config to delete. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * DeleteWorkstationConfigRequest request = + * DeleteWorkstationConfigRequest.newBuilder() + * .setName( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .setForce(true) + * .build(); + * WorkstationConfig response = workstationsClient.deleteWorkstationConfigAsync(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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * DeleteWorkstationConfigRequest request = + * DeleteWorkstationConfigRequest.newBuilder() + * .setName( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .setForce(true) + * .build(); + * OperationFuture+ */ + public final OperationCallable< + DeleteWorkstationConfigRequest, WorkstationConfig, OperationMetadata> + deleteWorkstationConfigOperationCallable() { + return stub.deleteWorkstationConfigOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the specified workstation configuration. + * + *future = + * workstationsClient.deleteWorkstationConfigOperationCallable().futureCall(request); + * // Do something. + * WorkstationConfig 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * DeleteWorkstationConfigRequest request = + * DeleteWorkstationConfigRequest.newBuilder() + * .setName( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .setForce(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.deleteWorkstationConfigCallable().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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationName name = + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]"); + * Workstation response = workstationsClient.getWorkstation(name); + * } + * }+ * + * @param name Required. Name of the requested resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Workstation getWorkstation(WorkstationName name) { + GetWorkstationRequest request = + GetWorkstationRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getWorkstation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested workstation. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String name = + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString(); + * Workstation response = workstationsClient.getWorkstation(name); + * } + * }+ * + * @param name Required. Name of the requested resource. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Workstation getWorkstation(String name) { + GetWorkstationRequest request = GetWorkstationRequest.newBuilder().setName(name).build(); + return getWorkstation(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested workstation. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * GetWorkstationRequest request = + * GetWorkstationRequest.newBuilder() + * .setName( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .build(); + * Workstation response = workstationsClient.getWorkstation(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 Workstation getWorkstation(GetWorkstationRequest request) { + return getWorkstationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the requested workstation. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * GetWorkstationRequest request = + * GetWorkstationRequest.newBuilder() + * .setName( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.getWorkstationCallable().futureCall(request); + * // Do something. + * Workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationConfigName parent = + * WorkstationConfigName.of( + * "[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]", "[WORKSTATION_CONFIG]"); + * for (Workstation element : workstationsClient.listWorkstations(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListWorkstationsPagedResponse listWorkstations(WorkstationConfigName parent) { + ListWorkstationsRequest request = + ListWorkstationsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listWorkstations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all Workstations using the specified config. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String parent = + * WorkstationConfigName.of( + * "[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]", "[WORKSTATION_CONFIG]") + * .toString(); + * for (Workstation element : workstationsClient.listWorkstations(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListWorkstationsPagedResponse listWorkstations(String parent) { + ListWorkstationsRequest request = + ListWorkstationsRequest.newBuilder().setParent(parent).build(); + return listWorkstations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all Workstations using the specified config. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListWorkstationsRequest request = + * ListWorkstationsRequest.newBuilder() + * .setParent( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Workstation element : workstationsClient.listWorkstations(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 ListWorkstationsPagedResponse listWorkstations(ListWorkstationsRequest request) { + return listWorkstationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all Workstations using the specified config. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListWorkstationsRequest request = + * ListWorkstationsRequest.newBuilder() + * .setParent( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.listWorkstationsPagedCallable().futureCall(request); + * // Do something. + * for (Workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListWorkstationsRequest request = + * ListWorkstationsRequest.newBuilder() + * .setParent( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListWorkstationsResponse response = + * workstationsClient.listWorkstationsCallable().call(request); + * for (Workstation element : response.getWorkstationsList()) { + * // 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationConfigName parent = + * WorkstationConfigName.of( + * "[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]", "[WORKSTATION_CONFIG]"); + * for (Workstation element : workstationsClient.listUsableWorkstations(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListUsableWorkstationsPagedResponse listUsableWorkstations( + WorkstationConfigName parent) { + ListUsableWorkstationsRequest request = + ListUsableWorkstationsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listUsableWorkstations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all Workstations using the specified config on which the caller has the + * "workstations.workstations.use" permission. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String parent = + * WorkstationConfigName.of( + * "[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]", "[WORKSTATION_CONFIG]") + * .toString(); + * for (Workstation element : workstationsClient.listUsableWorkstations(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. Parent resource name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListUsableWorkstationsPagedResponse listUsableWorkstations(String parent) { + ListUsableWorkstationsRequest request = + ListUsableWorkstationsRequest.newBuilder().setParent(parent).build(); + return listUsableWorkstations(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all Workstations using the specified config on which the caller has the + * "workstations.workstations.use" permission. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListUsableWorkstationsRequest request = + * ListUsableWorkstationsRequest.newBuilder() + * .setParent( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Workstation element : workstationsClient.listUsableWorkstations(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 ListUsableWorkstationsPagedResponse listUsableWorkstations( + ListUsableWorkstationsRequest request) { + return listUsableWorkstationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns all Workstations using the specified config on which the caller has the + * "workstations.workstations.use" permission. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListUsableWorkstationsRequest request = + * ListUsableWorkstationsRequest.newBuilder() + * .setParent( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.listUsableWorkstationsPagedCallable().futureCall(request); + * // Do something. + * for (Workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * ListUsableWorkstationsRequest request = + * ListUsableWorkstationsRequest.newBuilder() + * .setParent( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListUsableWorkstationsResponse response = + * workstationsClient.listUsableWorkstationsCallable().call(request); + * for (Workstation element : response.getWorkstationsList()) { + * // 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationConfigName parent = + * WorkstationConfigName.of( + * "[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]", "[WORKSTATION_CONFIG]"); + * Workstation workstation = Workstation.newBuilder().build(); + * String workstationId = "workstationId560540030"; + * Workstation response = + * workstationsClient.createWorkstationAsync(parent, workstation, workstationId).get(); + * } + * }+ * + * @param parent Required. Parent resource name. + * @param workstation Required. Workstation to create. + * @param workstationId Required. ID to use for the workstation. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String parent = + * WorkstationConfigName.of( + * "[PROJECT]", "[LOCATION]", "[WORKSTATION_CLUSTER]", "[WORKSTATION_CONFIG]") + * .toString(); + * Workstation workstation = Workstation.newBuilder().build(); + * String workstationId = "workstationId560540030"; + * Workstation response = + * workstationsClient.createWorkstationAsync(parent, workstation, workstationId).get(); + * } + * }+ * + * @param parent Required. Parent resource name. + * @param workstation Required. Workstation to create. + * @param workstationId Required. ID to use for the workstation. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * CreateWorkstationRequest request = + * CreateWorkstationRequest.newBuilder() + * .setParent( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setWorkstationId("workstationId560540030") + * .setWorkstation(Workstation.newBuilder().build()) + * .setValidateOnly(true) + * .build(); + * Workstation response = workstationsClient.createWorkstationAsync(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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * CreateWorkstationRequest request = + * CreateWorkstationRequest.newBuilder() + * .setParent( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setWorkstationId("workstationId560540030") + * .setWorkstation(Workstation.newBuilder().build()) + * .setValidateOnly(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * workstationsClient.createWorkstationOperationCallable().futureCall(request); + * // Do something. + * Workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * CreateWorkstationRequest request = + * CreateWorkstationRequest.newBuilder() + * .setParent( + * WorkstationConfigName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]") + * .toString()) + * .setWorkstationId("workstationId560540030") + * .setWorkstation(Workstation.newBuilder().build()) + * .setValidateOnly(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.createWorkstationCallable().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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * Workstation workstation = Workstation.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Workstation response = + * workstationsClient.updateWorkstationAsync(workstation, updateMask).get(); + * } + * }+ * + * @param workstation Required. Workstation to update. + * @param updateMask Required. Mask specifying which fields in the config should be updated. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * UpdateWorkstationRequest request = + * UpdateWorkstationRequest.newBuilder() + * .setWorkstation(Workstation.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * Workstation response = workstationsClient.updateWorkstationAsync(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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * UpdateWorkstationRequest request = + * UpdateWorkstationRequest.newBuilder() + * .setWorkstation(Workstation.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * workstationsClient.updateWorkstationOperationCallable().futureCall(request); + * // Do something. + * Workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * UpdateWorkstationRequest request = + * UpdateWorkstationRequest.newBuilder() + * .setWorkstation(Workstation.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .setValidateOnly(true) + * .setAllowMissing(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.updateWorkstationCallable().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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationName name = + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]"); + * Workstation response = workstationsClient.deleteWorkstationAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the workstation to delete. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String name = + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString(); + * Workstation response = workstationsClient.deleteWorkstationAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the workstation to delete. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * DeleteWorkstationRequest request = + * DeleteWorkstationRequest.newBuilder() + * .setName( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * Workstation response = workstationsClient.deleteWorkstationAsync(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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * DeleteWorkstationRequest request = + * DeleteWorkstationRequest.newBuilder() + * .setName( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * workstationsClient.deleteWorkstationOperationCallable().futureCall(request); + * // Do something. + * Workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * DeleteWorkstationRequest request = + * DeleteWorkstationRequest.newBuilder() + * .setName( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.deleteWorkstationCallable().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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationName name = + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]"); + * Workstation response = workstationsClient.startWorkstationAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the workstation to start. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String name = + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString(); + * Workstation response = workstationsClient.startWorkstationAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the workstation to start. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * StartWorkstationRequest request = + * StartWorkstationRequest.newBuilder() + * .setName( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * Workstation response = workstationsClient.startWorkstationAsync(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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * StartWorkstationRequest request = + * StartWorkstationRequest.newBuilder() + * .setName( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * workstationsClient.startWorkstationOperationCallable().futureCall(request); + * // Do something. + * Workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * StartWorkstationRequest request = + * StartWorkstationRequest.newBuilder() + * .setName( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.startWorkstationCallable().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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationName name = + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]"); + * Workstation response = workstationsClient.stopWorkstationAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the workstation to stop. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String name = + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString(); + * Workstation response = workstationsClient.stopWorkstationAsync(name).get(); + * } + * }+ * + * @param name Required. Name of the workstation to stop. + * @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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * StopWorkstationRequest request = + * StopWorkstationRequest.newBuilder() + * .setName( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * Workstation response = workstationsClient.stopWorkstationAsync(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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * StopWorkstationRequest request = + * StopWorkstationRequest.newBuilder() + * .setName( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * OperationFuture+ */ + public final OperationCallablefuture = + * workstationsClient.stopWorkstationOperationCallable().futureCall(request); + * // Do something. + * Workstation 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * StopWorkstationRequest request = + * StopWorkstationRequest.newBuilder() + * .setName( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setValidateOnly(true) + * .setEtag("etag3123477") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.stopWorkstationCallable().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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * WorkstationName workstation = + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]"); + * GenerateAccessTokenResponse response = workstationsClient.generateAccessToken(workstation); + * } + * }+ * + * @param workstation Required. Name of the workstation for which the access token should be + * generated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final GenerateAccessTokenResponse generateAccessToken(WorkstationName workstation) { + GenerateAccessTokenRequest request = + GenerateAccessTokenRequest.newBuilder() + .setWorkstation(workstation == null ? null : workstation.toString()) + .build(); + return generateAccessToken(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns a short-lived credential that can be used to send authenticated and authorized traffic + * to a workstation. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * String workstation = + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString(); + * GenerateAccessTokenResponse response = workstationsClient.generateAccessToken(workstation); + * } + * }+ * + * @param workstation Required. Name of the workstation for which the access token should be + * generated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final GenerateAccessTokenResponse generateAccessToken(String workstation) { + GenerateAccessTokenRequest request = + GenerateAccessTokenRequest.newBuilder().setWorkstation(workstation).build(); + return generateAccessToken(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns a short-lived credential that can be used to send authenticated and authorized traffic + * to a workstation. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * GenerateAccessTokenRequest request = + * GenerateAccessTokenRequest.newBuilder() + * .setWorkstation( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .build(); + * GenerateAccessTokenResponse response = workstationsClient.generateAccessToken(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 GenerateAccessTokenResponse generateAccessToken(GenerateAccessTokenRequest request) { + return generateAccessTokenCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns a short-lived credential that can be used to send authenticated and authorized traffic + * to a workstation. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * GenerateAccessTokenRequest request = + * GenerateAccessTokenRequest.newBuilder() + * .setWorkstation( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * workstationsClient.generateAccessTokenCallable().futureCall(request); + * // Do something. + * GenerateAccessTokenResponse response = future.get(); + * } + * }
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * SetIamPolicyRequest request = + * SetIamPolicyRequest.newBuilder() + * .setResource( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setPolicy(Policy.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Policy response = workstationsClient.setIamPolicy(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 Policy setIamPolicy(SetIamPolicyRequest request) { + return setIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sets the access control policy on the specified resource. Replacesany existing policy. + * + *
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * SetIamPolicyRequest request = + * SetIamPolicyRequest.newBuilder() + * .setResource( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setPolicy(Policy.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = workstationsClient.setIamPolicyCallable().futureCall(request); + * // Do something. + * Policy 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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * GetIamPolicyRequest request = + * GetIamPolicyRequest.newBuilder() + * .setResource( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setOptions(GetPolicyOptions.newBuilder().build()) + * .build(); + * Policy response = workstationsClient.getIamPolicy(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 Policy getIamPolicy(GetIamPolicyRequest request) { + return getIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the access control policy for a resource. Returns an empty policyif the resource exists + * and does not have a policy set. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * GetIamPolicyRequest request = + * GetIamPolicyRequest.newBuilder() + * .setResource( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .setOptions(GetPolicyOptions.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = workstationsClient.getIamPolicyCallable().futureCall(request); + * // Do something. + * Policy response = future.get(); + * } + * }
Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without + * warning. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * TestIamPermissionsRequest request = + * TestIamPermissionsRequest.newBuilder() + * .setResource( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .addAllPermissions(new ArrayList+ * + * @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 TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { + return testIamPermissionsCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns permissions that a caller has on the specified resource. If theresource does not exist, + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. + * + *()) + * .build(); + * TestIamPermissionsResponse response = workstationsClient.testIamPermissions(request); + * } + * }
Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without + * warning. + * + *
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 (WorkstationsClient workstationsClient = WorkstationsClient.create()) { + * TestIamPermissionsRequest request = + * TestIamPermissionsRequest.newBuilder() + * .setResource( + * WorkstationName.of( + * "[PROJECT]", + * "[LOCATION]", + * "[WORKSTATION_CLUSTER]", + * "[WORKSTATION_CONFIG]", + * "[WORKSTATION]") + * .toString()) + * .addAllPermissions(new ArrayList+ */ + public final UnaryCallable()) + * .build(); + * ApiFuture future = + * workstationsClient.testIamPermissionsCallable().futureCall(request); + * // Do something. + * TestIamPermissionsResponse 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 getWorkstationCluster 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 + * WorkstationsSettings.Builder workstationsSettingsBuilder = WorkstationsSettings.newBuilder(); + * workstationsSettingsBuilder + * .getWorkstationClusterSettings() + * .setRetrySettings( + * workstationsSettingsBuilder + * .getWorkstationClusterSettings() + * .getRetrySettings() + * .toBuilder() + * .setTotalTimeout(Duration.ofSeconds(30)) + * .build()); + * WorkstationsSettings workstationsSettings = workstationsSettingsBuilder.build(); + * }+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class WorkstationsSettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction