Skip to content
Permalink
Browse files
docs: generate sample code in the Java microgenerator (#56)
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/b5715173-fa09-4f29-8c69-530ae787b970/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 356341083
Source-Link: googleapis/googleapis@8d8c008
  • Loading branch information
yoshi-automation committed Feb 9, 2021
1 parent d177e1d commit 26bc136677c81c22030ce8efffc6c5387e99d8c9
@@ -42,6 +42,14 @@
* <p>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:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* WorkflowName parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
* Execution execution = Execution.newBuilder().build();
* Execution response = executionsClient.createExecution(parent, execution);
* }
* }</pre>
*
* <p>Note: close() needs to be called on the ExecutionsClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
*
@@ -146,6 +154,17 @@ public ExecutionsStub getStub() {
* returns executions of all workflow revisions. Returned executions are ordered by their start
* time (newest first).
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* WorkflowName parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
* for (Execution element : executionsClient.listExecutions(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. Name of the workflow for which the executions should be listed. Format:
* projects/{project}/locations/{location}/workflows/{workflow}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -164,6 +183,17 @@ public final ListExecutionsPagedResponse listExecutions(WorkflowName parent) {
* returns executions of all workflow revisions. Returned executions are ordered by their start
* time (newest first).
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* String parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString();
* for (Execution element : executionsClient.listExecutions(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param parent Required. Name of the workflow for which the executions should be listed. Format:
* projects/{project}/locations/{location}/workflows/{workflow}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -179,6 +209,22 @@ public final ListExecutionsPagedResponse listExecutions(String parent) {
* returns executions of all workflow revisions. Returned executions are ordered by their start
* time (newest first).
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* ListExecutionsRequest request =
* ListExecutionsRequest.newBuilder()
* .setParent(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Execution element : executionsClient.listExecutions(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</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
*/
@@ -193,6 +239,23 @@ public final ListExecutionsPagedResponse listExecutions(ListExecutionsRequest re
* time (newest first).
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* ListExecutionsRequest request =
* ListExecutionsRequest.newBuilder()
* .setParent(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture<Execution> future =
* executionsClient.listExecutionsPagedCallable().futureCall(request);
* // Do something.
* for (Execution element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
public final UnaryCallable<ListExecutionsRequest, ListExecutionsPagedResponse>
listExecutionsPagedCallable() {
@@ -206,6 +269,23 @@ public final ListExecutionsPagedResponse listExecutions(ListExecutionsRequest re
* time (newest first).
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* while (true) {
* ListExecutionsResponse response = executionsClient.listExecutionsCallable().call(request);
* for (Execution element : response.getResponsesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }</pre>
*/
public final UnaryCallable<ListExecutionsRequest, ListExecutionsResponse>
listExecutionsCallable() {
@@ -216,6 +296,16 @@ public final ListExecutionsPagedResponse listExecutions(ListExecutionsRequest re
/**
* Creates a new execution using the latest revision of the given workflow.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* WorkflowName parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
* Execution execution = Execution.newBuilder().build();
* Execution response = executionsClient.createExecution(parent, execution);
* }
* }</pre>
*
* @param parent Required. Name of the workflow for which an execution should be created. Format:
* projects/{project}/locations/{location}/workflows/{workflow} The latest revision of the
* workflow will be used.
@@ -235,6 +325,16 @@ public final Execution createExecution(WorkflowName parent, Execution execution)
/**
* Creates a new execution using the latest revision of the given workflow.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* String parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString();
* Execution execution = Execution.newBuilder().build();
* Execution response = executionsClient.createExecution(parent, execution);
* }
* }</pre>
*
* @param parent Required. Name of the workflow for which an execution should be created. Format:
* projects/{project}/locations/{location}/workflows/{workflow} The latest revision of the
* workflow will be used.
@@ -251,6 +351,19 @@ public final Execution createExecution(String parent, Execution execution) {
/**
* Creates a new execution using the latest revision of the given workflow.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* CreateExecutionRequest request =
* CreateExecutionRequest.newBuilder()
* .setParent(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
* .setExecution(Execution.newBuilder().build())
* .build();
* Execution response = executionsClient.createExecution(request);
* }
* }</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
*/
@@ -263,6 +376,19 @@ public final Execution createExecution(CreateExecutionRequest request) {
* Creates a new execution using the latest revision of the given workflow.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* CreateExecutionRequest request =
* CreateExecutionRequest.newBuilder()
* .setParent(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
* .setExecution(Execution.newBuilder().build())
* .build();
* ApiFuture<Execution> future = executionsClient.createExecutionCallable().futureCall(request);
* // Do something.
* Execution response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<CreateExecutionRequest, Execution> createExecutionCallable() {
return stub.createExecutionCallable();
@@ -272,6 +398,15 @@ public final UnaryCallable<CreateExecutionRequest, Execution> createExecutionCal
/**
* Returns an execution of the given name.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]");
* Execution response = executionsClient.getExecution(name);
* }
* }</pre>
*
* @param name Required. Name of the execution to be retrieved. Format:
* projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -286,6 +421,16 @@ public final Execution getExecution(ExecutionName name) {
/**
* Returns an execution of the given name.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* String name =
* ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]").toString();
* Execution response = executionsClient.getExecution(name);
* }
* }</pre>
*
* @param name Required. Name of the execution to be retrieved. Format:
* projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -299,6 +444,20 @@ public final Execution getExecution(String name) {
/**
* Returns an execution of the given name.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* GetExecutionRequest request =
* GetExecutionRequest.newBuilder()
* .setName(
* ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
* .toString())
* .build();
* Execution response = executionsClient.getExecution(request);
* }
* }</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
*/
@@ -311,6 +470,20 @@ public final Execution getExecution(GetExecutionRequest request) {
* Returns an execution of the given name.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* GetExecutionRequest request =
* GetExecutionRequest.newBuilder()
* .setName(
* ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
* .toString())
* .build();
* ApiFuture<Execution> future = executionsClient.getExecutionCallable().futureCall(request);
* // Do something.
* Execution response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<GetExecutionRequest, Execution> getExecutionCallable() {
return stub.getExecutionCallable();
@@ -320,6 +493,15 @@ public final UnaryCallable<GetExecutionRequest, Execution> getExecutionCallable(
/**
* Cancels an execution of the given name.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]");
* Execution response = executionsClient.cancelExecution(name);
* }
* }</pre>
*
* @param name Required. Name of the execution to be cancelled. Format:
* projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -334,6 +516,16 @@ public final Execution cancelExecution(ExecutionName name) {
/**
* Cancels an execution of the given name.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* String name =
* ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]").toString();
* Execution response = executionsClient.cancelExecution(name);
* }
* }</pre>
*
* @param name Required. Name of the execution to be cancelled. Format:
* projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -347,6 +539,20 @@ public final Execution cancelExecution(String name) {
/**
* Cancels an execution of the given name.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* CancelExecutionRequest request =
* CancelExecutionRequest.newBuilder()
* .setName(
* ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
* .toString())
* .build();
* Execution response = executionsClient.cancelExecution(request);
* }
* }</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
*/
@@ -359,6 +565,20 @@ public final Execution cancelExecution(CancelExecutionRequest request) {
* Cancels an execution of the given name.
*
* <p>Sample code:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* CancelExecutionRequest request =
* CancelExecutionRequest.newBuilder()
* .setName(
* ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
* .toString())
* .build();
* ApiFuture<Execution> future = executionsClient.cancelExecutionCallable().futureCall(request);
* // Do something.
* Execution response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<CancelExecutionRequest, Execution> cancelExecutionCallable() {
return stub.cancelExecutionCallable();
@@ -23,6 +23,14 @@
* [Workflows][google.cloud.workflows.v1beta.Workflow] called executions.
*
* <p>Sample for ExecutionsClient:
*
* <pre>{@code
* try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
* WorkflowName parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
* Execution execution = Execution.newBuilder().build();
* Execution response = executionsClient.createExecution(parent, execution);
* }
* }</pre>
*/
@Generated("by gapic-generator-java")
package com.google.cloud.workflows.executions.v1beta;
@@ -4,15 +4,15 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-workflow-executions.git",
"sha": "7d56d439c72df1b3e9ee80d95b619c9607860ca4"
"sha": "d177e1d797b6793c913f1c7d5e5fa8bf91319041"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3",
"internalRef": "350949863"
"sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb",
"internalRef": "356341083"
}
},
{

0 comments on commit 26bc136

Please sign in to comment.