All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.dataproc.v1.JobControllerClient Maven / Gradle / Ivy

/*
 * Copyright 2024 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.dataproc.v1;

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.dataproc.v1.stub.JobControllerStub;
import com.google.cloud.dataproc.v1.stub.JobControllerStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * Service Description: The JobController provides methods to manage jobs.
 *
 * 

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * *

{@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);
 * }
 * }
* *

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(). * *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Methods
MethodDescriptionMethod 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.

*
    *
  • submitJob(SubmitJobRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • submitJob(String projectId, String region, Job job) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • submitJobCallable() *

*

SubmitJobAsOperation

Submits job to a cluster.

*

Request object method variants only take one parameter, a request object, which must be constructed before the call.

*
    *
  • submitJobAsOperationAsync(SubmitJobRequest request) *

*

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

*
    *
  • submitJobAsOperationAsync(String projectId, String region, Job job) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • submitJobAsOperationOperationCallable() *

  • submitJobAsOperationCallable() *

*

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.

*
    *
  • getJob(GetJobRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • getJob(String projectId, String region, String jobId) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getJobCallable() *

*

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.

*
    *
  • listJobs(ListJobsRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • listJobs(String projectId, String region) *

  • listJobs(String projectId, String region, String filter) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • listJobsPagedCallable() *

  • listJobsCallable() *

*

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.

*
    *
  • updateJob(UpdateJobRequest request) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • updateJobCallable() *

*

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.

*
    *
  • cancelJob(CancelJobRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • cancelJob(String projectId, String region, String jobId) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • cancelJobCallable() *

*

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.

*
    *
  • deleteJob(DeleteJobRequest request) *

*

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

*
    *
  • deleteJob(String projectId, String region, String jobId) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • deleteJobCallable() *

*

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.

*
    *
  • setIamPolicy(SetIamPolicyRequest request) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • setIamPolicyCallable() *

*

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.

*
    *
  • getIamPolicy(GetIamPolicyRequest request) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • getIamPolicyCallable() *

*

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.

*
    *
  • testIamPermissions(TestIamPermissionsRequest request) *

*

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

*
    *
  • testIamPermissionsCallable() *

*
* *

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: * *

{@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
 * JobControllerSettings jobControllerSettings =
 *     JobControllerSettings.newBuilder()
 *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
 *         .build();
 * JobControllerClient jobControllerClient = JobControllerClient.create(jobControllerSettings);
 * }
* *

To customize the endpoint: * *

{@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
 * 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: * *

{@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
 * JobControllerSettings jobControllerSettings =
 *     JobControllerSettings.newHttpJsonBuilder().build();
 * JobControllerClient jobControllerClient = JobControllerClient.create(jobControllerSettings);
 * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class JobControllerClient implements BackgroundResource { private final JobControllerSettings settings; private final JobControllerStub stub; private final OperationsClient httpJsonOperationsClient; private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of JobControllerClient with default settings. */ public static final JobControllerClient create() throws IOException { return create(JobControllerSettings.newBuilder().build()); } /** * 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. */ public static final JobControllerClient create(JobControllerSettings settings) throws IOException { return new JobControllerClient(settings); } /** * Constructs an instance of JobControllerClient, using the given stub for making calls. This is * for advanced usage - prefer using create(JobControllerSettings). */ public static final JobControllerClient create(JobControllerStub stub) { return new JobControllerClient(stub); } /** * 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. */ protected JobControllerClient(JobControllerSettings settings) throws IOException { this.settings = settings; this.stub = ((JobControllerStubSettings) settings.getStubSettings()).createStub(); this.operationsClient = com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected JobControllerClient(JobControllerStub stub) { this.settings = null; this.stub = stub; this.operationsClient = com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final JobControllerSettings getSettings() { return settings; } public JobControllerStub getStub() { return stub; } /** * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } /** * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ @BetaApi public final OperationsClient getHttpJsonOperationsClient() { return httpJsonOperationsClient; } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Submits a job to a cluster. * *

Sample code: * *

{@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);
   * }
   * }
* * @param projectId Required. The ID of the Google Cloud Platform project that the job belongs to. * @param region Required. The Dataproc region in which to handle the request. * @param job Required. The job resource. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Job submitJob(String projectId, String region, Job job) { SubmitJobRequest request = SubmitJobRequest.newBuilder().setProjectId(projectId).setRegion(region).setJob(job).build(); return submitJob(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Submits a job to a cluster. * *

Sample code: * *

{@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);
   * }
   * }
* * @param 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 */ public final Job submitJob(SubmitJobRequest request) { return submitJobCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Submits a job to a cluster. * *

Sample code: * *

{@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 future = jobControllerClient.submitJobCallable().futureCall(request);
   *   // Do something.
   *   Job response = future.get();
   * }
   * }
*/ public final UnaryCallable submitJobCallable() { return stub.submitJobCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Submits job to a cluster. * *

Sample code: * *

{@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();
   * }
   * }
* * @param projectId Required. The ID of the Google Cloud Platform project that the job belongs to. * @param region Required. The Dataproc region in which to handle the request. * @param job Required. The job resource. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final OperationFuture submitJobAsOperationAsync( String projectId, String region, Job job) { SubmitJobRequest request = SubmitJobRequest.newBuilder().setProjectId(projectId).setRegion(region).setJob(job).build(); return submitJobAsOperationAsync(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Submits job to a cluster. * *

Sample code: * *

{@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();
   * }
   * }
* * @param 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 */ public final OperationFuture submitJobAsOperationAsync( SubmitJobRequest request) { return submitJobAsOperationOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Submits job to a cluster. * *

Sample code: * *

{@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 future =
   *       jobControllerClient.submitJobAsOperationOperationCallable().futureCall(request);
   *   // Do something.
   *   Job response = future.get();
   * }
   * }
*/ public final OperationCallable submitJobAsOperationOperationCallable() { return stub.submitJobAsOperationOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Submits job to a cluster. * *

Sample code: * *

{@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 future =
   *       jobControllerClient.submitJobAsOperationCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }
*/ public final UnaryCallable submitJobAsOperationCallable() { return stub.submitJobAsOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the resource representation for a job in a project. * *

Sample code: * *

{@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);
   * }
   * }
* * @param projectId Required. The ID of the Google Cloud Platform project that the job belongs to. * @param region Required. The Dataproc region in which to handle the request. * @param jobId Required. The job ID. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Job getJob(String projectId, String region, String jobId) { GetJobRequest request = GetJobRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setJobId(jobId) .build(); return getJob(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the resource representation for a job in a project. * *

Sample code: * *

{@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);
   * }
   * }
* * @param 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 */ public final Job getJob(GetJobRequest request) { return getJobCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the resource representation for a job in a project. * *

Sample code: * *

{@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 future = jobControllerClient.getJobCallable().futureCall(request);
   *   // Do something.
   *   Job response = future.get();
   * }
   * }
*/ public final UnaryCallable getJobCallable() { return stub.getJobCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists regions/{region}/jobs in a project. * *

Sample code: * *

{@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);
   *   }
   * }
   * }
* * @param projectId Required. The ID of the Google Cloud Platform project that the job belongs to. * @param region Required. The Dataproc region in which to handle the request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListJobsPagedResponse listJobs(String projectId, String region) { ListJobsRequest request = ListJobsRequest.newBuilder().setProjectId(projectId).setRegion(region).build(); return listJobs(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists regions/{region}/jobs in a project. * *

Sample code: * *

{@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);
   *   }
   * }
   * }
* * @param projectId Required. The ID of the Google Cloud Platform project that the job belongs to. * @param region Required. The Dataproc region in which to handle the request. * @param 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 com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListJobsPagedResponse listJobs(String projectId, String region, String filter) { ListJobsRequest request = ListJobsRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setFilter(filter) .build(); return listJobs(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists regions/{region}/jobs in a project. * *

Sample code: * *

{@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);
   *   }
   * }
   * }
* * @param 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 */ public final ListJobsPagedResponse listJobs(ListJobsRequest request) { return listJobsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists regions/{region}/jobs in a project. * *

Sample code: * *

{@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 future = jobControllerClient.listJobsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Job element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listJobsPagedCallable() { return stub.listJobsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists regions/{region}/jobs in a project. * *

Sample code: * *

{@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 UnaryCallable listJobsCallable() { return stub.listJobsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a job in a project. * *

Sample code: * *

{@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);
   * }
   * }
* * @param 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 */ public final Job updateJob(UpdateJobRequest request) { return updateJobCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a job in a project. * *

Sample code: * *

{@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 future = jobControllerClient.updateJobCallable().futureCall(request);
   *   // Do something.
   *   Job response = future.get();
   * }
   * }
*/ public final UnaryCallable updateJobCallable() { return stub.updateJobCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * 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: * *

{@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);
   * }
   * }
* * @param projectId Required. The ID of the Google Cloud Platform project that the job belongs to. * @param region Required. The Dataproc region in which to handle the request. * @param jobId Required. The job ID. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Job cancelJob(String projectId, String region, String jobId) { CancelJobRequest request = CancelJobRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setJobId(jobId) .build(); return cancelJob(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * 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: * *

{@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);
   * }
   * }
* * @param 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 */ public final Job cancelJob(CancelJobRequest request) { return cancelJobCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * 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: * *

{@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 future = jobControllerClient.cancelJobCallable().futureCall(request);
   *   // Do something.
   *   Job response = future.get();
   * }
   * }
*/ public final UnaryCallable cancelJobCallable() { return stub.cancelJobCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the job from the project. If the job is active, the delete fails, and the response * returns `FAILED_PRECONDITION`. * *

Sample code: * *

{@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);
   * }
   * }
* * @param projectId Required. The ID of the Google Cloud Platform project that the job belongs to. * @param region Required. The Dataproc region in which to handle the request. * @param jobId Required. The job ID. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteJob(String projectId, String region, String jobId) { DeleteJobRequest request = DeleteJobRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setJobId(jobId) .build(); deleteJob(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the job from the project. If the job is active, the delete fails, and the response * returns `FAILED_PRECONDITION`. * *

Sample code: * *

{@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);
   * }
   * }
* * @param 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 */ public final void deleteJob(DeleteJobRequest request) { deleteJobCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes the job from the project. If the job is active, the delete fails, and the response * returns `FAILED_PRECONDITION`. * *

Sample code: * *

{@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 future = jobControllerClient.deleteJobCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteJobCallable() { return stub.deleteJobCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified resource. Replacesany existing policy. * *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. * *

Sample code: * *

{@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);
   * }
   * }
* * @param 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 */ public final Policy setIamPolicy(SetIamPolicyRequest request) { return setIamPolicyCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Sets the access control policy on the specified resource. Replacesany existing policy. * *

Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. * *

Sample code: * *

{@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 future = jobControllerClient.setIamPolicyCallable().futureCall(request);
   *   // Do something.
   *   Policy response = future.get();
   * }
   * }
*/ public final UnaryCallable setIamPolicyCallable() { return stub.setIamPolicyCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a resource. Returns an empty policyif the resource exists * and does not have a policy set. * *

Sample code: * *

{@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);
   * }
   * }
* * @param 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 */ public final Policy getIamPolicy(GetIamPolicyRequest request) { return getIamPolicyCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Gets the access control policy for a resource. Returns an empty policyif the resource exists * and does not have a policy set. * *

Sample code: * *

{@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 future = jobControllerClient.getIamPolicyCallable().futureCall(request);
   *   // Do something.
   *   Policy response = future.get();
   * }
   * }
*/ public final UnaryCallable getIamPolicyCallable() { return stub.getIamPolicyCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * 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: * *

{@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())
   *           .build();
   *   TestIamPermissionsResponse response = jobControllerClient.testIamPermissions(request);
   * }
   * }
* * @param 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 */ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { return testIamPermissionsCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * 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: * *

{@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())
   *           .build();
   *   ApiFuture future =
   *       jobControllerClient.testIamPermissionsCallable().futureCall(request);
   *   // Do something.
   *   TestIamPermissionsResponse response = future.get();
   * }
   * }
*/ public final UnaryCallable testIamPermissionsCallable() { return stub.testIamPermissionsCallable(); } @Override public final void close() { stub.close(); } @Override public void shutdown() { stub.shutdown(); } @Override public boolean isShutdown() { return stub.isShutdown(); } @Override public boolean isTerminated() { return stub.isTerminated(); } @Override public void shutdownNow() { stub.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } public static class ListJobsPagedResponse extends AbstractPagedListResponse< ListJobsRequest, ListJobsResponse, Job, ListJobsPage, ListJobsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListJobsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListJobsPagedResponse(input), MoreExecutors.directExecutor()); } private ListJobsPagedResponse(ListJobsPage page) { super(page, ListJobsFixedSizeCollection.createEmptyCollection()); } } public static class ListJobsPage extends AbstractPage { private ListJobsPage( PageContext context, ListJobsResponse response) { super(context, response); } private static ListJobsPage createEmptyPage() { return new ListJobsPage(null, null); } @Override protected ListJobsPage createPage( PageContext context, ListJobsResponse response) { return new ListJobsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListJobsFixedSizeCollection extends AbstractFixedSizeCollection< ListJobsRequest, ListJobsResponse, Job, ListJobsPage, ListJobsFixedSizeCollection> { private ListJobsFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static ListJobsFixedSizeCollection createEmptyCollection() { return new ListJobsFixedSizeCollection(null, 0); } @Override protected ListJobsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListJobsFixedSizeCollection(pages, collectionSize); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy