Workflows V1beta API - Class Google::Cloud::Workflows::V1beta::Workflows::Client (v0.4.0)

Reference documentation and code samples for the Workflows V1beta API class Google::Cloud::Workflows::V1beta::Workflows::Client.

Client for the Workflows service.

Workflows is used to deploy and execute workflow programs. Workflows makes sure the program executes reliably, despite hardware and networking interruptions.

Inherits

  • Object

Methods

.configure

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

Configure the Workflows 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 Workflows clients
::Google::Cloud::Workflows::V1beta::Workflows::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the Workflows 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

def create_workflow(request, options = nil) -> ::Gapic::Operation
def create_workflow(parent: nil, workflow: nil, workflow_id: nil) -> ::Gapic::Operation

Creates a new workflow. If a workflow with the specified name already exists in the specified project and location, the long running operation will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error.

Overloads
def create_workflow(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_workflow via a request object, either of type CreateWorkflowRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Workflows::V1beta::CreateWorkflowRequest, ::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(parent: nil, workflow: nil, workflow_id: nil) -> ::Gapic::Operation
Pass arguments to create_workflow 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. Project and location in which the workflow should be created. Format: projects/{project}/locations/{location}
  • workflow (::Google::Cloud::Workflows::V1beta::Workflow, ::Hash) — Required. Workflow to be created.
  • workflow_id (::String) —

    Required. The ID of the workflow to be created. It has to fulfill the following requirements:

    • Must contain only letters, numbers, underscores and hyphens.
    • Must start with a letter.
    • Must be between 1-64 characters.
    • Must end with a number or a letter.
    • Must be unique within the customer project and location.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/workflows/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Workflows::V1beta::Workflows::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Workflows::V1beta::CreateWorkflowRequest.new

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

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

#delete_workflow

def delete_workflow(request, options = nil) -> ::Gapic::Operation
def delete_workflow(name: nil) -> ::Gapic::Operation

Deletes a workflow with the specified name. This method also cancels and deletes all running executions of the workflow.

Overloads
def delete_workflow(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_workflow via a request object, either of type DeleteWorkflowRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Workflows::V1beta::DeleteWorkflowRequest, ::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(name: nil) -> ::Gapic::Operation
Pass arguments to delete_workflow 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
  • name (::String) — Required. Name of the workflow to be deleted. Format: projects/{project}/locations/{location}/workflows/{workflow}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/workflows/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Workflows::V1beta::Workflows::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Workflows::V1beta::DeleteWorkflowRequest.new

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

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

#get_workflow

def get_workflow(request, options = nil) -> ::Google::Cloud::Workflows::V1beta::Workflow
def get_workflow(name: nil) -> ::Google::Cloud::Workflows::V1beta::Workflow

Gets details of a single Workflow.

Overloads
def get_workflow(request, options = nil) -> ::Google::Cloud::Workflows::V1beta::Workflow
Pass arguments to get_workflow via a request object, either of type GetWorkflowRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Workflows::V1beta::GetWorkflowRequest, ::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(name: nil) -> ::Google::Cloud::Workflows::V1beta::Workflow
Pass arguments to get_workflow 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
  • name (::String) — Required. Name of the workflow which information should be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/workflows/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Workflows::V1beta::Workflows::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Workflows::V1beta::GetWorkflowRequest.new

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

# The returned object is of type Google::Cloud::Workflows::V1beta::Workflow.
p result

#initialize

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

Create a new Workflows client object.

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

# Create a client using a custom configuration
client = ::Google::Cloud::Workflows::V1beta::Workflows::Client.new do |config|
  config.timeout = 10.0
end

#list_workflows

def list_workflows(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Workflows::V1beta::Workflow>
def list_workflows(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Workflows::V1beta::Workflow>

Lists Workflows in a given project and location. The default order is not specified.

Overloads
def list_workflows(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Workflows::V1beta::Workflow>
Pass arguments to list_workflows via a request object, either of type ListWorkflowsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Workflows::V1beta::ListWorkflowsRequest, ::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_workflows(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Workflows::V1beta::Workflow>
Pass arguments to list_workflows 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. Project and location from which the workflows should be listed. Format: projects/{project}/locations/{location}
  • page_size (::Integer) — Maximum number of workflows to return per call. The service may return fewer than this value. If the value is not specified, a default value of 500 will be used. The maximum permitted value is 1000 and values greater than 1000 will be coerced down to 1000.
  • page_token (::String) — A page token, received from a previous ListWorkflows call. Provide this to retrieve the subsequent page.

    When paginating, all other parameters provided to ListWorkflows must match the call that provided the page token.

  • filter (::String) — Filter to restrict results to specific workflows.
  • order_by (::String) — Comma-separated list of fields that that specify the order of the results. Default sorting order for a field is ascending. To specify descending order for a field, append a " desc" suffix. If not specified, the results will be returned in an unspecified order.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/workflows/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Workflows::V1beta::Workflows::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Workflows::V1beta::ListWorkflowsRequest.new

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

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::Workflows::V1beta::Workflow.
  p response
end

#operations_client

def operations_client() -> ::Google::Cloud::Workflows::V1beta::Workflows::Operations

Get the associated client for long-running operations.

#update_workflow

def update_workflow(request, options = nil) -> ::Gapic::Operation
def update_workflow(workflow: nil, update_mask: nil) -> ::Gapic::Operation

Updates an existing workflow. Running this method has no impact on already running executions of the workflow. A new revision of the workflow may be created as a result of a successful update operation. In that case, such revision will be used in new workflow executions.

Overloads
def update_workflow(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_workflow via a request object, either of type UpdateWorkflowRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Workflows::V1beta::UpdateWorkflowRequest, ::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(workflow: nil, update_mask: nil) -> ::Gapic::Operation
Pass arguments to update_workflow 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
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/workflows/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Workflows::V1beta::Workflows::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Workflows::V1beta::UpdateWorkflowRequest.new

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

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