@Generated(value="by gapic-generator-java") public class JobControllerClient extends Object implements BackgroundResource
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().
The surface of this class includes several types of Java methods for each of the API's methods:
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.newBuilder()
.setTransportChannelProvider(
JobControllerSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
JobControllerClient jobControllerClient = JobControllerClient.create(jobControllerSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Modifier and Type | Class and Description |
---|---|
static class |
JobControllerClient.ListJobsFixedSizeCollection |
static class |
JobControllerClient.ListJobsPage |
static class |
JobControllerClient.ListJobsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
JobControllerClient(JobControllerSettings settings)
Constructs an instance of JobControllerClient, using the given settings.
|
protected |
JobControllerClient(JobControllerStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
Job |
cancelJob(CancelJobRequest request)
Starts a job cancellation request.
|
Job |
cancelJob(String projectId,
String region,
String jobId)
Starts a job cancellation request.
|
UnaryCallable<CancelJobRequest,Job> |
cancelJobCallable()
Starts a job cancellation request.
|
void |
close() |
static JobControllerClient |
create()
Constructs an instance of JobControllerClient with default settings.
|
static JobControllerClient |
create(JobControllerSettings settings)
Constructs an instance of JobControllerClient, using the given settings.
|
static JobControllerClient |
create(JobControllerStub stub)
Constructs an instance of JobControllerClient, using the given stub for making calls.
|
void |
deleteJob(DeleteJobRequest request)
Deletes the job from the project.
|
void |
deleteJob(String projectId,
String region,
String jobId)
Deletes the job from the project.
|
UnaryCallable<DeleteJobRequest,Empty> |
deleteJobCallable()
Deletes the job from the project.
|
OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
Job |
getJob(GetJobRequest request)
Gets the resource representation for a job in a project.
|
Job |
getJob(String projectId,
String region,
String jobId)
Gets the resource representation for a job in a project.
|
UnaryCallable<GetJobRequest,Job> |
getJobCallable()
Gets the resource representation for a job in a project.
|
OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
JobControllerSettings |
getSettings() |
JobControllerStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
JobControllerClient.ListJobsPagedResponse |
listJobs(ListJobsRequest request)
Lists regions/{region}/jobs in a project.
|
JobControllerClient.ListJobsPagedResponse |
listJobs(String projectId,
String region)
Lists regions/{region}/jobs in a project.
|
JobControllerClient.ListJobsPagedResponse |
listJobs(String projectId,
String region,
String filter)
Lists regions/{region}/jobs in a project.
|
UnaryCallable<ListJobsRequest,ListJobsResponse> |
listJobsCallable()
Lists regions/{region}/jobs in a project.
|
UnaryCallable<ListJobsRequest,JobControllerClient.ListJobsPagedResponse> |
listJobsPagedCallable()
Lists regions/{region}/jobs in a project.
|
void |
shutdown() |
void |
shutdownNow() |
Job |
submitJob(String projectId,
String region,
Job job)
Submits a job to a cluster.
|
Job |
submitJob(SubmitJobRequest request)
Submits a job to a cluster.
|
OperationFuture<Job,JobMetadata> |
submitJobAsOperationAsync(String projectId,
String region,
Job job)
Submits job to a cluster.
|
OperationFuture<Job,JobMetadata> |
submitJobAsOperationAsync(SubmitJobRequest request)
Submits job to a cluster.
|
UnaryCallable<SubmitJobRequest,Operation> |
submitJobAsOperationCallable()
Submits job to a cluster.
|
OperationCallable<SubmitJobRequest,Job,JobMetadata> |
submitJobAsOperationOperationCallable()
Submits job to a cluster.
|
UnaryCallable<SubmitJobRequest,Job> |
submitJobCallable()
Submits a job to a cluster.
|
Job |
updateJob(UpdateJobRequest request)
Updates a job in a project.
|
UnaryCallable<UpdateJobRequest,Job> |
updateJobCallable()
Updates a job in a project.
|
protected JobControllerClient(JobControllerSettings settings) throws IOException
IOException
protected JobControllerClient(JobControllerStub stub)
public static final JobControllerClient create() throws IOException
IOException
public static final JobControllerClient create(JobControllerSettings settings) throws IOException
IOException
public static final JobControllerClient create(JobControllerStub stub)
public final JobControllerSettings getSettings()
public JobControllerStub getStub()
public final OperationsClient getOperationsClient()
@BetaApi public final OperationsClient getHttpJsonOperationsClient()
public final Job submitJob(String projectId, String region, Job 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 (JobControllerClient jobControllerClient = JobControllerClient.create()) {
String projectId = "projectId-894832108";
String region = "region-934795532";
Job job = Job.newBuilder().build();
Job response = jobControllerClient.submitJob(projectId, region, job);
}
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.ApiException
- if the remote call failspublic final Job submitJob(SubmitJobRequest request)
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);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<SubmitJobRequest,Job> submitJobCallable()
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();
}
public final OperationFuture<Job,JobMetadata> submitJobAsOperationAsync(String projectId, String region, Job 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 (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();
}
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.ApiException
- if the remote call failspublic final OperationFuture<Job,JobMetadata> submitJobAsOperationAsync(SubmitJobRequest request)
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();
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final OperationCallable<SubmitJobRequest,Job,JobMetadata> submitJobAsOperationOperationCallable()
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();
}
public final UnaryCallable<SubmitJobRequest,Operation> submitJobAsOperationCallable()
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();
}
public final Job getJob(String projectId, String region, String jobId)
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);
}
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.ApiException
- if the remote call failspublic final Job getJob(GetJobRequest request)
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);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<GetJobRequest,Job> getJobCallable()
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();
}
public final JobControllerClient.ListJobsPagedResponse listJobs(String projectId, String 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 (JobControllerClient jobControllerClient = JobControllerClient.create()) {
String projectId = "projectId-894832108";
String region = "region-934795532";
for (Job element : jobControllerClient.listJobs(projectId, region).iterateAll()) {
// doThingsWith(element);
}
}
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.ApiException
- if the remote call failspublic final JobControllerClient.ListJobsPagedResponse listJobs(String projectId, String region, String filter)
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);
}
}
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 = *
ApiException
- if the remote call failspublic final JobControllerClient.ListJobsPagedResponse listJobs(ListJobsRequest request)
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);
}
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<ListJobsRequest,JobControllerClient.ListJobsPagedResponse> listJobsPagedCallable()
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);
}
}
public final UnaryCallable<ListJobsRequest,ListJobsResponse> listJobsCallable()
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;
}
}
}
public final Job updateJob(UpdateJobRequest request)
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);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<UpdateJobRequest,Job> updateJobCallable()
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();
}
public final Job cancelJob(String projectId, String region, String jobId)
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);
}
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.ApiException
- if the remote call failspublic final Job cancelJob(CancelJobRequest request)
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);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<CancelJobRequest,Job> cancelJobCallable()
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();
}
public final void deleteJob(String projectId, String region, String jobId)
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);
}
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.ApiException
- if the remote call failspublic final void deleteJob(DeleteJobRequest request)
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);
}
request
- The request object containing all of the parameters for the API call.ApiException
- if the remote call failspublic final UnaryCallable<DeleteJobRequest,Empty> deleteJobCallable()
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();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface BackgroundResource
public boolean isShutdown()
isShutdown
in interface BackgroundResource
public boolean isTerminated()
isTerminated
in interface BackgroundResource
public void shutdownNow()
shutdownNow
in interface BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface BackgroundResource
InterruptedException
Copyright © 2022 Google LLC. All rights reserved.