lib/chambermaid/parameter_store.rb in chambermaid-0.5.4 vs lib/chambermaid/parameter_store.rb in chambermaid-0.5.5

- old
+ new

@@ -1,31 +1,53 @@ require "aws-sdk-ssm" module Chambermaid + # ParameterStore instances fetch all parameters under a namespace/path + # from AWS SSM + # + # @note AWS authentication requires configuration via ENV (IAM credentials/STS) class ParameterStore + # @param [String] path def initialize(path:) @path = path end + # Fetch and decrypt all parameters selected by a namespace/path string + # + # @return [Boolean] def load! fetch_ssm_params! end + # Clear cached parameters and re-fetch parameters from AWS SSM + # + # @return [Boolean] def reload! clear_params! fetch_ssm_params! end + # Returns true if parameters have been fetched from AWS SSM + # + # @return [Boolean] def loaded? !@params_list.empty? end + # Create a ParameterStore and fetch from AWS SSM immediately + # + # @see Chambermaid::ParameterStore#load! + # + # @return [Chambermaid::ParameterStore] def self.load!(path:) store = new(path: path) store.load! store end + # ENV formatted Hash of parameters loaded from AWS SSM + # + # @return [Hash] def params @params ||= @param_list.map { |p| [p.name.split("/").last.upcase, p.value] }.to_h end