Class: AWS::Flow::Templates::FlowDefaultWorkflowRuby

Inherits:
Object
  • Object
show all
Extended by:
Workflows
Defined in:
lib/aws/templates/default.rb

Overview

Default workflow class for the AWS Flow Framework for Ruby. It can run workflows defined by WorkflowTemplates.

Instance Attribute Summary

Attributes included from Workflows

#options, #version, #workflows

Attributes included from Utilities::UpwardLookups

#precursors

Instance Method Summary collapse

Methods included from Workflows

_options, activity_client, child_workflow_client, entry_point, extended, get_state_method, look_upwards, signal, signals, workflow

Methods included from Utilities::UpwardLookups

#held_properties, #properties, #property

Instance Method Details

#start(input) ⇒ Object

Define the workflow method :start. It will take in an input hash that contains the root template (:definition) and the arguments to the template (:args).

Parameters:

  • input

    Hash A hash containing the following keys -

    definition: An object of type AWS::Flow::Templates::RootTemplate
    args: Hash of arguments to be passed to the definition
    

Raises:

  • (ArgumentError)


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/aws/templates/default.rb', line 32

def start(input)

  raise ArgumentError, "Workflow input must be a Hash" unless input.is_a?(Hash)
  raise ArgumentError, "Input hash must contain key :definition" if input[:definition].nil?
  raise ArgumentError, "Input hash must contain key :args" if input[:args].nil?

  definition = input[:definition]
  args = input[:args]

  unless definition.is_a?(AWS::Flow::Templates::RootTemplate)
    raise "Workflow Definition must be a AWS::Flow::Templates::RootTemplate"
  end
  raise "Input must be a Hash" unless args.is_a?(Hash)

  # Run the root workflow template
  definition.run(args, self)

end