Class JobsClient
- java.lang.Object
-
- com.google.cloud.run.v2.JobsClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class JobsClient extends Object implements com.google.api.gax.core.BackgroundResource
Service Description: Cloud Run Job Control Plane API.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 (JobsClient jobsClient = JobsClient.create()) { JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); Job response = jobsClient.getJob(name); }
Note: close() needs to be called on the JobsClient 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 JobsSettings 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 JobsSettings jobsSettings = JobsSettings.newBuilder() .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .build(); JobsClient jobsClient = JobsClient.create(jobsSettings);
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 JobsSettings jobsSettings = JobsSettings.newBuilder().setEndpoint(myEndpoint).build(); JobsClient jobsClient = JobsClient.create(jobsSettings);
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 JobsSettings jobsSettings = JobsSettings.newHttpJsonBuilder().build(); JobsClient jobsClient = JobsClient.create(jobsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JobsClient.ListJobsFixedSizeCollection
static class
JobsClient.ListJobsPage
static class
JobsClient.ListJobsPagedResponse
-
Constructor Summary
Constructors Modifier Constructor Description protected
JobsClient(JobsSettings settings)
Constructs an instance of JobsClient, using the given settings.protected
JobsClient(JobsStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static JobsClient
create()
Constructs an instance of JobsClient with default settings.static JobsClient
create(JobsSettings settings)
Constructs an instance of JobsClient, using the given settings.static JobsClient
create(JobsStub stub)
Constructs an instance of JobsClient, using the given stub for making calls.com.google.api.gax.longrunning.OperationFuture<Job,Job>
createJobAsync(CreateJobRequest request)
Creates a Job.com.google.api.gax.longrunning.OperationFuture<Job,Job>
createJobAsync(LocationName parent, Job job, String jobId)
Creates a Job.com.google.api.gax.longrunning.OperationFuture<Job,Job>
createJobAsync(String parent, Job job, String jobId)
Creates a Job.com.google.api.gax.rpc.UnaryCallable<CreateJobRequest,com.google.longrunning.Operation>
createJobCallable()
Creates a Job.com.google.api.gax.rpc.OperationCallable<CreateJobRequest,Job,Job>
createJobOperationCallable()
Creates a Job.com.google.api.gax.longrunning.OperationFuture<Job,Job>
deleteJobAsync(DeleteJobRequest request)
Deletes a Job.com.google.api.gax.longrunning.OperationFuture<Job,Job>
deleteJobAsync(JobName name)
Deletes a Job.com.google.api.gax.longrunning.OperationFuture<Job,Job>
deleteJobAsync(String name)
Deletes a Job.com.google.api.gax.rpc.UnaryCallable<DeleteJobRequest,com.google.longrunning.Operation>
deleteJobCallable()
Deletes a Job.com.google.api.gax.rpc.OperationCallable<DeleteJobRequest,Job,Job>
deleteJobOperationCallable()
Deletes a Job.com.google.api.gax.httpjson.longrunning.OperationsClient
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.com.google.iam.v1.Policy
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the IAM Access Control policy currently in effect for the given Job.com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy>
getIamPolicyCallable()
Gets the IAM Access Control policy currently in effect for the given Job.Job
getJob(GetJobRequest request)
Gets information about a Job.Job
getJob(JobName name)
Gets information about a Job.Job
getJob(String name)
Gets information about a Job.com.google.api.gax.rpc.UnaryCallable<GetJobRequest,Job>
getJobCallable()
Gets information about a Job.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.JobsSettings
getSettings()
JobsStub
getStub()
boolean
isShutdown()
boolean
isTerminated()
JobsClient.ListJobsPagedResponse
listJobs(ListJobsRequest request)
Lists Jobs.JobsClient.ListJobsPagedResponse
listJobs(LocationName parent)
Lists Jobs.JobsClient.ListJobsPagedResponse
listJobs(String parent)
Lists Jobs.com.google.api.gax.rpc.UnaryCallable<ListJobsRequest,ListJobsResponse>
listJobsCallable()
Lists Jobs.com.google.api.gax.rpc.UnaryCallable<ListJobsRequest,JobsClient.ListJobsPagedResponse>
listJobsPagedCallable()
Lists Jobs.com.google.api.gax.longrunning.OperationFuture<Execution,Execution>
runJobAsync(JobName name)
Triggers creation of a new Execution of this Job.com.google.api.gax.longrunning.OperationFuture<Execution,Execution>
runJobAsync(RunJobRequest request)
Triggers creation of a new Execution of this Job.com.google.api.gax.longrunning.OperationFuture<Execution,Execution>
runJobAsync(String name)
Triggers creation of a new Execution of this Job.com.google.api.gax.rpc.UnaryCallable<RunJobRequest,com.google.longrunning.Operation>
runJobCallable()
Triggers creation of a new Execution of this Job.com.google.api.gax.rpc.OperationCallable<RunJobRequest,Execution,Execution>
runJobOperationCallable()
Triggers creation of a new Execution of this Job.com.google.iam.v1.Policy
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the IAM Access control policy for the specified Job.com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy>
setIamPolicyCallable()
Sets the IAM Access control policy for the specified Job.void
shutdown()
void
shutdownNow()
com.google.iam.v1.TestIamPermissionsResponse
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified Project.com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse>
testIamPermissionsCallable()
Returns permissions that a caller has on the specified Project.com.google.api.gax.longrunning.OperationFuture<Job,Job>
updateJobAsync(Job job)
Updates a Job.com.google.api.gax.longrunning.OperationFuture<Job,Job>
updateJobAsync(UpdateJobRequest request)
Updates a Job.com.google.api.gax.rpc.UnaryCallable<UpdateJobRequest,com.google.longrunning.Operation>
updateJobCallable()
Updates a Job.com.google.api.gax.rpc.OperationCallable<UpdateJobRequest,Job,Job>
updateJobOperationCallable()
Updates a Job.
-
-
-
Constructor Detail
-
JobsClient
protected JobsClient(JobsSettings settings) throws IOException
Constructs an instance of JobsClient, 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
-
JobsClient
protected JobsClient(JobsStub stub)
-
-
Method Detail
-
create
public static final JobsClient create() throws IOException
Constructs an instance of JobsClient with default settings.- Throws:
IOException
-
create
public static final JobsClient create(JobsSettings settings) throws IOException
Constructs an instance of JobsClient, 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
public static final JobsClient create(JobsStub stub)
Constructs an instance of JobsClient, using the given stub for making calls. This is for advanced usage - prefer using create(JobsSettings).
-
getSettings
public final JobsSettings getSettings()
-
getStub
public JobsStub 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.
-
getHttpJsonOperationsClient
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
-
createJobAsync
public final com.google.api.gax.longrunning.OperationFuture<Job,Job> createJobAsync(LocationName parent, Job job, String jobId)
Creates 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 (JobsClient jobsClient = JobsClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Job job = Job.newBuilder().build(); String jobId = "jobId101296568"; Job response = jobsClient.createJobAsync(parent, job, jobId).get(); }
- Parameters:
parent
- Required. The location and project in which this Job should be created. Format: projects/{project}/locations/{location}, where {project} can be project id or number.job
- Required. The Job instance to create.jobId
- Required. The unique identifier for the Job. The name of the job becomes {parent}/jobs/{job_id}.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createJobAsync
public final com.google.api.gax.longrunning.OperationFuture<Job,Job> createJobAsync(String parent, Job job, String jobId)
Creates 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 (JobsClient jobsClient = JobsClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Job job = Job.newBuilder().build(); String jobId = "jobId101296568"; Job response = jobsClient.createJobAsync(parent, job, jobId).get(); }
- Parameters:
parent
- Required. The location and project in which this Job should be created. Format: projects/{project}/locations/{location}, where {project} can be project id or number.job
- Required. The Job instance to create.jobId
- Required. The unique identifier for the Job. The name of the job becomes {parent}/jobs/{job_id}.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createJobAsync
public final com.google.api.gax.longrunning.OperationFuture<Job,Job> createJobAsync(CreateJobRequest request)
Creates 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 (JobsClient jobsClient = JobsClient.create()) { CreateJobRequest request = CreateJobRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setJob(Job.newBuilder().build()) .setJobId("jobId101296568") .setValidateOnly(true) .build(); Job response = jobsClient.createJobAsync(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
-
createJobOperationCallable
public final com.google.api.gax.rpc.OperationCallable<CreateJobRequest,Job,Job> createJobOperationCallable()
Creates 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 (JobsClient jobsClient = JobsClient.create()) { CreateJobRequest request = CreateJobRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setJob(Job.newBuilder().build()) .setJobId("jobId101296568") .setValidateOnly(true) .build(); OperationFuture<Job, Job> future = jobsClient.createJobOperationCallable().futureCall(request); // Do something. Job response = future.get(); }
-
createJobCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateJobRequest,com.google.longrunning.Operation> createJobCallable()
Creates 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 (JobsClient jobsClient = JobsClient.create()) { CreateJobRequest request = CreateJobRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setJob(Job.newBuilder().build()) .setJobId("jobId101296568") .setValidateOnly(true) .build(); ApiFuture<Operation> future = jobsClient.createJobCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
getJob
public final Job getJob(JobName name)
Gets information about 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 (JobsClient jobsClient = JobsClient.create()) { JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); Job response = jobsClient.getJob(name); }
- Parameters:
name
- Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getJob
public final Job getJob(String name)
Gets information about 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 (JobsClient jobsClient = JobsClient.create()) { String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString(); Job response = jobsClient.getJob(name); }
- Parameters:
name
- Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getJob
public final Job getJob(GetJobRequest request)
Gets information about 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 (JobsClient jobsClient = JobsClient.create()) { GetJobRequest request = GetJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .build(); Job response = jobsClient.getJob(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
-
getJobCallable
public final com.google.api.gax.rpc.UnaryCallable<GetJobRequest,Job> getJobCallable()
Gets information about 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 (JobsClient jobsClient = JobsClient.create()) { GetJobRequest request = GetJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .build(); ApiFuture<Job> future = jobsClient.getJobCallable().futureCall(request); // Do something. Job response = future.get(); }
-
listJobs
public final JobsClient.ListJobsPagedResponse listJobs(LocationName parent)
Lists Jobs.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 (JobsClient jobsClient = JobsClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Job element : jobsClient.listJobs(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The location and project to list resources on. Format: projects/{project}/locations/{location}, where {project} can be project id or number.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listJobs
public final JobsClient.ListJobsPagedResponse listJobs(String parent)
Lists Jobs.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 (JobsClient jobsClient = JobsClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Job element : jobsClient.listJobs(parent).iterateAll()) { // doThingsWith(element); } }
- Parameters:
parent
- Required. The location and project to list resources on. Format: projects/{project}/locations/{location}, where {project} can be project id or number.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listJobs
public final JobsClient.ListJobsPagedResponse listJobs(ListJobsRequest request)
Lists Jobs.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 (JobsClient jobsClient = JobsClient.create()) { ListJobsRequest request = ListJobsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setShowDeleted(true) .build(); for (Job element : jobsClient.listJobs(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
-
listJobsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListJobsRequest,JobsClient.ListJobsPagedResponse> listJobsPagedCallable()
Lists Jobs.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 (JobsClient jobsClient = JobsClient.create()) { ListJobsRequest request = ListJobsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setShowDeleted(true) .build(); ApiFuture<Job> future = jobsClient.listJobsPagedCallable().futureCall(request); // Do something. for (Job element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listJobsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListJobsRequest,ListJobsResponse> listJobsCallable()
Lists Jobs.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 (JobsClient jobsClient = JobsClient.create()) { ListJobsRequest request = ListJobsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setShowDeleted(true) .build(); while (true) { ListJobsResponse response = jobsClient.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; } } }
-
updateJobAsync
public final com.google.api.gax.longrunning.OperationFuture<Job,Job> updateJobAsync(Job job)
Updates 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 (JobsClient jobsClient = JobsClient.create()) { Job job = Job.newBuilder().build(); Job response = jobsClient.updateJobAsync(job).get(); }
- Parameters:
job
- Required. The Job to be updated.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateJobAsync
public final com.google.api.gax.longrunning.OperationFuture<Job,Job> updateJobAsync(UpdateJobRequest request)
Updates 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 (JobsClient jobsClient = JobsClient.create()) { UpdateJobRequest request = UpdateJobRequest.newBuilder() .setJob(Job.newBuilder().build()) .setValidateOnly(true) .setAllowMissing(true) .build(); Job response = jobsClient.updateJobAsync(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
-
updateJobOperationCallable
public final com.google.api.gax.rpc.OperationCallable<UpdateJobRequest,Job,Job> updateJobOperationCallable()
Updates 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 (JobsClient jobsClient = JobsClient.create()) { UpdateJobRequest request = UpdateJobRequest.newBuilder() .setJob(Job.newBuilder().build()) .setValidateOnly(true) .setAllowMissing(true) .build(); OperationFuture<Job, Job> future = jobsClient.updateJobOperationCallable().futureCall(request); // Do something. Job response = future.get(); }
-
updateJobCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateJobRequest,com.google.longrunning.Operation> updateJobCallable()
Updates 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 (JobsClient jobsClient = JobsClient.create()) { UpdateJobRequest request = UpdateJobRequest.newBuilder() .setJob(Job.newBuilder().build()) .setValidateOnly(true) .setAllowMissing(true) .build(); ApiFuture<Operation> future = jobsClient.updateJobCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
deleteJobAsync
public final com.google.api.gax.longrunning.OperationFuture<Job,Job> deleteJobAsync(JobName name)
Deletes 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 (JobsClient jobsClient = JobsClient.create()) { JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); Job response = jobsClient.deleteJobAsync(name).get(); }
- Parameters:
name
- Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteJobAsync
public final com.google.api.gax.longrunning.OperationFuture<Job,Job> deleteJobAsync(String name)
Deletes 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 (JobsClient jobsClient = JobsClient.create()) { String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString(); Job response = jobsClient.deleteJobAsync(name).get(); }
- Parameters:
name
- Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteJobAsync
public final com.google.api.gax.longrunning.OperationFuture<Job,Job> deleteJobAsync(DeleteJobRequest request)
Deletes 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 (JobsClient jobsClient = JobsClient.create()) { DeleteJobRequest request = DeleteJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setValidateOnly(true) .setEtag("etag3123477") .build(); Job response = jobsClient.deleteJobAsync(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
-
deleteJobOperationCallable
public final com.google.api.gax.rpc.OperationCallable<DeleteJobRequest,Job,Job> deleteJobOperationCallable()
Deletes 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 (JobsClient jobsClient = JobsClient.create()) { DeleteJobRequest request = DeleteJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setValidateOnly(true) .setEtag("etag3123477") .build(); OperationFuture<Job, Job> future = jobsClient.deleteJobOperationCallable().futureCall(request); // Do something. Job response = future.get(); }
-
deleteJobCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteJobRequest,com.google.longrunning.Operation> deleteJobCallable()
Deletes 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 (JobsClient jobsClient = JobsClient.create()) { DeleteJobRequest request = DeleteJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setValidateOnly(true) .setEtag("etag3123477") .build(); ApiFuture<Operation> future = jobsClient.deleteJobCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
runJobAsync
public final com.google.api.gax.longrunning.OperationFuture<Execution,Execution> runJobAsync(JobName name)
Triggers creation of a new Execution of this 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 (JobsClient jobsClient = JobsClient.create()) { JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]"); Execution response = jobsClient.runJobAsync(name).get(); }
- Parameters:
name
- Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
runJobAsync
public final com.google.api.gax.longrunning.OperationFuture<Execution,Execution> runJobAsync(String name)
Triggers creation of a new Execution of this 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 (JobsClient jobsClient = JobsClient.create()) { String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString(); Execution response = jobsClient.runJobAsync(name).get(); }
- Parameters:
name
- Required. The full name of the Job. Format: projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or number.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
runJobAsync
public final com.google.api.gax.longrunning.OperationFuture<Execution,Execution> runJobAsync(RunJobRequest request)
Triggers creation of a new Execution of this 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 (JobsClient jobsClient = JobsClient.create()) { RunJobRequest request = RunJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setValidateOnly(true) .setEtag("etag3123477") .build(); Execution response = jobsClient.runJobAsync(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
-
runJobOperationCallable
public final com.google.api.gax.rpc.OperationCallable<RunJobRequest,Execution,Execution> runJobOperationCallable()
Triggers creation of a new Execution of this 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 (JobsClient jobsClient = JobsClient.create()) { RunJobRequest request = RunJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setValidateOnly(true) .setEtag("etag3123477") .build(); OperationFuture<Execution, Execution> future = jobsClient.runJobOperationCallable().futureCall(request); // Do something. Execution response = future.get(); }
-
runJobCallable
public final com.google.api.gax.rpc.UnaryCallable<RunJobRequest,com.google.longrunning.Operation> runJobCallable()
Triggers creation of a new Execution of this 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 (JobsClient jobsClient = JobsClient.create()) { RunJobRequest request = RunJobRequest.newBuilder() .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setValidateOnly(true) .setEtag("etag3123477") .build(); ApiFuture<Operation> future = jobsClient.runJobCallable().futureCall(request); // Do something. Operation response = future.get(); }
-
getIamPolicy
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the IAM Access Control policy currently in effect for the given Job. This result does not include any inherited policies.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 (JobsClient jobsClient = JobsClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); Policy response = jobsClient.getIamPolicy(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
-
getIamPolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
Gets the IAM Access Control policy currently in effect for the given Job. This result does not include any inherited policies.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 (JobsClient jobsClient = JobsClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); ApiFuture<Policy> future = jobsClient.getIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); }
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the IAM Access control policy for the specified Job. Overwrites any existing policy.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 (JobsClient jobsClient = JobsClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Policy response = jobsClient.setIamPolicy(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
-
setIamPolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
Sets the IAM Access control policy for the specified Job. Overwrites any existing policy.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 (JobsClient jobsClient = JobsClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Policy> future = jobsClient.setIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); }
-
testIamPermissions
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified Project.There are no permissions required for making this API call.
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 (JobsClient jobsClient = JobsClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .addAllPermissions(new ArrayList<String>()) .build(); TestIamPermissionsResponse response = jobsClient.testIamPermissions(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
-
testIamPermissionsCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
Returns permissions that a caller has on the specified Project.There are no permissions required for making this API call.
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 (JobsClient jobsClient = JobsClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) .addAllPermissions(new ArrayList<String>()) .build(); ApiFuture<TestIamPermissionsResponse> future = jobsClient.testIamPermissionsCallable().futureCall(request); // Do something. TestIamPermissionsResponse response = future.get(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-