Class BatchJobServiceClient

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

    @Generated("by gapic-generator-java")
    public class BatchJobServiceClient
    extends java.lang.Object
    implements com.google.api.gax.core.BackgroundResource
    Service Description: Service to manage batch jobs.

    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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
       String customerId = "customerId-1581184615";
       BatchJobOperation operation = BatchJobOperation.newBuilder().build();
       MutateBatchJobResponse response = batchJobServiceClient.mutateBatchJob(customerId, operation);
     }
     

    Note: close() needs to be called on the BatchJobServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

    Methods
    Method Description Method Variants

    MutateBatchJob

    Mutates a batch job.

    List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() [ResourceCountLimitExceededError]()

    Request object method variants only take one parameter, a request object, which must be constructed before the call.

    • mutateBatchJob(MutateBatchJobRequest request)

    "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

    • mutateBatchJob(String customerId, BatchJobOperation operation)

    Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

    • mutateBatchJobCallable()

    ListBatchJobResults

    Returns the results of the batch job. The job must be done. Supports standard list paging.

    List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

    Request object method variants only take one parameter, a request object, which must be constructed before the call.

    • listBatchJobResults(ListBatchJobResultsRequest request)

    "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

    • listBatchJobResults(BatchJobName resourceName)

    • listBatchJobResults(String resourceName)

    Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

    • listBatchJobResultsPagedCallable()

    • listBatchJobResultsCallable()

    RunBatchJob

    Runs the batch job.

    The Operation.metadata field type is BatchJobMetadata. When finished, the long running operation will not contain errors or a response. Instead, use ListBatchJobResults to get the results of the job.

    List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

    Request object method variants only take one parameter, a request object, which must be constructed before the call.

    • runBatchJobAsync(RunBatchJobRequest request)

    Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

    • runBatchJobAsync(BatchJobName resourceName)

    • runBatchJobAsync(String resourceName)

    Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

    • runBatchJobOperationCallable()

    • runBatchJobCallable()

    AddBatchJobOperations

    Add operations to the batch job.

    List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() [ResourceCountLimitExceededError]()

    Request object method variants only take one parameter, a request object, which must be constructed before the call.

    • addBatchJobOperations(AddBatchJobOperationsRequest request)

    "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

    • addBatchJobOperations(BatchJobName resourceName, List<MutateOperation> mutateOperations)

    • addBatchJobOperations(String resourceName, List<MutateOperation> mutateOperations)

    • addBatchJobOperations(BatchJobName resourceName, String sequenceToken, List<MutateOperation> mutateOperations)

    • addBatchJobOperations(String resourceName, String sequenceToken, List<MutateOperation> mutateOperations)

    Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

    • addBatchJobOperationsCallable()

    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 BatchJobServiceSettings 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
     BatchJobServiceSettings batchJobServiceSettings =
         BatchJobServiceSettings.newBuilder()
             .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
             .build();
     BatchJobServiceClient batchJobServiceClient =
         BatchJobServiceClient.create(batchJobServiceSettings);
     

    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
     BatchJobServiceSettings batchJobServiceSettings =
         BatchJobServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
     BatchJobServiceClient batchJobServiceClient =
         BatchJobServiceClient.create(batchJobServiceSettings);
     

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

    • Constructor Detail

      • BatchJobServiceClient

        protected BatchJobServiceClient​(BatchJobServiceSettings settings)
                                 throws java.io.IOException
        Constructs an instance of BatchJobServiceClient, 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:
        java.io.IOException
    • Method Detail

      • create

        public static final BatchJobServiceClient create()
                                                  throws java.io.IOException
        Constructs an instance of BatchJobServiceClient with default settings.
        Throws:
        java.io.IOException
      • create

        public static final BatchJobServiceClient create​(BatchJobServiceSettings settings)
                                                  throws java.io.IOException
        Constructs an instance of BatchJobServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
        Throws:
        java.io.IOException
      • create

        public static final BatchJobServiceClient create​(BatchJobServiceStub stub)
        Constructs an instance of BatchJobServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(BatchJobServiceSettings).
      • 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.
      • mutateBatchJob

        public final MutateBatchJobResponse mutateBatchJob​(java.lang.String customerId,
                                                           BatchJobOperation operation)
        Mutates a batch job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() [ResourceCountLimitExceededError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           String customerId = "customerId-1581184615";
           BatchJobOperation operation = BatchJobOperation.newBuilder().build();
           MutateBatchJobResponse response = batchJobServiceClient.mutateBatchJob(customerId, operation);
         }
         
        Parameters:
        customerId - Required. The ID of the customer for which to create a batch job.
        operation - Required. The operation to perform on an individual batch job.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • mutateBatchJob

        public final MutateBatchJobResponse mutateBatchJob​(MutateBatchJobRequest request)
        Mutates a batch job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() [ResourceCountLimitExceededError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           MutateBatchJobRequest request =
               MutateBatchJobRequest.newBuilder()
                   .setCustomerId("customerId-1581184615")
                   .setOperation(BatchJobOperation.newBuilder().build())
                   .build();
           MutateBatchJobResponse response = batchJobServiceClient.mutateBatchJob(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
      • mutateBatchJobCallable

        public final com.google.api.gax.rpc.UnaryCallable<MutateBatchJobRequest,​MutateBatchJobResponse> mutateBatchJobCallable()
        Mutates a batch job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() [ResourceCountLimitExceededError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           MutateBatchJobRequest request =
               MutateBatchJobRequest.newBuilder()
                   .setCustomerId("customerId-1581184615")
                   .setOperation(BatchJobOperation.newBuilder().build())
                   .build();
           ApiFuture<MutateBatchJobResponse> future =
               batchJobServiceClient.mutateBatchJobCallable().futureCall(request);
           // Do something.
           MutateBatchJobResponse response = future.get();
         }
         
      • listBatchJobResults

        public final BatchJobServiceClient.ListBatchJobResultsPagedResponse listBatchJobResults​(BatchJobName resourceName)
        Returns the results of the batch job. The job must be done. Supports standard list paging.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           BatchJobName resourceName = BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]");
           for (BatchJobResult element :
               batchJobServiceClient.listBatchJobResults(resourceName).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        resourceName - Required. The resource name of the batch job whose results are being listed.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listBatchJobResults

        public final BatchJobServiceClient.ListBatchJobResultsPagedResponse listBatchJobResults​(java.lang.String resourceName)
        Returns the results of the batch job. The job must be done. Supports standard list paging.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           String resourceName = BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString();
           for (BatchJobResult element :
               batchJobServiceClient.listBatchJobResults(resourceName).iterateAll()) {
             // doThingsWith(element);
           }
         }
         
        Parameters:
        resourceName - Required. The resource name of the batch job whose results are being listed.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listBatchJobResults

        public final BatchJobServiceClient.ListBatchJobResultsPagedResponse listBatchJobResults​(ListBatchJobResultsRequest request)
        Returns the results of the batch job. The job must be done. Supports standard list paging.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           ListBatchJobResultsRequest request =
               ListBatchJobResultsRequest.newBuilder()
                   .setResourceName(BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString())
                   .setPageToken("pageToken873572522")
                   .setPageSize(883849137)
                   .build();
           for (BatchJobResult element :
               batchJobServiceClient.listBatchJobResults(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
      • listBatchJobResultsPagedCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListBatchJobResultsRequest,​BatchJobServiceClient.ListBatchJobResultsPagedResponse> listBatchJobResultsPagedCallable()
        Returns the results of the batch job. The job must be done. Supports standard list paging.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           ListBatchJobResultsRequest request =
               ListBatchJobResultsRequest.newBuilder()
                   .setResourceName(BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString())
                   .setPageToken("pageToken873572522")
                   .setPageSize(883849137)
                   .build();
           ApiFuture<BatchJobResult> future =
               batchJobServiceClient.listBatchJobResultsPagedCallable().futureCall(request);
           // Do something.
           for (BatchJobResult element : future.get().iterateAll()) {
             // doThingsWith(element);
           }
         }
         
      • listBatchJobResultsCallable

        public final com.google.api.gax.rpc.UnaryCallable<ListBatchJobResultsRequest,​ListBatchJobResultsResponse> listBatchJobResultsCallable()
        Returns the results of the batch job. The job must be done. Supports standard list paging.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           ListBatchJobResultsRequest request =
               ListBatchJobResultsRequest.newBuilder()
                   .setResourceName(BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString())
                   .setPageToken("pageToken873572522")
                   .setPageSize(883849137)
                   .build();
           while (true) {
             ListBatchJobResultsResponse response =
                 batchJobServiceClient.listBatchJobResultsCallable().call(request);
             for (BatchJobResult element : response.getResultsList()) {
               // doThingsWith(element);
             }
             String nextPageToken = response.getNextPageToken();
             if (!Strings.isNullOrEmpty(nextPageToken)) {
               request = request.toBuilder().setPageToken(nextPageToken).build();
             } else {
               break;
             }
           }
         }
         
      • runBatchJobAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​BatchJob.BatchJobMetadata> runBatchJobAsync​(BatchJobName resourceName)
        Runs the batch job.

        The Operation.metadata field type is BatchJobMetadata. When finished, the long running operation will not contain errors or a response. Instead, use ListBatchJobResults to get the results of the job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           BatchJobName resourceName = BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]");
           batchJobServiceClient.runBatchJobAsync(resourceName).get();
         }
         
        Parameters:
        resourceName - Required. The resource name of the BatchJob to run.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • runBatchJobAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​BatchJob.BatchJobMetadata> runBatchJobAsync​(java.lang.String resourceName)
        Runs the batch job.

        The Operation.metadata field type is BatchJobMetadata. When finished, the long running operation will not contain errors or a response. Instead, use ListBatchJobResults to get the results of the job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           String resourceName = BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString();
           batchJobServiceClient.runBatchJobAsync(resourceName).get();
         }
         
        Parameters:
        resourceName - Required. The resource name of the BatchJob to run.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • runBatchJobAsync

        public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,​BatchJob.BatchJobMetadata> runBatchJobAsync​(RunBatchJobRequest request)
        Runs the batch job.

        The Operation.metadata field type is BatchJobMetadata. When finished, the long running operation will not contain errors or a response. Instead, use ListBatchJobResults to get the results of the job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           RunBatchJobRequest request =
               RunBatchJobRequest.newBuilder()
                   .setResourceName(BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString())
                   .build();
           batchJobServiceClient.runBatchJobAsync(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
      • runBatchJobOperationCallable

        public final com.google.api.gax.rpc.OperationCallable<RunBatchJobRequest,​com.google.protobuf.Empty,​BatchJob.BatchJobMetadata> runBatchJobOperationCallable()
        Runs the batch job.

        The Operation.metadata field type is BatchJobMetadata. When finished, the long running operation will not contain errors or a response. Instead, use ListBatchJobResults to get the results of the job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           RunBatchJobRequest request =
               RunBatchJobRequest.newBuilder()
                   .setResourceName(BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString())
                   .build();
           OperationFuture<Empty, BatchJob.BatchJobMetadata> future =
               batchJobServiceClient.runBatchJobOperationCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • runBatchJobCallable

        public final com.google.api.gax.rpc.UnaryCallable<RunBatchJobRequest,​com.google.longrunning.Operation> runBatchJobCallable()
        Runs the batch job.

        The Operation.metadata field type is BatchJobMetadata. When finished, the long running operation will not contain errors or a response. Instead, use ListBatchJobResults to get the results of the job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           RunBatchJobRequest request =
               RunBatchJobRequest.newBuilder()
                   .setResourceName(BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString())
                   .build();
           ApiFuture<Operation> future = batchJobServiceClient.runBatchJobCallable().futureCall(request);
           // Do something.
           future.get();
         }
         
      • addBatchJobOperations

        public final AddBatchJobOperationsResponse addBatchJobOperations​(BatchJobName resourceName,
                                                                         java.util.List<MutateOperation> mutateOperations)
        Add operations to the batch job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() [ResourceCountLimitExceededError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           BatchJobName resourceName = BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]");
           List<MutateOperation> mutateOperations = new ArrayList<>();
           AddBatchJobOperationsResponse response =
               batchJobServiceClient.addBatchJobOperations(resourceName, mutateOperations);
         }
         
        Parameters:
        resourceName - Required. The resource name of the batch job.
        mutateOperations - Required. The list of mutates being added.

        Operations can use negative integers as temp ids to signify dependencies between entities created in this batch job. For example, a customer with id = 1234 can create a campaign and an ad group in that same campaign by creating a campaign in the first operation with the resource name explicitly set to "customers/1234/campaigns/-1", and creating an ad group in the second operation with the campaign field also set to "customers/1234/campaigns/-1".

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addBatchJobOperations

        public final AddBatchJobOperationsResponse addBatchJobOperations​(java.lang.String resourceName,
                                                                         java.util.List<MutateOperation> mutateOperations)
        Add operations to the batch job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() [ResourceCountLimitExceededError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           String resourceName = BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString();
           List<MutateOperation> mutateOperations = new ArrayList<>();
           AddBatchJobOperationsResponse response =
               batchJobServiceClient.addBatchJobOperations(resourceName, mutateOperations);
         }
         
        Parameters:
        resourceName - Required. The resource name of the batch job.
        mutateOperations - Required. The list of mutates being added.

        Operations can use negative integers as temp ids to signify dependencies between entities created in this batch job. For example, a customer with id = 1234 can create a campaign and an ad group in that same campaign by creating a campaign in the first operation with the resource name explicitly set to "customers/1234/campaigns/-1", and creating an ad group in the second operation with the campaign field also set to "customers/1234/campaigns/-1".

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addBatchJobOperations

        public final AddBatchJobOperationsResponse addBatchJobOperations​(BatchJobName resourceName,
                                                                         java.lang.String sequenceToken,
                                                                         java.util.List<MutateOperation> mutateOperations)
        Add operations to the batch job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() [ResourceCountLimitExceededError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           BatchJobName resourceName = BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]");
           String sequenceToken = "sequenceToken-731053384";
           List<MutateOperation> mutateOperations = new ArrayList<>();
           AddBatchJobOperationsResponse response =
               batchJobServiceClient.addBatchJobOperations(
                   resourceName, sequenceToken, mutateOperations);
         }
         
        Parameters:
        resourceName - Required. The resource name of the batch job.
        sequenceToken - A token used to enforce sequencing.

        The first AddBatchJobOperations request for a batch job should not set sequence_token. Subsequent requests must set sequence_token to the value of next_sequence_token received in the previous AddBatchJobOperations response.

        mutateOperations - Required. The list of mutates being added.

        Operations can use negative integers as temp ids to signify dependencies between entities created in this batch job. For example, a customer with id = 1234 can create a campaign and an ad group in that same campaign by creating a campaign in the first operation with the resource name explicitly set to "customers/1234/campaigns/-1", and creating an ad group in the second operation with the campaign field also set to "customers/1234/campaigns/-1".

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addBatchJobOperations

        public final AddBatchJobOperationsResponse addBatchJobOperations​(java.lang.String resourceName,
                                                                         java.lang.String sequenceToken,
                                                                         java.util.List<MutateOperation> mutateOperations)
        Add operations to the batch job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() [ResourceCountLimitExceededError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           String resourceName = BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString();
           String sequenceToken = "sequenceToken-731053384";
           List<MutateOperation> mutateOperations = new ArrayList<>();
           AddBatchJobOperationsResponse response =
               batchJobServiceClient.addBatchJobOperations(
                   resourceName, sequenceToken, mutateOperations);
         }
         
        Parameters:
        resourceName - Required. The resource name of the batch job.
        sequenceToken - A token used to enforce sequencing.

        The first AddBatchJobOperations request for a batch job should not set sequence_token. Subsequent requests must set sequence_token to the value of next_sequence_token received in the previous AddBatchJobOperations response.

        mutateOperations - Required. The list of mutates being added.

        Operations can use negative integers as temp ids to signify dependencies between entities created in this batch job. For example, a customer with id = 1234 can create a campaign and an ad group in that same campaign by creating a campaign in the first operation with the resource name explicitly set to "customers/1234/campaigns/-1", and creating an ad group in the second operation with the campaign field also set to "customers/1234/campaigns/-1".

        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addBatchJobOperations

        public final AddBatchJobOperationsResponse addBatchJobOperations​(AddBatchJobOperationsRequest request)
        Add operations to the batch job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() [ResourceCountLimitExceededError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           AddBatchJobOperationsRequest request =
               AddBatchJobOperationsRequest.newBuilder()
                   .setResourceName(BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString())
                   .setSequenceToken("sequenceToken-731053384")
                   .addAllMutateOperations(new ArrayList<MutateOperation>())
                   .build();
           AddBatchJobOperationsResponse response = batchJobServiceClient.addBatchJobOperations(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
      • addBatchJobOperationsCallable

        public final com.google.api.gax.rpc.UnaryCallable<AddBatchJobOperationsRequest,​AddBatchJobOperationsResponse> addBatchJobOperationsCallable()
        Add operations to the batch job.

        List of thrown errors: [AuthenticationError]() [AuthorizationError]() [BatchJobError]() [HeaderError]() [InternalError]() [QuotaError]() [RequestError]() [ResourceCountLimitExceededError]()

        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 (BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create()) {
           AddBatchJobOperationsRequest request =
               AddBatchJobOperationsRequest.newBuilder()
                   .setResourceName(BatchJobName.of("[CUSTOMER_ID]", "[BATCH_JOB_ID]").toString())
                   .setSequenceToken("sequenceToken-731053384")
                   .addAllMutateOperations(new ArrayList<MutateOperation>())
                   .build();
           ApiFuture<AddBatchJobOperationsResponse> future =
               batchJobServiceClient.addBatchJobOperationsCallable().futureCall(request);
           // Do something.
           AddBatchJobOperationsResponse response = future.get();
         }
         
      • close

        public final void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • 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
      • awaitTermination

        public boolean awaitTermination​(long duration,
                                        java.util.concurrent.TimeUnit unit)
                                 throws java.lang.InterruptedException
        Specified by:
        awaitTermination in interface com.google.api.gax.core.BackgroundResource
        Throws:
        java.lang.InterruptedException