module AWS::Flow::Templates::Utils

Public Class Methods

register_default_result_activity(domain) click to toggle source

Registers the default result activity type FlowDefaultResultActivityRuby with the Simple Workflow Service @api private

# File lib/aws/templates/utilities.rb, line 45
def self.register_default_result_activity(domain)
  worker = AWS::Flow::ActivityWorker.new(
    domain.client,
    domain,
    nil,
    AWS::Flow::Templates.result_activity
  ) {{ use_forking: false }}
  worker.register
end
register_default_workflow(domain) click to toggle source

Registers the default workflow type FlowDefaultWorkflowRuby with the Simple Workflow Service @api private

# File lib/aws/templates/utilities.rb, line 33
def self.register_default_workflow(domain)
  AWS::Flow::WorkflowWorker.new(
    domain.client,
    domain,
    nil,
    AWS::Flow::Templates.default_workflow
  ).register
end
register_defaults(name=nil) click to toggle source

Registers the relevant defaults with the Simple Workflow Service. If domain name is not provided, it registers the FlowDefault domain @api private

# File lib/aws/templates/utilities.rb, line 22
def self.register_defaults(name=nil)
  name ||= FlowConstants.defaults[:domain]
  domain = AWS::Flow::Utilities.register_domain(name)

  register_default_workflow(domain)
  register_default_result_activity(domain)
end
register_on_failure(domain, &block) click to toggle source

This method calls the given block. If an UnknownResourceFault is returned, then it tries to register AWS Flow defaults with the service and calls the block again.

# File lib/aws/templates/utilities.rb, line 10
def self.register_on_failure(domain, &block)
  begin
    block.call(domain)
  rescue AWS::SimpleWorkflow::Errors::UnknownResourceFault => e
    register_defaults(domain)
    block.call(domain)
  end
end