diff --git a/google-cloud-workflow-executions/src/main/java/com/google/cloud/workflows/executions/v1beta/ExecutionsClient.java b/google-cloud-workflow-executions/src/main/java/com/google/cloud/workflows/executions/v1beta/ExecutionsClient.java index 8cba1b50..f16883ee 100644 --- a/google-cloud-workflow-executions/src/main/java/com/google/cloud/workflows/executions/v1beta/ExecutionsClient.java +++ b/google-cloud-workflow-executions/src/main/java/com/google/cloud/workflows/executions/v1beta/ExecutionsClient.java @@ -42,6 +42,14 @@ *

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
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+ *   WorkflowName parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
+ *   Execution execution = Execution.newBuilder().build();
+ *   Execution response = executionsClient.createExecution(parent, execution);
+ * }
+ * }
+ * *

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

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   WorkflowName parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
+   *   for (Execution element : executionsClient.listExecutions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @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). * + *

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   String parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString();
+   *   for (Execution element : executionsClient.listExecutions(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * * @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). * + *

Sample code: + * + *

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

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   ListExecutionsRequest request =
+   *       ListExecutionsRequest.newBuilder()
+   *           .setParent(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       executionsClient.listExecutionsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Execution element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listExecutionsPagedCallable() { @@ -206,6 +269,23 @@ public final ListExecutionsPagedResponse listExecutions(ListExecutionsRequest re * time (newest first). * *

Sample code: + * + *

{@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;
+   *     }
+   *   }
+   * }
+   * }
*/ public final UnaryCallable listExecutionsCallable() { @@ -216,6 +296,16 @@ public final ListExecutionsPagedResponse listExecutions(ListExecutionsRequest re /** * Creates a new execution using the latest revision of the given workflow. * + *

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   WorkflowName parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
+   *   Execution execution = Execution.newBuilder().build();
+   *   Execution response = executionsClient.createExecution(parent, execution);
+   * }
+   * }
+ * * @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. * + *

Sample code: + * + *

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

Sample code: + * + *

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

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   CreateExecutionRequest request =
+   *       CreateExecutionRequest.newBuilder()
+   *           .setParent(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
+   *           .setExecution(Execution.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = executionsClient.createExecutionCallable().futureCall(request);
+   *   // Do something.
+   *   Execution response = future.get();
+   * }
+   * }
*/ public final UnaryCallable createExecutionCallable() { return stub.createExecutionCallable(); @@ -272,6 +398,15 @@ public final UnaryCallable createExecutionCal /** * Returns an execution of the given name. * + *

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]");
+   *   Execution response = executionsClient.getExecution(name);
+   * }
+   * }
+ * * @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. * + *

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   String name =
+   *       ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]").toString();
+   *   Execution response = executionsClient.getExecution(name);
+   * }
+   * }
+ * * @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. * + *

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   GetExecutionRequest request =
+   *       GetExecutionRequest.newBuilder()
+   *           .setName(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
+   *                   .toString())
+   *           .build();
+   *   Execution response = executionsClient.getExecution(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 */ @@ -311,6 +470,20 @@ public final Execution getExecution(GetExecutionRequest request) { * Returns an execution of the given name. * *

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   GetExecutionRequest request =
+   *       GetExecutionRequest.newBuilder()
+   *           .setName(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = executionsClient.getExecutionCallable().futureCall(request);
+   *   // Do something.
+   *   Execution response = future.get();
+   * }
+   * }
*/ public final UnaryCallable getExecutionCallable() { return stub.getExecutionCallable(); @@ -320,6 +493,15 @@ public final UnaryCallable getExecutionCallable( /** * Cancels an execution of the given name. * + *

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]");
+   *   Execution response = executionsClient.cancelExecution(name);
+   * }
+   * }
+ * * @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. * + *

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   String name =
+   *       ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]").toString();
+   *   Execution response = executionsClient.cancelExecution(name);
+   * }
+   * }
+ * * @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. * + *

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   CancelExecutionRequest request =
+   *       CancelExecutionRequest.newBuilder()
+   *           .setName(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
+   *                   .toString())
+   *           .build();
+   *   Execution response = executionsClient.cancelExecution(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 */ @@ -359,6 +565,20 @@ public final Execution cancelExecution(CancelExecutionRequest request) { * Cancels an execution of the given name. * *

Sample code: + * + *

{@code
+   * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+   *   CancelExecutionRequest request =
+   *       CancelExecutionRequest.newBuilder()
+   *           .setName(
+   *               ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
+   *                   .toString())
+   *           .build();
+   *   ApiFuture future = executionsClient.cancelExecutionCallable().futureCall(request);
+   *   // Do something.
+   *   Execution response = future.get();
+   * }
+   * }
*/ public final UnaryCallable cancelExecutionCallable() { return stub.cancelExecutionCallable(); diff --git a/google-cloud-workflow-executions/src/main/java/com/google/cloud/workflows/executions/v1beta/package-info.java b/google-cloud-workflow-executions/src/main/java/com/google/cloud/workflows/executions/v1beta/package-info.java index 5b9d78c2..91f91030 100644 --- a/google-cloud-workflow-executions/src/main/java/com/google/cloud/workflows/executions/v1beta/package-info.java +++ b/google-cloud-workflow-executions/src/main/java/com/google/cloud/workflows/executions/v1beta/package-info.java @@ -23,6 +23,14 @@ * [Workflows][google.cloud.workflows.v1beta.Workflow] called executions. * *

Sample for ExecutionsClient: + * + *

{@code
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
+ *   WorkflowName parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
+ *   Execution execution = Execution.newBuilder().build();
+ *   Execution response = executionsClient.createExecution(parent, execution);
+ * }
+ * }
*/ @Generated("by gapic-generator-java") package com.google.cloud.workflows.executions.v1beta; diff --git a/synth.metadata b/synth.metadata index a08f5457..f6f43544 100644 --- a/synth.metadata +++ b/synth.metadata @@ -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" } }, {