1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.cloud.dataproc.v1; 18 19 import com.google.api.core.ApiFuture; 20 import com.google.api.core.ApiFutures; 21 import com.google.api.core.BetaApi; 22 import com.google.api.gax.core.BackgroundResource; 23 import com.google.api.gax.httpjson.longrunning.OperationsClient; 24 import com.google.api.gax.longrunning.OperationFuture; 25 import com.google.api.gax.paging.AbstractFixedSizeCollection; 26 import com.google.api.gax.paging.AbstractPage; 27 import com.google.api.gax.paging.AbstractPagedListResponse; 28 import com.google.api.gax.rpc.OperationCallable; 29 import com.google.api.gax.rpc.PageContext; 30 import com.google.api.gax.rpc.UnaryCallable; 31 import com.google.cloud.dataproc.v1.stub.WorkflowTemplateServiceStub; 32 import com.google.cloud.dataproc.v1.stub.WorkflowTemplateServiceStubSettings; 33 import com.google.common.util.concurrent.MoreExecutors; 34 import com.google.longrunning.Operation; 35 import com.google.protobuf.Empty; 36 import java.io.IOException; 37 import java.util.List; 38 import java.util.Map; 39 import java.util.concurrent.TimeUnit; 40 import javax.annotation.Generated; 41 42 // AUTO-GENERATED DOCUMENTATION AND CLASS. 43 /** 44 * Service Description: The API interface for managing Workflow Templates in the Dataproc API. 45 * 46 * <p>This class provides the ability to make remote calls to the backing service through method 47 * calls that map to API methods. Sample code to get started: 48 * 49 * <pre>{@code 50 * // This snippet has been automatically generated and should be regarded as a code template only. 51 * // It will require modifications to work: 52 * // - It may require correct/in-range values for request initialization. 53 * // - It may require specifying regional endpoints when creating the service client as shown in 54 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 55 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 56 * WorkflowTemplateServiceClient.create()) { 57 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 58 * WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); 59 * WorkflowTemplate response = 60 * workflowTemplateServiceClient.createWorkflowTemplate(parent, template); 61 * } 62 * }</pre> 63 * 64 * <p>Note: close() needs to be called on the WorkflowTemplateServiceClient object to clean up 65 * resources such as threads. In the example above, try-with-resources is used, which automatically 66 * calls close(). 67 * 68 * <p>The surface of this class includes several types of Java methods for each of the API's 69 * methods: 70 * 71 * <ol> 72 * <li>A "flattened" method. With this type of method, the fields of the request type have been 73 * converted into function parameters. It may be the case that not all fields are available as 74 * parameters, and not every API method will have a flattened method entry point. 75 * <li>A "request object" method. This type of method only takes one parameter, a request object, 76 * which must be constructed before the call. Not every API method will have a request object 77 * method. 78 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 79 * callable object, which can be used to initiate calls to the service. 80 * </ol> 81 * 82 * <p>See the individual methods for example code. 83 * 84 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 85 * these names, this class includes a format method for each type of name, and additionally a parse 86 * method to extract the individual identifiers contained within names that are returned. 87 * 88 * <p>This class can be customized by passing in a custom instance of 89 * WorkflowTemplateServiceSettings to create(). For example: 90 * 91 * <p>To customize credentials: 92 * 93 * <pre>{@code 94 * // This snippet has been automatically generated and should be regarded as a code template only. 95 * // It will require modifications to work: 96 * // - It may require correct/in-range values for request initialization. 97 * // - It may require specifying regional endpoints when creating the service client as shown in 98 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 99 * WorkflowTemplateServiceSettings workflowTemplateServiceSettings = 100 * WorkflowTemplateServiceSettings.newBuilder() 101 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 102 * .build(); 103 * WorkflowTemplateServiceClient workflowTemplateServiceClient = 104 * WorkflowTemplateServiceClient.create(workflowTemplateServiceSettings); 105 * }</pre> 106 * 107 * <p>To customize the endpoint: 108 * 109 * <pre>{@code 110 * // This snippet has been automatically generated and should be regarded as a code template only. 111 * // It will require modifications to work: 112 * // - It may require correct/in-range values for request initialization. 113 * // - It may require specifying regional endpoints when creating the service client as shown in 114 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 115 * WorkflowTemplateServiceSettings workflowTemplateServiceSettings = 116 * WorkflowTemplateServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); 117 * WorkflowTemplateServiceClient workflowTemplateServiceClient = 118 * WorkflowTemplateServiceClient.create(workflowTemplateServiceSettings); 119 * }</pre> 120 * 121 * <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over 122 * the wire: 123 * 124 * <pre>{@code 125 * // This snippet has been automatically generated and should be regarded as a code template only. 126 * // It will require modifications to work: 127 * // - It may require correct/in-range values for request initialization. 128 * // - It may require specifying regional endpoints when creating the service client as shown in 129 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 130 * WorkflowTemplateServiceSettings workflowTemplateServiceSettings = 131 * WorkflowTemplateServiceSettings.newHttpJsonBuilder().build(); 132 * WorkflowTemplateServiceClient workflowTemplateServiceClient = 133 * WorkflowTemplateServiceClient.create(workflowTemplateServiceSettings); 134 * }</pre> 135 * 136 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 137 */ 138 @Generated("by gapic-generator-java") 139 public class WorkflowTemplateServiceClient implements BackgroundResource { 140 private final WorkflowTemplateServiceSettings settings; 141 private final WorkflowTemplateServiceStub stub; 142 private final OperationsClient httpJsonOperationsClient; 143 private final com.google.longrunning.OperationsClient operationsClient; 144 145 /** Constructs an instance of WorkflowTemplateServiceClient with default settings. */ create()146 public static final WorkflowTemplateServiceClient create() throws IOException { 147 return create(WorkflowTemplateServiceSettings.newBuilder().build()); 148 } 149 150 /** 151 * Constructs an instance of WorkflowTemplateServiceClient, using the given settings. The channels 152 * are created based on the settings passed in, or defaults for any settings that are not set. 153 */ create(WorkflowTemplateServiceSettings settings)154 public static final WorkflowTemplateServiceClient create(WorkflowTemplateServiceSettings settings) 155 throws IOException { 156 return new WorkflowTemplateServiceClient(settings); 157 } 158 159 /** 160 * Constructs an instance of WorkflowTemplateServiceClient, using the given stub for making calls. 161 * This is for advanced usage - prefer using create(WorkflowTemplateServiceSettings). 162 */ create(WorkflowTemplateServiceStub stub)163 public static final WorkflowTemplateServiceClient create(WorkflowTemplateServiceStub stub) { 164 return new WorkflowTemplateServiceClient(stub); 165 } 166 167 /** 168 * Constructs an instance of WorkflowTemplateServiceClient, using the given settings. This is 169 * protected so that it is easy to make a subclass, but otherwise, the static factory methods 170 * should be preferred. 171 */ WorkflowTemplateServiceClient(WorkflowTemplateServiceSettings settings)172 protected WorkflowTemplateServiceClient(WorkflowTemplateServiceSettings settings) 173 throws IOException { 174 this.settings = settings; 175 this.stub = ((WorkflowTemplateServiceStubSettings) settings.getStubSettings()).createStub(); 176 this.operationsClient = 177 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 178 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 179 } 180 WorkflowTemplateServiceClient(WorkflowTemplateServiceStub stub)181 protected WorkflowTemplateServiceClient(WorkflowTemplateServiceStub stub) { 182 this.settings = null; 183 this.stub = stub; 184 this.operationsClient = 185 com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); 186 this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); 187 } 188 getSettings()189 public final WorkflowTemplateServiceSettings getSettings() { 190 return settings; 191 } 192 getStub()193 public WorkflowTemplateServiceStub getStub() { 194 return stub; 195 } 196 197 /** 198 * Returns the OperationsClient that can be used to query the status of a long-running operation 199 * returned by another API method call. 200 */ getOperationsClient()201 public final com.google.longrunning.OperationsClient getOperationsClient() { 202 return operationsClient; 203 } 204 205 /** 206 * Returns the OperationsClient that can be used to query the status of a long-running operation 207 * returned by another API method call. 208 */ 209 @BetaApi getHttpJsonOperationsClient()210 public final OperationsClient getHttpJsonOperationsClient() { 211 return httpJsonOperationsClient; 212 } 213 214 // AUTO-GENERATED DOCUMENTATION AND METHOD. 215 /** 216 * Creates new workflow template. 217 * 218 * <p>Sample code: 219 * 220 * <pre>{@code 221 * // This snippet has been automatically generated and should be regarded as a code template only. 222 * // It will require modifications to work: 223 * // - It may require correct/in-range values for request initialization. 224 * // - It may require specifying regional endpoints when creating the service client as shown in 225 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 226 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 227 * WorkflowTemplateServiceClient.create()) { 228 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 229 * WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); 230 * WorkflowTemplate response = 231 * workflowTemplateServiceClient.createWorkflowTemplate(parent, template); 232 * } 233 * }</pre> 234 * 235 * @param parent Required. The resource name of the region or location, as described in 236 * https://cloud.google.com/apis/design/resource_names. 237 * <ul> 238 * <li>For `projects.regions.workflowTemplates.create`, the resource name of the region has 239 * the following format: `projects/{project_id}/regions/{region}` 240 * </ul> 241 * <ul> 242 * <li>For `projects.locations.workflowTemplates.create`, the resource name of the location 243 * has the following format: `projects/{project_id}/locations/{location}` 244 * </ul> 245 * 246 * @param template Required. The Dataproc workflow template to create. 247 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 248 */ createWorkflowTemplate( LocationName parent, WorkflowTemplate template)249 public final WorkflowTemplate createWorkflowTemplate( 250 LocationName parent, WorkflowTemplate template) { 251 CreateWorkflowTemplateRequest request = 252 CreateWorkflowTemplateRequest.newBuilder() 253 .setParent(parent == null ? null : parent.toString()) 254 .setTemplate(template) 255 .build(); 256 return createWorkflowTemplate(request); 257 } 258 259 // AUTO-GENERATED DOCUMENTATION AND METHOD. 260 /** 261 * Creates new workflow template. 262 * 263 * <p>Sample code: 264 * 265 * <pre>{@code 266 * // This snippet has been automatically generated and should be regarded as a code template only. 267 * // It will require modifications to work: 268 * // - It may require correct/in-range values for request initialization. 269 * // - It may require specifying regional endpoints when creating the service client as shown in 270 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 271 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 272 * WorkflowTemplateServiceClient.create()) { 273 * RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); 274 * WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); 275 * WorkflowTemplate response = 276 * workflowTemplateServiceClient.createWorkflowTemplate(parent, template); 277 * } 278 * }</pre> 279 * 280 * @param parent Required. The resource name of the region or location, as described in 281 * https://cloud.google.com/apis/design/resource_names. 282 * <ul> 283 * <li>For `projects.regions.workflowTemplates.create`, the resource name of the region has 284 * the following format: `projects/{project_id}/regions/{region}` 285 * </ul> 286 * <ul> 287 * <li>For `projects.locations.workflowTemplates.create`, the resource name of the location 288 * has the following format: `projects/{project_id}/locations/{location}` 289 * </ul> 290 * 291 * @param template Required. The Dataproc workflow template to create. 292 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 293 */ createWorkflowTemplate( RegionName parent, WorkflowTemplate template)294 public final WorkflowTemplate createWorkflowTemplate( 295 RegionName parent, WorkflowTemplate template) { 296 CreateWorkflowTemplateRequest request = 297 CreateWorkflowTemplateRequest.newBuilder() 298 .setParent(parent == null ? null : parent.toString()) 299 .setTemplate(template) 300 .build(); 301 return createWorkflowTemplate(request); 302 } 303 304 // AUTO-GENERATED DOCUMENTATION AND METHOD. 305 /** 306 * Creates new workflow template. 307 * 308 * <p>Sample code: 309 * 310 * <pre>{@code 311 * // This snippet has been automatically generated and should be regarded as a code template only. 312 * // It will require modifications to work: 313 * // - It may require correct/in-range values for request initialization. 314 * // - It may require specifying regional endpoints when creating the service client as shown in 315 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 316 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 317 * WorkflowTemplateServiceClient.create()) { 318 * String parent = RegionName.of("[PROJECT]", "[REGION]").toString(); 319 * WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); 320 * WorkflowTemplate response = 321 * workflowTemplateServiceClient.createWorkflowTemplate(parent, template); 322 * } 323 * }</pre> 324 * 325 * @param parent Required. The resource name of the region or location, as described in 326 * https://cloud.google.com/apis/design/resource_names. 327 * <ul> 328 * <li>For `projects.regions.workflowTemplates.create`, the resource name of the region has 329 * the following format: `projects/{project_id}/regions/{region}` 330 * </ul> 331 * <ul> 332 * <li>For `projects.locations.workflowTemplates.create`, the resource name of the location 333 * has the following format: `projects/{project_id}/locations/{location}` 334 * </ul> 335 * 336 * @param template Required. The Dataproc workflow template to create. 337 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 338 */ createWorkflowTemplate(String parent, WorkflowTemplate template)339 public final WorkflowTemplate createWorkflowTemplate(String parent, WorkflowTemplate template) { 340 CreateWorkflowTemplateRequest request = 341 CreateWorkflowTemplateRequest.newBuilder().setParent(parent).setTemplate(template).build(); 342 return createWorkflowTemplate(request); 343 } 344 345 // AUTO-GENERATED DOCUMENTATION AND METHOD. 346 /** 347 * Creates new workflow template. 348 * 349 * <p>Sample code: 350 * 351 * <pre>{@code 352 * // This snippet has been automatically generated and should be regarded as a code template only. 353 * // It will require modifications to work: 354 * // - It may require correct/in-range values for request initialization. 355 * // - It may require specifying regional endpoints when creating the service client as shown in 356 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 357 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 358 * WorkflowTemplateServiceClient.create()) { 359 * CreateWorkflowTemplateRequest request = 360 * CreateWorkflowTemplateRequest.newBuilder() 361 * .setParent(RegionName.of("[PROJECT]", "[REGION]").toString()) 362 * .setTemplate(WorkflowTemplate.newBuilder().build()) 363 * .build(); 364 * WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(request); 365 * } 366 * }</pre> 367 * 368 * @param request The request object containing all of the parameters for the API call. 369 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 370 */ createWorkflowTemplate(CreateWorkflowTemplateRequest request)371 public final WorkflowTemplate createWorkflowTemplate(CreateWorkflowTemplateRequest request) { 372 return createWorkflowTemplateCallable().call(request); 373 } 374 375 // AUTO-GENERATED DOCUMENTATION AND METHOD. 376 /** 377 * Creates new workflow template. 378 * 379 * <p>Sample code: 380 * 381 * <pre>{@code 382 * // This snippet has been automatically generated and should be regarded as a code template only. 383 * // It will require modifications to work: 384 * // - It may require correct/in-range values for request initialization. 385 * // - It may require specifying regional endpoints when creating the service client as shown in 386 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 387 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 388 * WorkflowTemplateServiceClient.create()) { 389 * CreateWorkflowTemplateRequest request = 390 * CreateWorkflowTemplateRequest.newBuilder() 391 * .setParent(RegionName.of("[PROJECT]", "[REGION]").toString()) 392 * .setTemplate(WorkflowTemplate.newBuilder().build()) 393 * .build(); 394 * ApiFuture<WorkflowTemplate> future = 395 * workflowTemplateServiceClient.createWorkflowTemplateCallable().futureCall(request); 396 * // Do something. 397 * WorkflowTemplate response = future.get(); 398 * } 399 * }</pre> 400 */ 401 public final UnaryCallable<CreateWorkflowTemplateRequest, WorkflowTemplate> createWorkflowTemplateCallable()402 createWorkflowTemplateCallable() { 403 return stub.createWorkflowTemplateCallable(); 404 } 405 406 // AUTO-GENERATED DOCUMENTATION AND METHOD. 407 /** 408 * Retrieves the latest workflow template. 409 * 410 * <p>Can retrieve previously instantiated template by specifying optional version parameter. 411 * 412 * <p>Sample code: 413 * 414 * <pre>{@code 415 * // This snippet has been automatically generated and should be regarded as a code template only. 416 * // It will require modifications to work: 417 * // - It may require correct/in-range values for request initialization. 418 * // - It may require specifying regional endpoints when creating the service client as shown in 419 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 420 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 421 * WorkflowTemplateServiceClient.create()) { 422 * WorkflowTemplateName name = 423 * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( 424 * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]"); 425 * WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(name); 426 * } 427 * }</pre> 428 * 429 * @param name Required. The resource name of the workflow template, as described in 430 * https://cloud.google.com/apis/design/resource_names. 431 * <ul> 432 * <li>For `projects.regions.workflowTemplates.get`, the resource name of the template has 433 * the following format: 434 * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` 435 * </ul> 436 * <ul> 437 * <li>For `projects.locations.workflowTemplates.get`, the resource name of the template has 438 * the following format: 439 * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` 440 * </ul> 441 * 442 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 443 */ getWorkflowTemplate(WorkflowTemplateName name)444 public final WorkflowTemplate getWorkflowTemplate(WorkflowTemplateName name) { 445 GetWorkflowTemplateRequest request = 446 GetWorkflowTemplateRequest.newBuilder() 447 .setName(name == null ? null : name.toString()) 448 .build(); 449 return getWorkflowTemplate(request); 450 } 451 452 // AUTO-GENERATED DOCUMENTATION AND METHOD. 453 /** 454 * Retrieves the latest workflow template. 455 * 456 * <p>Can retrieve previously instantiated template by specifying optional version parameter. 457 * 458 * <p>Sample code: 459 * 460 * <pre>{@code 461 * // This snippet has been automatically generated and should be regarded as a code template only. 462 * // It will require modifications to work: 463 * // - It may require correct/in-range values for request initialization. 464 * // - It may require specifying regional endpoints when creating the service client as shown in 465 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 466 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 467 * WorkflowTemplateServiceClient.create()) { 468 * String name = 469 * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( 470 * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") 471 * .toString(); 472 * WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(name); 473 * } 474 * }</pre> 475 * 476 * @param name Required. The resource name of the workflow template, as described in 477 * https://cloud.google.com/apis/design/resource_names. 478 * <ul> 479 * <li>For `projects.regions.workflowTemplates.get`, the resource name of the template has 480 * the following format: 481 * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` 482 * </ul> 483 * <ul> 484 * <li>For `projects.locations.workflowTemplates.get`, the resource name of the template has 485 * the following format: 486 * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` 487 * </ul> 488 * 489 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 490 */ getWorkflowTemplate(String name)491 public final WorkflowTemplate getWorkflowTemplate(String name) { 492 GetWorkflowTemplateRequest request = 493 GetWorkflowTemplateRequest.newBuilder().setName(name).build(); 494 return getWorkflowTemplate(request); 495 } 496 497 // AUTO-GENERATED DOCUMENTATION AND METHOD. 498 /** 499 * Retrieves the latest workflow template. 500 * 501 * <p>Can retrieve previously instantiated template by specifying optional version parameter. 502 * 503 * <p>Sample code: 504 * 505 * <pre>{@code 506 * // This snippet has been automatically generated and should be regarded as a code template only. 507 * // It will require modifications to work: 508 * // - It may require correct/in-range values for request initialization. 509 * // - It may require specifying regional endpoints when creating the service client as shown in 510 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 511 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 512 * WorkflowTemplateServiceClient.create()) { 513 * GetWorkflowTemplateRequest request = 514 * GetWorkflowTemplateRequest.newBuilder() 515 * .setName( 516 * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( 517 * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") 518 * .toString()) 519 * .setVersion(351608024) 520 * .build(); 521 * WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(request); 522 * } 523 * }</pre> 524 * 525 * @param request The request object containing all of the parameters for the API call. 526 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 527 */ getWorkflowTemplate(GetWorkflowTemplateRequest request)528 public final WorkflowTemplate getWorkflowTemplate(GetWorkflowTemplateRequest request) { 529 return getWorkflowTemplateCallable().call(request); 530 } 531 532 // AUTO-GENERATED DOCUMENTATION AND METHOD. 533 /** 534 * Retrieves the latest workflow template. 535 * 536 * <p>Can retrieve previously instantiated template by specifying optional version parameter. 537 * 538 * <p>Sample code: 539 * 540 * <pre>{@code 541 * // This snippet has been automatically generated and should be regarded as a code template only. 542 * // It will require modifications to work: 543 * // - It may require correct/in-range values for request initialization. 544 * // - It may require specifying regional endpoints when creating the service client as shown in 545 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 546 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 547 * WorkflowTemplateServiceClient.create()) { 548 * GetWorkflowTemplateRequest request = 549 * GetWorkflowTemplateRequest.newBuilder() 550 * .setName( 551 * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( 552 * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") 553 * .toString()) 554 * .setVersion(351608024) 555 * .build(); 556 * ApiFuture<WorkflowTemplate> future = 557 * workflowTemplateServiceClient.getWorkflowTemplateCallable().futureCall(request); 558 * // Do something. 559 * WorkflowTemplate response = future.get(); 560 * } 561 * }</pre> 562 */ 563 public final UnaryCallable<GetWorkflowTemplateRequest, WorkflowTemplate> getWorkflowTemplateCallable()564 getWorkflowTemplateCallable() { 565 return stub.getWorkflowTemplateCallable(); 566 } 567 568 // AUTO-GENERATED DOCUMENTATION AND METHOD. 569 /** 570 * Instantiates a template and begins execution. 571 * 572 * <p>The returned Operation can be used to track execution of workflow by polling 573 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 574 * entire workflow is finished. 575 * 576 * <p>The running workflow can be aborted via 577 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 578 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 579 * 580 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 581 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 582 * Also see [Using 583 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 584 * 585 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 586 * be [Empty][google.protobuf.Empty]. 587 * 588 * <p>Sample code: 589 * 590 * <pre>{@code 591 * // This snippet has been automatically generated and should be regarded as a code template only. 592 * // It will require modifications to work: 593 * // - It may require correct/in-range values for request initialization. 594 * // - It may require specifying regional endpoints when creating the service client as shown in 595 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 596 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 597 * WorkflowTemplateServiceClient.create()) { 598 * WorkflowTemplateName name = 599 * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( 600 * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]"); 601 * workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name).get(); 602 * } 603 * }</pre> 604 * 605 * @param name Required. The resource name of the workflow template, as described in 606 * https://cloud.google.com/apis/design/resource_names. 607 * <ul> 608 * <li>For `projects.regions.workflowTemplates.instantiate`, the resource name of the 609 * template has the following format: 610 * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` 611 * </ul> 612 * <ul> 613 * <li>For `projects.locations.workflowTemplates.instantiate`, the resource name of the 614 * template has the following format: 615 * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` 616 * </ul> 617 * 618 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 619 */ instantiateWorkflowTemplateAsync( WorkflowTemplateName name)620 public final OperationFuture<Empty, WorkflowMetadata> instantiateWorkflowTemplateAsync( 621 WorkflowTemplateName name) { 622 InstantiateWorkflowTemplateRequest request = 623 InstantiateWorkflowTemplateRequest.newBuilder() 624 .setName(name == null ? null : name.toString()) 625 .build(); 626 return instantiateWorkflowTemplateAsync(request); 627 } 628 629 // AUTO-GENERATED DOCUMENTATION AND METHOD. 630 /** 631 * Instantiates a template and begins execution. 632 * 633 * <p>The returned Operation can be used to track execution of workflow by polling 634 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 635 * entire workflow is finished. 636 * 637 * <p>The running workflow can be aborted via 638 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 639 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 640 * 641 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 642 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 643 * Also see [Using 644 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 645 * 646 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 647 * be [Empty][google.protobuf.Empty]. 648 * 649 * <p>Sample code: 650 * 651 * <pre>{@code 652 * // This snippet has been automatically generated and should be regarded as a code template only. 653 * // It will require modifications to work: 654 * // - It may require correct/in-range values for request initialization. 655 * // - It may require specifying regional endpoints when creating the service client as shown in 656 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 657 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 658 * WorkflowTemplateServiceClient.create()) { 659 * String name = 660 * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( 661 * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") 662 * .toString(); 663 * workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name).get(); 664 * } 665 * }</pre> 666 * 667 * @param name Required. The resource name of the workflow template, as described in 668 * https://cloud.google.com/apis/design/resource_names. 669 * <ul> 670 * <li>For `projects.regions.workflowTemplates.instantiate`, the resource name of the 671 * template has the following format: 672 * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` 673 * </ul> 674 * <ul> 675 * <li>For `projects.locations.workflowTemplates.instantiate`, the resource name of the 676 * template has the following format: 677 * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` 678 * </ul> 679 * 680 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 681 */ instantiateWorkflowTemplateAsync( String name)682 public final OperationFuture<Empty, WorkflowMetadata> instantiateWorkflowTemplateAsync( 683 String name) { 684 InstantiateWorkflowTemplateRequest request = 685 InstantiateWorkflowTemplateRequest.newBuilder().setName(name).build(); 686 return instantiateWorkflowTemplateAsync(request); 687 } 688 689 // AUTO-GENERATED DOCUMENTATION AND METHOD. 690 /** 691 * Instantiates a template and begins execution. 692 * 693 * <p>The returned Operation can be used to track execution of workflow by polling 694 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 695 * entire workflow is finished. 696 * 697 * <p>The running workflow can be aborted via 698 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 699 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 700 * 701 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 702 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 703 * Also see [Using 704 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 705 * 706 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 707 * be [Empty][google.protobuf.Empty]. 708 * 709 * <p>Sample code: 710 * 711 * <pre>{@code 712 * // This snippet has been automatically generated and should be regarded as a code template only. 713 * // It will require modifications to work: 714 * // - It may require correct/in-range values for request initialization. 715 * // - It may require specifying regional endpoints when creating the service client as shown in 716 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 717 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 718 * WorkflowTemplateServiceClient.create()) { 719 * WorkflowTemplateName name = 720 * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( 721 * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]"); 722 * Map<String, String> parameters = new HashMap<>(); 723 * workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name, parameters).get(); 724 * } 725 * }</pre> 726 * 727 * @param name Required. The resource name of the workflow template, as described in 728 * https://cloud.google.com/apis/design/resource_names. 729 * <ul> 730 * <li>For `projects.regions.workflowTemplates.instantiate`, the resource name of the 731 * template has the following format: 732 * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` 733 * </ul> 734 * <ul> 735 * <li>For `projects.locations.workflowTemplates.instantiate`, the resource name of the 736 * template has the following format: 737 * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` 738 * </ul> 739 * 740 * @param parameters Optional. Map from parameter names to values that should be used for those 741 * parameters. Values may not exceed 1000 characters. 742 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 743 */ instantiateWorkflowTemplateAsync( WorkflowTemplateName name, Map<String, String> parameters)744 public final OperationFuture<Empty, WorkflowMetadata> instantiateWorkflowTemplateAsync( 745 WorkflowTemplateName name, Map<String, String> parameters) { 746 InstantiateWorkflowTemplateRequest request = 747 InstantiateWorkflowTemplateRequest.newBuilder() 748 .setName(name == null ? null : name.toString()) 749 .putAllParameters(parameters) 750 .build(); 751 return instantiateWorkflowTemplateAsync(request); 752 } 753 754 // AUTO-GENERATED DOCUMENTATION AND METHOD. 755 /** 756 * Instantiates a template and begins execution. 757 * 758 * <p>The returned Operation can be used to track execution of workflow by polling 759 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 760 * entire workflow is finished. 761 * 762 * <p>The running workflow can be aborted via 763 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 764 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 765 * 766 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 767 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 768 * Also see [Using 769 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 770 * 771 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 772 * be [Empty][google.protobuf.Empty]. 773 * 774 * <p>Sample code: 775 * 776 * <pre>{@code 777 * // This snippet has been automatically generated and should be regarded as a code template only. 778 * // It will require modifications to work: 779 * // - It may require correct/in-range values for request initialization. 780 * // - It may require specifying regional endpoints when creating the service client as shown in 781 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 782 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 783 * WorkflowTemplateServiceClient.create()) { 784 * String name = 785 * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( 786 * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") 787 * .toString(); 788 * Map<String, String> parameters = new HashMap<>(); 789 * workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name, parameters).get(); 790 * } 791 * }</pre> 792 * 793 * @param name Required. The resource name of the workflow template, as described in 794 * https://cloud.google.com/apis/design/resource_names. 795 * <ul> 796 * <li>For `projects.regions.workflowTemplates.instantiate`, the resource name of the 797 * template has the following format: 798 * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` 799 * </ul> 800 * <ul> 801 * <li>For `projects.locations.workflowTemplates.instantiate`, the resource name of the 802 * template has the following format: 803 * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` 804 * </ul> 805 * 806 * @param parameters Optional. Map from parameter names to values that should be used for those 807 * parameters. Values may not exceed 1000 characters. 808 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 809 */ instantiateWorkflowTemplateAsync( String name, Map<String, String> parameters)810 public final OperationFuture<Empty, WorkflowMetadata> instantiateWorkflowTemplateAsync( 811 String name, Map<String, String> parameters) { 812 InstantiateWorkflowTemplateRequest request = 813 InstantiateWorkflowTemplateRequest.newBuilder() 814 .setName(name) 815 .putAllParameters(parameters) 816 .build(); 817 return instantiateWorkflowTemplateAsync(request); 818 } 819 820 // AUTO-GENERATED DOCUMENTATION AND METHOD. 821 /** 822 * Instantiates a template and begins execution. 823 * 824 * <p>The returned Operation can be used to track execution of workflow by polling 825 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 826 * entire workflow is finished. 827 * 828 * <p>The running workflow can be aborted via 829 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 830 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 831 * 832 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 833 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 834 * Also see [Using 835 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 836 * 837 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 838 * be [Empty][google.protobuf.Empty]. 839 * 840 * <p>Sample code: 841 * 842 * <pre>{@code 843 * // This snippet has been automatically generated and should be regarded as a code template only. 844 * // It will require modifications to work: 845 * // - It may require correct/in-range values for request initialization. 846 * // - It may require specifying regional endpoints when creating the service client as shown in 847 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 848 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 849 * WorkflowTemplateServiceClient.create()) { 850 * InstantiateWorkflowTemplateRequest request = 851 * InstantiateWorkflowTemplateRequest.newBuilder() 852 * .setName( 853 * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( 854 * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") 855 * .toString()) 856 * .setVersion(351608024) 857 * .setRequestId("requestId693933066") 858 * .putAllParameters(new HashMap<String, String>()) 859 * .build(); 860 * workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(request).get(); 861 * } 862 * }</pre> 863 * 864 * @param request The request object containing all of the parameters for the API call. 865 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 866 */ instantiateWorkflowTemplateAsync( InstantiateWorkflowTemplateRequest request)867 public final OperationFuture<Empty, WorkflowMetadata> instantiateWorkflowTemplateAsync( 868 InstantiateWorkflowTemplateRequest request) { 869 return instantiateWorkflowTemplateOperationCallable().futureCall(request); 870 } 871 872 // AUTO-GENERATED DOCUMENTATION AND METHOD. 873 /** 874 * Instantiates a template and begins execution. 875 * 876 * <p>The returned Operation can be used to track execution of workflow by polling 877 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 878 * entire workflow is finished. 879 * 880 * <p>The running workflow can be aborted via 881 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 882 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 883 * 884 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 885 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 886 * Also see [Using 887 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 888 * 889 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 890 * be [Empty][google.protobuf.Empty]. 891 * 892 * <p>Sample code: 893 * 894 * <pre>{@code 895 * // This snippet has been automatically generated and should be regarded as a code template only. 896 * // It will require modifications to work: 897 * // - It may require correct/in-range values for request initialization. 898 * // - It may require specifying regional endpoints when creating the service client as shown in 899 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 900 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 901 * WorkflowTemplateServiceClient.create()) { 902 * InstantiateWorkflowTemplateRequest request = 903 * InstantiateWorkflowTemplateRequest.newBuilder() 904 * .setName( 905 * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( 906 * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") 907 * .toString()) 908 * .setVersion(351608024) 909 * .setRequestId("requestId693933066") 910 * .putAllParameters(new HashMap<String, String>()) 911 * .build(); 912 * OperationFuture<Empty, WorkflowMetadata> future = 913 * workflowTemplateServiceClient 914 * .instantiateWorkflowTemplateOperationCallable() 915 * .futureCall(request); 916 * // Do something. 917 * future.get(); 918 * } 919 * }</pre> 920 */ 921 public final OperationCallable<InstantiateWorkflowTemplateRequest, Empty, WorkflowMetadata> instantiateWorkflowTemplateOperationCallable()922 instantiateWorkflowTemplateOperationCallable() { 923 return stub.instantiateWorkflowTemplateOperationCallable(); 924 } 925 926 // AUTO-GENERATED DOCUMENTATION AND METHOD. 927 /** 928 * Instantiates a template and begins execution. 929 * 930 * <p>The returned Operation can be used to track execution of workflow by polling 931 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 932 * entire workflow is finished. 933 * 934 * <p>The running workflow can be aborted via 935 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 936 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 937 * 938 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 939 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 940 * Also see [Using 941 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 942 * 943 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 944 * be [Empty][google.protobuf.Empty]. 945 * 946 * <p>Sample code: 947 * 948 * <pre>{@code 949 * // This snippet has been automatically generated and should be regarded as a code template only. 950 * // It will require modifications to work: 951 * // - It may require correct/in-range values for request initialization. 952 * // - It may require specifying regional endpoints when creating the service client as shown in 953 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 954 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 955 * WorkflowTemplateServiceClient.create()) { 956 * InstantiateWorkflowTemplateRequest request = 957 * InstantiateWorkflowTemplateRequest.newBuilder() 958 * .setName( 959 * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( 960 * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") 961 * .toString()) 962 * .setVersion(351608024) 963 * .setRequestId("requestId693933066") 964 * .putAllParameters(new HashMap<String, String>()) 965 * .build(); 966 * ApiFuture<Operation> future = 967 * workflowTemplateServiceClient.instantiateWorkflowTemplateCallable().futureCall(request); 968 * // Do something. 969 * future.get(); 970 * } 971 * }</pre> 972 */ 973 public final UnaryCallable<InstantiateWorkflowTemplateRequest, Operation> instantiateWorkflowTemplateCallable()974 instantiateWorkflowTemplateCallable() { 975 return stub.instantiateWorkflowTemplateCallable(); 976 } 977 978 // AUTO-GENERATED DOCUMENTATION AND METHOD. 979 /** 980 * Instantiates a template and begins execution. 981 * 982 * <p>This method is equivalent to executing the sequence 983 * [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], 984 * [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], 985 * [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]. 986 * 987 * <p>The returned Operation can be used to track execution of workflow by polling 988 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 989 * entire workflow is finished. 990 * 991 * <p>The running workflow can be aborted via 992 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 993 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 994 * 995 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 996 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 997 * Also see [Using 998 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 999 * 1000 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 1001 * be [Empty][google.protobuf.Empty]. 1002 * 1003 * <p>Sample code: 1004 * 1005 * <pre>{@code 1006 * // This snippet has been automatically generated and should be regarded as a code template only. 1007 * // It will require modifications to work: 1008 * // - It may require correct/in-range values for request initialization. 1009 * // - It may require specifying regional endpoints when creating the service client as shown in 1010 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1011 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1012 * WorkflowTemplateServiceClient.create()) { 1013 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 1014 * WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); 1015 * workflowTemplateServiceClient.instantiateInlineWorkflowTemplateAsync(parent, template).get(); 1016 * } 1017 * }</pre> 1018 * 1019 * @param parent Required. The resource name of the region or location, as described in 1020 * https://cloud.google.com/apis/design/resource_names. 1021 * <ul> 1022 * <li>For `projects.regions.workflowTemplates,instantiateinline`, the resource name of the 1023 * region has the following format: `projects/{project_id}/regions/{region}` 1024 * </ul> 1025 * <ul> 1026 * <li>For `projects.locations.workflowTemplates.instantiateinline`, the resource name of 1027 * the location has the following format: `projects/{project_id}/locations/{location}` 1028 * </ul> 1029 * 1030 * @param template Required. The workflow template to instantiate. 1031 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1032 */ instantiateInlineWorkflowTemplateAsync( LocationName parent, WorkflowTemplate template)1033 public final OperationFuture<Empty, WorkflowMetadata> instantiateInlineWorkflowTemplateAsync( 1034 LocationName parent, WorkflowTemplate template) { 1035 InstantiateInlineWorkflowTemplateRequest request = 1036 InstantiateInlineWorkflowTemplateRequest.newBuilder() 1037 .setParent(parent == null ? null : parent.toString()) 1038 .setTemplate(template) 1039 .build(); 1040 return instantiateInlineWorkflowTemplateAsync(request); 1041 } 1042 1043 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1044 /** 1045 * Instantiates a template and begins execution. 1046 * 1047 * <p>This method is equivalent to executing the sequence 1048 * [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], 1049 * [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], 1050 * [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]. 1051 * 1052 * <p>The returned Operation can be used to track execution of workflow by polling 1053 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 1054 * entire workflow is finished. 1055 * 1056 * <p>The running workflow can be aborted via 1057 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 1058 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 1059 * 1060 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 1061 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 1062 * Also see [Using 1063 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 1064 * 1065 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 1066 * be [Empty][google.protobuf.Empty]. 1067 * 1068 * <p>Sample code: 1069 * 1070 * <pre>{@code 1071 * // This snippet has been automatically generated and should be regarded as a code template only. 1072 * // It will require modifications to work: 1073 * // - It may require correct/in-range values for request initialization. 1074 * // - It may require specifying regional endpoints when creating the service client as shown in 1075 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1076 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1077 * WorkflowTemplateServiceClient.create()) { 1078 * RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); 1079 * WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); 1080 * workflowTemplateServiceClient.instantiateInlineWorkflowTemplateAsync(parent, template).get(); 1081 * } 1082 * }</pre> 1083 * 1084 * @param parent Required. The resource name of the region or location, as described in 1085 * https://cloud.google.com/apis/design/resource_names. 1086 * <ul> 1087 * <li>For `projects.regions.workflowTemplates,instantiateinline`, the resource name of the 1088 * region has the following format: `projects/{project_id}/regions/{region}` 1089 * </ul> 1090 * <ul> 1091 * <li>For `projects.locations.workflowTemplates.instantiateinline`, the resource name of 1092 * the location has the following format: `projects/{project_id}/locations/{location}` 1093 * </ul> 1094 * 1095 * @param template Required. The workflow template to instantiate. 1096 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1097 */ instantiateInlineWorkflowTemplateAsync( RegionName parent, WorkflowTemplate template)1098 public final OperationFuture<Empty, WorkflowMetadata> instantiateInlineWorkflowTemplateAsync( 1099 RegionName parent, WorkflowTemplate template) { 1100 InstantiateInlineWorkflowTemplateRequest request = 1101 InstantiateInlineWorkflowTemplateRequest.newBuilder() 1102 .setParent(parent == null ? null : parent.toString()) 1103 .setTemplate(template) 1104 .build(); 1105 return instantiateInlineWorkflowTemplateAsync(request); 1106 } 1107 1108 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1109 /** 1110 * Instantiates a template and begins execution. 1111 * 1112 * <p>This method is equivalent to executing the sequence 1113 * [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], 1114 * [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], 1115 * [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]. 1116 * 1117 * <p>The returned Operation can be used to track execution of workflow by polling 1118 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 1119 * entire workflow is finished. 1120 * 1121 * <p>The running workflow can be aborted via 1122 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 1123 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 1124 * 1125 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 1126 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 1127 * Also see [Using 1128 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 1129 * 1130 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 1131 * be [Empty][google.protobuf.Empty]. 1132 * 1133 * <p>Sample code: 1134 * 1135 * <pre>{@code 1136 * // This snippet has been automatically generated and should be regarded as a code template only. 1137 * // It will require modifications to work: 1138 * // - It may require correct/in-range values for request initialization. 1139 * // - It may require specifying regional endpoints when creating the service client as shown in 1140 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1141 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1142 * WorkflowTemplateServiceClient.create()) { 1143 * String parent = RegionName.of("[PROJECT]", "[REGION]").toString(); 1144 * WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); 1145 * workflowTemplateServiceClient.instantiateInlineWorkflowTemplateAsync(parent, template).get(); 1146 * } 1147 * }</pre> 1148 * 1149 * @param parent Required. The resource name of the region or location, as described in 1150 * https://cloud.google.com/apis/design/resource_names. 1151 * <ul> 1152 * <li>For `projects.regions.workflowTemplates,instantiateinline`, the resource name of the 1153 * region has the following format: `projects/{project_id}/regions/{region}` 1154 * </ul> 1155 * <ul> 1156 * <li>For `projects.locations.workflowTemplates.instantiateinline`, the resource name of 1157 * the location has the following format: `projects/{project_id}/locations/{location}` 1158 * </ul> 1159 * 1160 * @param template Required. The workflow template to instantiate. 1161 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1162 */ instantiateInlineWorkflowTemplateAsync( String parent, WorkflowTemplate template)1163 public final OperationFuture<Empty, WorkflowMetadata> instantiateInlineWorkflowTemplateAsync( 1164 String parent, WorkflowTemplate template) { 1165 InstantiateInlineWorkflowTemplateRequest request = 1166 InstantiateInlineWorkflowTemplateRequest.newBuilder() 1167 .setParent(parent) 1168 .setTemplate(template) 1169 .build(); 1170 return instantiateInlineWorkflowTemplateAsync(request); 1171 } 1172 1173 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1174 /** 1175 * Instantiates a template and begins execution. 1176 * 1177 * <p>This method is equivalent to executing the sequence 1178 * [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], 1179 * [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], 1180 * [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]. 1181 * 1182 * <p>The returned Operation can be used to track execution of workflow by polling 1183 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 1184 * entire workflow is finished. 1185 * 1186 * <p>The running workflow can be aborted via 1187 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 1188 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 1189 * 1190 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 1191 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 1192 * Also see [Using 1193 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 1194 * 1195 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 1196 * be [Empty][google.protobuf.Empty]. 1197 * 1198 * <p>Sample code: 1199 * 1200 * <pre>{@code 1201 * // This snippet has been automatically generated and should be regarded as a code template only. 1202 * // It will require modifications to work: 1203 * // - It may require correct/in-range values for request initialization. 1204 * // - It may require specifying regional endpoints when creating the service client as shown in 1205 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1206 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1207 * WorkflowTemplateServiceClient.create()) { 1208 * InstantiateInlineWorkflowTemplateRequest request = 1209 * InstantiateInlineWorkflowTemplateRequest.newBuilder() 1210 * .setParent(RegionName.of("[PROJECT]", "[REGION]").toString()) 1211 * .setTemplate(WorkflowTemplate.newBuilder().build()) 1212 * .setRequestId("requestId693933066") 1213 * .build(); 1214 * workflowTemplateServiceClient.instantiateInlineWorkflowTemplateAsync(request).get(); 1215 * } 1216 * }</pre> 1217 * 1218 * @param request The request object containing all of the parameters for the API call. 1219 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1220 */ instantiateInlineWorkflowTemplateAsync( InstantiateInlineWorkflowTemplateRequest request)1221 public final OperationFuture<Empty, WorkflowMetadata> instantiateInlineWorkflowTemplateAsync( 1222 InstantiateInlineWorkflowTemplateRequest request) { 1223 return instantiateInlineWorkflowTemplateOperationCallable().futureCall(request); 1224 } 1225 1226 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1227 /** 1228 * Instantiates a template and begins execution. 1229 * 1230 * <p>This method is equivalent to executing the sequence 1231 * [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], 1232 * [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], 1233 * [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]. 1234 * 1235 * <p>The returned Operation can be used to track execution of workflow by polling 1236 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 1237 * entire workflow is finished. 1238 * 1239 * <p>The running workflow can be aborted via 1240 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 1241 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 1242 * 1243 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 1244 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 1245 * Also see [Using 1246 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 1247 * 1248 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 1249 * be [Empty][google.protobuf.Empty]. 1250 * 1251 * <p>Sample code: 1252 * 1253 * <pre>{@code 1254 * // This snippet has been automatically generated and should be regarded as a code template only. 1255 * // It will require modifications to work: 1256 * // - It may require correct/in-range values for request initialization. 1257 * // - It may require specifying regional endpoints when creating the service client as shown in 1258 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1259 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1260 * WorkflowTemplateServiceClient.create()) { 1261 * InstantiateInlineWorkflowTemplateRequest request = 1262 * InstantiateInlineWorkflowTemplateRequest.newBuilder() 1263 * .setParent(RegionName.of("[PROJECT]", "[REGION]").toString()) 1264 * .setTemplate(WorkflowTemplate.newBuilder().build()) 1265 * .setRequestId("requestId693933066") 1266 * .build(); 1267 * OperationFuture<Empty, WorkflowMetadata> future = 1268 * workflowTemplateServiceClient 1269 * .instantiateInlineWorkflowTemplateOperationCallable() 1270 * .futureCall(request); 1271 * // Do something. 1272 * future.get(); 1273 * } 1274 * }</pre> 1275 */ 1276 public final OperationCallable<InstantiateInlineWorkflowTemplateRequest, Empty, WorkflowMetadata> instantiateInlineWorkflowTemplateOperationCallable()1277 instantiateInlineWorkflowTemplateOperationCallable() { 1278 return stub.instantiateInlineWorkflowTemplateOperationCallable(); 1279 } 1280 1281 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1282 /** 1283 * Instantiates a template and begins execution. 1284 * 1285 * <p>This method is equivalent to executing the sequence 1286 * [CreateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.CreateWorkflowTemplate], 1287 * [InstantiateWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.InstantiateWorkflowTemplate], 1288 * [DeleteWorkflowTemplate][google.cloud.dataproc.v1.WorkflowTemplateService.DeleteWorkflowTemplate]. 1289 * 1290 * <p>The returned Operation can be used to track execution of workflow by polling 1291 * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when 1292 * entire workflow is finished. 1293 * 1294 * <p>The running workflow can be aborted via 1295 * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any 1296 * inflight jobs to be cancelled and workflow-owned clusters to be deleted. 1297 * 1298 * <p>The [Operation.metadata][google.longrunning.Operation.metadata] will be 1299 * [WorkflowMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#workflowmetadata). 1300 * Also see [Using 1301 * WorkflowMetadata](https://cloud.google.com/dataproc/docs/concepts/workflows/debugging#using_workflowmetadata). 1302 * 1303 * <p>On successful completion, [Operation.response][google.longrunning.Operation.response] will 1304 * be [Empty][google.protobuf.Empty]. 1305 * 1306 * <p>Sample code: 1307 * 1308 * <pre>{@code 1309 * // This snippet has been automatically generated and should be regarded as a code template only. 1310 * // It will require modifications to work: 1311 * // - It may require correct/in-range values for request initialization. 1312 * // - It may require specifying regional endpoints when creating the service client as shown in 1313 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1314 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1315 * WorkflowTemplateServiceClient.create()) { 1316 * InstantiateInlineWorkflowTemplateRequest request = 1317 * InstantiateInlineWorkflowTemplateRequest.newBuilder() 1318 * .setParent(RegionName.of("[PROJECT]", "[REGION]").toString()) 1319 * .setTemplate(WorkflowTemplate.newBuilder().build()) 1320 * .setRequestId("requestId693933066") 1321 * .build(); 1322 * ApiFuture<Operation> future = 1323 * workflowTemplateServiceClient 1324 * .instantiateInlineWorkflowTemplateCallable() 1325 * .futureCall(request); 1326 * // Do something. 1327 * future.get(); 1328 * } 1329 * }</pre> 1330 */ 1331 public final UnaryCallable<InstantiateInlineWorkflowTemplateRequest, Operation> instantiateInlineWorkflowTemplateCallable()1332 instantiateInlineWorkflowTemplateCallable() { 1333 return stub.instantiateInlineWorkflowTemplateCallable(); 1334 } 1335 1336 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1337 /** 1338 * Updates (replaces) workflow template. The updated template must contain version that matches 1339 * the current server version. 1340 * 1341 * <p>Sample code: 1342 * 1343 * <pre>{@code 1344 * // This snippet has been automatically generated and should be regarded as a code template only. 1345 * // It will require modifications to work: 1346 * // - It may require correct/in-range values for request initialization. 1347 * // - It may require specifying regional endpoints when creating the service client as shown in 1348 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1349 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1350 * WorkflowTemplateServiceClient.create()) { 1351 * WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); 1352 * WorkflowTemplate response = workflowTemplateServiceClient.updateWorkflowTemplate(template); 1353 * } 1354 * }</pre> 1355 * 1356 * @param template Required. The updated workflow template. 1357 * <p>The `template.version` field must match the current version. 1358 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1359 */ updateWorkflowTemplate(WorkflowTemplate template)1360 public final WorkflowTemplate updateWorkflowTemplate(WorkflowTemplate template) { 1361 UpdateWorkflowTemplateRequest request = 1362 UpdateWorkflowTemplateRequest.newBuilder().setTemplate(template).build(); 1363 return updateWorkflowTemplate(request); 1364 } 1365 1366 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1367 /** 1368 * Updates (replaces) workflow template. The updated template must contain version that matches 1369 * the current server version. 1370 * 1371 * <p>Sample code: 1372 * 1373 * <pre>{@code 1374 * // This snippet has been automatically generated and should be regarded as a code template only. 1375 * // It will require modifications to work: 1376 * // - It may require correct/in-range values for request initialization. 1377 * // - It may require specifying regional endpoints when creating the service client as shown in 1378 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1379 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1380 * WorkflowTemplateServiceClient.create()) { 1381 * UpdateWorkflowTemplateRequest request = 1382 * UpdateWorkflowTemplateRequest.newBuilder() 1383 * .setTemplate(WorkflowTemplate.newBuilder().build()) 1384 * .build(); 1385 * WorkflowTemplate response = workflowTemplateServiceClient.updateWorkflowTemplate(request); 1386 * } 1387 * }</pre> 1388 * 1389 * @param request The request object containing all of the parameters for the API call. 1390 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1391 */ updateWorkflowTemplate(UpdateWorkflowTemplateRequest request)1392 public final WorkflowTemplate updateWorkflowTemplate(UpdateWorkflowTemplateRequest request) { 1393 return updateWorkflowTemplateCallable().call(request); 1394 } 1395 1396 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1397 /** 1398 * Updates (replaces) workflow template. The updated template must contain version that matches 1399 * the current server version. 1400 * 1401 * <p>Sample code: 1402 * 1403 * <pre>{@code 1404 * // This snippet has been automatically generated and should be regarded as a code template only. 1405 * // It will require modifications to work: 1406 * // - It may require correct/in-range values for request initialization. 1407 * // - It may require specifying regional endpoints when creating the service client as shown in 1408 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1409 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1410 * WorkflowTemplateServiceClient.create()) { 1411 * UpdateWorkflowTemplateRequest request = 1412 * UpdateWorkflowTemplateRequest.newBuilder() 1413 * .setTemplate(WorkflowTemplate.newBuilder().build()) 1414 * .build(); 1415 * ApiFuture<WorkflowTemplate> future = 1416 * workflowTemplateServiceClient.updateWorkflowTemplateCallable().futureCall(request); 1417 * // Do something. 1418 * WorkflowTemplate response = future.get(); 1419 * } 1420 * }</pre> 1421 */ 1422 public final UnaryCallable<UpdateWorkflowTemplateRequest, WorkflowTemplate> updateWorkflowTemplateCallable()1423 updateWorkflowTemplateCallable() { 1424 return stub.updateWorkflowTemplateCallable(); 1425 } 1426 1427 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1428 /** 1429 * Lists workflows that match the specified filter in the request. 1430 * 1431 * <p>Sample code: 1432 * 1433 * <pre>{@code 1434 * // This snippet has been automatically generated and should be regarded as a code template only. 1435 * // It will require modifications to work: 1436 * // - It may require correct/in-range values for request initialization. 1437 * // - It may require specifying regional endpoints when creating the service client as shown in 1438 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1439 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1440 * WorkflowTemplateServiceClient.create()) { 1441 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 1442 * for (WorkflowTemplate element : 1443 * workflowTemplateServiceClient.listWorkflowTemplates(parent).iterateAll()) { 1444 * // doThingsWith(element); 1445 * } 1446 * } 1447 * }</pre> 1448 * 1449 * @param parent Required. The resource name of the region or location, as described in 1450 * https://cloud.google.com/apis/design/resource_names. 1451 * <ul> 1452 * <li>For `projects.regions.workflowTemplates,list`, the resource name of the region has 1453 * the following format: `projects/{project_id}/regions/{region}` 1454 * </ul> 1455 * <ul> 1456 * <li>For `projects.locations.workflowTemplates.list`, the resource name of the location 1457 * has the following format: `projects/{project_id}/locations/{location}` 1458 * </ul> 1459 * 1460 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1461 */ listWorkflowTemplates(LocationName parent)1462 public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(LocationName parent) { 1463 ListWorkflowTemplatesRequest request = 1464 ListWorkflowTemplatesRequest.newBuilder() 1465 .setParent(parent == null ? null : parent.toString()) 1466 .build(); 1467 return listWorkflowTemplates(request); 1468 } 1469 1470 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1471 /** 1472 * Lists workflows that match the specified filter in the request. 1473 * 1474 * <p>Sample code: 1475 * 1476 * <pre>{@code 1477 * // This snippet has been automatically generated and should be regarded as a code template only. 1478 * // It will require modifications to work: 1479 * // - It may require correct/in-range values for request initialization. 1480 * // - It may require specifying regional endpoints when creating the service client as shown in 1481 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1482 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1483 * WorkflowTemplateServiceClient.create()) { 1484 * RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); 1485 * for (WorkflowTemplate element : 1486 * workflowTemplateServiceClient.listWorkflowTemplates(parent).iterateAll()) { 1487 * // doThingsWith(element); 1488 * } 1489 * } 1490 * }</pre> 1491 * 1492 * @param parent Required. The resource name of the region or location, as described in 1493 * https://cloud.google.com/apis/design/resource_names. 1494 * <ul> 1495 * <li>For `projects.regions.workflowTemplates,list`, the resource name of the region has 1496 * the following format: `projects/{project_id}/regions/{region}` 1497 * </ul> 1498 * <ul> 1499 * <li>For `projects.locations.workflowTemplates.list`, the resource name of the location 1500 * has the following format: `projects/{project_id}/locations/{location}` 1501 * </ul> 1502 * 1503 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1504 */ listWorkflowTemplates(RegionName parent)1505 public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(RegionName parent) { 1506 ListWorkflowTemplatesRequest request = 1507 ListWorkflowTemplatesRequest.newBuilder() 1508 .setParent(parent == null ? null : parent.toString()) 1509 .build(); 1510 return listWorkflowTemplates(request); 1511 } 1512 1513 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1514 /** 1515 * Lists workflows that match the specified filter in the request. 1516 * 1517 * <p>Sample code: 1518 * 1519 * <pre>{@code 1520 * // This snippet has been automatically generated and should be regarded as a code template only. 1521 * // It will require modifications to work: 1522 * // - It may require correct/in-range values for request initialization. 1523 * // - It may require specifying regional endpoints when creating the service client as shown in 1524 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1525 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1526 * WorkflowTemplateServiceClient.create()) { 1527 * String parent = RegionName.of("[PROJECT]", "[REGION]").toString(); 1528 * for (WorkflowTemplate element : 1529 * workflowTemplateServiceClient.listWorkflowTemplates(parent).iterateAll()) { 1530 * // doThingsWith(element); 1531 * } 1532 * } 1533 * }</pre> 1534 * 1535 * @param parent Required. The resource name of the region or location, as described in 1536 * https://cloud.google.com/apis/design/resource_names. 1537 * <ul> 1538 * <li>For `projects.regions.workflowTemplates,list`, the resource name of the region has 1539 * the following format: `projects/{project_id}/regions/{region}` 1540 * </ul> 1541 * <ul> 1542 * <li>For `projects.locations.workflowTemplates.list`, the resource name of the location 1543 * has the following format: `projects/{project_id}/locations/{location}` 1544 * </ul> 1545 * 1546 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1547 */ listWorkflowTemplates(String parent)1548 public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(String parent) { 1549 ListWorkflowTemplatesRequest request = 1550 ListWorkflowTemplatesRequest.newBuilder().setParent(parent).build(); 1551 return listWorkflowTemplates(request); 1552 } 1553 1554 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1555 /** 1556 * Lists workflows that match the specified filter in the request. 1557 * 1558 * <p>Sample code: 1559 * 1560 * <pre>{@code 1561 * // This snippet has been automatically generated and should be regarded as a code template only. 1562 * // It will require modifications to work: 1563 * // - It may require correct/in-range values for request initialization. 1564 * // - It may require specifying regional endpoints when creating the service client as shown in 1565 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1566 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1567 * WorkflowTemplateServiceClient.create()) { 1568 * ListWorkflowTemplatesRequest request = 1569 * ListWorkflowTemplatesRequest.newBuilder() 1570 * .setParent(RegionName.of("[PROJECT]", "[REGION]").toString()) 1571 * .setPageSize(883849137) 1572 * .setPageToken("pageToken873572522") 1573 * .build(); 1574 * for (WorkflowTemplate element : 1575 * workflowTemplateServiceClient.listWorkflowTemplates(request).iterateAll()) { 1576 * // doThingsWith(element); 1577 * } 1578 * } 1579 * }</pre> 1580 * 1581 * @param request The request object containing all of the parameters for the API call. 1582 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1583 */ listWorkflowTemplates( ListWorkflowTemplatesRequest request)1584 public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates( 1585 ListWorkflowTemplatesRequest request) { 1586 return listWorkflowTemplatesPagedCallable().call(request); 1587 } 1588 1589 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1590 /** 1591 * Lists workflows that match the specified filter in the request. 1592 * 1593 * <p>Sample code: 1594 * 1595 * <pre>{@code 1596 * // This snippet has been automatically generated and should be regarded as a code template only. 1597 * // It will require modifications to work: 1598 * // - It may require correct/in-range values for request initialization. 1599 * // - It may require specifying regional endpoints when creating the service client as shown in 1600 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1601 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1602 * WorkflowTemplateServiceClient.create()) { 1603 * ListWorkflowTemplatesRequest request = 1604 * ListWorkflowTemplatesRequest.newBuilder() 1605 * .setParent(RegionName.of("[PROJECT]", "[REGION]").toString()) 1606 * .setPageSize(883849137) 1607 * .setPageToken("pageToken873572522") 1608 * .build(); 1609 * ApiFuture<WorkflowTemplate> future = 1610 * workflowTemplateServiceClient.listWorkflowTemplatesPagedCallable().futureCall(request); 1611 * // Do something. 1612 * for (WorkflowTemplate element : future.get().iterateAll()) { 1613 * // doThingsWith(element); 1614 * } 1615 * } 1616 * }</pre> 1617 */ 1618 public final UnaryCallable<ListWorkflowTemplatesRequest, ListWorkflowTemplatesPagedResponse> listWorkflowTemplatesPagedCallable()1619 listWorkflowTemplatesPagedCallable() { 1620 return stub.listWorkflowTemplatesPagedCallable(); 1621 } 1622 1623 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1624 /** 1625 * Lists workflows that match the specified filter in the request. 1626 * 1627 * <p>Sample code: 1628 * 1629 * <pre>{@code 1630 * // This snippet has been automatically generated and should be regarded as a code template only. 1631 * // It will require modifications to work: 1632 * // - It may require correct/in-range values for request initialization. 1633 * // - It may require specifying regional endpoints when creating the service client as shown in 1634 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1635 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1636 * WorkflowTemplateServiceClient.create()) { 1637 * ListWorkflowTemplatesRequest request = 1638 * ListWorkflowTemplatesRequest.newBuilder() 1639 * .setParent(RegionName.of("[PROJECT]", "[REGION]").toString()) 1640 * .setPageSize(883849137) 1641 * .setPageToken("pageToken873572522") 1642 * .build(); 1643 * while (true) { 1644 * ListWorkflowTemplatesResponse response = 1645 * workflowTemplateServiceClient.listWorkflowTemplatesCallable().call(request); 1646 * for (WorkflowTemplate element : response.getTemplatesList()) { 1647 * // doThingsWith(element); 1648 * } 1649 * String nextPageToken = response.getNextPageToken(); 1650 * if (!Strings.isNullOrEmpty(nextPageToken)) { 1651 * request = request.toBuilder().setPageToken(nextPageToken).build(); 1652 * } else { 1653 * break; 1654 * } 1655 * } 1656 * } 1657 * }</pre> 1658 */ 1659 public final UnaryCallable<ListWorkflowTemplatesRequest, ListWorkflowTemplatesResponse> listWorkflowTemplatesCallable()1660 listWorkflowTemplatesCallable() { 1661 return stub.listWorkflowTemplatesCallable(); 1662 } 1663 1664 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1665 /** 1666 * Deletes a workflow template. It does not cancel in-progress workflows. 1667 * 1668 * <p>Sample code: 1669 * 1670 * <pre>{@code 1671 * // This snippet has been automatically generated and should be regarded as a code template only. 1672 * // It will require modifications to work: 1673 * // - It may require correct/in-range values for request initialization. 1674 * // - It may require specifying regional endpoints when creating the service client as shown in 1675 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1676 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1677 * WorkflowTemplateServiceClient.create()) { 1678 * WorkflowTemplateName name = 1679 * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( 1680 * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]"); 1681 * workflowTemplateServiceClient.deleteWorkflowTemplate(name); 1682 * } 1683 * }</pre> 1684 * 1685 * @param name Required. The resource name of the workflow template, as described in 1686 * https://cloud.google.com/apis/design/resource_names. 1687 * <ul> 1688 * <li>For `projects.regions.workflowTemplates.delete`, the resource name of the template 1689 * has the following format: 1690 * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` 1691 * </ul> 1692 * <ul> 1693 * <li>For `projects.locations.workflowTemplates.instantiate`, the resource name of the 1694 * template has the following format: 1695 * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` 1696 * </ul> 1697 * 1698 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1699 */ deleteWorkflowTemplate(WorkflowTemplateName name)1700 public final void deleteWorkflowTemplate(WorkflowTemplateName name) { 1701 DeleteWorkflowTemplateRequest request = 1702 DeleteWorkflowTemplateRequest.newBuilder() 1703 .setName(name == null ? null : name.toString()) 1704 .build(); 1705 deleteWorkflowTemplate(request); 1706 } 1707 1708 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1709 /** 1710 * Deletes a workflow template. It does not cancel in-progress workflows. 1711 * 1712 * <p>Sample code: 1713 * 1714 * <pre>{@code 1715 * // This snippet has been automatically generated and should be regarded as a code template only. 1716 * // It will require modifications to work: 1717 * // - It may require correct/in-range values for request initialization. 1718 * // - It may require specifying regional endpoints when creating the service client as shown in 1719 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1720 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1721 * WorkflowTemplateServiceClient.create()) { 1722 * String name = 1723 * WorkflowTemplateName.ofProjectRegionWorkflowTemplateName( 1724 * "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]") 1725 * .toString(); 1726 * workflowTemplateServiceClient.deleteWorkflowTemplate(name); 1727 * } 1728 * }</pre> 1729 * 1730 * @param name Required. The resource name of the workflow template, as described in 1731 * https://cloud.google.com/apis/design/resource_names. 1732 * <ul> 1733 * <li>For `projects.regions.workflowTemplates.delete`, the resource name of the template 1734 * has the following format: 1735 * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` 1736 * </ul> 1737 * <ul> 1738 * <li>For `projects.locations.workflowTemplates.instantiate`, the resource name of the 1739 * template has the following format: 1740 * `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` 1741 * </ul> 1742 * 1743 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1744 */ deleteWorkflowTemplate(String name)1745 public final void deleteWorkflowTemplate(String name) { 1746 DeleteWorkflowTemplateRequest request = 1747 DeleteWorkflowTemplateRequest.newBuilder().setName(name).build(); 1748 deleteWorkflowTemplate(request); 1749 } 1750 1751 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1752 /** 1753 * Deletes a workflow template. It does not cancel in-progress workflows. 1754 * 1755 * <p>Sample code: 1756 * 1757 * <pre>{@code 1758 * // This snippet has been automatically generated and should be regarded as a code template only. 1759 * // It will require modifications to work: 1760 * // - It may require correct/in-range values for request initialization. 1761 * // - It may require specifying regional endpoints when creating the service client as shown in 1762 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1763 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1764 * WorkflowTemplateServiceClient.create()) { 1765 * DeleteWorkflowTemplateRequest request = 1766 * DeleteWorkflowTemplateRequest.newBuilder() 1767 * .setName( 1768 * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( 1769 * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") 1770 * .toString()) 1771 * .setVersion(351608024) 1772 * .build(); 1773 * workflowTemplateServiceClient.deleteWorkflowTemplate(request); 1774 * } 1775 * }</pre> 1776 * 1777 * @param request The request object containing all of the parameters for the API call. 1778 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1779 */ deleteWorkflowTemplate(DeleteWorkflowTemplateRequest request)1780 public final void deleteWorkflowTemplate(DeleteWorkflowTemplateRequest request) { 1781 deleteWorkflowTemplateCallable().call(request); 1782 } 1783 1784 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1785 /** 1786 * Deletes a workflow template. It does not cancel in-progress workflows. 1787 * 1788 * <p>Sample code: 1789 * 1790 * <pre>{@code 1791 * // This snippet has been automatically generated and should be regarded as a code template only. 1792 * // It will require modifications to work: 1793 * // - It may require correct/in-range values for request initialization. 1794 * // - It may require specifying regional endpoints when creating the service client as shown in 1795 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1796 * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = 1797 * WorkflowTemplateServiceClient.create()) { 1798 * DeleteWorkflowTemplateRequest request = 1799 * DeleteWorkflowTemplateRequest.newBuilder() 1800 * .setName( 1801 * WorkflowTemplateName.ofProjectLocationWorkflowTemplateName( 1802 * "[PROJECT]", "[LOCATION]", "[WORKFLOW_TEMPLATE]") 1803 * .toString()) 1804 * .setVersion(351608024) 1805 * .build(); 1806 * ApiFuture<Empty> future = 1807 * workflowTemplateServiceClient.deleteWorkflowTemplateCallable().futureCall(request); 1808 * // Do something. 1809 * future.get(); 1810 * } 1811 * }</pre> 1812 */ 1813 public final UnaryCallable<DeleteWorkflowTemplateRequest, Empty> deleteWorkflowTemplateCallable()1814 deleteWorkflowTemplateCallable() { 1815 return stub.deleteWorkflowTemplateCallable(); 1816 } 1817 1818 @Override close()1819 public final void close() { 1820 stub.close(); 1821 } 1822 1823 @Override shutdown()1824 public void shutdown() { 1825 stub.shutdown(); 1826 } 1827 1828 @Override isShutdown()1829 public boolean isShutdown() { 1830 return stub.isShutdown(); 1831 } 1832 1833 @Override isTerminated()1834 public boolean isTerminated() { 1835 return stub.isTerminated(); 1836 } 1837 1838 @Override shutdownNow()1839 public void shutdownNow() { 1840 stub.shutdownNow(); 1841 } 1842 1843 @Override awaitTermination(long duration, TimeUnit unit)1844 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 1845 return stub.awaitTermination(duration, unit); 1846 } 1847 1848 public static class ListWorkflowTemplatesPagedResponse 1849 extends AbstractPagedListResponse< 1850 ListWorkflowTemplatesRequest, 1851 ListWorkflowTemplatesResponse, 1852 WorkflowTemplate, 1853 ListWorkflowTemplatesPage, 1854 ListWorkflowTemplatesFixedSizeCollection> { 1855 createAsync( PageContext<ListWorkflowTemplatesRequest, ListWorkflowTemplatesResponse, WorkflowTemplate> context, ApiFuture<ListWorkflowTemplatesResponse> futureResponse)1856 public static ApiFuture<ListWorkflowTemplatesPagedResponse> createAsync( 1857 PageContext<ListWorkflowTemplatesRequest, ListWorkflowTemplatesResponse, WorkflowTemplate> 1858 context, 1859 ApiFuture<ListWorkflowTemplatesResponse> futureResponse) { 1860 ApiFuture<ListWorkflowTemplatesPage> futurePage = 1861 ListWorkflowTemplatesPage.createEmptyPage().createPageAsync(context, futureResponse); 1862 return ApiFutures.transform( 1863 futurePage, 1864 input -> new ListWorkflowTemplatesPagedResponse(input), 1865 MoreExecutors.directExecutor()); 1866 } 1867 ListWorkflowTemplatesPagedResponse(ListWorkflowTemplatesPage page)1868 private ListWorkflowTemplatesPagedResponse(ListWorkflowTemplatesPage page) { 1869 super(page, ListWorkflowTemplatesFixedSizeCollection.createEmptyCollection()); 1870 } 1871 } 1872 1873 public static class ListWorkflowTemplatesPage 1874 extends AbstractPage< 1875 ListWorkflowTemplatesRequest, 1876 ListWorkflowTemplatesResponse, 1877 WorkflowTemplate, 1878 ListWorkflowTemplatesPage> { 1879 ListWorkflowTemplatesPage( PageContext<ListWorkflowTemplatesRequest, ListWorkflowTemplatesResponse, WorkflowTemplate> context, ListWorkflowTemplatesResponse response)1880 private ListWorkflowTemplatesPage( 1881 PageContext<ListWorkflowTemplatesRequest, ListWorkflowTemplatesResponse, WorkflowTemplate> 1882 context, 1883 ListWorkflowTemplatesResponse response) { 1884 super(context, response); 1885 } 1886 createEmptyPage()1887 private static ListWorkflowTemplatesPage createEmptyPage() { 1888 return new ListWorkflowTemplatesPage(null, null); 1889 } 1890 1891 @Override createPage( PageContext<ListWorkflowTemplatesRequest, ListWorkflowTemplatesResponse, WorkflowTemplate> context, ListWorkflowTemplatesResponse response)1892 protected ListWorkflowTemplatesPage createPage( 1893 PageContext<ListWorkflowTemplatesRequest, ListWorkflowTemplatesResponse, WorkflowTemplate> 1894 context, 1895 ListWorkflowTemplatesResponse response) { 1896 return new ListWorkflowTemplatesPage(context, response); 1897 } 1898 1899 @Override createPageAsync( PageContext<ListWorkflowTemplatesRequest, ListWorkflowTemplatesResponse, WorkflowTemplate> context, ApiFuture<ListWorkflowTemplatesResponse> futureResponse)1900 public ApiFuture<ListWorkflowTemplatesPage> createPageAsync( 1901 PageContext<ListWorkflowTemplatesRequest, ListWorkflowTemplatesResponse, WorkflowTemplate> 1902 context, 1903 ApiFuture<ListWorkflowTemplatesResponse> futureResponse) { 1904 return super.createPageAsync(context, futureResponse); 1905 } 1906 } 1907 1908 public static class ListWorkflowTemplatesFixedSizeCollection 1909 extends AbstractFixedSizeCollection< 1910 ListWorkflowTemplatesRequest, 1911 ListWorkflowTemplatesResponse, 1912 WorkflowTemplate, 1913 ListWorkflowTemplatesPage, 1914 ListWorkflowTemplatesFixedSizeCollection> { 1915 ListWorkflowTemplatesFixedSizeCollection( List<ListWorkflowTemplatesPage> pages, int collectionSize)1916 private ListWorkflowTemplatesFixedSizeCollection( 1917 List<ListWorkflowTemplatesPage> pages, int collectionSize) { 1918 super(pages, collectionSize); 1919 } 1920 createEmptyCollection()1921 private static ListWorkflowTemplatesFixedSizeCollection createEmptyCollection() { 1922 return new ListWorkflowTemplatesFixedSizeCollection(null, 0); 1923 } 1924 1925 @Override createCollection( List<ListWorkflowTemplatesPage> pages, int collectionSize)1926 protected ListWorkflowTemplatesFixedSizeCollection createCollection( 1927 List<ListWorkflowTemplatesPage> pages, int collectionSize) { 1928 return new ListWorkflowTemplatesFixedSizeCollection(pages, collectionSize); 1929 } 1930 } 1931 } 1932