Class BatchJobServiceClient
- java.lang.Object
-
- com.google.ads.googleads.v10.services.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.BackgroundResourceService 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:
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().
The surface of this class includes several types of Java methods for each of the API's methods:
- 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.
- 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.
- 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 BatchJobServiceSettings to create(). For example:
To customize credentials:
BatchJobServiceSettings batchJobServiceSettings = BatchJobServiceSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); BatchJobServiceClient batchJobServiceClient = BatchJobServiceClient.create(batchJobServiceSettings);To customize the endpoint:
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBatchJobServiceClient.ListBatchJobResultsFixedSizeCollectionstatic classBatchJobServiceClient.ListBatchJobResultsPagestatic classBatchJobServiceClient.ListBatchJobResultsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protectedBatchJobServiceClient(BatchJobServiceSettings settings)Constructs an instance of BatchJobServiceClient, using the given settings.protectedBatchJobServiceClient(BatchJobServiceStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AddBatchJobOperationsResponseaddBatchJobOperations(BatchJobName resourceName, java.lang.String sequenceToken, java.util.List<MutateOperation> mutateOperations)Add operations to the batch job.AddBatchJobOperationsResponseaddBatchJobOperations(BatchJobName resourceName, java.util.List<MutateOperation> mutateOperations)Add operations to the batch job.AddBatchJobOperationsResponseaddBatchJobOperations(AddBatchJobOperationsRequest request)Add operations to the batch job.AddBatchJobOperationsResponseaddBatchJobOperations(java.lang.String resourceName, java.lang.String sequenceToken, java.util.List<MutateOperation> mutateOperations)Add operations to the batch job.AddBatchJobOperationsResponseaddBatchJobOperations(java.lang.String resourceName, java.util.List<MutateOperation> mutateOperations)Add operations to the batch job.com.google.api.gax.rpc.UnaryCallable<AddBatchJobOperationsRequest,AddBatchJobOperationsResponse>addBatchJobOperationsCallable()Add operations to the batch job.booleanawaitTermination(long duration, java.util.concurrent.TimeUnit unit)voidclose()static BatchJobServiceClientcreate()Constructs an instance of BatchJobServiceClient with default settings.static BatchJobServiceClientcreate(BatchJobServiceSettings settings)Constructs an instance of BatchJobServiceClient, using the given settings.static BatchJobServiceClientcreate(BatchJobServiceStub stub)Constructs an instance of BatchJobServiceClient, using the given stub for making calls.com.google.longrunning.OperationsClientgetOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.BatchJobServiceSettingsgetSettings()BatchJobServiceStubgetStub()booleanisShutdown()booleanisTerminated()BatchJobServiceClient.ListBatchJobResultsPagedResponselistBatchJobResults(BatchJobName resourceName)Returns the results of the batch job.BatchJobServiceClient.ListBatchJobResultsPagedResponselistBatchJobResults(ListBatchJobResultsRequest request)Returns the results of the batch job.BatchJobServiceClient.ListBatchJobResultsPagedResponselistBatchJobResults(java.lang.String resourceName)Returns the results of the batch job.com.google.api.gax.rpc.UnaryCallable<ListBatchJobResultsRequest,ListBatchJobResultsResponse>listBatchJobResultsCallable()Returns the results of the batch job.com.google.api.gax.rpc.UnaryCallable<ListBatchJobResultsRequest,BatchJobServiceClient.ListBatchJobResultsPagedResponse>listBatchJobResultsPagedCallable()Returns the results of the batch job.MutateBatchJobResponsemutateBatchJob(MutateBatchJobRequest request)Mutates a batch job.MutateBatchJobResponsemutateBatchJob(java.lang.String customerId, BatchJobOperation operation)Mutates a batch job.com.google.api.gax.rpc.UnaryCallable<MutateBatchJobRequest,MutateBatchJobResponse>mutateBatchJobCallable()Mutates a batch job.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,BatchJob.BatchJobMetadata>runBatchJobAsync(BatchJobName resourceName)Runs the batch job.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,BatchJob.BatchJobMetadata>runBatchJobAsync(RunBatchJobRequest request)Runs the batch job.com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,BatchJob.BatchJobMetadata>runBatchJobAsync(java.lang.String resourceName)Runs the batch job.com.google.api.gax.rpc.UnaryCallable<RunBatchJobRequest,com.google.longrunning.Operation>runBatchJobCallable()Runs the batch job.com.google.api.gax.rpc.OperationCallable<RunBatchJobRequest,com.google.protobuf.Empty,BatchJob.BatchJobMetadata>runBatchJobOperationCallable()Runs the batch job.voidshutdown()voidshutdownNow()
-
-
-
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
-
BatchJobServiceClient
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected BatchJobServiceClient(BatchJobServiceStub stub)
-
-
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
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") 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).
-
getSettings
public final BatchJobServiceSettings getSettings()
-
getStub
@BetaApi("A restructuring of stub classes is planned, so this may break in the future") public BatchJobServiceStub getStub()
-
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:
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:
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:
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:
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:
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:
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:
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:
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.getResponsesList()) { // 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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
closein interfacejava.lang.AutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNowin interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
java.lang.InterruptedException
-
-