Class JobControllerClient
- 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 (JobControllerClient jobControllerClient = JobControllerClient.create()) {
String projectId = "projectId-894832108";
String region = "region-934795532";
Job job = Job.newBuilder().build();
Job response = jobControllerClient.submitJob(projectId, region, job);
}
Note: close() needs to be called on the JobControllerClient 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 |
|---|---|---|
SubmitJob |
Submits a job to a cluster. |
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.
|
SubmitJobAsOperation |
Submits job to a cluster. |
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.
|
GetJob |
Gets the resource representation for a job in a project. |
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 |
Lists regions/{region}/jobs in a project. |
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.
|
UpdateJob |
Updates a job in a project. |
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.
|
CancelJob |
Starts a job cancellation request. To access the job resource after cancellation, call [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) or [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get). |
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 |
Deletes the job from the project. If the job is active, the delete fails, and the response returns `FAILED_PRECONDITION`. |
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.
|
SetIamPolicy |
Sets the access control policy on the specified resource. Replacesany existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
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.
|
GetIamPolicy |
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
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.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
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 JobControllerSettings 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
JobControllerSettings jobControllerSettings =
JobControllerSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
JobControllerClient jobControllerClient = JobControllerClient.create(jobControllerSettings);
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
JobControllerSettings jobControllerSettings =
JobControllerSettings.newBuilder().setEndpoint(myEndpoint).build();
JobControllerClient jobControllerClient = JobControllerClient.create(jobControllerSettings);
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
JobControllerSettings jobControllerSettings =
JobControllerSettings.newHttpJsonBuilder().build();
JobControllerClient jobControllerClient = JobControllerClient.create(jobControllerSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJobControllerClient(JobControllerSettings settings) Constructs an instance of JobControllerClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final JobcancelJob(CancelJobRequest request) Starts a job cancellation request.final JobStarts a job cancellation request.final UnaryCallable<CancelJobRequest,Job> Starts a job cancellation request.final voidclose()static final JobControllerClientcreate()Constructs an instance of JobControllerClient with default settings.static final JobControllerClientcreate(JobControllerSettings settings) Constructs an instance of JobControllerClient, using the given settings.static final JobControllerClientcreate(JobControllerStub stub) Constructs an instance of JobControllerClient, using the given stub for making calls.final voiddeleteJob(DeleteJobRequest request) Deletes the job from the project.final voidDeletes the job from the project.final UnaryCallable<DeleteJobRequest,com.google.protobuf.Empty> Deletes the job from the project.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final PolicygetIamPolicy(GetIamPolicyRequest request) Gets the access control policy for a resource.Gets the access control policy for a resource.final JobgetJob(GetJobRequest request) Gets the resource representation for a job in a project.final JobGets the resource representation for a job in a project.final UnaryCallable<GetJobRequest,Job> Gets the resource representation for a job in a project.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final JobControllerSettingsgetStub()booleanbooleanlistJobs(ListJobsRequest request) Lists regions/{region}/jobs in a project.Lists regions/{region}/jobs in a project.Lists regions/{region}/jobs in a project.Lists regions/{region}/jobs in a project.Lists regions/{region}/jobs in a project.final PolicysetIamPolicy(SetIamPolicyRequest request) Sets the access control policy on the specified resource.Sets the access control policy on the specified resource.voidshutdown()voidfinal JobsubmitJob(SubmitJobRequest request) Submits a job to a cluster.final JobSubmits a job to a cluster.final OperationFuture<Job,JobMetadata> Submits job to a cluster.final OperationFuture<Job,JobMetadata> submitJobAsOperationAsync(String projectId, String region, Job job) Submits job to a cluster.Submits job to a cluster.Submits job to a cluster.final UnaryCallable<SubmitJobRequest,Job> Submits a job to a cluster.Returns permissions that a caller has on the specified resource.Returns permissions that a caller has on the specified resource.final JobupdateJob(UpdateJobRequest request) Updates a job in a project.final UnaryCallable<UpdateJobRequest,Job> Updates a job in a project.
-
Constructor Details
-
JobControllerClient
Constructs an instance of JobControllerClient, 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
-
JobControllerClient
-
-
Method Details
-
create
Constructs an instance of JobControllerClient with default settings.- Throws:
IOException
-
create
Constructs an instance of JobControllerClient, 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 JobControllerClient, using the given stub for making calls. This is for advanced usage - prefer using create(JobControllerSettings). -
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. -
submitJob
Submits a job to a cluster.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { String projectId = "projectId-894832108"; String region = "region-934795532"; Job job = Job.newBuilder().build(); Job response = jobControllerClient.submitJob(projectId, region, job); }- Parameters:
projectId- Required. The ID of the Google Cloud Platform project that the job belongs to.region- Required. The Dataproc region in which to handle the request.job- Required. The job resource.- Throws:
ApiException- if the remote call fails
-
submitJob
Submits a job to a cluster.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { SubmitJobRequest request = SubmitJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJob(Job.newBuilder().build()) .setRequestId("requestId693933066") .build(); Job response = jobControllerClient.submitJob(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
submitJobCallable
Submits a job to a cluster.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { SubmitJobRequest request = SubmitJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJob(Job.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Job> future = jobControllerClient.submitJobCallable().futureCall(request); // Do something. Job response = future.get(); } -
submitJobAsOperationAsync
public final OperationFuture<Job,JobMetadata> submitJobAsOperationAsync(String projectId, String region, Job job) Submits job to a cluster.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { String projectId = "projectId-894832108"; String region = "region-934795532"; Job job = Job.newBuilder().build(); Job response = jobControllerClient.submitJobAsOperationAsync(projectId, region, job).get(); }- Parameters:
projectId- Required. The ID of the Google Cloud Platform project that the job belongs to.region- Required. The Dataproc region in which to handle the request.job- Required. The job resource.- Throws:
ApiException- if the remote call fails
-
submitJobAsOperationAsync
Submits job to a cluster.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { SubmitJobRequest request = SubmitJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJob(Job.newBuilder().build()) .setRequestId("requestId693933066") .build(); Job response = jobControllerClient.submitJobAsOperationAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
submitJobAsOperationOperationCallable
public final OperationCallable<SubmitJobRequest,Job, submitJobAsOperationOperationCallable()JobMetadata> Submits job to a cluster.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { SubmitJobRequest request = SubmitJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJob(Job.newBuilder().build()) .setRequestId("requestId693933066") .build(); OperationFuture<Job, JobMetadata> future = jobControllerClient.submitJobAsOperationOperationCallable().futureCall(request); // Do something. Job response = future.get(); } -
submitJobAsOperationCallable
Submits job to a cluster.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { SubmitJobRequest request = SubmitJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJob(Job.newBuilder().build()) .setRequestId("requestId693933066") .build(); ApiFuture<Operation> future = jobControllerClient.submitJobAsOperationCallable().futureCall(request); // Do something. Operation response = future.get(); } -
getJob
Gets the resource representation for a job in a project.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { String projectId = "projectId-894832108"; String region = "region-934795532"; String jobId = "jobId101296568"; Job response = jobControllerClient.getJob(projectId, region, jobId); }- Parameters:
projectId- Required. The ID of the Google Cloud Platform project that the job belongs to.region- Required. The Dataproc region in which to handle the request.jobId- Required. The job ID.- Throws:
ApiException- if the remote call fails
-
getJob
Gets the resource representation for a job in a project.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { GetJobRequest request = GetJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJobId("jobId101296568") .build(); Job response = jobControllerClient.getJob(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getJobCallable
Gets the resource representation for a job in a project.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { GetJobRequest request = GetJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJobId("jobId101296568") .build(); ApiFuture<Job> future = jobControllerClient.getJobCallable().futureCall(request); // Do something. Job response = future.get(); } -
listJobs
Lists regions/{region}/jobs in a project.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { String projectId = "projectId-894832108"; String region = "region-934795532"; for (Job element : jobControllerClient.listJobs(projectId, region).iterateAll()) { // doThingsWith(element); } }- Parameters:
projectId- Required. The ID of the Google Cloud Platform project that the job belongs to.region- Required. The Dataproc region in which to handle the request.- Throws:
ApiException- if the remote call fails
-
listJobs
public final JobControllerClient.ListJobsPagedResponse listJobs(String projectId, String region, String filter) Lists regions/{region}/jobs in a project.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { String projectId = "projectId-894832108"; String region = "region-934795532"; String filter = "filter-1274492040"; for (Job element : jobControllerClient.listJobs(projectId, region, filter).iterateAll()) { // doThingsWith(element); } }- Parameters:
projectId- Required. The ID of the Google Cloud Platform project that the job belongs to.region- Required. The Dataproc region in which to handle the request.filter- Optional. A filter constraining the jobs to list. Filters are case-sensitive and have the following syntax:[field = value] AND [field [= value]] ...
where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label key. **value** can be `*` to match all values. `status.state` can be either `ACTIVE` or `NON_ACTIVE`. Only the logical `AND` operator is supported; space-separated items are treated as having an implicit `AND` operator.
Example filter:
status.state = ACTIVE AND labels.env = staging AND labels.starred = *
- Throws:
ApiException- if the remote call fails
-
listJobs
Lists regions/{region}/jobs in a project.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { ListJobsRequest request = ListJobsRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setPageSize(883849137) .setPageToken("pageToken873572522") .setClusterName("clusterName-1141738587") .setFilter("filter-1274492040") .build(); for (Job element : jobControllerClient.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,JobControllerClient.ListJobsPagedResponse> listJobsPagedCallable()Lists regions/{region}/jobs in a project.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { ListJobsRequest request = ListJobsRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setPageSize(883849137) .setPageToken("pageToken873572522") .setClusterName("clusterName-1141738587") .setFilter("filter-1274492040") .build(); ApiFuture<Job> future = jobControllerClient.listJobsPagedCallable().futureCall(request); // Do something. for (Job element : future.get().iterateAll()) { // doThingsWith(element); } } -
listJobsCallable
Lists regions/{region}/jobs in a project.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { ListJobsRequest request = ListJobsRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setPageSize(883849137) .setPageToken("pageToken873572522") .setClusterName("clusterName-1141738587") .setFilter("filter-1274492040") .build(); while (true) { ListJobsResponse response = jobControllerClient.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; } } } -
updateJob
Updates a job in a project.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { UpdateJobRequest request = UpdateJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJobId("jobId101296568") .setJob(Job.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Job response = jobControllerClient.updateJob(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateJobCallable
Updates a job in a project.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { UpdateJobRequest request = UpdateJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJobId("jobId101296568") .setJob(Job.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Job> future = jobControllerClient.updateJobCallable().futureCall(request); // Do something. Job response = future.get(); } -
cancelJob
Starts a job cancellation request. To access the job resource after cancellation, call [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) or [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get).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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { String projectId = "projectId-894832108"; String region = "region-934795532"; String jobId = "jobId101296568"; Job response = jobControllerClient.cancelJob(projectId, region, jobId); }- Parameters:
projectId- Required. The ID of the Google Cloud Platform project that the job belongs to.region- Required. The Dataproc region in which to handle the request.jobId- Required. The job ID.- Throws:
ApiException- if the remote call fails
-
cancelJob
Starts a job cancellation request. To access the job resource after cancellation, call [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) or [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get).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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { CancelJobRequest request = CancelJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJobId("jobId101296568") .build(); Job response = jobControllerClient.cancelJob(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
cancelJobCallable
Starts a job cancellation request. To access the job resource after cancellation, call [regions/{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list) or [regions/{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get).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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { CancelJobRequest request = CancelJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJobId("jobId101296568") .build(); ApiFuture<Job> future = jobControllerClient.cancelJobCallable().futureCall(request); // Do something. Job response = future.get(); } -
deleteJob
Deletes the job from the project. If the job is active, the delete fails, and the response returns `FAILED_PRECONDITION`.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { String projectId = "projectId-894832108"; String region = "region-934795532"; String jobId = "jobId101296568"; jobControllerClient.deleteJob(projectId, region, jobId); }- Parameters:
projectId- Required. The ID of the Google Cloud Platform project that the job belongs to.region- Required. The Dataproc region in which to handle the request.jobId- Required. The job ID.- Throws:
ApiException- if the remote call fails
-
deleteJob
Deletes the job from the project. If the job is active, the delete fails, and the response returns `FAILED_PRECONDITION`.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { DeleteJobRequest request = DeleteJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJobId("jobId101296568") .build(); jobControllerClient.deleteJob(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteJobCallable
Deletes the job from the project. If the job is active, the delete fails, and the response returns `FAILED_PRECONDITION`.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { DeleteJobRequest request = DeleteJobRequest.newBuilder() .setProjectId("projectId-894832108") .setRegion("region-934795532") .setJobId("jobId101296568") .build(); ApiFuture<Empty> future = jobControllerClient.deleteJobCallable().futureCall(request); // Do something. future.get(); } -
setIamPolicy
Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource( AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") .toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Policy response = jobControllerClient.setIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
setIamPolicyCallable
Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource( AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") .toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Policy> future = jobControllerClient.setIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
getIamPolicy
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource( AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") .toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); Policy response = jobControllerClient.getIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getIamPolicyCallable
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource( AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") .toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); ApiFuture<Policy> future = jobControllerClient.getIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
testIamPermissions
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource( AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") .toString()) .addAllPermissions(new ArrayList<String>()) .build(); TestIamPermissionsResponse response = jobControllerClient.testIamPermissions(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
testIamPermissionsCallable
public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
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 (JobControllerClient jobControllerClient = JobControllerClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource( AutoscalingPolicyName.ofProjectRegionAutoscalingPolicyName( "[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]") .toString()) .addAllPermissions(new ArrayList<String>()) .build(); ApiFuture<TestIamPermissionsResponse> future = jobControllerClient.testIamPermissionsCallable().futureCall(request); // Do something. TestIamPermissionsResponse 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
-