Class: SmPs::Client
- Inherits:
-
Object
- Object
- SmPs::Client
- Defined in:
- lib/smps/client.rb
Overview
Presents a client interface with parameter parsing to aws ssm Allows querying and writing Paramstore parameters.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
-
#parameter(options) ⇒ Object
Creates a new SmPs::Parameter from the given options hash.
-
#parameters_by_path(options) ⇒ Object
Creates a list of all parameters filtered by path.
-
#ssm_client ⇒ Object
Creates (if needed) and returns the ssm_client.
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
11 12 13 14 |
# File 'lib/smps/client.rb', line 11 def initialize( = {}) = @parameters = {} end |
Instance Method Details
#parameter(options) ⇒ Object
Creates a new SmPs::Parameter from the given options hash.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/smps/client.rb', line 22 def parameter() name = .fetch(:name) type = [:type] key_id = [:key_id] unless @parameters.key?(name) @parameters[name] = SmPs::Parameter.new( ssm: ssm_client, name: name, type: type, key_id: key_id ) end @parameters[name] end |
#parameters_by_path(options) ⇒ Object
Creates a list of all parameters filtered by path.
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/smps/client.rb', line 36 def parameters_by_path() @parameters_by_path_list = [] next_token = nil while (params = get_parameters_by_path_with_token(, next_token)) store_parameters params next_token = params.next_token break if next_token.nil? || next_token.empty? end parameters_result_hash .fetch(:path), @parameters_by_path_list end |
#ssm_client ⇒ Object
Creates (if needed) and returns the ssm_client.
17 18 19 |
# File 'lib/smps/client.rb', line 17 def ssm_client @ssm_client ||= initialize_ssm_client end |