42
42
* <p>This class provides the ability to make remote calls to the backing service through method
43
43
* calls that map to API methods. Sample code to get started:
44
44
*
45
+ * <pre>{@code
46
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
47
+ * WorkflowName parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
48
+ * Execution execution = Execution.newBuilder().build();
49
+ * Execution response = executionsClient.createExecution(parent, execution);
50
+ * }
51
+ * }</pre>
52
+ *
45
53
* <p>Note: close() needs to be called on the ExecutionsClient object to clean up resources such as
46
54
* threads. In the example above, try-with-resources is used, which automatically calls close().
47
55
*
@@ -146,6 +154,17 @@ public ExecutionsStub getStub() {
146
154
* returns executions of all workflow revisions. Returned executions are ordered by their start
147
155
* time (newest first).
148
156
*
157
+ * <p>Sample code:
158
+ *
159
+ * <pre>{@code
160
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
161
+ * WorkflowName parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
162
+ * for (Execution element : executionsClient.listExecutions(parent).iterateAll()) {
163
+ * // doThingsWith(element);
164
+ * }
165
+ * }
166
+ * }</pre>
167
+ *
149
168
* @param parent Required. Name of the workflow for which the executions should be listed. Format:
150
169
* projects/{project}/locations/{location}/workflows/{workflow}
151
170
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -164,6 +183,17 @@ public final ListExecutionsPagedResponse listExecutions(WorkflowName parent) {
164
183
* returns executions of all workflow revisions. Returned executions are ordered by their start
165
184
* time (newest first).
166
185
*
186
+ * <p>Sample code:
187
+ *
188
+ * <pre>{@code
189
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
190
+ * String parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString();
191
+ * for (Execution element : executionsClient.listExecutions(parent).iterateAll()) {
192
+ * // doThingsWith(element);
193
+ * }
194
+ * }
195
+ * }</pre>
196
+ *
167
197
* @param parent Required. Name of the workflow for which the executions should be listed. Format:
168
198
* projects/{project}/locations/{location}/workflows/{workflow}
169
199
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -179,6 +209,22 @@ public final ListExecutionsPagedResponse listExecutions(String parent) {
179
209
* returns executions of all workflow revisions. Returned executions are ordered by their start
180
210
* time (newest first).
181
211
*
212
+ * <p>Sample code:
213
+ *
214
+ * <pre>{@code
215
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
216
+ * ListExecutionsRequest request =
217
+ * ListExecutionsRequest.newBuilder()
218
+ * .setParent(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
219
+ * .setPageSize(883849137)
220
+ * .setPageToken("pageToken873572522")
221
+ * .build();
222
+ * for (Execution element : executionsClient.listExecutions(request).iterateAll()) {
223
+ * // doThingsWith(element);
224
+ * }
225
+ * }
226
+ * }</pre>
227
+ *
182
228
* @param request The request object containing all of the parameters for the API call.
183
229
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
184
230
*/
@@ -193,6 +239,23 @@ public final ListExecutionsPagedResponse listExecutions(ListExecutionsRequest re
193
239
* time (newest first).
194
240
*
195
241
* <p>Sample code:
242
+ *
243
+ * <pre>{@code
244
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
245
+ * ListExecutionsRequest request =
246
+ * ListExecutionsRequest.newBuilder()
247
+ * .setParent(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
248
+ * .setPageSize(883849137)
249
+ * .setPageToken("pageToken873572522")
250
+ * .build();
251
+ * ApiFuture<Execution> future =
252
+ * executionsClient.listExecutionsPagedCallable().futureCall(request);
253
+ * // Do something.
254
+ * for (Execution element : future.get().iterateAll()) {
255
+ * // doThingsWith(element);
256
+ * }
257
+ * }
258
+ * }</pre>
196
259
*/
197
260
public final UnaryCallable <ListExecutionsRequest , ListExecutionsPagedResponse >
198
261
listExecutionsPagedCallable () {
@@ -206,6 +269,23 @@ public final ListExecutionsPagedResponse listExecutions(ListExecutionsRequest re
206
269
* time (newest first).
207
270
*
208
271
* <p>Sample code:
272
+ *
273
+ * <pre>{@code
274
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
275
+ * while (true) {
276
+ * ListExecutionsResponse response = executionsClient.listExecutionsCallable().call(request);
277
+ * for (Execution element : response.getResponsesList()) {
278
+ * // doThingsWith(element);
279
+ * }
280
+ * String nextPageToken = response.getNextPageToken();
281
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
282
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
283
+ * } else {
284
+ * break;
285
+ * }
286
+ * }
287
+ * }
288
+ * }</pre>
209
289
*/
210
290
public final UnaryCallable <ListExecutionsRequest , ListExecutionsResponse >
211
291
listExecutionsCallable () {
@@ -216,6 +296,16 @@ public final ListExecutionsPagedResponse listExecutions(ListExecutionsRequest re
216
296
/**
217
297
* Creates a new execution using the latest revision of the given workflow.
218
298
*
299
+ * <p>Sample code:
300
+ *
301
+ * <pre>{@code
302
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
303
+ * WorkflowName parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
304
+ * Execution execution = Execution.newBuilder().build();
305
+ * Execution response = executionsClient.createExecution(parent, execution);
306
+ * }
307
+ * }</pre>
308
+ *
219
309
* @param parent Required. Name of the workflow for which an execution should be created. Format:
220
310
* projects/{project}/locations/{location}/workflows/{workflow} The latest revision of the
221
311
* workflow will be used.
@@ -235,6 +325,16 @@ public final Execution createExecution(WorkflowName parent, Execution execution)
235
325
/**
236
326
* Creates a new execution using the latest revision of the given workflow.
237
327
*
328
+ * <p>Sample code:
329
+ *
330
+ * <pre>{@code
331
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
332
+ * String parent = WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString();
333
+ * Execution execution = Execution.newBuilder().build();
334
+ * Execution response = executionsClient.createExecution(parent, execution);
335
+ * }
336
+ * }</pre>
337
+ *
238
338
* @param parent Required. Name of the workflow for which an execution should be created. Format:
239
339
* projects/{project}/locations/{location}/workflows/{workflow} The latest revision of the
240
340
* workflow will be used.
@@ -251,6 +351,19 @@ public final Execution createExecution(String parent, Execution execution) {
251
351
/**
252
352
* Creates a new execution using the latest revision of the given workflow.
253
353
*
354
+ * <p>Sample code:
355
+ *
356
+ * <pre>{@code
357
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
358
+ * CreateExecutionRequest request =
359
+ * CreateExecutionRequest.newBuilder()
360
+ * .setParent(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
361
+ * .setExecution(Execution.newBuilder().build())
362
+ * .build();
363
+ * Execution response = executionsClient.createExecution(request);
364
+ * }
365
+ * }</pre>
366
+ *
254
367
* @param request The request object containing all of the parameters for the API call.
255
368
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
256
369
*/
@@ -263,6 +376,19 @@ public final Execution createExecution(CreateExecutionRequest request) {
263
376
* Creates a new execution using the latest revision of the given workflow.
264
377
*
265
378
* <p>Sample code:
379
+ *
380
+ * <pre>{@code
381
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
382
+ * CreateExecutionRequest request =
383
+ * CreateExecutionRequest.newBuilder()
384
+ * .setParent(WorkflowName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]").toString())
385
+ * .setExecution(Execution.newBuilder().build())
386
+ * .build();
387
+ * ApiFuture<Execution> future = executionsClient.createExecutionCallable().futureCall(request);
388
+ * // Do something.
389
+ * Execution response = future.get();
390
+ * }
391
+ * }</pre>
266
392
*/
267
393
public final UnaryCallable <CreateExecutionRequest , Execution > createExecutionCallable () {
268
394
return stub .createExecutionCallable ();
@@ -272,6 +398,15 @@ public final UnaryCallable<CreateExecutionRequest, Execution> createExecutionCal
272
398
/**
273
399
* Returns an execution of the given name.
274
400
*
401
+ * <p>Sample code:
402
+ *
403
+ * <pre>{@code
404
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
405
+ * ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]");
406
+ * Execution response = executionsClient.getExecution(name);
407
+ * }
408
+ * }</pre>
409
+ *
275
410
* @param name Required. Name of the execution to be retrieved. Format:
276
411
* projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
277
412
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -286,6 +421,16 @@ public final Execution getExecution(ExecutionName name) {
286
421
/**
287
422
* Returns an execution of the given name.
288
423
*
424
+ * <p>Sample code:
425
+ *
426
+ * <pre>{@code
427
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
428
+ * String name =
429
+ * ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]").toString();
430
+ * Execution response = executionsClient.getExecution(name);
431
+ * }
432
+ * }</pre>
433
+ *
289
434
* @param name Required. Name of the execution to be retrieved. Format:
290
435
* projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
291
436
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -299,6 +444,20 @@ public final Execution getExecution(String name) {
299
444
/**
300
445
* Returns an execution of the given name.
301
446
*
447
+ * <p>Sample code:
448
+ *
449
+ * <pre>{@code
450
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
451
+ * GetExecutionRequest request =
452
+ * GetExecutionRequest.newBuilder()
453
+ * .setName(
454
+ * ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
455
+ * .toString())
456
+ * .build();
457
+ * Execution response = executionsClient.getExecution(request);
458
+ * }
459
+ * }</pre>
460
+ *
302
461
* @param request The request object containing all of the parameters for the API call.
303
462
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
304
463
*/
@@ -311,6 +470,20 @@ public final Execution getExecution(GetExecutionRequest request) {
311
470
* Returns an execution of the given name.
312
471
*
313
472
* <p>Sample code:
473
+ *
474
+ * <pre>{@code
475
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
476
+ * GetExecutionRequest request =
477
+ * GetExecutionRequest.newBuilder()
478
+ * .setName(
479
+ * ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
480
+ * .toString())
481
+ * .build();
482
+ * ApiFuture<Execution> future = executionsClient.getExecutionCallable().futureCall(request);
483
+ * // Do something.
484
+ * Execution response = future.get();
485
+ * }
486
+ * }</pre>
314
487
*/
315
488
public final UnaryCallable <GetExecutionRequest , Execution > getExecutionCallable () {
316
489
return stub .getExecutionCallable ();
@@ -320,6 +493,15 @@ public final UnaryCallable<GetExecutionRequest, Execution> getExecutionCallable(
320
493
/**
321
494
* Cancels an execution of the given name.
322
495
*
496
+ * <p>Sample code:
497
+ *
498
+ * <pre>{@code
499
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
500
+ * ExecutionName name = ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]");
501
+ * Execution response = executionsClient.cancelExecution(name);
502
+ * }
503
+ * }</pre>
504
+ *
323
505
* @param name Required. Name of the execution to be cancelled. Format:
324
506
* projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
325
507
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -334,6 +516,16 @@ public final Execution cancelExecution(ExecutionName name) {
334
516
/**
335
517
* Cancels an execution of the given name.
336
518
*
519
+ * <p>Sample code:
520
+ *
521
+ * <pre>{@code
522
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
523
+ * String name =
524
+ * ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]").toString();
525
+ * Execution response = executionsClient.cancelExecution(name);
526
+ * }
527
+ * }</pre>
528
+ *
337
529
* @param name Required. Name of the execution to be cancelled. Format:
338
530
* projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
339
531
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -347,6 +539,20 @@ public final Execution cancelExecution(String name) {
347
539
/**
348
540
* Cancels an execution of the given name.
349
541
*
542
+ * <p>Sample code:
543
+ *
544
+ * <pre>{@code
545
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
546
+ * CancelExecutionRequest request =
547
+ * CancelExecutionRequest.newBuilder()
548
+ * .setName(
549
+ * ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
550
+ * .toString())
551
+ * .build();
552
+ * Execution response = executionsClient.cancelExecution(request);
553
+ * }
554
+ * }</pre>
555
+ *
350
556
* @param request The request object containing all of the parameters for the API call.
351
557
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
352
558
*/
@@ -359,6 +565,20 @@ public final Execution cancelExecution(CancelExecutionRequest request) {
359
565
* Cancels an execution of the given name.
360
566
*
361
567
* <p>Sample code:
568
+ *
569
+ * <pre>{@code
570
+ * try (ExecutionsClient executionsClient = ExecutionsClient.create()) {
571
+ * CancelExecutionRequest request =
572
+ * CancelExecutionRequest.newBuilder()
573
+ * .setName(
574
+ * ExecutionName.of("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]")
575
+ * .toString())
576
+ * .build();
577
+ * ApiFuture<Execution> future = executionsClient.cancelExecutionCallable().futureCall(request);
578
+ * // Do something.
579
+ * Execution response = future.get();
580
+ * }
581
+ * }</pre>
362
582
*/
363
583
public final UnaryCallable <CancelExecutionRequest , Execution > cancelExecutionCallable () {
364
584
return stub .cancelExecutionCallable ();
0 commit comments