Class: CloudConfig::Providers::AwsParameterStore
- Inherits:
-
Object
- Object
- CloudConfig::Providers::AwsParameterStore
- Defined in:
- lib/cloud-config/providers/aws_parameter_store.rb
Overview
A class for fetching configuration from AWS Parameter Store
Instance Attribute Summary collapse
- #An instance of the AWS Parameter Store client(instanceoftheAWSParameterStoreclient) ⇒ Aws::SSM::Client readonly
-
#client ⇒ Object
readonly
Returns the value of attribute client.
- #Whether parameters need to be decrypted(parametersneedtobedecrypted) ⇒ Boolean readonly
-
#with_decryption ⇒ Object
readonly
Returns the value of attribute with_decryption.
Instance Method Summary collapse
-
#get(key, opts = {}) ⇒ String
Fetch the value of the key.
-
#initialize(opts = {}) ⇒ AwsParameterStore
constructor
Create a new instance of AwsParameterStore.
-
#set(key, value) ⇒ Object
Set the value of the key.
Constructor Details
#initialize(opts = {}) ⇒ AwsParameterStore
Create a new instance of CloudConfig::Providers::AwsParameterStore.
24 25 26 27 28 |
# File 'lib/cloud-config/providers/aws_parameter_store.rb', line 24 def initialize(opts = {}) @client = Aws::SSM::Client.new @with_decryption = opts.fetch(:with_decryption, false) end |
Instance Attribute Details
#An instance of the AWS Parameter Store client(instanceoftheAWSParameterStoreclient) ⇒ Aws::SSM::Client (readonly)
14 |
# File 'lib/cloud-config/providers/aws_parameter_store.rb', line 14 attr_reader :client |
#client ⇒ Object (readonly)
Returns the value of attribute client.
14 15 16 |
# File 'lib/cloud-config/providers/aws_parameter_store.rb', line 14 def client @client end |
#Whether parameters need to be decrypted(parametersneedtobedecrypted) ⇒ Boolean (readonly)
18 |
# File 'lib/cloud-config/providers/aws_parameter_store.rb', line 18 attr_reader :with_decryption |
#with_decryption ⇒ Object (readonly)
Returns the value of attribute with_decryption.
18 19 20 |
# File 'lib/cloud-config/providers/aws_parameter_store.rb', line 18 def with_decryption @with_decryption end |
Instance Method Details
#get(key, opts = {}) ⇒ String
Fetch the value of the key
37 38 39 40 41 |
# File 'lib/cloud-config/providers/aws_parameter_store.rb', line 37 def get(key, opts = {}) decrypt = opts.fetch(:with_decryption) { with_decryption } client.get_parameter(name: key, with_decryption: decrypt).parameter.value end |
#set(key, value) ⇒ Object
Set the value of the key
47 48 49 |
# File 'lib/cloud-config/providers/aws_parameter_store.rb', line 47 def set(key, value) client.put_parameter(name: key, value:) end |