Class AssuredWorkloadsServiceClient

  • All Implemented Interfaces:
    com.google.api.gax.core.BackgroundResource, AutoCloseable

    @BetaApi
    @Generated("by gapic-generator-java")
    public class AssuredWorkloadsServiceClient
    extends Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: Service to manage AssuredWorkloads.

    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:

    
     // 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
         AssuredWorkloadsServiceClient.create()) {
       Workload workload = Workload.newBuilder().build();
       FieldMask updateMask = FieldMask.newBuilder().build();
       Workload response = assuredWorkloadsServiceClient.updateWorkload(workload, updateMask);
     }
     

    Note: close() needs to be called on the AssuredWorkloadsServiceClient 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:

    1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
    2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
    3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

    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 AssuredWorkloadsServiceSettings to create(). For example:

    To customize credentials:

    
     // 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
     AssuredWorkloadsServiceSettings assuredWorkloadsServiceSettings =
         AssuredWorkloadsServiceSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
         AssuredWorkloadsServiceClient.create(assuredWorkloadsServiceSettings);
     

    To customize the endpoint:

    
     // 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
     AssuredWorkloadsServiceSettings assuredWorkloadsServiceSettings =
         AssuredWorkloadsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
     AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
         AssuredWorkloadsServiceClient.create(assuredWorkloadsServiceSettings);
     

    To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:

    
     // 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
     AssuredWorkloadsServiceSettings assuredWorkloadsServiceSettings =
         AssuredWorkloadsServiceSettings.newHttpJsonBuilder().build();
     AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
         AssuredWorkloadsServiceClient.create(assuredWorkloadsServiceSettings);
     

    Please refer to the GitHub repository's samples for more quickstart code snippets.

    • Constructor Detail

      • AssuredWorkloadsServiceClient

        protected AssuredWorkloadsServiceClient​(AssuredWorkloadsServiceSettings settings)
                                         throws IOException
        Constructs an instance of AssuredWorkloadsServiceClient, 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.
        Throws:
        IOException
    • Method Detail

      • create

        public static final AssuredWorkloadsServiceClient create​(AssuredWorkloadsServiceStub stub)
        Constructs an instance of AssuredWorkloadsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(AssuredWorkloadsServiceSettings).
      • getOperationsClient

        public final com.google.longrunning.OperationsClient getOperationsClient()
        Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
      • getHttpJsonOperationsClient

        @BetaApi
        public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
        Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
      • createWorkloadAsync

        public final com.google.api.gax.longrunning.OperationFuture<Workload,​CreateWorkloadOperationMetadata> createWorkloadAsync​(LocationName parent,
                                                                                                                                        Workload workload)
        Creates Assured Workload.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           LocationName parent = LocationName.of("[ORGANIZATION]", "[LOCATION]");
           Workload workload = Workload.newBuilder().build();
           Workload response = assuredWorkloadsServiceClient.createWorkloadAsync(parent, workload).get();
         }
         
        Parameters:
        parent - Required. The resource name of the new Workload's parent. Must be of the form `organizations/{org_id}/locations/{location_id}`.
        workload - Required. Assured Workload to create
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createWorkloadAsync

        public final com.google.api.gax.longrunning.OperationFuture<Workload,​CreateWorkloadOperationMetadata> createWorkloadAsync​(String parent,
                                                                                                                                        Workload workload)
        Creates Assured Workload.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           String parent = LocationName.of("[ORGANIZATION]", "[LOCATION]").toString();
           Workload workload = Workload.newBuilder().build();
           Workload response = assuredWorkloadsServiceClient.createWorkloadAsync(parent, workload).get();
         }
         
        Parameters:
        parent - Required. The resource name of the new Workload's parent. Must be of the form `organizations/{org_id}/locations/{location_id}`.
        workload - Required. Assured Workload to create
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • createWorkloadAsync

        public final com.google.api.gax.longrunning.OperationFuture<Workload,​CreateWorkloadOperationMetadata> createWorkloadAsync​(CreateWorkloadRequest request)
        Creates Assured Workload.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           CreateWorkloadRequest request =
               CreateWorkloadRequest.newBuilder()
                   .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
                   .setWorkload(Workload.newBuilder().build())
                   .setExternalId("externalId-1699764666")
                   .build();
           Workload response = assuredWorkloadsServiceClient.createWorkloadAsync(request).get();
         }
         
        Parameters:
        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
      • createWorkloadOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<CreateWorkloadRequest,​Workload,​CreateWorkloadOperationMetadata> createWorkloadOperationCallable()
        Creates Assured Workload.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           CreateWorkloadRequest request =
               CreateWorkloadRequest.newBuilder()
                   .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
                   .setWorkload(Workload.newBuilder().build())
                   .setExternalId("externalId-1699764666")
                   .build();
           OperationFuture<Workload, CreateWorkloadOperationMetadata> future =
               assuredWorkloadsServiceClient.createWorkloadOperationCallable().futureCall(request);
           // Do something.
           Workload response = future.get();
         }
         
      • createWorkloadCallable

        public final com.google.api.gax.rpc.UnaryCallable<CreateWorkloadRequest,​com.google.longrunning.Operation> createWorkloadCallable()
        Creates Assured Workload.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           CreateWorkloadRequest request =
               CreateWorkloadRequest.newBuilder()
                   .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
                   .setWorkload(Workload.newBuilder().build())
                   .setExternalId("externalId-1699764666")
                   .build();
           ApiFuture<Operation> future =
               assuredWorkloadsServiceClient.createWorkloadCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • updateWorkload

        public final Workload updateWorkload​(Workload workload,
                                             com.google.protobuf.FieldMask updateMask)
        Updates an existing workload. Currently allows updating of workload display_name and labels. For force updates don't set etag field in the Workload. Only one update operation per workload can be in progress.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           Workload workload = Workload.newBuilder().build();
           FieldMask updateMask = FieldMask.newBuilder().build();
           Workload response = assuredWorkloadsServiceClient.updateWorkload(workload, updateMask);
         }
         
        Parameters:
        workload - Required. The workload to update. The workload's `name` field is used to identify the workload to be updated. Format: organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
        updateMask - Required. The list of fields to be updated.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateWorkload

        public final Workload updateWorkload​(UpdateWorkloadRequest request)
        Updates an existing workload. Currently allows updating of workload display_name and labels. For force updates don't set etag field in the Workload. Only one update operation per workload can be in progress.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           UpdateWorkloadRequest request =
               UpdateWorkloadRequest.newBuilder()
                   .setWorkload(Workload.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           Workload response = assuredWorkloadsServiceClient.updateWorkload(request);
         }
         
        Parameters:
        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
      • updateWorkloadCallable

        public final com.google.api.gax.rpc.UnaryCallable<UpdateWorkloadRequest,​Workload> updateWorkloadCallable()
        Updates an existing workload. Currently allows updating of workload display_name and labels. For force updates don't set etag field in the Workload. Only one update operation per workload can be in progress.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           UpdateWorkloadRequest request =
               UpdateWorkloadRequest.newBuilder()
                   .setWorkload(Workload.newBuilder().build())
                   .setUpdateMask(FieldMask.newBuilder().build())
                   .build();
           ApiFuture<Workload> future =
               assuredWorkloadsServiceClient.updateWorkloadCallable().futureCall(request);
           // Do something.
           Workload response = future.get();
         }
         
      • restrictAllowedResources

        public final RestrictAllowedResourcesResponse restrictAllowedResources​(RestrictAllowedResourcesRequest request)
        Restrict the list of resources allowed in the Workload environment. The current list of allowed products can be found at https://cloud.google.com/assured-workloads/docs/supported-products In addition to assuredworkloads.workload.update permission, the user should also have orgpolicy.policy.set permission on the folder resource to use this functionality.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           RestrictAllowedResourcesRequest request =
               RestrictAllowedResourcesRequest.newBuilder().setName("name3373707").build();
           RestrictAllowedResourcesResponse response =
               assuredWorkloadsServiceClient.restrictAllowedResources(request);
         }
         
        Parameters:
        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
      • restrictAllowedResourcesCallable

        public final com.google.api.gax.rpc.UnaryCallable<RestrictAllowedResourcesRequest,​RestrictAllowedResourcesResponse> restrictAllowedResourcesCallable()
        Restrict the list of resources allowed in the Workload environment. The current list of allowed products can be found at https://cloud.google.com/assured-workloads/docs/supported-products In addition to assuredworkloads.workload.update permission, the user should also have orgpolicy.policy.set permission on the folder resource to use this functionality.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           RestrictAllowedResourcesRequest request =
               RestrictAllowedResourcesRequest.newBuilder().setName("name3373707").build();
           ApiFuture<RestrictAllowedResourcesResponse> future =
               assuredWorkloadsServiceClient.restrictAllowedResourcesCallable().futureCall(request);
           // Do something.
           RestrictAllowedResourcesResponse response = future.get();
         }
         
      • deleteWorkload

        public final void deleteWorkload​(WorkloadName name)
        Deletes the workload. Make sure that workload's direct children are already in a deleted state, otherwise the request will fail with a FAILED_PRECONDITION error. In addition to assuredworkloads.workload.delete permission, the user should also have orgpolicy.policy.set permission on the deleted folder to remove Assured Workloads OrgPolicies.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           WorkloadName name = WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]");
           assuredWorkloadsServiceClient.deleteWorkload(name);
         }
         
        Parameters:
        name - Required. The `name` field is used to identify the workload. Format: organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteWorkload

        public final void deleteWorkload​(String name)
        Deletes the workload. Make sure that workload's direct children are already in a deleted state, otherwise the request will fail with a FAILED_PRECONDITION error. In addition to assuredworkloads.workload.delete permission, the user should also have orgpolicy.policy.set permission on the deleted folder to remove Assured Workloads OrgPolicies.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           String name = WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString();
           assuredWorkloadsServiceClient.deleteWorkload(name);
         }
         
        Parameters:
        name - Required. The `name` field is used to identify the workload. Format: organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteWorkload

        public final void deleteWorkload​(DeleteWorkloadRequest request)
        Deletes the workload. Make sure that workload's direct children are already in a deleted state, otherwise the request will fail with a FAILED_PRECONDITION error. In addition to assuredworkloads.workload.delete permission, the user should also have orgpolicy.policy.set permission on the deleted folder to remove Assured Workloads OrgPolicies.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           DeleteWorkloadRequest request =
               DeleteWorkloadRequest.newBuilder()
                   .setName(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString())
                   .setEtag("etag3123477")
                   .build();
           assuredWorkloadsServiceClient.deleteWorkload(request);
         }
         
        Parameters:
        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
      • deleteWorkloadCallable

        public final com.google.api.gax.rpc.UnaryCallable<DeleteWorkloadRequest,​com.google.protobuf.Empty> deleteWorkloadCallable()
        Deletes the workload. Make sure that workload's direct children are already in a deleted state, otherwise the request will fail with a FAILED_PRECONDITION error. In addition to assuredworkloads.workload.delete permission, the user should also have orgpolicy.policy.set permission on the deleted folder to remove Assured Workloads OrgPolicies.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           DeleteWorkloadRequest request =
               DeleteWorkloadRequest.newBuilder()
                   .setName(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString())
                   .setEtag("etag3123477")
                   .build();
           ApiFuture<Empty> future =
               assuredWorkloadsServiceClient.deleteWorkloadCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • getWorkload

        public final Workload getWorkload​(WorkloadName name)
        Gets Assured Workload associated with a CRM Node

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           WorkloadName name = WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]");
           Workload response = assuredWorkloadsServiceClient.getWorkload(name);
         }
         
        Parameters:
        name - Required. The resource name of the Workload to fetch. This is the workloads's relative path in the API, formatted as "organizations/{organization_id}/locations/{location_id}/workloads/{workload_id}". For example, "organizations/123/locations/us-east1/workloads/assured-workload-1".
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getWorkload

        public final Workload getWorkload​(String name)
        Gets Assured Workload associated with a CRM Node

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           String name = WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString();
           Workload response = assuredWorkloadsServiceClient.getWorkload(name);
         }
         
        Parameters:
        name - Required. The resource name of the Workload to fetch. This is the workloads's relative path in the API, formatted as "organizations/{organization_id}/locations/{location_id}/workloads/{workload_id}". For example, "organizations/123/locations/us-east1/workloads/assured-workload-1".
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getWorkload

        public final Workload getWorkload​(GetWorkloadRequest request)
        Gets Assured Workload associated with a CRM Node

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           GetWorkloadRequest request =
               GetWorkloadRequest.newBuilder()
                   .setName(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString())
                   .build();
           Workload response = assuredWorkloadsServiceClient.getWorkload(request);
         }
         
        Parameters:
        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
      • getWorkloadCallable

        public final com.google.api.gax.rpc.UnaryCallable<GetWorkloadRequest,​Workload> getWorkloadCallable()
        Gets Assured Workload associated with a CRM Node

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           GetWorkloadRequest request =
               GetWorkloadRequest.newBuilder()
                   .setName(WorkloadName.of("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]").toString())
                   .build();
           ApiFuture<Workload> future =
               assuredWorkloadsServiceClient.getWorkloadCallable().futureCall(request);
           // Do something.
           Workload response = future.get();
         }
         
      • analyzeWorkloadMove

        public final AnalyzeWorkloadMoveResponse analyzeWorkloadMove​(String project,
                                                                     String target)
        Analyze if the source Assured Workloads can be moved to the target Assured Workload

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           String project = "project-309310695";
           String target = "target-880905839";
           AnalyzeWorkloadMoveResponse response =
               assuredWorkloadsServiceClient.analyzeWorkloadMove(project, target);
         }
         
        Parameters:
        project - The source type is a project. Specify the project's relative resource name, formatted as either a project number or a project ID: "projects/{PROJECT_NUMBER}" or "projects/{PROJECT_ID}" For example: "projects/951040570662" when specifying a project number, or "projects/my-project-123" when specifying a project ID.
        target - Required. The resource ID of the folder-based destination workload. This workload is where the source project will hypothetically be moved to. Specify the workload's relative resource name, formatted as: "organizations/{ORGANIZATION_ID}/locations/{LOCATION_ID}/workloads/{WORKLOAD_ID}" For example: "organizations/123/locations/us-east1/workloads/assured-workload-2"
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • analyzeWorkloadMove

        public final AnalyzeWorkloadMoveResponse analyzeWorkloadMove​(AnalyzeWorkloadMoveRequest request)
        Analyze if the source Assured Workloads can be moved to the target Assured Workload

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           AnalyzeWorkloadMoveRequest request =
               AnalyzeWorkloadMoveRequest.newBuilder().setTarget("target-880905839").build();
           AnalyzeWorkloadMoveResponse response =
               assuredWorkloadsServiceClient.analyzeWorkloadMove(request);
         }
         
        Parameters:
        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
      • analyzeWorkloadMoveCallable

        public final com.google.api.gax.rpc.UnaryCallable<AnalyzeWorkloadMoveRequest,​AnalyzeWorkloadMoveResponse> analyzeWorkloadMoveCallable()
        Analyze if the source Assured Workloads can be moved to the target Assured Workload

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           AnalyzeWorkloadMoveRequest request =
               AnalyzeWorkloadMoveRequest.newBuilder().setTarget("target-880905839").build();
           ApiFuture<AnalyzeWorkloadMoveResponse> future =
               assuredWorkloadsServiceClient.analyzeWorkloadMoveCallable().futureCall(request);
           // Do something.
           AnalyzeWorkloadMoveResponse response = future.get();
         }
         
      • listWorkloads

        public final AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse listWorkloads​(LocationName parent)
        Lists Assured Workloads under a CRM Node.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           LocationName parent = LocationName.of("[ORGANIZATION]", "[LOCATION]");
           for (Workload element : assuredWorkloadsServiceClient.listWorkloads(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. Parent Resource to list workloads from. Must be of the form `organizations/{org_id}/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listWorkloads

        public final AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse listWorkloads​(String parent)
        Lists Assured Workloads under a CRM Node.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           String parent = LocationName.of("[ORGANIZATION]", "[LOCATION]").toString();
           for (Workload element : assuredWorkloadsServiceClient.listWorkloads(parent).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        parent - Required. Parent Resource to list workloads from. Must be of the form `organizations/{org_id}/locations/{location}`.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listWorkloads

        public final AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse listWorkloads​(ListWorkloadsRequest request)
        Lists Assured Workloads under a CRM Node.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           ListWorkloadsRequest request =
               ListWorkloadsRequest.newBuilder()
                   .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilter("filter-1274492040")
                   .build();
           for (Workload element : assuredWorkloadsServiceClient.listWorkloads(request).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        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
      • listWorkloadsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListWorkloadsRequest,​AssuredWorkloadsServiceClient.ListWorkloadsPagedResponse> listWorkloadsPagedCallable()
        Lists Assured Workloads under a CRM Node.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           ListWorkloadsRequest request =
               ListWorkloadsRequest.newBuilder()
                   .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilter("filter-1274492040")
                   .build();
           ApiFuture<Workload> future =
               assuredWorkloadsServiceClient.listWorkloadsPagedCallable().futureCall(request);
           // Do something.
           for (Workload element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listWorkloadsCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListWorkloadsRequest,​ListWorkloadsResponse> listWorkloadsCallable()
        Lists Assured Workloads under a CRM Node.

        Sample 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 (AssuredWorkloadsServiceClient assuredWorkloadsServiceClient =
             AssuredWorkloadsServiceClient.create()) {
           ListWorkloadsRequest request =
               ListWorkloadsRequest.newBuilder()
                   .setParent(LocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
                   .setPageSize(883849137)
                   .setPageToken("pageToken873572522")
                   .setFilter("filter-1274492040")
                   .build();
           while (true) {
             ListWorkloadsResponse response =
                 assuredWorkloadsServiceClient.listWorkloadsCallable().call(request);
             for (Workload element : response.getWorkloadsList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface com.google.api.gax.core.BackgroundResource
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface com.google.api.gax.core.BackgroundResource
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface com.google.api.gax.core.BackgroundResource
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface com.google.api.gax.core.BackgroundResource