class AWS::Flow::Templates::FlowDefaultWorkflowRuby

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

Public Instance Methods

start(input) click to toggle source

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). @param 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
# 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