Method: AWS::SimpleWorkflow::WorkflowExecutionCollection#count

Defined in:
lib/aws/simple_workflow/workflow_execution_collection.rb

#count(options = {}) ⇒ Count

Note:

You may only pass one of the following options: :workflow_id, :workflow_type, :tagged or :status with a “closed” value (:status with :open is okay).

Note:

This operation is eventually consistent. The results are best effort and may not exactly reflect recent updates and changes.

Returns the number of workflow executions within the domain that meet the specified filtering criteria. Counts can be truncated so you should check the return value.

count = domain.workflow_executions.count
puts(count.truncated? ? "#{count.to_i}+" : count.to_i)

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :status (Symbol)

    Filters workflow executions by the given status. If status is not provided then it defaults to :open unless you pass :closed_between (then it defaults to :closed).

    If :status is anything besides :open or :closed then it may not be passed with :workflow_id, :workflow_type or :tagged.

    Accepted values for :status include:

    • :open

    • :closed

    • :completed

    • :failed

    • :canceled

    • :terminated

    • :continued

    • :timed_out

  • :started_after (Time)

    Filters workflow executions down to those started after the given time.

    You may pass :started_after with :started_before, but not with :closed_after or :closed_before.

  • :started_before (Time)

    Filters workflow executions down to those started before the given time.

    You may pass :started_after with :started_before, but not with :closed_after or :closed_before.

  • :closed_after (Time)

    Filters workflow executions to those closed after the given time.

    • You may pass :closed_after with :closed_before, but not with :started_after or :started_before.

    • This option is invalid when counting or listing open executions.

  • :closed_before (Time)

    Filters workflow executions to those closed before the given time.

    • You may pass :closed_after with :closed_before, but not with :started_after or :started_before.

    • This option is invalid when counting or listing open executions.

  • :workflow_id (String) — default: nil

    If specified, workflow executions are filtered by the provided workflow id.

  • :tagged (String) — default: nil

    Filters workflow executions by the given tag.

  • :workflow_type (WorkflowType, Hash) — default: nil

    Filters workflow executions with the given workflow type. :workflow_type can be a AWS::SimpleWorkflow::WorkflowType object or a hash with a workflow type :name and :version.

Returns:

  • (Count)

    Returns a possibly truncated count of workflow executions.



470
471
472
473
474
475
476
477
# File 'lib/aws/simple_workflow/workflow_execution_collection.rb', line 470

def count options = {}

  open_or_closed, client_opts = handle_options(options)

  client_method = :"count_#{open_or_closed}_workflow_executions"
  response = client.send(client_method, client_opts)
  Count.new(response.data['count'], response.data['truncated'])
end