smps 0.5.1 → 0.5.4

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: 41828ccf94fe65db48d50e5f9f6ad9fb3f8bb90966bc2693d30f6b4f19bc2d76
4
- data.tar.gz: 1939b73e01b471a4f9501db5cf16723b2a655ab7e0bfd38d5714e26759c0a9be
3
+ metadata.gz: d28b459006110169081af4ffa0bbf3602cd87ec18bec0c3090f61a83031e4118
4
+ data.tar.gz: 516d0b9783c8ea2a5c4685be3240cf0526d69e9a88b79bb8121c59786e1319d6
5
5
  SHA512:
6
- metadata.gz: 82b6f70310a2478a8144bc6bf2a97a905dc5c4c1717ba8ffc9a127dfd2f7116592dbf971ac256a7d127966c9389284d9ec44d659b5806bfe035e70e91f868a70
7
- data.tar.gz: c8f71027b2bf3738269c05eb07c2f0fe3cc2278d3860b988f3e231466b6f77eccb0e3ae1b591dfd264fe9149440f3c5f7ec115bc47d46ca3d89a1e9c40b1d6ea
6
+ metadata.gz: ac4b56d53277286c7ee4e5662bbc21f58ada8330263acfa9fdd574c443b37fb6825d662e4daa6c3d3e8dfdd2e2b4757aab16a91f233cc366a07687ccd41fe16c
7
+ data.tar.gz: 679c488a2b926beea73ffb4c6e58c76eff6ca36f14b4994a879f66f66e69ceb0385fd6e221eccba7f354cf93a7a3da3068bb676108d7828dac87f507f342e661
data/README.md CHANGED
@@ -22,7 +22,7 @@ And then execute:
22
22
 
23
23
  ### CLI
24
24
 
25
- After installation, 2 executeable scripts will be installed: `smps` & `smps-cli`:
25
+ After installation, 2 executable scripts will be installed: `smps` & `smps-cli`:
26
26
 
27
27
  - smps: the simple version of this utility.
28
28
  - smps-cli: The thor cli executable offers a different interface.
@@ -122,10 +122,12 @@ Set the parameter to this value
122
122
 
123
123
  ## Development
124
124
 
125
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
125
+ After checking out the repo, run `./bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
126
126
 
127
127
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
128
128
 
129
+ To test the `smps` utility on your local machine, run `bundle exec smps --help` to see command-line options.
130
+
129
131
  ## Contributing
130
132
 
131
133
  We use git flow in this project. To create your pull request, you can either use the git-flow helper or
data/changelog.md CHANGED
@@ -5,66 +5,114 @@ Version format based on http://semver.org/
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.5.4] - 2021-09-17
9
+
10
+ ### Changed
11
+
12
+ - Added automatic client side throttling to avoid Aws::SSM::Errors::ThrottlingException.
13
+
14
+ ## [0.5.3] - 2020-04-01
15
+
16
+ ### Changed
17
+
18
+ - Don't use .to_h as it is not available on jruby (puppetserver)
19
+
20
+ ## [0.5.2] - 2020-03-11
21
+
22
+ ### Changed
23
+
24
+ - Make return of parameters_by_path a hash with key : value and print it cleanly on cli
25
+
8
26
  ## [0.5.1] - 2019-04-29
27
+
9
28
  ### Changed
29
+
10
30
  - Updated doc.
11
31
  - Lower required Ruby version for smps gem.
12
32
 
13
33
  ## [0.5.0.pre]
34
+
14
35
  ### Changed
36
+
15
37
  - Split in 2 separate gems: smps and smps-cli.
16
38
 
17
39
  ## [0.4.1] - 2018-09-25
40
+
18
41
  ### Changed
42
+
19
43
  - Change dependency on thor to 0.19.* to work with available native debian packages
20
44
 
21
45
  ## [0.4.0] - 2018-09-18
46
+
22
47
  ### Added
48
+
23
49
  - New cli executable based on thor
24
50
 
25
51
  ## [0.3.4] - 2017-12-20
52
+
26
53
  ### Changed
54
+
27
55
  - Add http timeout to region get in helper script
28
56
 
29
57
  ## [0.3.3] - 2017-11-17
58
+
30
59
  ### Changed
60
+
31
61
  - Add next_token handling for get_parameters_by_path
32
62
 
33
63
  ## [0.3.2] - 2017-11-16
64
+
34
65
  ### Changed
66
+
35
67
  - Set \@decrypt param to true by default
36
68
 
37
69
  ## [0.3.1] - 2017-11-16
70
+
38
71
  ### Added
72
+
39
73
  - Test script param for fetch by_path
40
74
 
41
75
  ## [0.3.0] - 2017-10-13
76
+
42
77
  ### Added
78
+
43
79
  - parameters_by_path method
44
80
 
45
81
  ## [0.2.3] - 2017-10-06
82
+
46
83
  ### Changed
84
+
47
85
  - Update gem dependency specification
48
86
 
49
87
  ## [0.2.2] - 2017-10-06
88
+
50
89
  ### Added
90
+
51
91
  - Parameters for creating / writing SecureString
52
92
 
53
93
  ## [0.2.1] - 2017-10-05
94
+
54
95
  ### Changed
96
+
55
97
  - Class structure improvement
56
98
  - move optional requires into if block
57
99
 
58
100
  ## [0.2.0] - 2017-10-05
101
+
59
102
  ### Added
103
+
60
104
  - smps cli query script
61
105
 
62
106
  ## [0.1.3] - 2017-10-05
107
+
63
108
  ### Added
109
+
64
110
  - ...
65
111
 
66
112
  ### Changed
113
+
67
114
  - ...
68
115
 
69
116
  ### Removed
117
+
70
118
  - ...
data/exe/smps CHANGED
@@ -109,7 +109,9 @@ class SmpsCLI
109
109
 
110
110
  return unless by_path
111
111
  parameters = smps.parameters_by_path(path: by_path)
112
- pp parameters
112
+ parameters.each do |k, v|
113
+ puts "key: #{k}\nvalue: #{v}"
114
+ end
113
115
  end
114
116
  end
115
117
 
data/lib/smps/client.rb CHANGED
@@ -9,7 +9,7 @@ module SmPs
9
9
  # Allows querying and writing Paramstore parameters.
10
10
  class Client
11
11
  def initialize(options = {})
12
- @credentials = options[:credentials]
12
+ @options = options
13
13
  @parameters = {}
14
14
  end
15
15
 
@@ -41,11 +41,19 @@ module SmPs
41
41
  next_token = params.next_token
42
42
  break if next_token.nil? || next_token.empty?
43
43
  end
44
- @parameters_by_path_list
44
+ parameters_result_hash options.fetch(:path), @parameters_by_path_list
45
45
  end
46
46
 
47
47
  protected
48
48
 
49
+ def parameters_result_hash(path, list)
50
+ path = "#{path}/" unless path.end_with?('/')
51
+ # .to_h is not available in jruby (the puppetserver ruby version)
52
+ # list.map { |p| [p.name.gsub(/#{Regexp.escape(path)}/, ''), p.value] }.to_h
53
+ arr = list.map { |p| [p.name.gsub(/#{Regexp.escape(path)}/, ''), p.value] }
54
+ Hash[arr]
55
+ end
56
+
49
57
  # Get a parameter list by path using the next_token (if provided)
50
58
  def get_parameters_by_path_with_token(options, next_token = nil)
51
59
  ssm_client.get_parameters_by_path(
@@ -82,11 +90,11 @@ module SmPs
82
90
  # end
83
91
 
84
92
  def initialize_ssm_client
85
- if @credentials.nil?
86
- Aws::SSM::Client.new
87
- else
88
- Aws::SSM::Client.new(credentials: @credentials)
89
- end
93
+ # see https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SSM/Client.html#initialize-instance_method
94
+ all_options = @options.merge(max_attempts: 10,
95
+ retry_mode: 'adaptive')
96
+ # puts all_options
97
+ Aws::SSM::Client.new(all_options)
90
98
  end
91
99
  end
92
100
  end
data/lib/smps/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module SmPs
4
4
  # Current version.
5
- VERSION = '0.5.1'
5
+ VERSION = '0.5.4'
6
6
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan - Zipkid - Goethals
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-29 00:00:00.000000000 Z
11
+ date: 2024-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aws-sdk-ssm
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  description: SMPS - Systems Manager Parameter Store.
@@ -60,23 +60,23 @@ licenses:
60
60
  - MIT
61
61
  metadata:
62
62
  allowed_push_host: https://rubygems.org
63
- post_install_message:
63
+ post_install_message:
64
64
  rdoc_options: []
65
65
  require_paths:
66
66
  - lib
67
67
  required_ruby_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - "~>"
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
- version: '2.1'
71
+ version: '2.3'
72
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.0.2
79
- signing_key:
78
+ rubygems_version: 3.1.6
79
+ signing_key:
80
80
  specification_version: 4
81
81
  summary: SMPS - Systems Manager Parameter Store
82
82
  test_files: []