Cloud Dataproc V1 API - Class Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client (v0.25.0)

Reference documentation and code samples for the Cloud Dataproc V1 API class Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client.

REST client for the WorkflowTemplateService service.

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

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the WorkflowTemplateService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all WorkflowTemplateService clients
::Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the WorkflowTemplateService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_workflow_template

def create_workflow_template(request, options = nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate
def create_workflow_template(parent: nil, template: nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate

Creates new workflow template.

Overloads
def create_workflow_template(request, options = nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate
Pass arguments to create_workflow_template via a request object, either of type CreateWorkflowTemplateRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::CreateWorkflowTemplateRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_workflow_template(parent: nil, template: nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate
Pass arguments to create_workflow_template via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • 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::V1::WorkflowTemplate, ::Hash) — Required. The Dataproc workflow template to create.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::CreateWorkflowTemplateRequest.new

# Call the create_workflow_template method.
result = client.create_workflow_template request

# The returned object is of type Google::Cloud::Dataproc::V1::WorkflowTemplate.
p result

#delete_workflow_template

def delete_workflow_template(request, options = nil) -> ::Google::Protobuf::Empty
def delete_workflow_template(name: nil, version: nil) -> ::Google::Protobuf::Empty

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

Overloads
def delete_workflow_template(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_workflow_template via a request object, either of type DeleteWorkflowTemplateRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::DeleteWorkflowTemplateRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_workflow_template(name: nil, version: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_workflow_template via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • 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 (::Integer) — Optional. The version of workflow template to delete. If specified, will only delete the template if the current server version matches specified version.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::DeleteWorkflowTemplateRequest.new

# Call the delete_workflow_template method.
result = client.delete_workflow_template request

# The returned object is of type Google::Protobuf::Empty.
p result

#get_workflow_template

def get_workflow_template(request, options = nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate
def get_workflow_template(name: nil, version: nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate

Retrieves the latest workflow template.

Can retrieve previously instantiated template by specifying optional version parameter.

Overloads
def get_workflow_template(request, options = nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate
Pass arguments to get_workflow_template via a request object, either of type GetWorkflowTemplateRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::GetWorkflowTemplateRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_workflow_template(name: nil, version: nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate
Pass arguments to get_workflow_template via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • 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 (::Integer) — Optional. The version of workflow template to retrieve. Only previously instantiated versions can be retrieved.

    If unspecified, retrieves the current version.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::GetWorkflowTemplateRequest.new

# Call the get_workflow_template method.
result = client.get_workflow_template request

# The returned object is of type Google::Cloud::Dataproc::V1::WorkflowTemplate.
p result

#iam_policy_client

def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Rest::Client

Get the associated client for mix-in of the IAMPolicy.

Returns
  • (Google::Iam::V1::IAMPolicy::Rest::Client)

#initialize

def initialize() { |config| ... } -> Client

Create a new WorkflowTemplateService REST client object.

Yields
  • (config) — Configure the WorkflowTemplateService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client.new do |config|
  config.timeout = 10.0
end

#instantiate_inline_workflow_template

def instantiate_inline_workflow_template(request, options = nil) -> ::Gapic::Operation
def instantiate_inline_workflow_template(parent: nil, template: nil, request_id: nil) -> ::Gapic::Operation

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.

Overloads
def instantiate_inline_workflow_template(request, options = nil) -> ::Gapic::Operation
Pass arguments to instantiate_inline_workflow_template via a request object, either of type InstantiateInlineWorkflowTemplateRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::InstantiateInlineWorkflowTemplateRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def instantiate_inline_workflow_template(parent: nil, template: nil, request_id: nil) -> ::Gapic::Operation
Pass arguments to instantiate_inline_workflow_template via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • 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::V1::WorkflowTemplate, ::Hash) — Required. The workflow template to instantiate.
  • request_id (::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.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::InstantiateInlineWorkflowTemplateRequest.new

# Call the instantiate_inline_workflow_template method.
result = client.instantiate_inline_workflow_template request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#instantiate_workflow_template

def instantiate_workflow_template(request, options = nil) -> ::Gapic::Operation
def instantiate_workflow_template(name: nil, version: nil, request_id: nil, parameters: nil) -> ::Gapic::Operation

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.

Overloads
def instantiate_workflow_template(request, options = nil) -> ::Gapic::Operation
Pass arguments to instantiate_workflow_template via a request object, either of type InstantiateWorkflowTemplateRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::InstantiateWorkflowTemplateRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def instantiate_workflow_template(name: nil, version: nil, request_id: nil, parameters: nil) -> ::Gapic::Operation
Pass arguments to instantiate_workflow_template via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • 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 (::Integer) — 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.

  • request_id (::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 (::Hash{::String => ::String}) — Optional. Map from parameter names to values that should be used for those parameters. Values may not exceed 1000 characters.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::InstantiateWorkflowTemplateRequest.new

# Call the instantiate_workflow_template method.
result = client.instantiate_workflow_template request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#list_workflow_templates

def list_workflow_templates(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::WorkflowTemplate>
def list_workflow_templates(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::WorkflowTemplate>

Lists workflows that match the specified filter in the request.

Overloads
def list_workflow_templates(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::WorkflowTemplate>
Pass arguments to list_workflow_templates via a request object, either of type ListWorkflowTemplatesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::ListWorkflowTemplatesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_workflow_templates(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::WorkflowTemplate>
Pass arguments to list_workflow_templates via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • 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}

  • page_size (::Integer) — Optional. The maximum number of results to return in each response.
  • page_token (::String) — Optional. The page token, returned by a previous call, to request the next page of results.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::ListWorkflowTemplatesRequest.new

# Call the list_workflow_templates method.
result = client.list_workflow_templates request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Dataproc::V1::WorkflowTemplate.
  p item
end

#operations_client

def operations_client() -> ::Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Operations

Get the associated client for long-running operations.

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_workflow_template

def update_workflow_template(request, options = nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate
def update_workflow_template(template: nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate

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

Overloads
def update_workflow_template(request, options = nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate
Pass arguments to update_workflow_template via a request object, either of type UpdateWorkflowTemplateRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Dataproc::V1::UpdateWorkflowTemplateRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_workflow_template(template: nil) -> ::Google::Cloud::Dataproc::V1::WorkflowTemplate
Pass arguments to update_workflow_template via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/dataproc/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dataproc::V1::WorkflowTemplateService::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dataproc::V1::UpdateWorkflowTemplateRequest.new

# Call the update_workflow_template method.
result = client.update_workflow_template request

# The returned object is of type Google::Cloud::Dataproc::V1::WorkflowTemplate.
p result