Class: ParamStore::Adapters::SSM
- Inherits:
-
Object
- Object
- ParamStore::Adapters::SSM
- Defined in:
- lib/param_store/adapters/ssm.rb
Instance Attribute Summary collapse
-
#default_path ⇒ Object
readonly
Returns the value of attribute default_path.
Instance Method Summary collapse
- #fetch(key, *args, path: nil, &block) ⇒ Object
- #fetch_all(*keys, path: nil) ⇒ Object
-
#initialize(default_path: nil) ⇒ SSM
constructor
A new instance of SSM.
Constructor Details
#initialize(default_path: nil) ⇒ SSM
Returns a new instance of SSM.
6 7 8 |
# File 'lib/param_store/adapters/ssm.rb', line 6 def initialize(default_path: nil) @default_path = default_path end |
Instance Attribute Details
#default_path ⇒ Object (readonly)
Returns the value of attribute default_path.
4 5 6 |
# File 'lib/param_store/adapters/ssm.rb', line 4 def default_path @default_path end |
Instance Method Details
#fetch(key, *args, path: nil, &block) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/param_store/adapters/ssm.rb', line 10 def fetch(key, *args, path: nil, &block) key = prepend_path(path, key) tmp = {} if string = get_parameter(key) tmp[key] = string end tmp.fetch(key, *args, &block) end |
#fetch_all(*keys, path: nil) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/param_store/adapters/ssm.rb', line 19 def fetch_all(*keys, path: nil) keys = keys.flatten keys = keys.map { |key| prepend_path(path, key) } if path ParamStore.ssm_client.get_parameters(names: keys, with_decryption: true).parameters.each_with_object({}) do |param, result| result[param.name.gsub(path.to_s, '')] = param.value end end |