Sha256: 607b181792504bdf5fcd53e3890414d0967a6a0c3f04fb78d2c7186a7b1108a3
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 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 Hash[ parameters. map { |parameter| Parameter.new(parameter) }. map { |parameter| [parameter.name, parameter.value] } ] 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 StandardError => error raise RetrieveError, error end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
psenv-0.7.0 | lib/psenv/retriever.rb |
psenv-0.6.0 | lib/psenv/retriever.rb |
psenv-0.4.0 | lib/psenv/retriever.rb |