Class BatchServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Job job = Job.newBuilder().build();
String jobId = "jobId101296568";
Job response = batchServiceClient.createJob(parent, job, jobId);
}
Note: close() needs to be called on the BatchServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
CreateJob |
Create a Job. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetJob |
Get a Job specified by its resource name. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteJob |
Delete a Job. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CancelJob |
Cancel a Job. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateJob |
Update a Job. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListJobs |
List all Jobs for a project within a region. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetTask |
Return a single Task. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListTasks |
List Tasks associated with a job. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateResourceAllowance |
Create a Resource Allowance. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetResourceAllowance |
Get a ResourceAllowance specified by its resource name. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteResourceAllowance |
Delete a ResourceAllowance. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListResourceAllowances |
List all ResourceAllowances for a project within a region. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateResourceAllowance |
Update a Resource Allowance. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return 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 BatchServiceSettings 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
BatchServiceSettings batchServiceSettings =
BatchServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
BatchServiceClient batchServiceClient = BatchServiceClient.create(batchServiceSettings);
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
BatchServiceSettings batchServiceSettings =
BatchServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
BatchServiceClient batchServiceClient = BatchServiceClient.create(batchServiceSettings);
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
BatchServiceSettings batchServiceSettings = BatchServiceSettings.newHttpJsonBuilder().build();
BatchServiceClient batchServiceClient = BatchServiceClient.create(batchServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBatchServiceClient(BatchServiceSettings settings) Constructs an instance of BatchServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) cancelJobAsync(CancelJobRequest request) Cancel a Job.cancelJobAsync(JobName name) Cancel a Job.cancelJobAsync(String name) Cancel a Job.Cancel a Job.Cancel a Job.final voidclose()static final BatchServiceClientcreate()Constructs an instance of BatchServiceClient with default settings.static final BatchServiceClientcreate(BatchServiceSettings settings) Constructs an instance of BatchServiceClient, using the given settings.static final BatchServiceClientcreate(BatchServiceStub stub) Constructs an instance of BatchServiceClient, using the given stub for making calls.final JobcreateJob(CreateJobRequest request) Create a Job.final JobcreateJob(LocationName parent, Job job, String jobId) Create a Job.final JobCreate a Job.final UnaryCallable<CreateJobRequest,Job> Create a Job.final ResourceAllowanceCreate a Resource Allowance.final ResourceAllowancecreateResourceAllowance(LocationName parent, ResourceAllowance resourceAllowance, String resourceAllowanceId) Create a Resource Allowance.final ResourceAllowancecreateResourceAllowance(String parent, ResourceAllowance resourceAllowance, String resourceAllowanceId) Create a Resource Allowance.Create a Resource Allowance.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteJobAsync(DeleteJobRequest request) Delete a Job.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteJobAsync(String name) Delete a Job.Delete a Job.final OperationCallable<DeleteJobRequest,com.google.protobuf.Empty, OperationMetadata> Delete a Job.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> Delete a ResourceAllowance.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> Delete a ResourceAllowance.final OperationFuture<com.google.protobuf.Empty,OperationMetadata> Delete a ResourceAllowance.Delete a ResourceAllowance.final OperationCallable<DeleteResourceAllowanceRequest,com.google.protobuf.Empty, OperationMetadata> Delete a ResourceAllowance.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final JobgetJob(GetJobRequest request) Get a Job specified by its resource name.final JobGet a Job specified by its resource name.final JobGet a Job specified by its resource name.final UnaryCallable<GetJobRequest,Job> Get a Job specified by its resource name.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final ResourceAllowanceGet a ResourceAllowance specified by its resource name.final ResourceAllowanceGet a ResourceAllowance specified by its resource name.final ResourceAllowancegetResourceAllowance(String name) Get a ResourceAllowance specified by its resource name.Get a ResourceAllowance specified by its resource name.final BatchServiceSettingsgetStub()final TaskgetTask(GetTaskRequest request) Return a single Task.final TaskReturn a single Task.final TaskReturn a single Task.final UnaryCallable<GetTaskRequest,Task> Return a single Task.booleanbooleanlistJobs(ListJobsRequest request) List all Jobs for a project within a region.List all Jobs for a project within a region.List all Jobs for a project within a region.List all Jobs for a project within a region.listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.List all ResourceAllowances for a project within a region.listResourceAllowances(LocationName parent) List all ResourceAllowances for a project within a region.listResourceAllowances(String parent) List all ResourceAllowances for a project within a region.List all ResourceAllowances for a project within a region.final UnaryCallable<ListResourceAllowancesRequest,BatchServiceClient.ListResourceAllowancesPagedResponse> List all ResourceAllowances for a project within a region.listTasks(ListTasksRequest request) List Tasks associated with a job.listTasks(TaskGroupName parent) List Tasks associated with a job.List Tasks associated with a job.List Tasks associated with a job.List Tasks associated with a job.voidshutdown()voidfinal JobUpdate a Job.final JobupdateJob(UpdateJobRequest request) Update a Job.final UnaryCallable<UpdateJobRequest,Job> Update a Job.final ResourceAllowanceupdateResourceAllowance(ResourceAllowance resourceAllowance, com.google.protobuf.FieldMask updateMask) Update a Resource Allowance.final ResourceAllowanceUpdate a Resource Allowance.Update a Resource Allowance.
-
Constructor Details
-
BatchServiceClient
Constructs an instance of BatchServiceClient, 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
-
BatchServiceClient
-
-
Method Details
-
create
Constructs an instance of BatchServiceClient with default settings.- Throws:
IOException
-
create
Constructs an instance of BatchServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of BatchServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(BatchServiceSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
getHttpJsonOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
createJob
Create a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Job job = Job.newBuilder().build(); String jobId = "jobId101296568"; Job response = batchServiceClient.createJob(parent, job, jobId); }- Parameters:
parent- Required. The parent resource name where the Job will be created. Pattern: "projects/{project}/locations/{location}"job- Required. The Job to create.jobId- ID used to uniquely identify the Job within its parent scope. This field should contain at most 63 characters and must start with lowercase characters. Only lowercase characters, numbers and '-' are accepted. The '-' character cannot be the first or the last one. A system generated ID will be used if the field is not set.The job.name field in the request will be ignored and the created resource name of the Job will be "{parent}/jobs/{job_id}".
- Throws:
ApiException- if the remote call fails
-
createJob
Create a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Job job = Job.newBuilder().build(); String jobId = "jobId101296568"; Job response = batchServiceClient.createJob(parent, job, jobId); }- Parameters:
parent- Required. The parent resource name where the Job will be created. Pattern: "projects/{project}/locations/{location}"job- Required. The Job to create.jobId- ID used to uniquely identify the Job within its parent scope. This field should contain at most 63 characters and must start with lowercase characters. Only lowercase characters, numbers and '-' are accepted. The '-' character cannot be the first or the last one. A system generated ID will be used if the field is not set.The job.name field in the request will be ignored and the created resource name of the Job will be "{parent}/jobs/{job_id}".
- Throws:
ApiException- if the remote call fails
-
createJob
Create a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { CreateJobRequest request = CreateJobRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setJobId("jobId101296568") .setJob(Job.newBuilder().build()) .setRequestId("requestId693933066") .build(); Job response = batchServiceClient.createJob(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createJobCallable
Create a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { CreateJobRequest request = CreateJobRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setJobId("jobId101296568") .setJob(Job.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Job> future = batchServiceClient.createJobCallable().futureCall(request); // Do something. Job response = future.get(); } -
getJob
Get a Job specified by its resource name.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); Job response = batchServiceClient.getJob(name); }- Parameters:
name- Required. Job name.- Throws:
ApiException- if the remote call fails
-
getJob
Get a Job specified by its resource name.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString(); Job response = batchServiceClient.getJob(name); }- Parameters:
name- Required. Job name.- Throws:
ApiException- if the remote call fails
-
getJob
Get a Job specified by its resource name.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { GetJobRequest request = GetJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .build(); Job response = batchServiceClient.getJob(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getJobCallable
Get a Job specified by its resource name.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { GetJobRequest request = GetJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .build(); ApiFuture<Job> future = batchServiceClient.getJobCallable().futureCall(request); // Do something. Job response = future.get(); } -
deleteJobAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteJobAsync(String name) Delete a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { String name = "name3373707"; batchServiceClient.deleteJobAsync(name).get(); }- Parameters:
name- Job name.- Throws:
ApiException- if the remote call fails
-
deleteJobAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteJobAsync(DeleteJobRequest request) Delete a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { DeleteJobRequest request = DeleteJobRequest.newBuilder() .setName("name3373707") .setReason("reason-934964668") .setRequestId("requestId693933066") .build(); batchServiceClient.deleteJobAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteJobOperationCallable
public final OperationCallable<DeleteJobRequest,com.google.protobuf.Empty, deleteJobOperationCallable()OperationMetadata> Delete a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { DeleteJobRequest request = DeleteJobRequest.newBuilder() .setName("name3373707") .setReason("reason-934964668") .setRequestId("requestId693933066") .build(); OperationFuture<Empty, OperationMetadata> future = batchServiceClient.deleteJobOperationCallable().futureCall(request); // Do something. future.get(); } -
deleteJobCallable
Delete a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { DeleteJobRequest request = DeleteJobRequest.newBuilder() .setName("name3373707") .setReason("reason-934964668") .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = batchServiceClient.deleteJobCallable().futureCall(request); // Do something. future.get(); } -
cancelJobAsync
Cancel a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); CancelJobResponse response = batchServiceClient.cancelJobAsync(name).get(); }- Parameters:
name- Required. Job name.- Throws:
ApiException- if the remote call fails
-
cancelJobAsync
Cancel a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString(); CancelJobResponse response = batchServiceClient.cancelJobAsync(name).get(); }- Parameters:
name- Required. Job name.- Throws:
ApiException- if the remote call fails
-
cancelJobAsync
public final OperationFuture<CancelJobResponse,OperationMetadata> cancelJobAsync(CancelJobRequest request) Cancel a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { CancelJobRequest request = CancelJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setRequestId("requestId693933066") .build(); CancelJobResponse response = batchServiceClient.cancelJobAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
cancelJobOperationCallable
public final OperationCallable<CancelJobRequest,CancelJobResponse, cancelJobOperationCallable()OperationMetadata> Cancel a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { CancelJobRequest request = CancelJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setRequestId("requestId693933066") .build(); OperationFuture<CancelJobResponse, OperationMetadata> future = batchServiceClient.cancelJobOperationCallable().futureCall(request); // Do something. CancelJobResponse response = future.get(); } -
cancelJobCallable
Cancel a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { CancelJobRequest request = CancelJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = batchServiceClient.cancelJobCallable().futureCall(request); // Do something. Operation response = future.get(); } -
updateJob
Update a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { Job job = Job.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Job response = batchServiceClient.updateJob(job, updateMask); }- Parameters:
job- Required. The Job to update. Only fields specified in `updateMask` are updated.updateMask- Required. Mask of fields to update.The `jobs.patch` method can only be used while a job is in the `QUEUED`, `SCHEDULED`, or `RUNNING` state and currently only supports increasing the value of the first `taskCount` field in the job's `taskGroups` field. Therefore, you must set the value of `updateMask` to `taskGroups`. Any other job fields in the update request will be ignored.
For example, to update a job's `taskCount` to `2`, set `updateMask` to `taskGroups` and use the following request body: ``` { "taskGroups":[{ "taskCount": 2 }] } ```
- Throws:
ApiException- if the remote call fails
-
updateJob
Update a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { UpdateJobRequest request = UpdateJobRequest.newBuilder() .setJob(Job.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setRequestId("requestId693933066") .build(); Job response = batchServiceClient.updateJob(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateJobCallable
Update a Job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { UpdateJobRequest request = UpdateJobRequest.newBuilder() .setJob(Job.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Job> future = batchServiceClient.updateJobCallable().futureCall(request); // Do something. Job response = future.get(); } -
listJobs
List all Jobs for a project within a region.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { String parent = "parent-995424086"; for (Job element : batchServiceClient.listJobs(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Parent path.- Throws:
ApiException- if the remote call fails
-
listJobs
List all Jobs for a project within a region.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListJobsRequest request = ListJobsRequest.newBuilder() .setParent("parent-995424086") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Job element : batchServiceClient.listJobs(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listJobsPagedCallable
public final UnaryCallable<ListJobsRequest,BatchServiceClient.ListJobsPagedResponse> listJobsPagedCallable()List all Jobs for a project within a region.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListJobsRequest request = ListJobsRequest.newBuilder() .setParent("parent-995424086") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Job> future = batchServiceClient.listJobsPagedCallable().futureCall(request); // Do something. for (Job element : future.get().iterateAll()) { // doThingsWith(element); } } -
listJobsCallable
List all Jobs for a project within a region.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListJobsRequest request = ListJobsRequest.newBuilder() .setParent("parent-995424086") .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListJobsResponse response = batchServiceClient.listJobsCallable().call(request); for (Job element : response.getJobsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getTask
Return a single Task.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]", "[TASK]"); Task response = batchServiceClient.getTask(name); }- Parameters:
name- Required. Task name.- Throws:
ApiException- if the remote call fails
-
getTask
Return a single Task.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { String name = TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]", "[TASK]").toString(); Task response = batchServiceClient.getTask(name); }- Parameters:
name- Required. Task name.- Throws:
ApiException- if the remote call fails
-
getTask
Return a single Task.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { GetTaskRequest request = GetTaskRequest.newBuilder() .setName( TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]", "[TASK]") .toString()) .build(); Task response = batchServiceClient.getTask(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getTaskCallable
Return a single Task.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { GetTaskRequest request = GetTaskRequest.newBuilder() .setName( TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]", "[TASK]") .toString()) .build(); ApiFuture<Task> future = batchServiceClient.getTaskCallable().futureCall(request); // Do something. Task response = future.get(); } -
listTasks
List Tasks associated with a job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { TaskGroupName parent = TaskGroupName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]"); for (Task element : batchServiceClient.listTasks(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Name of a TaskGroup from which Tasks are being requested. Pattern: "projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}"- Throws:
ApiException- if the remote call fails
-
listTasks
List Tasks associated with a job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { String parent = TaskGroupName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]").toString(); for (Task element : batchServiceClient.listTasks(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Name of a TaskGroup from which Tasks are being requested. Pattern: "projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}"- Throws:
ApiException- if the remote call fails
-
listTasks
List Tasks associated with a job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListTasksRequest request = ListTasksRequest.newBuilder() .setParent( TaskGroupName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]").toString()) .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Task element : batchServiceClient.listTasks(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listTasksPagedCallable
public final UnaryCallable<ListTasksRequest,BatchServiceClient.ListTasksPagedResponse> listTasksPagedCallable()List Tasks associated with a job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListTasksRequest request = ListTasksRequest.newBuilder() .setParent( TaskGroupName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]").toString()) .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Task> future = batchServiceClient.listTasksPagedCallable().futureCall(request); // Do something. for (Task element : future.get().iterateAll()) { // doThingsWith(element); } } -
listTasksCallable
List Tasks associated with a job.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListTasksRequest request = ListTasksRequest.newBuilder() .setParent( TaskGroupName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]").toString()) .setFilter("filter-1274492040") .setOrderBy("orderBy-1207110587") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListTasksResponse response = batchServiceClient.listTasksCallable().call(request); for (Task element : response.getTasksList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
createResourceAllowance
public final ResourceAllowance createResourceAllowance(LocationName parent, ResourceAllowance resourceAllowance, String resourceAllowanceId) Create a Resource Allowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build(); String resourceAllowanceId = "resourceAllowanceId-786470299"; ResourceAllowance response = batchServiceClient.createResourceAllowance( parent, resourceAllowance, resourceAllowanceId); }- Parameters:
parent- Required. The parent resource name where the ResourceAllowance will be created. Pattern: "projects/{project}/locations/{location}"resourceAllowance- Required. The ResourceAllowance to create.resourceAllowanceId- ID used to uniquely identify the ResourceAllowance within its parent scope. This field should contain at most 63 characters and must start with lowercase characters. Only lowercase characters, numbers and '-' are accepted. The '-' character cannot be the first or the last one. A system generated ID will be used if the field is not set.The resource_allowance.name field in the request will be ignored and the created resource name of the ResourceAllowance will be "{parent}/resourceAllowances/{resource_allowance_id}".
- Throws:
ApiException- if the remote call fails
-
createResourceAllowance
public final ResourceAllowance createResourceAllowance(String parent, ResourceAllowance resourceAllowance, String resourceAllowanceId) Create a Resource Allowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build(); String resourceAllowanceId = "resourceAllowanceId-786470299"; ResourceAllowance response = batchServiceClient.createResourceAllowance( parent, resourceAllowance, resourceAllowanceId); }- Parameters:
parent- Required. The parent resource name where the ResourceAllowance will be created. Pattern: "projects/{project}/locations/{location}"resourceAllowance- Required. The ResourceAllowance to create.resourceAllowanceId- ID used to uniquely identify the ResourceAllowance within its parent scope. This field should contain at most 63 characters and must start with lowercase characters. Only lowercase characters, numbers and '-' are accepted. The '-' character cannot be the first or the last one. A system generated ID will be used if the field is not set.The resource_allowance.name field in the request will be ignored and the created resource name of the ResourceAllowance will be "{parent}/resourceAllowances/{resource_allowance_id}".
- Throws:
ApiException- if the remote call fails
-
createResourceAllowance
Create a Resource Allowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { CreateResourceAllowanceRequest request = CreateResourceAllowanceRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setResourceAllowanceId("resourceAllowanceId-786470299") .setResourceAllowance(ResourceAllowance.newBuilder().build()) .setRequestId("requestId693933066") .build(); ResourceAllowance response = batchServiceClient.createResourceAllowance(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createResourceAllowanceCallable
public final UnaryCallable<CreateResourceAllowanceRequest,ResourceAllowance> createResourceAllowanceCallable()Create a Resource Allowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { CreateResourceAllowanceRequest request = CreateResourceAllowanceRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setResourceAllowanceId("resourceAllowanceId-786470299") .setResourceAllowance(ResourceAllowance.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<ResourceAllowance> future = batchServiceClient.createResourceAllowanceCallable().futureCall(request); // Do something. ResourceAllowance response = future.get(); } -
getResourceAllowance
Get a ResourceAllowance specified by its resource name.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ResourceAllowanceName name = ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]"); ResourceAllowance response = batchServiceClient.getResourceAllowance(name); }- Parameters:
name- Required. ResourceAllowance name.- Throws:
ApiException- if the remote call fails
-
getResourceAllowance
Get a ResourceAllowance specified by its resource name.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { String name = ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]").toString(); ResourceAllowance response = batchServiceClient.getResourceAllowance(name); }- Parameters:
name- Required. ResourceAllowance name.- Throws:
ApiException- if the remote call fails
-
getResourceAllowance
Get a ResourceAllowance specified by its resource name.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { GetResourceAllowanceRequest request = GetResourceAllowanceRequest.newBuilder() .setName( ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]") .toString()) .build(); ResourceAllowance response = batchServiceClient.getResourceAllowance(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getResourceAllowanceCallable
public final UnaryCallable<GetResourceAllowanceRequest,ResourceAllowance> getResourceAllowanceCallable()Get a ResourceAllowance specified by its resource name.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { GetResourceAllowanceRequest request = GetResourceAllowanceRequest.newBuilder() .setName( ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]") .toString()) .build(); ApiFuture<ResourceAllowance> future = batchServiceClient.getResourceAllowanceCallable().futureCall(request); // Do something. ResourceAllowance response = future.get(); } -
deleteResourceAllowanceAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteResourceAllowanceAsync(ResourceAllowanceName name) Delete a ResourceAllowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ResourceAllowanceName name = ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]"); batchServiceClient.deleteResourceAllowanceAsync(name).get(); }- Parameters:
name- Required. ResourceAllowance name.- Throws:
ApiException- if the remote call fails
-
deleteResourceAllowanceAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteResourceAllowanceAsync(String name) Delete a ResourceAllowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { String name = ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]").toString(); batchServiceClient.deleteResourceAllowanceAsync(name).get(); }- Parameters:
name- Required. ResourceAllowance name.- Throws:
ApiException- if the remote call fails
-
deleteResourceAllowanceAsync
public final OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteResourceAllowanceAsync(DeleteResourceAllowanceRequest request) Delete a ResourceAllowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { DeleteResourceAllowanceRequest request = DeleteResourceAllowanceRequest.newBuilder() .setName( ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]") .toString()) .setReason("reason-934964668") .setRequestId("requestId693933066") .build(); batchServiceClient.deleteResourceAllowanceAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteResourceAllowanceOperationCallable
public final OperationCallable<DeleteResourceAllowanceRequest,com.google.protobuf.Empty, deleteResourceAllowanceOperationCallable()OperationMetadata> Delete a ResourceAllowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { DeleteResourceAllowanceRequest request = DeleteResourceAllowanceRequest.newBuilder() .setName( ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]") .toString()) .setReason("reason-934964668") .setRequestId("requestId693933066") .build(); OperationFuture<Empty, OperationMetadata> future = batchServiceClient.deleteResourceAllowanceOperationCallable().futureCall(request); // Do something. future.get(); } -
deleteResourceAllowanceCallable
public final UnaryCallable<DeleteResourceAllowanceRequest,Operation> deleteResourceAllowanceCallable()Delete a ResourceAllowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { DeleteResourceAllowanceRequest request = DeleteResourceAllowanceRequest.newBuilder() .setName( ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]") .toString()) .setReason("reason-934964668") .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = batchServiceClient.deleteResourceAllowanceCallable().futureCall(request); // Do something. future.get(); } -
listResourceAllowances
public final BatchServiceClient.ListResourceAllowancesPagedResponse listResourceAllowances(LocationName parent) List all ResourceAllowances for a project within a region.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (ResourceAllowance element : batchServiceClient.listResourceAllowances(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Parent path.- Throws:
ApiException- if the remote call fails
-
listResourceAllowances
public final BatchServiceClient.ListResourceAllowancesPagedResponse listResourceAllowances(String parent) List all ResourceAllowances for a project within a region.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (ResourceAllowance element : batchServiceClient.listResourceAllowances(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Parent path.- Throws:
ApiException- if the remote call fails
-
listResourceAllowances
public final BatchServiceClient.ListResourceAllowancesPagedResponse listResourceAllowances(ListResourceAllowancesRequest request) List all ResourceAllowances for a project within a region.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListResourceAllowancesRequest request = ListResourceAllowancesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (ResourceAllowance element : batchServiceClient.listResourceAllowances(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listResourceAllowancesPagedCallable
public final UnaryCallable<ListResourceAllowancesRequest,BatchServiceClient.ListResourceAllowancesPagedResponse> listResourceAllowancesPagedCallable()List all ResourceAllowances for a project within a region.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListResourceAllowancesRequest request = ListResourceAllowancesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<ResourceAllowance> future = batchServiceClient.listResourceAllowancesPagedCallable().futureCall(request); // Do something. for (ResourceAllowance element : future.get().iterateAll()) { // doThingsWith(element); } } -
listResourceAllowancesCallable
public final UnaryCallable<ListResourceAllowancesRequest,ListResourceAllowancesResponse> listResourceAllowancesCallable()List all ResourceAllowances for a project within a region.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListResourceAllowancesRequest request = ListResourceAllowancesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListResourceAllowancesResponse response = batchServiceClient.listResourceAllowancesCallable().call(request); for (ResourceAllowance element : response.getResourceAllowancesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
updateResourceAllowance
public final ResourceAllowance updateResourceAllowance(ResourceAllowance resourceAllowance, com.google.protobuf.FieldMask updateMask) Update a Resource Allowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); ResourceAllowance response = batchServiceClient.updateResourceAllowance(resourceAllowance, updateMask); }- Parameters:
resourceAllowance- Required. The ResourceAllowance to update. Update description. Only fields specified in `update_mask` are updated.updateMask- Required. Mask of fields to update.Field mask is used to specify the fields to be overwritten in the ResourceAllowance resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.
UpdateResourceAllowance request now only supports update on `limit` field.
- Throws:
ApiException- if the remote call fails
-
updateResourceAllowance
Update a Resource Allowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { UpdateResourceAllowanceRequest request = UpdateResourceAllowanceRequest.newBuilder() .setResourceAllowance(ResourceAllowance.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setRequestId("requestId693933066") .build(); ResourceAllowance response = batchServiceClient.updateResourceAllowance(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateResourceAllowanceCallable
public final UnaryCallable<UpdateResourceAllowanceRequest,ResourceAllowance> updateResourceAllowanceCallable()Update a Resource Allowance.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { UpdateResourceAllowanceRequest request = UpdateResourceAllowanceRequest.newBuilder() .setResourceAllowance(ResourceAllowance.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<ResourceAllowance> future = batchServiceClient.updateResourceAllowanceCallable().futureCall(request); // Do something. ResourceAllowance response = future.get(); } -
listLocations
public final BatchServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Location element : batchServiceClient.listLocations(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listLocationsPagedCallable
public final UnaryCallable<ListLocationsRequest,BatchServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()Lists information about the supported locations for this service.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Location> future = batchServiceClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } } -
listLocationsCallable
Lists information about the supported locations for this service.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListLocationsResponse response = batchServiceClient.listLocationsCallable().call(request); for (Location element : response.getLocationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getLocation
Gets information about a location.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = batchServiceClient.getLocation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getLocationCallable
Gets information about a location.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 (BatchServiceClient batchServiceClient = BatchServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = batchServiceClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-