Module: AWS::Flow::Templates Private

Defined in:
lib/aws/templates/starter.rb,
lib/aws/templates/base.rb,
lib/aws/templates/result.rb,
lib/aws/templates/default.rb,
lib/aws/templates/activity.rb,
lib/aws/templates/utilities.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Modules: ActivityProxies, Utils Classes: ActivityTemplate, FlowDefaultResultActivityRuby, FlowDefaultWorkflowRuby, ResultActivityTemplate, ResultWorker, RootTemplate, Starter, TemplateBase

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.activity(name, opts = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes an activity template

Parameters:

  • name (String)
  • options (Hash)


63
64
65
# File 'lib/aws/templates/activity.rb', line 63

def self.activity(name, opts = {})
  ActivityTemplate.new(name, opts)
end

.default_workflowObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the default workflow class



143
144
145
# File 'lib/aws/templates/default.rb', line 143

def self.default_workflow
  return AWS::Flow::Templates.const_get(FlowConstants.defaults[:prefix_name])
end

.make_activity_class(klass) ⇒ Object

Used to convert a regular ruby class into a Ruby Flow Activity class, i.e. extends the AWS::Flow::Activities module. It converts all user defined instance methods into activities and assigns the following defaults to the ActivityType - version: “1.0”



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/aws/templates/default.rb', line 60

def self.make_activity_class(klass)
  return klass if klass.nil?

  name = klass.name.split(":").last

  proxy_name = name + "Proxy"
  # Create a proxy activity class that will define activities for all
  # instance methods of the class.
  new_klass = self::ActivityProxies.const_set(proxy_name.to_sym, Class.new(Object))

  # Extend the AWS::Flow::Activities module and create activities for all
  # instance methods
  new_klass.class_exec do
    extend AWS::Flow::Activities

    attr_reader :instance

    @@klass = klass

    def initialize
      @instance = @@klass.new
    end

    # Creates activities for all instance methods of the held klass
    @@klass.instance_methods(false).each do |method|
      activity(method) do
        {
          version: "1.0",
          prefix_name: name
        }
      end
    end

    # Redirect all method calls to the held instance
    def method_missing(method, *args, &block)
      @instance.send(method, *args, &block)
    end

  end
  new_klass
end

.result(key, opts = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes a result activity template

Parameters:

  • key (String)

    A unique key that identifies the result of an activity execution

  • options (Hash)


103
104
105
# File 'lib/aws/templates/activity.rb', line 103

def self.result(key, opts = {})
  ResultActivityTemplate.new(key, opts)
end

.result_activityObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the default result activity class



137
138
139
# File 'lib/aws/templates/default.rb', line 137

def self.result_activity
  return AWS::Flow::Templates.const_get(FlowConstants.defaults[:result_activity_prefix])
end

.root(step, result_step = nil) ⇒ Object

Initializes a root template

Parameters:

  • step (TemplateBase)

    An AWS Flow Framework Template class that inherits TemplateBase. It contains the actual orchestration of workflow logic inside it.

  • result_step (ActivityTemplate) (defaults to: nil)

    An optional ActivityTemplate that can be used to report the result of the ‘step’



80
81
82
# File 'lib/aws/templates/base.rb', line 80

def self.root(step, result_step = nil)
  RootTemplate.new(step, result_step)
end

Instance Method Details

#activity(name, opts = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes an activity template

Parameters:

  • name (String)
  • options (Hash)


56
57
58
# File 'lib/aws/templates/activity.rb', line 56

def activity(name, opts = {})
  AWS::Flow::Templates.send(:activity, name, opts)
end

#result(key, opts = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes a result activity template

Parameters:

  • key (String)

    A unique key that identifies the result of an activity execution

  • options (Hash)


95
96
97
# File 'lib/aws/templates/activity.rb', line 95

def result(key, opts = {})
  AWS::Flow::Templates.send(:result, key, opts)
end

#root(step, result_step = nil) ⇒ Object

Initializes a root template

Parameters:

  • step (TemplateBase)

    An AWS Flow Framework Template class that inherits TemplateBase. It contains the actual orchestration of workflow logic inside it.

  • result_step (ActivityTemplate) (defaults to: nil)

    An optional ActivityTemplate that can be used to report the result of the ‘step’



69
70
71
# File 'lib/aws/templates/base.rb', line 69

def root(step, result_step = nil)
  AWS::Flow::Templates.send(:root, step, result_step)
end