Class: Simplerubysteps::Task
- Defined in:
- lib/simplerubysteps/model.rb
Instance Attribute Summary collapse
-
#iam_permissions ⇒ Object
Returns the value of attribute iam_permissions.
Attributes inherited from State
Instance Method Summary collapse
- #action(&action_block) ⇒ Object
- #error_catch(state) ⇒ Object
- #error_retry(interval, max, backoff) ⇒ Object
- #implicit_choice ⇒ Object
-
#initialize(name) ⇒ Task
constructor
A new instance of Task.
- #perform_action(input) ⇒ Object
Methods inherited from State
Constructor Details
#initialize(name) ⇒ Task
Returns a new instance of Task.
160 161 162 163 164 165 166 167 168 |
# File 'lib/simplerubysteps/model.rb', line 160 def initialize(name) super @dict[:Type] = "Task" @dict[:Resource] = pop_function_arn @dict[:Parameters] = { :Task => name, "Input.$" => "$", } end |
Instance Attribute Details
#iam_permissions ⇒ Object
Returns the value of attribute iam_permissions.
158 159 160 |
# File 'lib/simplerubysteps/model.rb', line 158 def @iam_permissions end |
Instance Method Details
#action(&action_block) ⇒ Object
191 192 193 |
# File 'lib/simplerubysteps/model.rb', line 191 def action(&action_block) @action_block = action_block end |
#error_catch(state) ⇒ Object
181 182 183 184 185 186 187 188 189 |
# File 'lib/simplerubysteps/model.rb', line 181 def error_catch(state) @dict[:Catch] = [ { :ErrorEquals => ["States.ALL"], :Next => (state.is_a? Symbol) ? state : state.name, :ResultPath => "$.error", }, ] end |
#error_retry(interval, max, backoff) ⇒ Object
170 171 172 173 174 175 176 177 178 179 |
# File 'lib/simplerubysteps/model.rb', line 170 def error_retry(interval, max, backoff) @dict[:Retry] = [ { :ErrorEquals => ["States.ALL"], :IntervalSeconds => interval, :BackoffRate => backoff, :MaxAttempts => max, }, ] end |
#implicit_choice ⇒ Object
208 209 210 211 212 213 214 215 |
# File 'lib/simplerubysteps/model.rb', line 208 def implicit_choice unless @implicit_choice @implicit_choice = Choice.new("#{name}_choice") $sm.add @implicit_choice self.next = @implicit_choice end @implicit_choice end |
#perform_action(input) ⇒ Object
195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/simplerubysteps/model.rb', line 195 def perform_action(input) output = input # default: pass through output = @action_block.call(input) if @action_block if @implicit_choice output = {} unless output @implicit_choice.perform_action(output) end output end |