Sha256: 3681af52aca3c3f824750d0b1d8bab6adc78386edd52ca8666c548051b8d6c98
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
require "aws-sdk-ssm" module Chambermaid class ParameterStore def initialize(path:) @path = path end def load! fetch_ssm_params! end def reload! clear_params! fetch_ssm_params! end def loaded? !@params_list.empty? end def self.load!(path:) store = new(path: path) store.load! store end def params @params ||= @param_list.map { |p| [p.name.split("/").last.upcase, p.value] }.to_h end alias :to_h :params private def client @client ||= Aws::SSM::Client.new end def fetch_ssm_params! @param_list = [] response = nil loop do response = fetch_ssm_param_batch!(response&.next_token) @param_list.concat(response.parameters) break unless response.next_token end end def fetch_ssm_param_batch!(next_token = nil) client.get_parameters_by_path( path: @path, with_decryption: true, recursive: true, next_token: next_token ) end def clear_params! @params = nil @params_list = [] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
chambermaid-0.3.2 | lib/chambermaid/parameter_store.rb |
chambermaid-0.3.1 | lib/chambermaid/parameter_store.rb |
chambermaid-0.3.0 | lib/chambermaid/parameter_store.rb |