Class: Simplerubysteps::Task

Inherits:
State
  • Object
show all
Defined in:
lib/simplerubysteps/model.rb

Instance Attribute Summary collapse

Attributes inherited from State

#name, #state_machine

Instance Method Summary collapse

Methods inherited from State

#[]=, #error_catch, #error_retry, #next=, #render, #task_timeout

Constructor Details

#initialize(name) ⇒ Task

Returns a new instance of Task.



197
198
199
200
201
202
203
204
205
# File 'lib/simplerubysteps/model.rb', line 197

def initialize(name)
  super
  @dict[:Type] = "Task"
  @dict[:Resource] = pop_function_arn
  @dict[:Parameters] = {
    :Task => name,
    "Input.$" => "$",
  }
end

Instance Attribute Details

#iam_permissionsObject

Returns the value of attribute iam_permissions.



195
196
197
# File 'lib/simplerubysteps/model.rb', line 195

def iam_permissions
  @iam_permissions
end

Instance Method Details

#action(&action_block) ⇒ Object



207
208
209
# File 'lib/simplerubysteps/model.rb', line 207

def action(&action_block)
  @action_block = action_block
end

#implicit_choiceObject



224
225
226
227
228
229
230
231
# File 'lib/simplerubysteps/model.rb', line 224

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



211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/simplerubysteps/model.rb', line 211

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