Class: CloudConfig::Providers::AwsSecretsManager
- Inherits:
-
Object
- Object
- CloudConfig::Providers::AwsSecretsManager
- Defined in:
- lib/cloud-config/providers/aws_secrets_manager.rb
Overview
A class for fetching configuration from AWS Secrets Manager
Instance Attribute Summary collapse
- #An instance of the AWS Secrets Manager client(instanceoftheAWSSecretsManagerclient) ⇒ Aws::SSM::Client readonly
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#get(key, _opts = {}) ⇒ String
Fetch the value of the key.
-
#initialize(_opts = {}) ⇒ AwsSecretsManager
constructor
Create a new instance of AwsSecretsManager.
-
#set(key, value) ⇒ Object
Set the value of the key.
Constructor Details
#initialize(_opts = {}) ⇒ AwsSecretsManager
Create a new instance of CloudConfig::Providers::AwsSecretsManager.
17 18 19 |
# File 'lib/cloud-config/providers/aws_secrets_manager.rb', line 17 def initialize(_opts = {}) @client = Aws::SecretsManager::Client.new end |
Instance Attribute Details
#An instance of the AWS Secrets Manager client(instanceoftheAWSSecretsManagerclient) ⇒ Aws::SSM::Client (readonly)
14 |
# File 'lib/cloud-config/providers/aws_secrets_manager.rb', line 14 attr_reader :client |
#client ⇒ Object (readonly)
Returns the value of attribute client.
14 15 16 |
# File 'lib/cloud-config/providers/aws_secrets_manager.rb', line 14 def client @client end |
Instance Method Details
#get(key, _opts = {}) ⇒ String
Fetch the value of the key
26 27 28 29 30 |
# File 'lib/cloud-config/providers/aws_secrets_manager.rb', line 26 def get(key, _opts = {}) secret = client.get_secret_value(secret_id: key) secret.secret_binary || secret.secret_string end |
#set(key, value) ⇒ Object
Set the value of the key
36 37 38 |
# File 'lib/cloud-config/providers/aws_secrets_manager.rb', line 36 def set(key, value) client.put_secret_value(secret_id: key, secret_string: value) end |