WorkflowTemplateServiceClient

WorkflowTemplateServiceClient

The API interface for managing Workflow Templates in the Dataproc API.

Constructor

new WorkflowTemplateServiceClient(optionsopt)

Construct an instance of WorkflowTemplateServiceClient.

Parameters:
Name Type Attributes Description
options object <optional>

The configuration object. The options accepted by the constructor are described in detail in this document. The common options are:

Properties
Name Type Attributes Description
credentials object <optional>

Credentials object.

Properties
Name Type Attributes Description
client_email string <optional>
private_key string <optional>
email string <optional>

Account email address. Required when using a .pem or .p12 keyFilename.

keyFilename string <optional>

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option below is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port number <optional>

The port on which to connect to the remote host.

projectId string <optional>

The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

apiEndpoint string <optional>

The domain name of the API remote host.

clientConfig gax.ClientConfig <optional>

Client configuration override. Follows the structure of gapicConfig.

fallback boolean <optional>

Use HTTP fallback mode. In fallback mode, a special browser-compatible transport implementation is used instead of gRPC transport. In browser context (if the window object is defined) the fallback mode is enabled automatically; set options.fallback to false if you need to override this behavior.

Members

apiEndpoint

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

port

The port for this API service.

scopes

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

The DNS address for this API service.

Methods

(async) checkInstantiateInlineWorkflowTemplateProgress(name) → {Promise}

Check the status of the long running operation returned by instantiateInlineWorkflowTemplate().

Parameters:
Name Type Description
name String

The operation name that will be passed.

Returns:
Type Description
Promise
  • The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.
Example
const decodedOperation = await checkInstantiateInlineWorkflowTemplateProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);

(async) checkInstantiateWorkflowTemplateProgress(name) → {Promise}

Check the status of the long running operation returned by instantiateWorkflowTemplate().

Parameters:
Name Type Description
name String

The operation name that will be passed.

Returns:
Type Description
Promise
  • The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples.
Example
const decodedOperation = await checkInstantiateWorkflowTemplateProgress(name);
console.log(decodedOperation.result);
console.log(decodedOperation.done);
console.log(decodedOperation.metadata);

close() → {Promise}

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns:
Type Description
Promise

A promise that resolves when the client is closed.

createWorkflowTemplate(request, optionsopt) → {Promise}

Creates new workflow template.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

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}

template google.cloud.dataproc.v1beta2.WorkflowTemplate

Required. The Dataproc workflow template to create.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing WorkflowTemplate. Please see the documentation for more details and examples.
Example
const [response] = await client.createWorkflowTemplate(request);

deleteWorkflowTemplate(request, optionsopt) → {Promise}

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

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

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}

version number

Optional. The version of workflow template to delete. If specified, will only delete the template if the current server version matches specified version.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.
Example
const [response] = await client.deleteWorkflowTemplate(request);

getProjectId() → {Promise}

Return the project ID used by this class.

Returns:
Type Description
Promise

A promise that resolves to string containing the project ID.

getWorkflowTemplate(request, optionsopt) → {Promise}

Retrieves the latest workflow template.

Can retrieve previously instantiated template by specifying optional version parameter.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

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}

version number

Optional. The version of workflow template to retrieve. Only previously instantiated versions can be retrieved.

If unspecified, retrieves the current version.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing WorkflowTemplate. Please see the documentation for more details and examples.
Example
const [response] = await client.getWorkflowTemplate(request);

initialize() → {Promise}

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns:
Type Description
Promise

A promise that resolves to an authenticated service stub.

instantiateInlineWorkflowTemplate(request, optionsopt) → {Promise}

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.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

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}

template google.cloud.dataproc.v1beta2.WorkflowTemplate

Required. The workflow template to instantiate.

instanceId string

Deprecated. Please use request_id field instead.

requestId string

Optional. A tag that prevents multiple concurrent workflow instances with the same tag from running. This mitigates risk of concurrent instances started due to retries.

It is recommended to always set this value to a UUID.

The tag must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.
Example
const [operation] = await client.instantiateInlineWorkflowTemplate(request);
const [response] = await operation.promise();

instantiateWorkflowTemplate(request, optionsopt) → {Promise}

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.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

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}

version number

Optional. The version of workflow template to instantiate. If specified, the workflow will be instantiated only if the current version of the workflow template has the supplied version.

This option cannot be used to instantiate a previous version of workflow template.

instanceId string

Deprecated. Please use request_id field instead.

requestId string

Optional. A tag that prevents multiple concurrent workflow instances with the same tag from running. This mitigates risk of concurrent instances started due to retries.

It is recommended to always set this value to a UUID.

The tag must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). The maximum length is 40 characters.

parameters Array.<number>

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

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the documentation for more details and examples.
Example
const [operation] = await client.instantiateWorkflowTemplate(request);
const [response] = await operation.promise();

listWorkflowTemplates(request, optionsopt) → {Promise}

Lists workflows that match the specified filter in the request.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

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}

pageSize number

Optional. The maximum number of results to return in each response.

pageToken string

Optional. The page token, returned by a previous call, to request the next page of results.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is Array of WorkflowTemplate. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listWorkflowTemplatesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listWorkflowTemplatesAsync(request, optionsopt) → {Object}

Equivalent to listWorkflowTemplates, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

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}

pageSize number

Optional. The maximum number of results to return in each response.

pageToken string

Optional. The page token, returned by a previous call, to request the next page of results.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Object

An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing WorkflowTemplate. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example
const iterable = client.listWorkflowTemplatesAsync(request);
for await (const response of iterable) {
  // process response
}

listWorkflowTemplatesStream(request, optionsopt) → {Stream}

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

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}

pageSize number

Optional. The maximum number of results to return in each response.

pageToken string

Optional. The page token, returned by a previous call, to request the next page of results.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Stream

An object stream which emits an object representing WorkflowTemplate on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listWorkflowTemplatesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName) → {string}

Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource.

Parameters:
Name Type Description
projectLocationAutoscalingPolicyName string

A fully-qualified path representing project_location_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the autoscaling_policy.

matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName) → {string}

Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource.

Parameters:
Name Type Description
projectRegionAutoscalingPolicyName string

A fully-qualified path representing project_region_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the autoscaling_policy.

matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName) → {string}

Parse the location from ProjectLocationAutoscalingPolicy resource.

Parameters:
Name Type Description
projectLocationAutoscalingPolicyName string

A fully-qualified path representing project_location_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the location.

matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName) → {string}

Parse the location from ProjectLocationWorkflowTemplate resource.

Parameters:
Name Type Description
projectLocationWorkflowTemplateName string

A fully-qualified path representing project_location_workflow_template resource.

Returns:
Type Description
string

A string representing the location.

matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName) → {string}

Parse the project from ProjectLocationAutoscalingPolicy resource.

Parameters:
Name Type Description
projectLocationAutoscalingPolicyName string

A fully-qualified path representing project_location_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the project.

matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName) → {string}

Parse the project from ProjectLocationWorkflowTemplate resource.

Parameters:
Name Type Description
projectLocationWorkflowTemplateName string

A fully-qualified path representing project_location_workflow_template resource.

Returns:
Type Description
string

A string representing the project.

matchProjectFromProjectName(projectName) → {string}

Parse the project from Project resource.

Parameters:
Name Type Description
projectName string

A fully-qualified path representing Project resource.

Returns:
Type Description
string

A string representing the project.

matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName) → {string}

Parse the project from ProjectRegionAutoscalingPolicy resource.

Parameters:
Name Type Description
projectRegionAutoscalingPolicyName string

A fully-qualified path representing project_region_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the project.

matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName) → {string}

Parse the project from ProjectRegionWorkflowTemplate resource.

Parameters:
Name Type Description
projectRegionWorkflowTemplateName string

A fully-qualified path representing project_region_workflow_template resource.

Returns:
Type Description
string

A string representing the project.

matchProjectFromRegionName(regionName) → {string}

Parse the project from Region resource.

Parameters:
Name Type Description
regionName string

A fully-qualified path representing Region resource.

Returns:
Type Description
string

A string representing the project.

matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName) → {string}

Parse the region from ProjectRegionAutoscalingPolicy resource.

Parameters:
Name Type Description
projectRegionAutoscalingPolicyName string

A fully-qualified path representing project_region_autoscaling_policy resource.

Returns:
Type Description
string

A string representing the region.

matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName) → {string}

Parse the region from ProjectRegionWorkflowTemplate resource.

Parameters:
Name Type Description
projectRegionWorkflowTemplateName string

A fully-qualified path representing project_region_workflow_template resource.

Returns:
Type Description
string

A string representing the region.

matchRegionFromRegionName(regionName) → {string}

Parse the region from Region resource.

Parameters:
Name Type Description
regionName string

A fully-qualified path representing Region resource.

Returns:
Type Description
string

A string representing the region.

matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName) → {string}

Parse the workflow_template from ProjectLocationWorkflowTemplate resource.

Parameters:
Name Type Description
projectLocationWorkflowTemplateName string

A fully-qualified path representing project_location_workflow_template resource.

Returns:
Type Description
string

A string representing the workflow_template.

matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName) → {string}

Parse the workflow_template from ProjectRegionWorkflowTemplate resource.

Parameters:
Name Type Description
projectRegionWorkflowTemplateName string

A fully-qualified path representing project_region_workflow_template resource.

Returns:
Type Description
string

A string representing the workflow_template.

projectLocationAutoscalingPolicyPath(project, location, autoscaling_policy) → {string}

Return a fully-qualified projectLocationAutoscalingPolicy resource name string.

Parameters:
Name Type Description
project string
location string
autoscaling_policy string
Returns:
Type Description
string

Resource name string.

projectLocationWorkflowTemplatePath(project, location, workflow_template) → {string}

Return a fully-qualified projectLocationWorkflowTemplate resource name string.

Parameters:
Name Type Description
project string
location string
workflow_template string
Returns:
Type Description
string

Resource name string.

projectPath(project) → {string}

Return a fully-qualified project resource name string.

Parameters:
Name Type Description
project string
Returns:
Type Description
string

Resource name string.

projectRegionAutoscalingPolicyPath(project, region, autoscaling_policy) → {string}

Return a fully-qualified projectRegionAutoscalingPolicy resource name string.

Parameters:
Name Type Description
project string
region string
autoscaling_policy string
Returns:
Type Description
string

Resource name string.

projectRegionWorkflowTemplatePath(project, region, workflow_template) → {string}

Return a fully-qualified projectRegionWorkflowTemplate resource name string.

Parameters:
Name Type Description
project string
region string
workflow_template string
Returns:
Type Description
string

Resource name string.

regionPath(project, region) → {string}

Return a fully-qualified region resource name string.

Parameters:
Name Type Description
project string
region string
Returns:
Type Description
string

Resource name string.

updateWorkflowTemplate(request, optionsopt) → {Promise}

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

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
template google.cloud.dataproc.v1beta2.WorkflowTemplate

Required. The updated workflow template.

The template.version field must match the current version.

options object <optional>

Call options. See CallOptions for more details.

Returns:
Type Description
Promise
  • The promise which resolves to an array. The first element of the array is an object representing WorkflowTemplate. Please see the documentation for more details and examples.
Example
const [response] = await client.updateWorkflowTemplate(request);