Sha256: 3b4acb6132ca3e873148de85407acdaa4a4126552338307654ff7cc61cc34d61
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
require "aws-sdk-ssm" module Psenv class RetrieveError < StandardError; end class Parameter attr_reader :name, :value def initialize(parameter) @name = parameter[:name].split("/").last @value = parameter[:value] @type = parameter[:type] @version = parameter[:version] end end class Retriever def initialize(path) @path = path end def call parameters .map { |parameter| Parameter.new(parameter) } .map { |parameter| [parameter.name, parameter.value] } .to_h end def self.call(path) new(path).call end private def ssm @ssm ||= Aws::SSM::Client.new end def parameters parameters = [] response = ssm.get_parameters_by_path(path: @path, with_decryption: true) parameters << response.parameters while response.next_page? response = response.next_page parameters << response.parameters end parameters.flatten rescue => error raise RetrieveError, error end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
psenv-0.9.1 | lib/psenv/retriever.rb |
psenv-0.9.0 | lib/psenv/retriever.rb |
psenv-0.8.0 | lib/psenv/retriever.rb |