Class: Persey::Adapters::Ssm

Inherits:
Base
  • Object
show all
Defined in:
lib/persey/adapters/ssm.rb

Class Method Summary collapse

Methods inherited from Base

symbolize_keys

Class Method Details

.config_exists?(path, opts: {}) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
# File 'lib/persey/adapters/ssm.rb', line 25

def config_exists?(path, opts: {})
  ssm = ssm_client(opts)
  ssm.get_parameter(name: path, with_decryption: true).parameter.nil? == false
rescue Aws::SSM::Errors::ParameterNotFound
  false
end

.load(path, _env, opts: {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/persey/adapters/ssm.rb', line 12

def load(path, _env, opts: {})
  ssm = ssm_client(opts)
  param = ssm.get_parameter(name: path, with_decryption: true).parameter

  res = begin
          JSON.parse(param.value)
        rescue JSON::ParserError
          param.to_h
        end

  symbolize_keys(res)
end