Workflows V1 API - Class Google::Cloud::Workflows::V1::Workflows::Client (v0.5.0)

Reference documentation and code samples for the Workflows V1 API class Google::Cloud::Workflows::V1::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::V1::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 returns a [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::V1::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::V1::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/v1"

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

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

# Call the create_workflow method.
result = client.create_workflow 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

#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::V1::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/v1"

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

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

# Call the delete_workflow method.
result = client.delete_workflow 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

#get_workflow

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

Gets details of a single workflow.

Overloads
def get_workflow(request, options = nil) -> ::Google::Cloud::Workflows::V1::Workflow
Pass arguments to get_workflow via a request object, either of type GetWorkflowRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Workflows::V1::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, revision_id: nil) -> ::Google::Cloud::Workflows::V1::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).
Parameters
  • name (::String) — Required. Name of the workflow for which information should be retrieved. Format: projects/{project}/locations/{location}/workflows/{workflow}
  • revision_id (::String) — Optional. The revision of the workflow to retrieve. If the revision_id is empty, the latest revision is retrieved. The format is "000001-a4d", where the first six characters define the zero-padded decimal revision number. They are followed by a hyphen and three hexadecimal characters.
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/v1"

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

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

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

# The returned object is of type Google::Cloud::Workflows::V1::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::V1::Workflows::Client.new

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

#list_workflows

def list_workflows(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Workflows::V1::Workflow>
def list_workflows(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Workflows::V1::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::V1::Workflow>
Pass arguments to list_workflows via a request object, either of type ListWorkflowsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Workflows::V1::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::V1::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 might return fewer than this value even if not at the end of the collection. If a value is not specified, a default value of 500 is used. The maximum permitted value is 1000 and values greater than 1000 are 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 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 are 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/v1"

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

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

# Call the list_workflows method.
result = client.list_workflows 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::Workflows::V1::Workflow.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Client

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

Returns
  • (Google::Cloud::Location::Locations::Client)

#operations_client

def operations_client() -> ::Google::Cloud::Workflows::V1::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 might be created as a result of a successful update operation. In that case, the new revision is 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::V1::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/v1"

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

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

# Call the update_workflow method.
result = client.update_workflow 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