Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google-cloud-dataproc-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<version>0.5.0</version>
</parent>

<name>Google Cloud dataproc BOM</name>
<name>Google Cloud Dataproc BOM</name>
<url>https://github.com/googleapis/java-dataproc</url>
<description>
BOM for Google Cloud Dataproc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public final AutoscalingPolicy updateAutoscalingPolicy(UpdateAutoscalingPolicyRe
* has the following format: `projects/{project_id}/regions/{region}`
* <p>&#42; For `projects.locations.autoscalingPolicies.create`, the resource name of the
* location has the following format: `projects/{project_id}/locations/{location}`
* @param policy The autoscaling policy to create.
* @param policy Required. The autoscaling policy to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final AutoscalingPolicy createAutoscalingPolicy(
Expand Down Expand Up @@ -284,7 +284,7 @@ public final AutoscalingPolicy createAutoscalingPolicy(
* has the following format: `projects/{project_id}/regions/{region}`
* <p>&#42; For `projects.locations.autoscalingPolicies.create`, the resource name of the
* location has the following format: `projects/{project_id}/locations/{location}`
* @param policy The autoscaling policy to create.
* @param policy Required. The autoscaling policy to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final AutoscalingPolicy createAutoscalingPolicy(
Expand Down Expand Up @@ -317,7 +317,7 @@ public final AutoscalingPolicy createAutoscalingPolicy(
* has the following format: `projects/{project_id}/regions/{region}`
* <p>&#42; For `projects.locations.autoscalingPolicies.create`, the resource name of the
* location has the following format: `projects/{project_id}/locations/{location}`
* @param policy The autoscaling policy to create.
* @param policy Required. The autoscaling policy to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final AutoscalingPolicy createAutoscalingPolicy(String parent, AutoscalingPolicy policy) {
Expand All @@ -335,8 +335,10 @@ public final AutoscalingPolicy createAutoscalingPolicy(String parent, Autoscalin
* <pre><code>
* try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.create()) {
* RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
* AutoscalingPolicy policy = AutoscalingPolicy.newBuilder().build();
* CreateAutoscalingPolicyRequest request = CreateAutoscalingPolicyRequest.newBuilder()
* .setParent(parent.toString())
* .setPolicy(policy)
* .build();
* AutoscalingPolicy response = autoscalingPolicyServiceClient.createAutoscalingPolicy(request);
* }
Expand All @@ -358,8 +360,10 @@ public final AutoscalingPolicy createAutoscalingPolicy(CreateAutoscalingPolicyRe
* <pre><code>
* try (AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.create()) {
* RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
* AutoscalingPolicy policy = AutoscalingPolicy.newBuilder().build();
* CreateAutoscalingPolicyRequest request = CreateAutoscalingPolicyRequest.newBuilder()
* .setParent(parent.toString())
* .setPolicy(policy)
* .build();
* ApiFuture&lt;AutoscalingPolicy&gt; future = autoscalingPolicyServiceClient.createAutoscalingPolicyCallable().futureCall(request);
* // Do something
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ public final UnaryCallable<GetClusterRequest, Cluster> getClusterCallable() {

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Lists all regions/{region}/clusters in a project.
* Lists all regions/{region}/clusters in a project alphabetically.
*
* <p>Sample code:
*
Expand All @@ -704,7 +704,7 @@ public final ListClustersPagedResponse listClusters(String projectId, String reg

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Lists all regions/{region}/clusters in a project.
* Lists all regions/{region}/clusters in a project alphabetically.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -751,7 +751,7 @@ public final ListClustersPagedResponse listClusters(

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Lists all regions/{region}/clusters in a project.
* Lists all regions/{region}/clusters in a project alphabetically.
*
* <p>Sample code:
*
Expand All @@ -778,7 +778,7 @@ public final ListClustersPagedResponse listClusters(ListClustersRequest request)

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Lists all regions/{region}/clusters in a project.
* Lists all regions/{region}/clusters in a project alphabetically.
*
* <p>Sample code:
*
Expand All @@ -805,7 +805,7 @@ public final ListClustersPagedResponse listClusters(ListClustersRequest request)

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Lists all regions/{region}/clusters in a project.
* Lists all regions/{region}/clusters in a project alphabetically.
*
* <p>Sample code:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
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.longrunning.Operation;
import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -107,6 +111,7 @@
public class JobControllerClient implements BackgroundResource {
private final JobControllerSettings settings;
private final JobControllerStub stub;
private final OperationsClient operationsClient;

/** Constructs an instance of JobControllerClient with default settings. */
public static final JobControllerClient create() throws IOException {
Expand Down Expand Up @@ -139,12 +144,14 @@ public static final JobControllerClient create(JobControllerStub stub) {
protected JobControllerClient(JobControllerSettings settings) throws IOException {
this.settings = settings;
this.stub = ((JobControllerStubSettings) settings.getStubSettings()).createStub();
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected JobControllerClient(JobControllerStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}

public final JobControllerSettings getSettings() {
Expand All @@ -156,6 +163,16 @@ 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.
*/
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public final OperationsClient getOperationsClient() {
return operationsClient;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Submits a job to a cluster.
Expand Down Expand Up @@ -709,6 +726,119 @@ public final UnaryCallable<DeleteJobRequest, Empty> deleteJobCallable() {
return stub.deleteJobCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Submits job to a cluster.
*
* <p>Sample code:
*
* <pre><code>
* try (JobControllerClient jobControllerClient = JobControllerClient.create()) {
* String projectId = "";
* String region = "";
* Job job = Job.newBuilder().build();
* Job response = jobControllerClient.submitJobAsOperationAsync(projectId, region, job).get();
* }
* </code></pre>
*
* @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
*/
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture<Job, JobMetadata> 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.
*
* <p>Sample code:
*
* <pre><code>
* try (JobControllerClient jobControllerClient = JobControllerClient.create()) {
* String projectId = "";
* String region = "";
* Job job = Job.newBuilder().build();
* SubmitJobRequest request = SubmitJobRequest.newBuilder()
* .setProjectId(projectId)
* .setRegion(region)
* .setJob(job)
* .build();
* Job response = jobControllerClient.submitJobAsOperationAsync(request).get();
* }
* </code></pre>
*
* @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
*/
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public final OperationFuture<Job, JobMetadata> submitJobAsOperationAsync(
SubmitJobRequest request) {
return submitJobAsOperationOperationCallable().futureCall(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Submits job to a cluster.
*
* <p>Sample code:
*
* <pre><code>
* try (JobControllerClient jobControllerClient = JobControllerClient.create()) {
* String projectId = "";
* String region = "";
* Job job = Job.newBuilder().build();
* SubmitJobRequest request = SubmitJobRequest.newBuilder()
* .setProjectId(projectId)
* .setRegion(region)
* .setJob(job)
* .build();
* OperationFuture&lt;Job, JobMetadata&gt; future = jobControllerClient.submitJobAsOperationOperationCallable().futureCall(request);
* // Do something
* Job response = future.get();
* }
* </code></pre>
*/
@BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
public final OperationCallable<SubmitJobRequest, Job, JobMetadata>
submitJobAsOperationOperationCallable() {
return stub.submitJobAsOperationOperationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Submits job to a cluster.
*
* <p>Sample code:
*
* <pre><code>
* try (JobControllerClient jobControllerClient = JobControllerClient.create()) {
* String projectId = "";
* String region = "";
* Job job = Job.newBuilder().build();
* SubmitJobRequest request = SubmitJobRequest.newBuilder()
* .setProjectId(projectId)
* .setRegion(region)
* .setJob(job)
* .build();
* ApiFuture&lt;Operation&gt; future = jobControllerClient.submitJobAsOperationCallable().futureCall(request);
* // Do something
* Operation response = future.get();
* }
* </code></pre>
*/
public final UnaryCallable<SubmitJobRequest, Operation> submitJobAsOperationCallable() {
return stub.submitJobAsOperationCallable();
}

@Override
public final void close() {
stub.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.dataproc.v1.stub.JobControllerStubSettings;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -99,6 +101,19 @@ public UnaryCallSettings<DeleteJobRequest, Empty> deleteJobSettings() {
return ((JobControllerStubSettings) getStubSettings()).deleteJobSettings();
}

/** Returns the object with the settings used for calls to submitJobAsOperation. */
public UnaryCallSettings<SubmitJobRequest, Operation> submitJobAsOperationSettings() {
return ((JobControllerStubSettings) getStubSettings()).submitJobAsOperationSettings();
}

/** Returns the object with the settings used for calls to submitJobAsOperation. */
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings<SubmitJobRequest, Job, JobMetadata>
submitJobAsOperationOperationSettings() {
return ((JobControllerStubSettings) getStubSettings()).submitJobAsOperationOperationSettings();
}

public static final JobControllerSettings create(JobControllerStubSettings stub)
throws IOException {
return new JobControllerSettings.Builder(stub.toBuilder()).build();
Expand Down Expand Up @@ -227,6 +242,19 @@ public UnaryCallSettings.Builder<DeleteJobRequest, Empty> deleteJobSettings() {
return getStubSettingsBuilder().deleteJobSettings();
}

/** Returns the builder for the settings used for calls to submitJobAsOperation. */
public UnaryCallSettings.Builder<SubmitJobRequest, Operation> submitJobAsOperationSettings() {
return getStubSettingsBuilder().submitJobAsOperationSettings();
}

/** Returns the builder for the settings used for calls to submitJobAsOperation. */
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
public OperationCallSettings.Builder<SubmitJobRequest, Job, JobMetadata>
submitJobAsOperationOperationSettings() {
return getStubSettingsBuilder().submitJobAsOperationOperationSettings();
}

@Override
public JobControllerSettings build() throws IOException {
return new JobControllerSettings(this);
Expand Down
Loading