Class: Sfn::Execution
- Inherits:
-
Object
- Object
- Sfn::Execution
- Defined in:
- lib/sfn/execution.rb
Instance Attribute Summary collapse
-
#arn ⇒ Object
Returns the value of attribute arn.
-
#id ⇒ Object
Returns the value of attribute id.
-
#output ⇒ Object
Returns the value of attribute output.
-
#profile ⇒ Object
Returns the value of attribute profile.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
-
#state_machine ⇒ Object
Returns the value of attribute state_machine.
-
#test_case ⇒ Object
Returns the value of attribute test_case.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Class Method Summary collapse
Instance Method Summary collapse
- #exec(mock_data, input, dry_run = false) ⇒ Object
-
#initialize(state_machine, test_case) ⇒ Execution
constructor
A new instance of Execution.
Constructor Details
#initialize(state_machine, test_case) ⇒ Execution
Returns a new instance of Execution.
11 12 13 14 15 16 |
# File 'lib/sfn/execution.rb', line 11 def initialize(state_machine, test_case) self.uuid = SecureRandom.uuid self.state_machine = state_machine self.id = "#{self.state_machine.arn.gsub('stateMachine', 'execution')}:#{uuid}" self.test_case = test_case.camelize end |
Instance Attribute Details
#arn ⇒ Object
Returns the value of attribute arn.
5 6 7 |
# File 'lib/sfn/execution.rb', line 5 def arn @arn end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/sfn/execution.rb', line 5 def id @id end |
#output ⇒ Object
Returns the value of attribute output.
5 6 7 |
# File 'lib/sfn/execution.rb', line 5 def output @output end |
#profile ⇒ Object
Returns the value of attribute profile.
5 6 7 |
# File 'lib/sfn/execution.rb', line 5 def profile @profile end |
#start_date ⇒ Object
Returns the value of attribute start_date.
5 6 7 |
# File 'lib/sfn/execution.rb', line 5 def start_date @start_date end |
#state_machine ⇒ Object
Returns the value of attribute state_machine.
5 6 7 |
# File 'lib/sfn/execution.rb', line 5 def state_machine @state_machine end |
#test_case ⇒ Object
Returns the value of attribute test_case.
5 6 7 |
# File 'lib/sfn/execution.rb', line 5 def test_case @test_case end |
#uuid ⇒ Object
Returns the value of attribute uuid.
5 6 7 |
# File 'lib/sfn/execution.rb', line 5 def uuid @uuid end |
Class Method Details
.call(state_machine, test_case, mock_data, input, dry_run = false) ⇒ Object
7 8 9 |
# File 'lib/sfn/execution.rb', line 7 def self.call(state_machine, test_case, mock_data, input, dry_run = false) new(state_machine, test_case).exec(mock_data, input, dry_run) end |
Instance Method Details
#exec(mock_data, input, dry_run = false) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sfn/execution.rb', line 18 def exec(mock_data, input, dry_run = false) MockData.write_context(state_machine.name, test_case, mock_data) out = AwsCli.run('stepfunctions', 'start-execution', { name: uuid, 'state-machine': "#{state_machine.arn}##{test_case}", input: "'#{input.to_json}'" }) decoded = JSON.parse(out) self.arn = decoded['executionArn'] self.start_date = decoded['startDate'].gsub('000+00:00', 'Z') self.output, self.profile = ExecutionLog.parse(arn, dry_run) self end |