Class: KubesAws::SSM::Fetcher
Instance Method Summary
collapse
#eks, #iam, #secrets, #ssm
Methods included from Logging
#logger
Constructor Details
#initialize(options = {}) ⇒ Fetcher
Returns a new instance of Fetcher.
6
7
8
9
|
# File 'lib/kubes_aws/ssm/fetcher.rb', line 6
def initialize(options={})
@options = options
@base64 = options[:base64]
end
|
Instance Method Details
#base64?(type) ⇒ Boolean
18
19
20
21
22
23
24
|
# File 'lib/kubes_aws/ssm/fetcher.rb', line 18
def base64?(type)
if @base64.nil?
type == "SecureString"
else
@base64
end
end
|
#fetch(name) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/kubes_aws/ssm/fetcher.rb', line 11
def fetch(name)
parameter = fetch_parameter(name)
value = parameter.value
value = Base64.strict_encode64(value).strip if base64?(parameter.type)
value
end
|
#fetch_parameter(name) ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/kubes_aws/ssm/fetcher.rb', line 26
def fetch_parameter(name)
resp = ssm.get_parameter(name: name, with_decryption: true)
resp.parameter
rescue Aws::SSM::Errors::ParameterNotFound => e
logger.info "WARN: name #{name} not found".color(:yellow)
logger.info e.message
"NOT FOUND #{name}"
end
|