Class WorkflowTemplateServiceClient (2.3.1)

public class WorkflowTemplateServiceClient implements BackgroundResource

Service Description: The API interface for managing Workflow Templates in the Dataproc API.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
   WorkflowTemplate response =
       workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
 }
 

Note: close() needs to be called on the WorkflowTemplateServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of WorkflowTemplateServiceSettings to create(). For example:

To customize credentials:


 WorkflowTemplateServiceSettings workflowTemplateServiceSettings =
     WorkflowTemplateServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create(workflowTemplateServiceSettings);
 

To customize the endpoint:


 WorkflowTemplateServiceSettings workflowTemplateServiceSettings =
     WorkflowTemplateServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create(workflowTemplateServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > WorkflowTemplateServiceClient

Implements

BackgroundResource

Constructors

WorkflowTemplateServiceClient(WorkflowTemplateServiceSettings settings)

protected WorkflowTemplateServiceClient(WorkflowTemplateServiceSettings settings)

Constructs an instance of WorkflowTemplateServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsWorkflowTemplateServiceSettings

WorkflowTemplateServiceClient(WorkflowTemplateServiceStub stub)

protected WorkflowTemplateServiceClient(WorkflowTemplateServiceStub stub)
Parameter
NameDescription
stubWorkflowTemplateServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

create()

public static final WorkflowTemplateServiceClient create()

Constructs an instance of WorkflowTemplateServiceClient with default settings.

Returns
TypeDescription
WorkflowTemplateServiceClient
Exceptions
TypeDescription
IOException

create(WorkflowTemplateServiceSettings settings)

public static final WorkflowTemplateServiceClient create(WorkflowTemplateServiceSettings settings)

Constructs an instance of WorkflowTemplateServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsWorkflowTemplateServiceSettings
Returns
TypeDescription
WorkflowTemplateServiceClient
Exceptions
TypeDescription
IOException

create(WorkflowTemplateServiceStub stub)

public static final WorkflowTemplateServiceClient create(WorkflowTemplateServiceStub stub)

Constructs an instance of WorkflowTemplateServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(WorkflowTemplateServiceSettings).

Parameter
NameDescription
stubWorkflowTemplateServiceStub
Returns
TypeDescription
WorkflowTemplateServiceClient

createWorkflowTemplate(CreateWorkflowTemplateRequest request)

public final WorkflowTemplate createWorkflowTemplate(CreateWorkflowTemplateRequest request)

Creates new workflow template.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   CreateWorkflowTemplateRequest request =
       CreateWorkflowTemplateRequest.newBuilder()
           .setParent(RegionName.of("[PROJECT]", "[REGION]").toString())
           .setTemplate(WorkflowTemplate.newBuilder().build())
           .build();
   WorkflowTemplate response = workflowTemplateServiceClient.createWorkflowTemplate(request);
 }
 
Parameter
NameDescription
requestCreateWorkflowTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
WorkflowTemplate

createWorkflowTemplate(LocationName parent, WorkflowTemplate template)

public final WorkflowTemplate createWorkflowTemplate(LocationName parent, WorkflowTemplate template)

Creates new workflow template.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
   WorkflowTemplate response =
       workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
 }
 
Parameters
NameDescription
parentLocationName

Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates,create, the resource name of the region has the following format: projects/{project_id}/regions/{region}
  • For projects.locations.workflowTemplates.create, the resource name of the location has the following format: projects/{project_id}/locations/{location}

templateWorkflowTemplate

Required. The Dataproc workflow template to create.

Returns
TypeDescription
WorkflowTemplate

createWorkflowTemplate(RegionName parent, WorkflowTemplate template)

public final WorkflowTemplate createWorkflowTemplate(RegionName parent, WorkflowTemplate template)

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, template);
 }
 
Parameters
NameDescription
parentRegionName

Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates,create, the resource name of the region has the following format: projects/{project_id}/regions/{region}
  • For projects.locations.workflowTemplates.create, the resource name of the location has the following format: projects/{project_id}/locations/{location}

templateWorkflowTemplate

Required. The Dataproc workflow template to create.

Returns
TypeDescription
WorkflowTemplate

createWorkflowTemplate(String parent, WorkflowTemplate template)

public final WorkflowTemplate createWorkflowTemplate(String parent, WorkflowTemplate template)

Creates new workflow template.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   String parent = RegionName.of("[PROJECT]", "[REGION]").toString();
   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
   WorkflowTemplate response =
       workflowTemplateServiceClient.createWorkflowTemplate(parent, template);
 }
 
Parameters
NameDescription
parentString

Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates,create, the resource name of the region has the following format: projects/{project_id}/regions/{region}
  • For projects.locations.workflowTemplates.create, the resource name of the location has the following format: projects/{project_id}/locations/{location}

templateWorkflowTemplate

Required. The Dataproc workflow template to create.

Returns
TypeDescription
WorkflowTemplate

createWorkflowTemplateCallable()

public final UnaryCallable<CreateWorkflowTemplateRequest,WorkflowTemplate> createWorkflowTemplateCallable()

Creates new workflow template.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   CreateWorkflowTemplateRequest request =
       CreateWorkflowTemplateRequest.newBuilder()
           .setParent(RegionName.of("[PROJECT]", "[REGION]").toString())
           .setTemplate(WorkflowTemplate.newBuilder().build())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<CreateWorkflowTemplateRequest,WorkflowTemplate>

deleteWorkflowTemplate(DeleteWorkflowTemplateRequest request)

public final void deleteWorkflowTemplate(DeleteWorkflowTemplateRequest request)

Deletes a workflow template. It does not cancel in-progress workflows.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   DeleteWorkflowTemplateRequest request =
       DeleteWorkflowTemplateRequest.newBuilder()
           .setName(
               WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
                       "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
                   .toString())
           .setVersion(351608024)
           .build();
   workflowTemplateServiceClient.deleteWorkflowTemplate(request);
 }
 
Parameter
NameDescription
requestDeleteWorkflowTemplateRequest

The request object containing all of the parameters for the API call.

deleteWorkflowTemplate(WorkflowTemplateName name)

public final void deleteWorkflowTemplate(WorkflowTemplateName name)

Deletes a workflow template. It does not cancel in-progress workflows.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   WorkflowTemplateName name =
       WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
           "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
   workflowTemplateServiceClient.deleteWorkflowTemplate(name);
 }
 
Parameter
NameDescription
nameWorkflowTemplateName

Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates.delete, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id}
  • For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}

deleteWorkflowTemplate(String name)

public final void deleteWorkflowTemplate(String name)

Deletes a workflow template. It does not cancel in-progress workflows.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   String name =
       WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
               "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
           .toString();
   workflowTemplateServiceClient.deleteWorkflowTemplate(name);
 }
 
Parameter
NameDescription
nameString

Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates.delete, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id}
  • For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}

deleteWorkflowTemplateCallable()

public final UnaryCallable<DeleteWorkflowTemplateRequest,Empty> deleteWorkflowTemplateCallable()

Deletes a workflow template. It does not cancel in-progress workflows.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   DeleteWorkflowTemplateRequest request =
       DeleteWorkflowTemplateRequest.newBuilder()
           .setName(
               WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
                       "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
                   .toString())
           .setVersion(351608024)
           .build();
   ApiFuture<Empty> future =
       workflowTemplateServiceClient.deleteWorkflowTemplateCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteWorkflowTemplateRequest,Empty>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getSettings()

public final WorkflowTemplateServiceSettings getSettings()
Returns
TypeDescription
WorkflowTemplateServiceSettings

getStub()

public WorkflowTemplateServiceStub getStub()
Returns
TypeDescription
WorkflowTemplateServiceStub

getWorkflowTemplate(GetWorkflowTemplateRequest request)

public final WorkflowTemplate getWorkflowTemplate(GetWorkflowTemplateRequest request)

Retrieves the latest workflow template.

Can retrieve previously instantiated template by specifying optional version parameter.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   GetWorkflowTemplateRequest request =
       GetWorkflowTemplateRequest.newBuilder()
           .setName(
               WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
                       "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
                   .toString())
           .setVersion(351608024)
           .build();
   WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(request);
 }
 
Parameter
NameDescription
requestGetWorkflowTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
WorkflowTemplate

getWorkflowTemplate(WorkflowTemplateName name)

public final WorkflowTemplate getWorkflowTemplate(WorkflowTemplateName name)

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.ofProjectRegionWorkflowTemplateName(
           "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
   WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(name);
 }
 
Parameter
NameDescription
nameWorkflowTemplateName

Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id}
  • For projects.locations.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}

Returns
TypeDescription
WorkflowTemplate

getWorkflowTemplate(String name)

public final WorkflowTemplate getWorkflowTemplate(String name)

Retrieves the latest workflow template.

Can retrieve previously instantiated template by specifying optional version parameter.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   String name =
       WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
               "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
           .toString();
   WorkflowTemplate response = workflowTemplateServiceClient.getWorkflowTemplate(name);
 }
 
Parameter
NameDescription
nameString

Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id}
  • For projects.locations.workflowTemplates.get, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}

Returns
TypeDescription
WorkflowTemplate

getWorkflowTemplateCallable()

public final UnaryCallable<GetWorkflowTemplateRequest,WorkflowTemplate> getWorkflowTemplateCallable()

Retrieves the latest workflow template.

Can retrieve previously instantiated template by specifying optional version parameter.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   GetWorkflowTemplateRequest request =
       GetWorkflowTemplateRequest.newBuilder()
           .setName(
               WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
                       "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
                   .toString())
           .setVersion(351608024)
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<GetWorkflowTemplateRequest,WorkflowTemplate>

instantiateInlineWorkflowTemplateAsync(InstantiateInlineWorkflowTemplateRequest request)

public final OperationFuture<Empty,WorkflowMetadata> instantiateInlineWorkflowTemplateAsync(InstantiateInlineWorkflowTemplateRequest request)

Instantiates a template and begins execution.

This method is equivalent to executing the sequence CreateWorkflowTemplate, InstantiateWorkflowTemplate, DeleteWorkflowTemplate.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   InstantiateInlineWorkflowTemplateRequest request =
       InstantiateInlineWorkflowTemplateRequest.newBuilder()
           .setParent(RegionName.of("[PROJECT]", "[REGION]").toString())
           .setTemplate(WorkflowTemplate.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   workflowTemplateServiceClient.instantiateInlineWorkflowTemplateAsync(request).get();
 }
 
Parameter
NameDescription
requestInstantiateInlineWorkflowTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Empty,WorkflowMetadata>

instantiateInlineWorkflowTemplateAsync(LocationName parent, WorkflowTemplate template)

public final OperationFuture<Empty,WorkflowMetadata> instantiateInlineWorkflowTemplateAsync(LocationName parent, WorkflowTemplate template)

Instantiates a template and begins execution.

This method is equivalent to executing the sequence CreateWorkflowTemplate, InstantiateWorkflowTemplate, DeleteWorkflowTemplate.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
   workflowTemplateServiceClient.instantiateInlineWorkflowTemplateAsync(parent, template).get();
 }
 
Parameters
NameDescription
parentLocationName

Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates,instantiateinline, the resource name of the region has the following format: projects/{project_id}/regions/{region}
  • For projects.locations.workflowTemplates.instantiateinline, the resource name of the location has the following format: projects/{project_id}/locations/{location}

templateWorkflowTemplate

Required. The workflow template to instantiate.

Returns
TypeDescription
OperationFuture<Empty,WorkflowMetadata>

instantiateInlineWorkflowTemplateAsync(RegionName parent, WorkflowTemplate template)

public final OperationFuture<Empty,WorkflowMetadata> instantiateInlineWorkflowTemplateAsync(RegionName parent, WorkflowTemplate template)

Instantiates a template and begins execution.

This method is equivalent to executing the sequence CreateWorkflowTemplate, InstantiateWorkflowTemplate, DeleteWorkflowTemplate.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
   workflowTemplateServiceClient.instantiateInlineWorkflowTemplateAsync(parent, template).get();
 }
 
Parameters
NameDescription
parentRegionName

Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates,instantiateinline, the resource name of the region has the following format: projects/{project_id}/regions/{region}
  • For projects.locations.workflowTemplates.instantiateinline, the resource name of the location has the following format: projects/{project_id}/locations/{location}

templateWorkflowTemplate

Required. The workflow template to instantiate.

Returns
TypeDescription
OperationFuture<Empty,WorkflowMetadata>

instantiateInlineWorkflowTemplateAsync(String parent, WorkflowTemplate template)

public final OperationFuture<Empty,WorkflowMetadata> instantiateInlineWorkflowTemplateAsync(String parent, WorkflowTemplate template)

Instantiates a template and begins execution.

This method is equivalent to executing the sequence CreateWorkflowTemplate, InstantiateWorkflowTemplate, DeleteWorkflowTemplate.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   String parent = RegionName.of("[PROJECT]", "[REGION]").toString();
   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
   workflowTemplateServiceClient.instantiateInlineWorkflowTemplateAsync(parent, template).get();
 }
 
Parameters
NameDescription
parentString

Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates,instantiateinline, the resource name of the region has the following format: projects/{project_id}/regions/{region}
  • For projects.locations.workflowTemplates.instantiateinline, the resource name of the location has the following format: projects/{project_id}/locations/{location}

templateWorkflowTemplate

Required. The workflow template to instantiate.

Returns
TypeDescription
OperationFuture<Empty,WorkflowMetadata>

instantiateInlineWorkflowTemplateCallable()

public final UnaryCallable<InstantiateInlineWorkflowTemplateRequest,Operation> instantiateInlineWorkflowTemplateCallable()

Instantiates a template and begins execution.

This method is equivalent to executing the sequence CreateWorkflowTemplate, InstantiateWorkflowTemplate, DeleteWorkflowTemplate.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   InstantiateInlineWorkflowTemplateRequest request =
       InstantiateInlineWorkflowTemplateRequest.newBuilder()
           .setParent(RegionName.of("[PROJECT]", "[REGION]").toString())
           .setTemplate(WorkflowTemplate.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       workflowTemplateServiceClient
           .instantiateInlineWorkflowTemplateCallable()
           .futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<InstantiateInlineWorkflowTemplateRequest,Operation>

instantiateInlineWorkflowTemplateOperationCallable()

public final OperationCallable<InstantiateInlineWorkflowTemplateRequest,Empty,WorkflowMetadata> instantiateInlineWorkflowTemplateOperationCallable()

Instantiates a template and begins execution.

This method is equivalent to executing the sequence CreateWorkflowTemplate, InstantiateWorkflowTemplate, DeleteWorkflowTemplate.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   InstantiateInlineWorkflowTemplateRequest request =
       InstantiateInlineWorkflowTemplateRequest.newBuilder()
           .setParent(RegionName.of("[PROJECT]", "[REGION]").toString())
           .setTemplate(WorkflowTemplate.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<InstantiateInlineWorkflowTemplateRequest,Empty,WorkflowMetadata>

instantiateWorkflowTemplateAsync(InstantiateWorkflowTemplateRequest request)

public final OperationFuture<Empty,WorkflowMetadata> instantiateWorkflowTemplateAsync(InstantiateWorkflowTemplateRequest request)

Instantiates a template and begins execution.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   InstantiateWorkflowTemplateRequest request =
       InstantiateWorkflowTemplateRequest.newBuilder()
           .setName(
               WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
                       "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
                   .toString())
           .setVersion(351608024)
           .setRequestId("requestId693933066")
           .putAllParameters(new HashMap
Parameter
NameDescription
requestInstantiateWorkflowTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Empty,WorkflowMetadata>

instantiateWorkflowTemplateAsync(WorkflowTemplateName name)

public final OperationFuture<Empty,WorkflowMetadata> instantiateWorkflowTemplateAsync(WorkflowTemplateName name)

Instantiates a template and begins execution.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   WorkflowTemplateName name =
       WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
           "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
   workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name).get();
 }
 
Parameter
NameDescription
nameWorkflowTemplateName

Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id}
  • For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}

Returns
TypeDescription
OperationFuture<Empty,WorkflowMetadata>

instantiateWorkflowTemplateAsync(WorkflowTemplateName name, Map<String,String> parameters)

public final OperationFuture<Empty,WorkflowMetadata> instantiateWorkflowTemplateAsync(WorkflowTemplateName name, Map<String,String> parameters)

Instantiates a template and begins execution.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   WorkflowTemplateName name =
       WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
           "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]");
   Map
Parameters
NameDescription
nameWorkflowTemplateName

Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id}
  • For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}

parametersMap<String,String>

Optional. Map from parameter names to values that should be used for those parameters. Values may not exceed 1000 characters.

Returns
TypeDescription
OperationFuture<Empty,WorkflowMetadata>

instantiateWorkflowTemplateAsync(String name)

public final OperationFuture<Empty,WorkflowMetadata> instantiateWorkflowTemplateAsync(String name)

Instantiates a template and begins execution.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   String name =
       WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
               "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
           .toString();
   workflowTemplateServiceClient.instantiateWorkflowTemplateAsync(name).get();
 }
 
Parameter
NameDescription
nameString

Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id}
  • For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}

Returns
TypeDescription
OperationFuture<Empty,WorkflowMetadata>

instantiateWorkflowTemplateAsync(String name, Map<String,String> parameters)

public final OperationFuture<Empty,WorkflowMetadata> instantiateWorkflowTemplateAsync(String name, Map<String,String> parameters)

Instantiates a template and begins execution.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   String name =
       WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
               "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
           .toString();
   Map
Parameters
NameDescription
nameString

Required. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/regions/{region}/workflowTemplates/{template_id}
  • For projects.locations.workflowTemplates.instantiate, the resource name of the template has the following format: projects/{project_id}/locations/{location}/workflowTemplates/{template_id}

parametersMap<String,String>

Optional. Map from parameter names to values that should be used for those parameters. Values may not exceed 1000 characters.

Returns
TypeDescription
OperationFuture<Empty,WorkflowMetadata>

instantiateWorkflowTemplateCallable()

public final UnaryCallable<InstantiateWorkflowTemplateRequest,Operation> instantiateWorkflowTemplateCallable()

Instantiates a template and begins execution.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   InstantiateWorkflowTemplateRequest request =
       InstantiateWorkflowTemplateRequest.newBuilder()
           .setName(
               WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
                       "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
                   .toString())
           .setVersion(351608024)
           .setRequestId("requestId693933066")
           .putAllParameters(new HashMap
Returns
TypeDescription
UnaryCallable<InstantiateWorkflowTemplateRequest,Operation>

instantiateWorkflowTemplateOperationCallable()

public final OperationCallable<InstantiateWorkflowTemplateRequest,Empty,WorkflowMetadata> instantiateWorkflowTemplateOperationCallable()

Instantiates a template and begins execution.

The returned Operation can be used to track execution of workflow by polling operations.get. The Operation will complete when entire workflow is finished.

The running workflow can be aborted via operations.cancel. This will cause any inflight jobs to be cancelled and workflow-owned clusters to be deleted.

The Operation.metadata will be WorkflowMetadata. Also see Using WorkflowMetadata.

On successful completion, Operation.response will be Empty.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   InstantiateWorkflowTemplateRequest request =
       InstantiateWorkflowTemplateRequest.newBuilder()
           .setName(
               WorkflowTemplateName.ofProjectRegionWorkflowTemplateName(
                       "[PROJECT]", "[REGION]", "[WORKFLOW_TEMPLATE]")
                   .toString())
           .setVersion(351608024)
           .setRequestId("requestId693933066")
           .putAllParameters(new HashMap
Returns
TypeDescription
OperationCallable<InstantiateWorkflowTemplateRequest,Empty,WorkflowMetadata>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listWorkflowTemplates(ListWorkflowTemplatesRequest request)

public final WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse listWorkflowTemplates(ListWorkflowTemplatesRequest request)

Lists workflows that match the specified filter in the request.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   ListWorkflowTemplatesRequest request =
       ListWorkflowTemplatesRequest.newBuilder()
           .setParent(RegionName.of("[PROJECT]", "[REGION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (WorkflowTemplate element :
       workflowTemplateServiceClient.listWorkflowTemplates(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListWorkflowTemplatesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse

listWorkflowTemplates(LocationName parent)

public final WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse listWorkflowTemplates(LocationName parent)

Lists workflows that match the specified filter in the request.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (WorkflowTemplate element :
       workflowTemplateServiceClient.listWorkflowTemplates(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates,list, the resource name of the region has the following format: projects/{project_id}/regions/{region}
  • For projects.locations.workflowTemplates.list, the resource name of the location has the following format: projects/{project_id}/locations/{location}

Returns
TypeDescription
WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse

listWorkflowTemplates(RegionName parent)

public final WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse listWorkflowTemplates(RegionName parent)

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).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentRegionName

Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates,list, the resource name of the region has the following format: projects/{project_id}/regions/{region}
  • For projects.locations.workflowTemplates.list, the resource name of the location has the following format: projects/{project_id}/locations/{location}

Returns
TypeDescription
WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse

listWorkflowTemplates(String parent)

public final WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse listWorkflowTemplates(String parent)

Lists workflows that match the specified filter in the request.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   String parent = RegionName.of("[PROJECT]", "[REGION]").toString();
   for (WorkflowTemplate element :
       workflowTemplateServiceClient.listWorkflowTemplates(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The resource name of the region or location, as described in https://cloud.google.com/apis/design/resource_names.

  • For projects.regions.workflowTemplates,list, the resource name of the region has the following format: projects/{project_id}/regions/{region}
  • For projects.locations.workflowTemplates.list, the resource name of the location has the following format: projects/{project_id}/locations/{location}

Returns
TypeDescription
WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse

listWorkflowTemplatesCallable()

public final UnaryCallable<ListWorkflowTemplatesRequest,ListWorkflowTemplatesResponse> listWorkflowTemplatesCallable()

Lists workflows that match the specified filter in the request.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   ListWorkflowTemplatesRequest request =
       ListWorkflowTemplatesRequest.newBuilder()
           .setParent(RegionName.of("[PROJECT]", "[REGION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListWorkflowTemplatesResponse response =
         workflowTemplateServiceClient.listWorkflowTemplatesCallable().call(request);
     for (WorkflowTemplate element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListWorkflowTemplatesRequest,ListWorkflowTemplatesResponse>

listWorkflowTemplatesPagedCallable()

public final UnaryCallable<ListWorkflowTemplatesRequest,WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse> listWorkflowTemplatesPagedCallable()

Lists workflows that match the specified filter in the request.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   ListWorkflowTemplatesRequest request =
       ListWorkflowTemplatesRequest.newBuilder()
           .setParent(RegionName.of("[PROJECT]", "[REGION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<ListWorkflowTemplatesRequest,ListWorkflowTemplatesPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateWorkflowTemplate(UpdateWorkflowTemplateRequest request)

public final WorkflowTemplate updateWorkflowTemplate(UpdateWorkflowTemplateRequest request)

Updates (replaces) workflow template. The updated template must contain version that matches the current server version.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   UpdateWorkflowTemplateRequest request =
       UpdateWorkflowTemplateRequest.newBuilder()
           .setTemplate(WorkflowTemplate.newBuilder().build())
           .build();
   WorkflowTemplate response = workflowTemplateServiceClient.updateWorkflowTemplate(request);
 }
 
Parameter
NameDescription
requestUpdateWorkflowTemplateRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
WorkflowTemplate

updateWorkflowTemplate(WorkflowTemplate template)

public final WorkflowTemplate updateWorkflowTemplate(WorkflowTemplate template)

Updates (replaces) workflow template. The updated template must contain version that matches the current server version.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   WorkflowTemplate template = WorkflowTemplate.newBuilder().build();
   WorkflowTemplate response = workflowTemplateServiceClient.updateWorkflowTemplate(template);
 }
 
Parameter
NameDescription
templateWorkflowTemplate

Required. The updated workflow template.

The template.version field must match the current version.

Returns
TypeDescription
WorkflowTemplate

updateWorkflowTemplateCallable()

public final UnaryCallable<UpdateWorkflowTemplateRequest,WorkflowTemplate> updateWorkflowTemplateCallable()

Updates (replaces) workflow template. The updated template must contain version that matches the current server version.

Sample code:


 try (WorkflowTemplateServiceClient workflowTemplateServiceClient =
     WorkflowTemplateServiceClient.create()) {
   UpdateWorkflowTemplateRequest request =
       UpdateWorkflowTemplateRequest.newBuilder()
           .setTemplate(WorkflowTemplate.newBuilder().build())
           .build();
   ApiFuture
Returns
TypeDescription
UnaryCallable<UpdateWorkflowTemplateRequest,WorkflowTemplate>