Skip to content

Commit

Permalink
feat: [run] Adds support for cancel Execution (#9880)
Browse files Browse the repository at this point in the history
* feat: Adds support for cancel Execution
feat: Adds support for Execution overrides
feat: Adds support for Direct VPC egress setting
feat: New fields for multi-container
feat: New field for Task's scheduled timestamp
docs: General documentation fixes.

PiperOrigin-RevId: 567710896

Source-Link: googleapis/googleapis@c5985fe

Source-Link: googleapis/googleapis-gen@0e5c6ac
Copy-Tag: eyJwIjoiamF2YS1ydW4vLk93bEJvdC55YW1sIiwiaCI6IjBlNWM2YWM3ZjM1OWJhMTc3NjYzNGUzNmMzYzE3NGVlNzJhMDdlYWMifQ==

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Sep 25, 2023
1 parent dc7f567 commit 1122185
Show file tree
Hide file tree
Showing 73 changed files with 10,899 additions and 747 deletions.
4 changes: 2 additions & 2 deletions java-run/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.22.0</version>
<version>26.23.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -201,7 +201,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-preview-yellow
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-run.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-run/0.23.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-run/0.24.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ public final OperationsClient getHttpJsonOperationsClient() {
* }</pre>
*
* @param name Required. The full name of the Execution. Format:
* projects/{project}/locations/{location}/jobs/{job}/executions/{execution}, where {project}
* can be project id or number.
* `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where
* `{project}` can be project id or number.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Execution getExecution(ExecutionName name) {
Expand Down Expand Up @@ -246,8 +246,8 @@ public final Execution getExecution(ExecutionName name) {
* }</pre>
*
* @param name Required. The full name of the Execution. Format:
* projects/{project}/locations/{location}/jobs/{job}/executions/{execution}, where {project}
* can be project id or number.
* `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where
* `{project}` can be project id or number.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Execution getExecution(String name) {
Expand Down Expand Up @@ -334,8 +334,8 @@ public final UnaryCallable<GetExecutionRequest, Execution> getExecutionCallable(
*
* @param parent Required. The Execution from which the Executions should be listed. To list all
* Executions across Jobs, use "-" instead of Job name. Format:
* projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or
* number.
* `projects/{project}/locations/{location}/jobs/{job}`, where `{project}` can be project id
* or number.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListExecutionsPagedResponse listExecutions(JobName parent) {
Expand Down Expand Up @@ -368,8 +368,8 @@ public final ListExecutionsPagedResponse listExecutions(JobName parent) {
*
* @param parent Required. The Execution from which the Executions should be listed. To list all
* Executions across Jobs, use "-" instead of Job name. Format:
* projects/{project}/locations/{location}/jobs/{job}, where {project} can be project id or
* number.
* `projects/{project}/locations/{location}/jobs/{job}`, where `{project}` can be project id
* or number.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListExecutionsPagedResponse listExecutions(String parent) {
Expand Down Expand Up @@ -503,8 +503,8 @@ public final ListExecutionsPagedResponse listExecutions(ListExecutionsRequest re
* }</pre>
*
* @param name Required. The name of the Execution to delete. Format:
* projects/{project}/locations/{location}/jobs/{job}/executions/{execution}, where {project}
* can be project id or number.
* `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where
* `{project}` can be project id or number.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Execution, Execution> deleteExecutionAsync(ExecutionName name) {
Expand Down Expand Up @@ -532,8 +532,8 @@ public final OperationFuture<Execution, Execution> deleteExecutionAsync(Executio
* }</pre>
*
* @param name Required. The name of the Execution to delete. Format:
* projects/{project}/locations/{location}/jobs/{job}/executions/{execution}, where {project}
* can be project id or number.
* `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where
* `{project}` can be project id or number.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Execution, Execution> deleteExecutionAsync(String name) {
Expand Down Expand Up @@ -635,6 +635,157 @@ public final UnaryCallable<DeleteExecutionRequest, Operation> deleteExecutionCal
return stub.deleteExecutionCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Cancels an Execution.
*
* <p>Sample code:
*
* <pre>{@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 (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]");
* Execution response = executionsClient.cancelExecutionAsync(name).get();
* }
* }</pre>
*
* @param name Required. The name of the Execution to cancel. Format:
* `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where
* `{project}` can be project id or number.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Execution, Execution> cancelExecutionAsync(ExecutionName name) {
CancelExecutionRequest request =
CancelExecutionRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return cancelExecutionAsync(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Cancels an Execution.
*
* <p>Sample code:
*
* <pre>{@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 (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* String name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString();
* Execution response = executionsClient.cancelExecutionAsync(name).get();
* }
* }</pre>
*
* @param name Required. The name of the Execution to cancel. Format:
* `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`, where
* `{project}` can be project id or number.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Execution, Execution> cancelExecutionAsync(String name) {
CancelExecutionRequest request = CancelExecutionRequest.newBuilder().setName(name).build();
return cancelExecutionAsync(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Cancels an Execution.
*
* <p>Sample code:
*
* <pre>{@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 (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* CancelExecutionRequest request =
* CancelExecutionRequest.newBuilder()
* .setName(
* ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* Execution response = executionsClient.cancelExecutionAsync(request).get();
* }
* }</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
*/
public final OperationFuture<Execution, Execution> cancelExecutionAsync(
CancelExecutionRequest request) {
return cancelExecutionOperationCallable().futureCall(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Cancels an Execution.
*
* <p>Sample code:
*
* <pre>{@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 (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* CancelExecutionRequest request =
* CancelExecutionRequest.newBuilder()
* .setName(
* ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* OperationFuture<Execution, Execution> future =
* executionsClient.cancelExecutionOperationCallable().futureCall(request);
* // Do something.
* Execution response = future.get();
* }
* }</pre>
*/
public final OperationCallable<CancelExecutionRequest, Execution, Execution>
cancelExecutionOperationCallable() {
return stub.cancelExecutionOperationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Cancels an Execution.
*
* <p>Sample code:
*
* <pre>{@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 (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* CancelExecutionRequest request =
* CancelExecutionRequest.newBuilder()
* .setName(
* ExecutionName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[EXECUTION]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .build();
* ApiFuture<Operation> future = executionsClient.cancelExecutionCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<CancelExecutionRequest, Operation> cancelExecutionCallable() {
return stub.cancelExecutionCallable();
}

@Override
public final void close() {
stub.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ public UnaryCallSettings<DeleteExecutionRequest, Operation> deleteExecutionSetti
return ((ExecutionsStubSettings) getStubSettings()).deleteExecutionOperationSettings();
}

/** Returns the object with the settings used for calls to cancelExecution. */
public UnaryCallSettings<CancelExecutionRequest, Operation> cancelExecutionSettings() {
return ((ExecutionsStubSettings) getStubSettings()).cancelExecutionSettings();
}

/** Returns the object with the settings used for calls to cancelExecution. */
public OperationCallSettings<CancelExecutionRequest, Execution, Execution>
cancelExecutionOperationSettings() {
return ((ExecutionsStubSettings) getStubSettings()).cancelExecutionOperationSettings();
}

public static final ExecutionsSettings create(ExecutionsStubSettings stub) throws IOException {
return new ExecutionsSettings.Builder(stub.toBuilder()).build();
}
Expand Down Expand Up @@ -236,6 +247,17 @@ public UnaryCallSettings.Builder<DeleteExecutionRequest, Operation> deleteExecut
return getStubSettingsBuilder().deleteExecutionOperationSettings();
}

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

/** Returns the builder for the settings used for calls to cancelExecution. */
public OperationCallSettings.Builder<CancelExecutionRequest, Execution, Execution>
cancelExecutionOperationSettings() {
return getStubSettingsBuilder().cancelExecutionOperationSettings();
}

@Override
public ExecutionsSettings build() throws IOException {
return new ExecutionsSettings(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ public final OperationFuture<Execution, Execution> runJobAsync(String name) {
* .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .setOverrides(RunJobRequest.Overrides.newBuilder().build())
* .build();
* Execution response = jobsClient.runJobAsync(request).get();
* }
Expand Down Expand Up @@ -1006,6 +1007,7 @@ public final OperationFuture<Execution, Execution> runJobAsync(RunJobRequest req
* .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .setOverrides(RunJobRequest.Overrides.newBuilder().build())
* .build();
* OperationFuture<Execution, Execution> future =
* jobsClient.runJobOperationCallable().futureCall(request);
Expand Down Expand Up @@ -1036,6 +1038,7 @@ public final OperationCallable<RunJobRequest, Execution, Execution> runJobOperat
* .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
* .setValidateOnly(true)
* .setEtag("etag3123477")
* .setOverrides(RunJobRequest.Overrides.newBuilder().build())
* .build();
* ApiFuture<Operation> future = jobsClient.runJobCallable().futureCall(request);
* // Do something.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"grpc": {
"libraryClient": "ExecutionsClient",
"rpcs": {
"CancelExecution": {
"methods": ["cancelExecutionAsync", "cancelExecutionAsync", "cancelExecutionAsync", "cancelExecutionOperationCallable", "cancelExecutionCallable"]
},
"DeleteExecution": {
"methods": ["deleteExecutionAsync", "deleteExecutionAsync", "deleteExecutionAsync", "deleteExecutionOperationCallable", "deleteExecutionCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.run.v2.CancelExecutionRequest;
import com.google.cloud.run.v2.DeleteExecutionRequest;
import com.google.cloud.run.v2.Execution;
import com.google.cloud.run.v2.GetExecutionRequest;
Expand Down Expand Up @@ -69,6 +70,15 @@ public UnaryCallable<DeleteExecutionRequest, Operation> deleteExecutionCallable(
throw new UnsupportedOperationException("Not implemented: deleteExecutionCallable()");
}

public OperationCallable<CancelExecutionRequest, Execution, Execution>
cancelExecutionOperationCallable() {
throw new UnsupportedOperationException("Not implemented: cancelExecutionOperationCallable()");
}

public UnaryCallable<CancelExecutionRequest, Operation> cancelExecutionCallable() {
throw new UnsupportedOperationException("Not implemented: cancelExecutionCallable()");
}

@Override
public abstract void close();
}
Loading

0 comments on commit 1122185

Please sign in to comment.