From c0f21dd811166848a60f810565a5614bb9c7f47e Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Sat, 8 Dec 2018 00:38:57 -0800 Subject: [PATCH] Regenerate dataproc client --- .../v1/WorkflowTemplateServiceClient.java | 283 +++++++++++++++--- .../cloud/dataproc/v1/package-info.java | 4 +- .../WorkflowTemplateServiceClient.java | 231 +++++++++++--- .../cloud/dataproc/v1beta2/package-info.java | 4 +- .../v1/WorkflowTemplateServiceClientTest.java | 77 +++-- .../WorkflowTemplateServiceClientTest.java | 63 ++-- .../google-cloud-dataproc/synth.metadata | 41 ++- 7 files changed, 541 insertions(+), 162 deletions(-) diff --git a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClient.java b/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClient.java index 02f37191880d..1eb41bf19bf2 100644 --- a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClient.java +++ b/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClient.java @@ -48,9 +48,9 @@ *
  * 
  * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
- *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+ *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
  *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
- *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(formattedParent, template);
+ *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
  * }
  * 
  * 
@@ -182,9 +182,40 @@ public final OperationsClient getOperationsClient() { * *

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
+   *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
+   *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
+   * }
+   * 
+ * + * @param parent Required. The "resource name" of the region, as described in + * https://cloud.google.com/apis/design/resource_names of the form + * `projects/{project_id}/regions/{region}` + * @param template Required. The Dataproc workflow template to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final WorkflowTemplate createWorkflowTemplate( + RegionName parent, WorkflowTemplate template) { + + CreateWorkflowTemplateRequest request = + CreateWorkflowTemplateRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setTemplate(template) + .build(); + return createWorkflowTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates new workflow template. + * + *

Sample code: + * + *


+   * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
-   *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(formattedParent, template);
+   *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(parent.toString(), template);
    * }
    * 
* @@ -209,10 +240,10 @@ public final WorkflowTemplate createWorkflowTemplate(String parent, WorkflowTemp * *

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
    *   CreateWorkflowTemplateRequest request = CreateWorkflowTemplateRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setTemplate(template)
    *     .build();
    *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(request);
@@ -234,10 +265,10 @@ public final WorkflowTemplate createWorkflowTemplate(CreateWorkflowTemplateReque
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
    *   CreateWorkflowTemplateRequest request = CreateWorkflowTemplateRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setTemplate(template)
    *     .build();
    *   ApiFuture<WorkflowTemplate> future = workflowTemplateServiceClient.createWorkflowTemplateCallable().futureCall(request);
@@ -261,8 +292,37 @@ public final WorkflowTemplate createWorkflowTemplate(CreateWorkflowTemplateReque
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
-   *   WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(formattedName);
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(name);
+   * }
+   * 
+ * + * @param name Required. The "resource name" of the workflow template, as described in + * https://cloud.google.com/apis/design/resource_names of the form + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final WorkflowTemplate getWorkflowTemplate(WorkflowTemplateName name) { + + GetWorkflowTemplateRequest request = + GetWorkflowTemplateRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getWorkflowTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the latest workflow template. + * + *

Can retrieve previously instantiated template by specifying optional version parameter. + * + *

Sample code: + * + *


+   * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(name.toString());
    * }
    * 
* @@ -288,9 +348,9 @@ public final WorkflowTemplate getWorkflowTemplate(String name) { * *

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   GetWorkflowTemplateRequest request = GetWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(request);
    * }
@@ -313,9 +373,9 @@ public final WorkflowTemplate getWorkflowTemplate(GetWorkflowTemplateRequest req
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   GetWorkflowTemplateRequest request = GetWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<WorkflowTemplate> future = workflowTemplateServiceClient.getWorkflowTemplateCallable().futureCall(request);
    *   // Do something
@@ -350,8 +410,52 @@ public final WorkflowTemplate getWorkflowTemplate(GetWorkflowTemplateRequest req
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
-   *   Empty response = workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(formattedName).get();
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   Empty response = workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name).get();
+   * }
+   * 
+ * + * @param name Required. The "resource name" of the workflow template, as described in + * https://cloud.google.com/apis/design/resource_names of the form + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture instantiateWorkflowTemplateAsync( + WorkflowTemplateName name) { + + InstantiateWorkflowTemplateRequest request = + InstantiateWorkflowTemplateRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return instantiateWorkflowTemplateAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Instantiates a template and begins execution. + * + *

The returned Operation can be used to track execution of workflow by polling + * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when + * entire workflow is finished. + * + *

The running workflow can be aborted via + * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any + * inflight jobs to be cancelled and workflow-owned clusters to be deleted. + * + *

The [Operation.metadata][google.longrunning.Operation.metadata] will be + * [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata]. + * + *

On successful completion, [Operation.response][google.longrunning.Operation.response] will + * be [Empty][google.protobuf.Empty]. + * + *

Sample code: + * + *


+   * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   Empty response = workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name.toString()).get();
    * }
    * 
* @@ -392,9 +496,57 @@ public final OperationFuture instantiateWorkflowTemplat * *

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   Map<String, String> parameters = new HashMap<>();
+   *   Empty response = workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name, parameters).get();
+   * }
+   * 
+ * + * @param name Required. The "resource name" of the workflow template, as described in + * https://cloud.google.com/apis/design/resource_names of the form + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * @param parameters Optional. Map from parameter names to values that should be used for those + * parameters. Values may not exceed 100 characters. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture instantiateWorkflowTemplateAsync( + WorkflowTemplateName name, Map parameters) { + + InstantiateWorkflowTemplateRequest request = + InstantiateWorkflowTemplateRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .putAllParameters(parameters) + .build(); + return instantiateWorkflowTemplateAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Instantiates a template and begins execution. + * + *

The returned Operation can be used to track execution of workflow by polling + * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when + * entire workflow is finished. + * + *

The running workflow can be aborted via + * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any + * inflight jobs to be cancelled and workflow-owned clusters to be deleted. + * + *

The [Operation.metadata][google.longrunning.Operation.metadata] will be + * [WorkflowMetadata][google.cloud.dataproc.v1.WorkflowMetadata]. + * + *

On successful completion, [Operation.response][google.longrunning.Operation.response] will + * be [Empty][google.protobuf.Empty]. + * + *

Sample code: + * + *


+   * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   Map<String, String> parameters = new HashMap<>();
-   *   Empty response = workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(formattedName, parameters).get();
+   *   Empty response = workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name.toString(), parameters).get();
    * }
    * 
* @@ -440,9 +592,9 @@ public final OperationFuture instantiateWorkflowTemplat * *

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   InstantiateWorkflowTemplateRequest request = InstantiateWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   Empty response = workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(request).get();
    * }
@@ -480,9 +632,9 @@ public final OperationFuture instantiateWorkflowTemplat
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   InstantiateWorkflowTemplateRequest request = InstantiateWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   OperationFuture<Operation> future = workflowTemplateServiceClient.instantiateWorkflowTemplateOperationCallable().futureCall(request);
    *   // Do something
@@ -518,9 +670,9 @@ public final OperationFuture instantiateWorkflowTemplat
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   InstantiateWorkflowTemplateRequest request = InstantiateWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Operation> future = workflowTemplateServiceClient.instantiateWorkflowTemplateCallable().futureCall(request);
    *   // Do something
@@ -802,8 +954,36 @@ public final WorkflowTemplate updateWorkflowTemplate(UpdateWorkflowTemplateReque
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
-   *   for (WorkflowTemplate element : workflowTemplateServiceClient.listWorkflowTemplates(formattedParent).iterateAll()) {
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
+   *   for (WorkflowTemplate element : workflowTemplateServiceClient.listWorkflowTemplates(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The "resource name" of the region, as described in + * https://cloud.google.com/apis/design/resource_names of the form + * `projects/{project_id}/regions/{region}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(RegionName parent) { + ListWorkflowTemplatesRequest request = + ListWorkflowTemplatesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listWorkflowTemplates(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists workflows that match the specified filter in the request. + * + *

Sample code: + * + *


+   * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
+   *   for (WorkflowTemplate element : workflowTemplateServiceClient.listWorkflowTemplates(parent.toString()).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
@@ -828,9 +1008,9 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(String par
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   ListWorkflowTemplatesRequest request = ListWorkflowTemplatesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   for (WorkflowTemplate element : workflowTemplateServiceClient.listWorkflowTemplates(request).iterateAll()) {
    *     // doThingsWith(element);
@@ -854,9 +1034,9 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   ListWorkflowTemplatesRequest request = ListWorkflowTemplatesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   ApiFuture<ListWorkflowTemplatesPagedResponse> future = workflowTemplateServiceClient.listWorkflowTemplatesPagedCallable().futureCall(request);
    *   // Do something
@@ -879,9 +1059,9 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   ListWorkflowTemplatesRequest request = ListWorkflowTemplatesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   while (true) {
    *     ListWorkflowTemplatesResponse response = workflowTemplateServiceClient.listWorkflowTemplatesCallable().call(request);
@@ -911,8 +1091,35 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
-   *   workflowTemplateServiceClient.deleteWorkflowTemplate(formattedName);
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   workflowTemplateServiceClient.deleteWorkflowTemplate(name);
+   * }
+   * 
+ * + * @param name Required. The "resource name" of the workflow template, as described in + * https://cloud.google.com/apis/design/resource_names of the form + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteWorkflowTemplate(WorkflowTemplateName name) { + + DeleteWorkflowTemplateRequest request = + DeleteWorkflowTemplateRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteWorkflowTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a workflow template. It does not cancel in-progress workflows. + * + *

Sample code: + * + *


+   * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   workflowTemplateServiceClient.deleteWorkflowTemplate(name.toString());
    * }
    * 
* @@ -936,9 +1143,9 @@ public final void deleteWorkflowTemplate(String name) { * *

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   DeleteWorkflowTemplateRequest request = DeleteWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   workflowTemplateServiceClient.deleteWorkflowTemplate(request);
    * }
@@ -959,9 +1166,9 @@ public final void deleteWorkflowTemplate(DeleteWorkflowTemplateRequest request)
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   DeleteWorkflowTemplateRequest request = DeleteWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Void> future = workflowTemplateServiceClient.deleteWorkflowTemplateCallable().futureCall(request);
    *   // Do something
diff --git a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/package-info.java b/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/package-info.java
index 17f90816b57d..f457fd43a683 100644
--- a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/package-info.java
+++ b/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/package-info.java
@@ -64,9 +64,9 @@
  * 
  * 
  * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
- *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+ *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
  *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
- *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(formattedParent, template);
+ *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
  * }
  * 
  * 
diff --git a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1beta2/WorkflowTemplateServiceClient.java b/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1beta2/WorkflowTemplateServiceClient.java index 30d95f80d705..bcd58a2308f5 100644 --- a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1beta2/WorkflowTemplateServiceClient.java +++ b/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1beta2/WorkflowTemplateServiceClient.java @@ -48,9 +48,9 @@ *
  * 
  * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
- *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+ *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
  *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
- *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(formattedParent, template);
+ *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
  * }
  * 
  * 
@@ -182,9 +182,40 @@ public final OperationsClient getOperationsClient() { * *

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
-   *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(formattedParent, template);
+   *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
+   * }
+   * 
+ * + * @param parent Required. The "resource name" of the region, as described in + * https://cloud.google.com/apis/design/resource_names of the form + * `projects/{project_id}/regions/{region}` + * @param template Required. The Dataproc workflow template to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final WorkflowTemplate createWorkflowTemplate( + RegionName parent, WorkflowTemplate template) { + + CreateWorkflowTemplateRequest request = + CreateWorkflowTemplateRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setTemplate(template) + .build(); + return createWorkflowTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates new workflow template. + * + *

Sample code: + * + *


+   * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
+   *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
+   *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(parent.toString(), template);
    * }
    * 
* @@ -209,10 +240,10 @@ public final WorkflowTemplate createWorkflowTemplate(String parent, WorkflowTemp * *

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
    *   CreateWorkflowTemplateRequest request = CreateWorkflowTemplateRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setTemplate(template)
    *     .build();
    *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(request);
@@ -234,10 +265,10 @@ public final WorkflowTemplate createWorkflowTemplate(CreateWorkflowTemplateReque
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
    *   CreateWorkflowTemplateRequest request = CreateWorkflowTemplateRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .setTemplate(template)
    *     .build();
    *   ApiFuture<WorkflowTemplate> future = workflowTemplateServiceClient.createWorkflowTemplateCallable().futureCall(request);
@@ -261,8 +292,37 @@ public final WorkflowTemplate createWorkflowTemplate(CreateWorkflowTemplateReque
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
-   *   WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(formattedName);
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(name);
+   * }
+   * 
+ * + * @param name Required. The "resource name" of the workflow template, as described in + * https://cloud.google.com/apis/design/resource_names of the form + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final WorkflowTemplate getWorkflowTemplate(WorkflowTemplateName name) { + + GetWorkflowTemplateRequest request = + GetWorkflowTemplateRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getWorkflowTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Retrieves the latest workflow template. + * + *

Can retrieve previously instantiated template by specifying optional version parameter. + * + *

Sample code: + * + *


+   * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(name.toString());
    * }
    * 
* @@ -288,9 +348,9 @@ public final WorkflowTemplate getWorkflowTemplate(String name) { * *

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   GetWorkflowTemplateRequest request = GetWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(request);
    * }
@@ -313,9 +373,9 @@ public final WorkflowTemplate getWorkflowTemplate(GetWorkflowTemplateRequest req
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   GetWorkflowTemplateRequest request = GetWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<WorkflowTemplate> future = workflowTemplateServiceClient.getWorkflowTemplateCallable().futureCall(request);
    *   // Do something
@@ -350,8 +410,52 @@ public final WorkflowTemplate getWorkflowTemplate(GetWorkflowTemplateRequest req
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
-   *   Empty response = workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(formattedName).get();
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   Empty response = workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name).get();
+   * }
+   * 
+ * + * @param name Required. The "resource name" of the workflow template, as described in + * https://cloud.google.com/apis/design/resource_names of the form + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + public final OperationFuture instantiateWorkflowTemplateAsync( + WorkflowTemplateName name) { + + InstantiateWorkflowTemplateRequest request = + InstantiateWorkflowTemplateRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return instantiateWorkflowTemplateAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Instantiates a template and begins execution. + * + *

The returned Operation can be used to track execution of workflow by polling + * [operations.get][google.longrunning.Operations.GetOperation]. The Operation will complete when + * entire workflow is finished. + * + *

The running workflow can be aborted via + * [operations.cancel][google.longrunning.Operations.CancelOperation]. This will cause any + * inflight jobs to be cancelled and workflow-owned clusters to be deleted. + * + *

The [Operation.metadata][google.longrunning.Operation.metadata] will be + * [WorkflowMetadata][google.cloud.dataproc.v1beta2.WorkflowMetadata]. + * + *

On successful completion, [Operation.response][google.longrunning.Operation.response] will + * be [Empty][google.protobuf.Empty]. + * + *

Sample code: + * + *


+   * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   Empty response = workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name.toString()).get();
    * }
    * 
* @@ -433,9 +537,9 @@ public final OperationFuture instantiateWorkflowTemplat * *

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   InstantiateWorkflowTemplateRequest request = InstantiateWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   Empty response = workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(request).get();
    * }
@@ -473,9 +577,9 @@ public final OperationFuture instantiateWorkflowTemplat
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   InstantiateWorkflowTemplateRequest request = InstantiateWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   OperationFuture<Operation> future = workflowTemplateServiceClient.instantiateWorkflowTemplateOperationCallable().futureCall(request);
    *   // Do something
@@ -511,9 +615,9 @@ public final OperationFuture instantiateWorkflowTemplat
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   InstantiateWorkflowTemplateRequest request = InstantiateWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Operation> future = workflowTemplateServiceClient.instantiateWorkflowTemplateCallable().futureCall(request);
    *   // Do something
@@ -795,8 +899,36 @@ public final WorkflowTemplate updateWorkflowTemplate(UpdateWorkflowTemplateReque
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
-   *   for (WorkflowTemplate element : workflowTemplateServiceClient.listWorkflowTemplates(formattedParent).iterateAll()) {
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
+   *   for (WorkflowTemplate element : workflowTemplateServiceClient.listWorkflowTemplates(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The "resource name" of the region, as described in + * https://cloud.google.com/apis/design/resource_names of the form + * `projects/{project_id}/regions/{region}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(RegionName parent) { + ListWorkflowTemplatesRequest request = + ListWorkflowTemplatesRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listWorkflowTemplates(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists workflows that match the specified filter in the request. + * + *

Sample code: + * + *


+   * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
+   *   for (WorkflowTemplate element : workflowTemplateServiceClient.listWorkflowTemplates(parent.toString()).iterateAll()) {
    *     // doThingsWith(element);
    *   }
    * }
@@ -821,9 +953,9 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(String par
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   ListWorkflowTemplatesRequest request = ListWorkflowTemplatesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   for (WorkflowTemplate element : workflowTemplateServiceClient.listWorkflowTemplates(request).iterateAll()) {
    *     // doThingsWith(element);
@@ -847,9 +979,9 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   ListWorkflowTemplatesRequest request = ListWorkflowTemplatesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   ApiFuture<ListWorkflowTemplatesPagedResponse> future = workflowTemplateServiceClient.listWorkflowTemplatesPagedCallable().futureCall(request);
    *   // Do something
@@ -872,9 +1004,9 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+   *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    *   ListWorkflowTemplatesRequest request = ListWorkflowTemplatesRequest.newBuilder()
-   *     .setParent(formattedParent)
+   *     .setParent(parent.toString())
    *     .build();
    *   while (true) {
    *     ListWorkflowTemplatesResponse response = workflowTemplateServiceClient.listWorkflowTemplatesCallable().call(request);
@@ -904,8 +1036,35 @@ public final ListWorkflowTemplatesPagedResponse listWorkflowTemplates(
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
-   *   workflowTemplateServiceClient.deleteWorkflowTemplate(formattedName);
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   workflowTemplateServiceClient.deleteWorkflowTemplate(name);
+   * }
+   * 
+ * + * @param name Required. The "resource name" of the workflow template, as described in + * https://cloud.google.com/apis/design/resource_names of the form + * `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteWorkflowTemplate(WorkflowTemplateName name) { + + DeleteWorkflowTemplateRequest request = + DeleteWorkflowTemplateRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteWorkflowTemplate(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a workflow template. It does not cancel in-progress workflows. + * + *

Sample code: + * + *


+   * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   workflowTemplateServiceClient.deleteWorkflowTemplate(name.toString());
    * }
    * 
* @@ -929,9 +1088,9 @@ public final void deleteWorkflowTemplate(String name) { * *

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   DeleteWorkflowTemplateRequest request = DeleteWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   workflowTemplateServiceClient.deleteWorkflowTemplate(request);
    * }
@@ -952,9 +1111,9 @@ public final void deleteWorkflowTemplate(DeleteWorkflowTemplateRequest request)
    *
    * 

    * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
-   *   String formattedName = WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
+   *   WorkflowTemplateName name = WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
    *   DeleteWorkflowTemplateRequest request = DeleteWorkflowTemplateRequest.newBuilder()
-   *     .setName(formattedName)
+   *     .setName(name.toString())
    *     .build();
    *   ApiFuture<Void> future = workflowTemplateServiceClient.deleteWorkflowTemplateCallable().futureCall(request);
    *   // Do something
diff --git a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1beta2/package-info.java b/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1beta2/package-info.java
index 4a8f89efb1f2..b648f64c96e4 100644
--- a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1beta2/package-info.java
+++ b/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1beta2/package-info.java
@@ -64,9 +64,9 @@
  * 
  * 
  * try (WorkflowTemplateServiceClient workflowTemplateServiceClient = WorkflowTemplateServiceClient.create()) {
- *   String formattedParent = RegionName.format("[PROJECT]", "[REGION]");
+ *   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
  *   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
- *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(formattedParent, template);
+ *   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
  * }
  * 
  * 
diff --git a/google-cloud-clients/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClientTest.java b/google-cloud-clients/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClientTest.java index fe711cd57e90..37fef7ef6bd3 100644 --- a/google-cloud-clients/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClientTest.java +++ b/google-cloud-clients/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1/WorkflowTemplateServiceClientTest.java @@ -104,10 +104,10 @@ public void createWorkflowTemplateTest() { .build(); mockWorkflowTemplateService.addResponse(expectedResponse); - String formattedParent = RegionName.format("[PROJECT]", "[REGION]"); + RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); - WorkflowTemplate actualResponse = client.createWorkflowTemplate(formattedParent, template); + WorkflowTemplate actualResponse = client.createWorkflowTemplate(parent, template); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockWorkflowTemplateService.getRequests(); @@ -115,7 +115,7 @@ public void createWorkflowTemplateTest() { CreateWorkflowTemplateRequest actualRequest = (CreateWorkflowTemplateRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, RegionName.parse(actualRequest.getParent())); Assert.assertEquals(template, actualRequest.getTemplate()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -130,10 +130,10 @@ public void createWorkflowTemplateExceptionTest() throws Exception { mockWorkflowTemplateService.addException(exception); try { - String formattedParent = RegionName.format("[PROJECT]", "[REGION]"); + RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); - client.createWorkflowTemplate(formattedParent, template); + client.createWorkflowTemplate(parent, template); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -155,17 +155,17 @@ public void getWorkflowTemplateTest() { .build(); mockWorkflowTemplateService.addResponse(expectedResponse); - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - WorkflowTemplate actualResponse = client.getWorkflowTemplate(formattedName); + WorkflowTemplate actualResponse = client.getWorkflowTemplate(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockWorkflowTemplateService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetWorkflowTemplateRequest actualRequest = (GetWorkflowTemplateRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, WorkflowTemplateName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -179,10 +179,10 @@ public void getWorkflowTemplateExceptionTest() throws Exception { mockWorkflowTemplateService.addException(exception); try { - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - client.getWorkflowTemplate(formattedName); + client.getWorkflowTemplate(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -201,10 +201,10 @@ public void instantiateWorkflowTemplateTest() throws Exception { .build(); mockWorkflowTemplateService.addResponse(resultOperation); - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - Empty actualResponse = client.instantiateWorkflowTemplateAsync(formattedName).get(); + Empty actualResponse = client.instantiateWorkflowTemplateAsync(name).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockWorkflowTemplateService.getRequests(); @@ -212,7 +212,7 @@ public void instantiateWorkflowTemplateTest() throws Exception { InstantiateWorkflowTemplateRequest actualRequest = (InstantiateWorkflowTemplateRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, WorkflowTemplateName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -226,10 +226,10 @@ public void instantiateWorkflowTemplateExceptionTest() throws Exception { mockWorkflowTemplateService.addException(exception); try { - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - client.instantiateWorkflowTemplateAsync(formattedName).get(); + client.instantiateWorkflowTemplateAsync(name).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); @@ -250,11 +250,11 @@ public void instantiateWorkflowTemplateTest2() throws Exception { .build(); mockWorkflowTemplateService.addResponse(resultOperation); - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); Map parameters = new HashMap<>(); - Empty actualResponse = client.instantiateWorkflowTemplateAsync(formattedName, parameters).get(); + Empty actualResponse = client.instantiateWorkflowTemplateAsync(name, parameters).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockWorkflowTemplateService.getRequests(); @@ -262,7 +262,7 @@ public void instantiateWorkflowTemplateTest2() throws Exception { InstantiateWorkflowTemplateRequest actualRequest = (InstantiateWorkflowTemplateRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, WorkflowTemplateName.parse(actualRequest.getName())); Assert.assertEquals(parameters, actualRequest.getParametersMap()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -277,11 +277,11 @@ public void instantiateWorkflowTemplateExceptionTest2() throws Exception { mockWorkflowTemplateService.addException(exception); try { - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); Map parameters = new HashMap<>(); - client.instantiateWorkflowTemplateAsync(formattedName, parameters).get(); + client.instantiateWorkflowTemplateAsync(name, parameters).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); @@ -402,10 +402,9 @@ public void listWorkflowTemplatesTest() { .build(); mockWorkflowTemplateService.addResponse(expectedResponse); - String formattedParent = RegionName.format("[PROJECT]", "[REGION]"); + RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); - ListWorkflowTemplatesPagedResponse pagedListResponse = - client.listWorkflowTemplates(formattedParent); + ListWorkflowTemplatesPagedResponse pagedListResponse = client.listWorkflowTemplates(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); @@ -416,7 +415,7 @@ public void listWorkflowTemplatesTest() { ListWorkflowTemplatesRequest actualRequest = (ListWorkflowTemplatesRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, RegionName.parse(actualRequest.getParent())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -430,9 +429,9 @@ public void listWorkflowTemplatesExceptionTest() throws Exception { mockWorkflowTemplateService.addException(exception); try { - String formattedParent = RegionName.format("[PROJECT]", "[REGION]"); + RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); - client.listWorkflowTemplates(formattedParent); + client.listWorkflowTemplates(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -445,17 +444,17 @@ public void deleteWorkflowTemplateTest() { Empty expectedResponse = Empty.newBuilder().build(); mockWorkflowTemplateService.addResponse(expectedResponse); - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - client.deleteWorkflowTemplate(formattedName); + client.deleteWorkflowTemplate(name); List actualRequests = mockWorkflowTemplateService.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteWorkflowTemplateRequest actualRequest = (DeleteWorkflowTemplateRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, WorkflowTemplateName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -469,10 +468,10 @@ public void deleteWorkflowTemplateExceptionTest() throws Exception { mockWorkflowTemplateService.addException(exception); try { - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - client.deleteWorkflowTemplate(formattedName); + client.deleteWorkflowTemplate(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception diff --git a/google-cloud-clients/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1beta2/WorkflowTemplateServiceClientTest.java b/google-cloud-clients/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1beta2/WorkflowTemplateServiceClientTest.java index 280a591c46ec..06fc340f38b7 100644 --- a/google-cloud-clients/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1beta2/WorkflowTemplateServiceClientTest.java +++ b/google-cloud-clients/google-cloud-dataproc/src/test/java/com/google/cloud/dataproc/v1beta2/WorkflowTemplateServiceClientTest.java @@ -104,10 +104,10 @@ public void createWorkflowTemplateTest() { .build(); mockWorkflowTemplateService.addResponse(expectedResponse); - String formattedParent = RegionName.format("[PROJECT]", "[REGION]"); + RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); - WorkflowTemplate actualResponse = client.createWorkflowTemplate(formattedParent, template); + WorkflowTemplate actualResponse = client.createWorkflowTemplate(parent, template); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockWorkflowTemplateService.getRequests(); @@ -115,7 +115,7 @@ public void createWorkflowTemplateTest() { CreateWorkflowTemplateRequest actualRequest = (CreateWorkflowTemplateRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, RegionName.parse(actualRequest.getParent())); Assert.assertEquals(template, actualRequest.getTemplate()); Assert.assertTrue( channelProvider.isHeaderSent( @@ -130,10 +130,10 @@ public void createWorkflowTemplateExceptionTest() throws Exception { mockWorkflowTemplateService.addException(exception); try { - String formattedParent = RegionName.format("[PROJECT]", "[REGION]"); + RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); WorkflowTemplate template = WorkflowTemplate.newBuilder().build(); - client.createWorkflowTemplate(formattedParent, template); + client.createWorkflowTemplate(parent, template); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -155,17 +155,17 @@ public void getWorkflowTemplateTest() { .build(); mockWorkflowTemplateService.addResponse(expectedResponse); - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - WorkflowTemplate actualResponse = client.getWorkflowTemplate(formattedName); + WorkflowTemplate actualResponse = client.getWorkflowTemplate(name); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockWorkflowTemplateService.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetWorkflowTemplateRequest actualRequest = (GetWorkflowTemplateRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, WorkflowTemplateName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -179,10 +179,10 @@ public void getWorkflowTemplateExceptionTest() throws Exception { mockWorkflowTemplateService.addException(exception); try { - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - client.getWorkflowTemplate(formattedName); + client.getWorkflowTemplate(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -201,10 +201,10 @@ public void instantiateWorkflowTemplateTest() throws Exception { .build(); mockWorkflowTemplateService.addResponse(resultOperation); - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - Empty actualResponse = client.instantiateWorkflowTemplateAsync(formattedName).get(); + Empty actualResponse = client.instantiateWorkflowTemplateAsync(name).get(); Assert.assertEquals(expectedResponse, actualResponse); List actualRequests = mockWorkflowTemplateService.getRequests(); @@ -212,7 +212,7 @@ public void instantiateWorkflowTemplateTest() throws Exception { InstantiateWorkflowTemplateRequest actualRequest = (InstantiateWorkflowTemplateRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, WorkflowTemplateName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -226,10 +226,10 @@ public void instantiateWorkflowTemplateExceptionTest() throws Exception { mockWorkflowTemplateService.addException(exception); try { - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - client.instantiateWorkflowTemplateAsync(formattedName).get(); + client.instantiateWorkflowTemplateAsync(name).get(); Assert.fail("No exception raised"); } catch (ExecutionException e) { Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); @@ -397,10 +397,9 @@ public void listWorkflowTemplatesTest() { .build(); mockWorkflowTemplateService.addResponse(expectedResponse); - String formattedParent = RegionName.format("[PROJECT]", "[REGION]"); + RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); - ListWorkflowTemplatesPagedResponse pagedListResponse = - client.listWorkflowTemplates(formattedParent); + ListWorkflowTemplatesPagedResponse pagedListResponse = client.listWorkflowTemplates(parent); List resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); @@ -411,7 +410,7 @@ public void listWorkflowTemplatesTest() { ListWorkflowTemplatesRequest actualRequest = (ListWorkflowTemplatesRequest) actualRequests.get(0); - Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(parent, RegionName.parse(actualRequest.getParent())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -425,9 +424,9 @@ public void listWorkflowTemplatesExceptionTest() throws Exception { mockWorkflowTemplateService.addException(exception); try { - String formattedParent = RegionName.format("[PROJECT]", "[REGION]"); + RegionName parent = RegionName.of("[PROJECT]", "[REGION]"); - client.listWorkflowTemplates(formattedParent); + client.listWorkflowTemplates(parent); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception @@ -440,17 +439,17 @@ public void deleteWorkflowTemplateTest() { Empty expectedResponse = Empty.newBuilder().build(); mockWorkflowTemplateService.addResponse(expectedResponse); - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - client.deleteWorkflowTemplate(formattedName); + client.deleteWorkflowTemplate(name); List actualRequests = mockWorkflowTemplateService.getRequests(); Assert.assertEquals(1, actualRequests.size()); DeleteWorkflowTemplateRequest actualRequest = (DeleteWorkflowTemplateRequest) actualRequests.get(0); - Assert.assertEquals(formattedName, actualRequest.getName()); + Assert.assertEquals(name, WorkflowTemplateName.parse(actualRequest.getName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), @@ -464,10 +463,10 @@ public void deleteWorkflowTemplateExceptionTest() throws Exception { mockWorkflowTemplateService.addException(exception); try { - String formattedName = - WorkflowTemplateName.format("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); + WorkflowTemplateName name = + WorkflowTemplateName.of("[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]"); - client.deleteWorkflowTemplate(formattedName); + client.deleteWorkflowTemplate(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { // Expected exception diff --git a/google-cloud-clients/google-cloud-dataproc/synth.metadata b/google-cloud-clients/google-cloud-dataproc/synth.metadata index 2bd4f07a69a5..c9793292a9a7 100644 --- a/google-cloud-clients/google-cloud-dataproc/synth.metadata +++ b/google-cloud-clients/google-cloud-dataproc/synth.metadata @@ -1,27 +1,42 @@ { + "updateTime": "2018-12-08T08:38:57.573295Z", "sources": [ + { + "generator": { + "name": "artman", + "version": "0.16.2", + "dockerImage": "googleapis/artman@sha256:2f6b261ee7fe1aedf238991c93a20b3820de37a343d0cacf3e3e9555c2aaf2ea" + } + }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5a57f0c13a358b2b15452bf2d67453774a5f6d4f", - "internalRef": "221837528" + "sha": "6f6505a69b2b0a1260c93e890d636eefb859e76e", + "internalRef": "224530961" } - }, + } + ], + "destinations": [ { - "git": { - "name": "googleapis-private", - "remote": "https://github.com/googleapis/googleapis-private.git", - "sha": "6aa8e1a447bb8d0367150356a28cb4d3f2332641", - "internalRef": "221340946" + "client": { + "source": "googleapis", + "apiName": "dataproc", + "apiVersion": "v1", + "language": "java", + "generator": "gapic", + "config": "google/cloud/dataproc/artman_dataproc_v1.yaml" } }, { - "generator": { - "name": "artman", - "version": "0.16.0", - "dockerImage": "googleapis/artman@sha256:90f9d15e9bad675aeecd586725bce48f5667ffe7d5fc4d1e96d51ff34304815b" + "client": { + "source": "googleapis", + "apiName": "dataproc", + "apiVersion": "v1beta2", + "language": "java", + "generator": "gapic", + "config": "google/cloud/dataproc/artman_dataproc_v1beta2.yaml" } } ] -} +} \ No newline at end of file