ruby-sfn-local 0.1.6 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sfn/execution_log.rb +8 -8
- data/lib/sfn/state_machine.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c91b50b39f94e77840a25e9179e86fca730a556d7884fcee41997f76e6273ae0
|
4
|
+
data.tar.gz: 36465c625f9169533a80018d4a5d3840bff585fcfac216b9ab43d0f8df933211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dfe1991cac8fdecccf933a4b83c1bd328875dc6b6fa236098ab0d64f79a5dc8a6adeba45e45987182b57c974957a7d01852d03dce23c284feb4ba9a907d31e5
|
7
|
+
data.tar.gz: 3405576ab516b3d7f5f9f59478d8113ec31da189a01a2aa1ee255e0163b349991274e1b00c1310cb69cbd3047fafb8261cd0fed1ed0561653756ae99c24deceb
|
data/lib/sfn/execution_log.rb
CHANGED
@@ -33,12 +33,12 @@ module Sfn
|
|
33
33
|
state_name = parsed_event.state_name
|
34
34
|
|
35
35
|
unless state_name.nil?
|
36
|
-
profile[state_name] ||= { input
|
37
|
-
profile[state_name][
|
38
|
-
profile[state_name][
|
36
|
+
profile[state_name] ||= { 'input' => [], 'output' => [], 'parameters' => [] }
|
37
|
+
profile[state_name]['input'] << parsed_event.profile['input'] unless parsed_event.profile['input'].nil?
|
38
|
+
profile[state_name]['output'] << parsed_event.profile['output'] unless parsed_event.profile['output'].nil?
|
39
39
|
end
|
40
|
-
if !last_state_name.nil? && !parsed_event.profile[
|
41
|
-
profile[last_state_name][
|
40
|
+
if !last_state_name.nil? && !parsed_event.profile['parameters'].nil?
|
41
|
+
profile[last_state_name]['parameters'] << parsed_event.profile['parameters']
|
42
42
|
end
|
43
43
|
end
|
44
44
|
[output, profile]
|
@@ -66,9 +66,9 @@ module Sfn
|
|
66
66
|
|
67
67
|
def profile
|
68
68
|
{
|
69
|
-
input
|
70
|
-
output
|
71
|
-
parameters
|
69
|
+
'input' => try_parse(event.dig('stateEnteredEventDetails', 'input')),
|
70
|
+
'output' => try_parse(event.dig('stateExitedEventDetails', 'output')),
|
71
|
+
'parameters' => try_parse(event.dig('taskScheduledEventDetails', 'parameters'))
|
72
72
|
}.compact
|
73
73
|
end
|
74
74
|
|
data/lib/sfn/state_machine.rb
CHANGED
@@ -9,7 +9,7 @@ module Sfn
|
|
9
9
|
class StateMachine
|
10
10
|
ROLE = 'arn:aws:iam::123456789012:role/DummyRole'
|
11
11
|
|
12
|
-
attr_accessor :name, :definition, :arn, :executions, :execution_arn
|
12
|
+
attr_accessor :name, :path, :definition, :arn, :executions, :execution_arn
|
13
13
|
|
14
14
|
def self.all
|
15
15
|
Collection.instance.all.map { |sf| new(sf['name'], sf['stateMachineArn']) }
|
@@ -28,8 +28,9 @@ module Sfn
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def initialize(name, arn = nil)
|
31
|
-
self.
|
32
|
-
self.
|
31
|
+
self.path = "#{Sfn.configuration.definition_path}/#{name}.json"
|
32
|
+
self.name = name.split("/").last
|
33
|
+
self.arn = arn || self.class.find_by_name(self.name)&.arn || create_state_machine
|
33
34
|
self.executions = {}
|
34
35
|
end
|
35
36
|
|
@@ -53,18 +54,17 @@ module Sfn
|
|
53
54
|
|
54
55
|
def create_state_machine
|
55
56
|
self.arn = AwsCli.run('stepfunctions', 'create-state-machine',
|
56
|
-
{ definition: load_definition
|
57
|
+
{ definition: load_definition, name: name, 'role-arn': ROLE }, 'stateMachineArn')
|
57
58
|
raise Sf::DefinitionError if arn.empty?
|
58
59
|
|
59
60
|
Collection.instance.add(to_hash)
|
60
61
|
arn
|
61
62
|
end
|
62
63
|
|
63
|
-
def load_definition
|
64
|
+
def load_definition
|
64
65
|
local_definition_path = Tempfile.new(['name', '.json']).path
|
65
|
-
|
66
|
-
|
67
|
-
definition = File.read(remote_definition_path)
|
66
|
+
|
67
|
+
definition = File.read(self.path)
|
68
68
|
local_definition = definition.gsub(/"MaxConcurrency": [0-9]+/, '"MaxConcurrency": 1')
|
69
69
|
|
70
70
|
File.open(local_definition_path, 'w') { |file| file.puts local_definition }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-sfn-local
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gianni Mazza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-release
|