cloud-config 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f4463471bbbffc8cdfcda8361581f051804c106523c0fa86838f5e62de59a6e
4
- data.tar.gz: 8c31a0844247d7e210e219099170f8bda4212fca7e2e61ab323872a8d68f8ed7
3
+ metadata.gz: 14a075dc5489c921dd0cc57ce34900f1b44956430f04b7f65bae877191cb1146
4
+ data.tar.gz: 93ae7d5b13fa07e10f1e4f32c9e6b26707d42466aab400f6314f0542ad05d254
5
5
  SHA512:
6
- metadata.gz: 75a640f3415c4ae1b66e1d9260f1e02c77b5d4a692ef1de609ef3fbef5afcd6e858120a74ca15ef3a8a77259cce702bf856d60c1bac3d549cad1c32f24f2343e
7
- data.tar.gz: 9e033c6fa3481c798ff064666f419478a5ff150e05cce1fe0bd6a44a235601b7a28f54fc7e37fa95bed89ddb38a2fb97b9e4587f1375a2531084cfbd55aad9e3
6
+ metadata.gz: 816e3d5ddf6ecc65d7ebbaef7fe5f37df5cc43296fd8bfb7b9e8ff89d6fa9e0fe192df70669b228196940973e1fe8558352388afd65dc8ab2949cba3f9148dde
7
+ data.tar.gz: 50661d530a79e7407faa3b1d54f9f70aa958af68f07b4fb19092027888da1129fbf689e2d92a079582a16ac7039ff5f096fa4ccc95b5889911f7c75bebc4de49
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.2] - 2023-05-21
4
+
5
+ Enhancements:
6
+
7
+ - Add AWS Secrets Manager provider
8
+
3
9
  ## [Released]
4
10
 
5
11
  ## [0.2.1] - 2023-05-21
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloud-config (0.2.0)
4
+ cloud-config (0.2.2)
5
5
  parallel
6
6
 
7
7
  GEM
@@ -15,6 +15,9 @@ GEM
15
15
  aws-partitions (~> 1, >= 1.651.0)
16
16
  aws-sigv4 (~> 1.5)
17
17
  jmespath (~> 1, >= 1.6.1)
18
+ aws-sdk-secretsmanager (1.75.0)
19
+ aws-sdk-core (~> 3, >= 3.165.0)
20
+ aws-sigv4 (~> 1.1)
18
21
  aws-sdk-ssm (1.150.0)
19
22
  aws-sdk-core (~> 3, >= 3.165.0)
20
23
  aws-sigv4 (~> 1.1)
@@ -89,6 +92,7 @@ PLATFORMS
89
92
  aarch64-linux
90
93
 
91
94
  DEPENDENCIES
95
+ aws-sdk-secretsmanager
92
96
  aws-sdk-ssm
93
97
  cloud-config!
94
98
  mock_redis
data/cloud-config.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.metadata['homepage_uri'] = spec.homepage
23
23
  spec.metadata['source_code_uri'] = spec.homepage
24
- spec.metadata['changelog_uri'] = "#{spec.homepage}/CHANGELOG.md"
24
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
25
25
 
26
26
  # Specify which files should be added to the gem when it is released.
27
27
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -37,6 +37,7 @@ Gem::Specification.new do |spec|
37
37
  # Uncomment to register a new dependency of your gem
38
38
  spec.add_dependency 'parallel'
39
39
 
40
+ spec.add_development_dependency 'aws-sdk-secretsmanager'
40
41
  spec.add_development_dependency 'aws-sdk-ssm'
41
42
  spec.add_development_dependency 'mock_redis'
42
43
  spec.add_development_dependency 'pry'
@@ -11,7 +11,6 @@ gemfile do
11
11
  gem 'cloud-config', path: '..'
12
12
  end
13
13
 
14
- require 'benchmark'
15
14
  require 'cloud-config/providers/aws_parameter_store'
16
15
 
17
16
  # @note: Make sure the `parameter_store_example` key is set in the parameter store
@@ -0,0 +1,25 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'bundler/inline'
4
+
5
+ gemfile do
6
+ source 'https://rubygems.org'
7
+
8
+ gem 'nokogiri'
9
+ gem 'aws-sdk-secretsmanager'
10
+
11
+ gem 'cloud-config', path: '..'
12
+ end
13
+
14
+ require 'cloud-config/providers/aws_secrets_manager'
15
+
16
+ # @note: Make sure the `secret_example` key is set in AWS Secrets Manager
17
+ CloudConfig.configure do
18
+ provider :aws_secrets_manager do
19
+ setting :secret_example
20
+ end
21
+ end
22
+
23
+ puts 'Fetching key: secret_example'
24
+ value = CloudConfig.get(:secret_example)
25
+ puts "Fetched value: #{value}"
@@ -2,10 +2,10 @@
2
2
 
3
3
  module CloudConfig
4
4
  module Providers
5
- # A class for fetching configuration from the AWS Parameter Store
5
+ # A class for fetching configuration from AWS Parameter Store
6
6
  #
7
7
  # @example
8
- # provider = AwsParameterStore.new # Assuming AWS credentials are already configured
8
+ # provider = CloudConfig::Providers::AwsParameterStore.new # Assuming AWS credentials are already configured
9
9
  # provider.set(:example_key, :example_value)
10
10
  # provider.get(:example_key) #=> 'example_value'
11
11
  class AwsParameterStore
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CloudConfig
4
+ module Providers
5
+ # A class for fetching configuration from AWS Secrets Manager
6
+ #
7
+ # @example
8
+ # provider = CloudConfig::Providers::AwsSecretsManager.new # Assuming AWS credentials are already configured
9
+ # provider.set(:example_key, :example_value)
10
+ # provider.get(:example_key) #=> 'example_value'
11
+ class AwsSecretsManager
12
+ # @!attribute [r] An instance of the AWS Secrets Manager client
13
+ # @return [Aws::SSM::Client]
14
+ attr_reader :client
15
+
16
+ # Create a new instance of {AwsSecretsManager}.
17
+ def initialize(_opts = {})
18
+ @client = Aws::SecretsManager::Client.new
19
+ end
20
+
21
+ # Fetch the value of the key
22
+ #
23
+ # @param key [String,Symbol] Key to fetch
24
+ #
25
+ # @return [String] Value of the key
26
+ def get(key, _opts = {})
27
+ secret = client.get_secret_value(secret_id: key)
28
+
29
+ secret.secret_binary || secret.secret_string
30
+ end
31
+
32
+ # Set the value of the key
33
+ #
34
+ # @param key [String,Symbol] Key to set
35
+ # @param value [Object] Value of the key
36
+ def set(key, value)
37
+ client.put_secret_value(secret_id: key, secret_string: value)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -5,7 +5,7 @@ module CloudConfig
5
5
  # A class that acts as a provider for storing configuration in-memory
6
6
  #
7
7
  # @example
8
- # provider = InMemory.new # Assuming AWS credentials are already configured
8
+ # provider = CloudConfig::Providers::InMemory.new # Assuming AWS credentials are already configured
9
9
  # provider.set(:example_key, :example_value)
10
10
  # provider.get(:example_key) #=> 'example_value'
11
11
  class InMemory
@@ -5,7 +5,7 @@ module CloudConfig
5
5
  # A class for fetching configuration from the AWS Parameter Store
6
6
  #
7
7
  # @example
8
- # provider = YamlFile.new # Assuming AWS credentials are already configured
8
+ # provider = CloudConfig::Providers::YamlFile.new # Assuming AWS credentials are already configured
9
9
  # provider.set(:example_key, :example_value)
10
10
  # provider.get(:example_key) #=> 'example_value'
11
11
  class YamlFile
@@ -2,5 +2,5 @@
2
2
 
3
3
  module CloudConfig
4
4
  # Version of CloudConfig
5
- VERSION = '0.2.1'
5
+ VERSION = '0.2.2'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hypernova2002
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk-secretsmanager
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: aws-sdk-ssm
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -232,6 +246,7 @@ files:
232
246
  - examples/003_parameter_store_with_preload.rb
233
247
  - examples/004_handling_configuration_changes.rb
234
248
  - examples/005_parameter_store_encrypted_key.rb
249
+ - examples/006_secrets_manager.rb
235
250
  - lib/cloud-config.rb
236
251
  - lib/cloud-config/cache.rb
237
252
  - lib/cloud-config/cache/in_memory.rb
@@ -241,6 +256,7 @@ files:
241
256
  - lib/cloud-config/provider_options.rb
242
257
  - lib/cloud-config/providers.rb
243
258
  - lib/cloud-config/providers/aws_parameter_store.rb
259
+ - lib/cloud-config/providers/aws_secrets_manager.rb
244
260
  - lib/cloud-config/providers/in_memory.rb
245
261
  - lib/cloud-config/providers/yaml_file.rb
246
262
  - lib/cloud-config/version.rb
@@ -251,7 +267,7 @@ licenses:
251
267
  metadata:
252
268
  homepage_uri: http://github.com/hypernova2002/cloud-config
253
269
  source_code_uri: http://github.com/hypernova2002/cloud-config
254
- changelog_uri: http://github.com/hypernova2002/cloud-config/CHANGELOG.md
270
+ changelog_uri: http://github.com/hypernova2002/cloud-config/blob/main/CHANGELOG.md
255
271
  rubygems_mfa_required: 'true'
256
272
  post_install_message:
257
273
  rdoc_options: []