ruby-sfn-local 0.1.19 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 184760e30916c0f301d4bc438b66f213c75774987df81472cf3a7c05dbbc0b3d
4
- data.tar.gz: 7d6c7cf307eec32ade24d3a472c2f0dc396ece10daf296af401ce8d7d5fa7023
3
+ metadata.gz: 7aecf6c849675ba5bedf2ce24ba2d61f413979d33f9c41f09aca0727300a9d57
4
+ data.tar.gz: ac7e0c7daee81a592c5f1b2b80c87b5f87195cc44cfbd93f9a53c67cc97ffaaf
5
5
  SHA512:
6
- metadata.gz: 4a78367ca2df85472e6a090e5aac5d0d5c2707828a1a5d852c74aa9afb1ba05820a56192103743556856b6af92bccc234a6de1fd9a4c4d43d3a887bb808693e2
7
- data.tar.gz: 332a9ab75391af1b4b106bca9f28ae4f9203d30a2506c180be3750cddf9239160d80559d1e9c027cced1f95675ab589f4e87fbaf393751b6860dbdb250a55ed4
6
+ metadata.gz: d0a215a2121df1512c0744b83d81363923c766042020f24dec06cf8a487999709e4d08c341311ed46547ea848571ca171667fefaf1a410e7995f054e1f24d081
7
+ data.tar.gz: 67a289346a119264a6d45536f5d8af693bec4a64360f04db223d2f1b221eab97a6488a05f63d63d55036f17cc25b7d069787ec0990a496bb2f0d3bc6e71d7973
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sfn
4
+ module MockMacros
5
+ module SecretsManager
6
+ def self.response(data)
7
+ data = [data] if data.is_a?(Hash)
8
+ data.map! do |val|
9
+ if val.key?(:error)
10
+ { Throw: { Error: val[:error], Cause: val[:cause] } }
11
+ else
12
+ val[:response] ||= val[:payload]
13
+ val[:response] ||= val[:output]
14
+ { Return: response_body(val) }
15
+ end
16
+ end
17
+ out = {}
18
+ data.each_with_index do |val, idx|
19
+ out[idx.to_s] = val
20
+ end
21
+ out
22
+ end
23
+
24
+ def self.response_body(val)
25
+ { ARN: val[:arn], CreatedDate: val[:created_date], Name: val[:name], SecretBinary: val[:secret_binary],
26
+ SecretString: val[:response], VersionId: val[:version_id],
27
+ VersionStages: (val[:version_stages] ? [val[:version_stages]] : nil) }.compact
28
+ end
29
+ end
30
+ end
31
+ end
@@ -6,6 +6,7 @@ require 'sfn/mock_macros/step_function'
6
6
  require 'sfn/mock_macros/api_gateway'
7
7
  require 'sfn/mock_macros/sns'
8
8
  require 'sfn/mock_macros/sqs'
9
+ require 'sfn/mock_macros/secrets_manager'
9
10
 
10
11
  module Sfn
11
12
  module MockMacros
@@ -40,6 +41,10 @@ module Sfn
40
41
  OptimisedStepFunction.response(data)
41
42
  end
42
43
 
44
+ def self.secrets_manager_response(data)
45
+ SecretsManager.response(data)
46
+ end
47
+
43
48
  def self.gateway_payload(data)
44
49
  warn '[DEPRECATION] `gateway_payload` is deprecated. Please use `gateway_response` instead.'
45
50
  ApiGateway.response(data)
@@ -69,7 +69,13 @@ module Sfn
69
69
  local_definition_path = Tempfile.new(['name', '.json']).path
70
70
 
71
71
  definition = File.read(path)
72
- local_definition = definition.gsub(/"MaxConcurrency": [0-9]+/, '"MaxConcurrency": 1')
72
+ local_definition = definition
73
+ local_definition = local_definition.gsub(/"MaxConcurrency": [0-9]+/, '"MaxConcurrency": 1')
74
+ local_definition = local_definition.gsub(/"Type": "Wait"/, '"Type": "Pass"')
75
+ local_definition = local_definition.gsub(/"Seconds": [0-9]+,*/, '')
76
+ local_definition = local_definition.gsub(/"Timestamp": "[0-9\-T:+]+",*/, '')
77
+ local_definition = local_definition.gsub(/"TimestampPath": "[^\"]+",*/, '')
78
+ local_definition = local_definition.gsub(/,[\s\n]+\}/, "\n}")
73
79
 
74
80
  File.open(local_definition_path, 'w') { |file| file.puts local_definition }
75
81
  "file://#{local_definition_path}"
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.19
4
+ version: 0.1.21
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-10-17 00:00:00.000000000 Z
11
+ date: 2022-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-release
@@ -69,6 +69,7 @@ files:
69
69
  - lib/sfn/mock_macros/api_gateway.rb
70
70
  - lib/sfn/mock_macros/lambda.rb
71
71
  - lib/sfn/mock_macros/optimised_step_function.rb
72
+ - lib/sfn/mock_macros/secrets_manager.rb
72
73
  - lib/sfn/mock_macros/sns.rb
73
74
  - lib/sfn/mock_macros/sqs.rb
74
75
  - lib/sfn/mock_macros/step_function.rb