smps 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/changelog.md +5 -6
- data/exe/smps +3 -3
- data/lib/smps/parameter.rb +43 -40
- data/lib/smps/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15e113dabe0eb6b4a7fc8fb7fc3f3c547f5e356c
|
4
|
+
data.tar.gz: d135671af94168bfd52e42879a704db5f6d9c104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e60e0396a8fed1ff31d46f7f60f9de7c9dad586c05f7f17d9739420388881a06185ef5267741f142944ab82f51b90c2b91512e40154c507618f433de8f19988
|
7
|
+
data.tar.gz: 529e4a1fb4b898084d4511636ca92f6564f83dc6cfe6830b5d44cf80dac0f9611abf5907aa4d6162e690f005baa0339f5f08034fcb2a19b21b9963e676ac6967
|
data/changelog.md
CHANGED
@@ -3,16 +3,15 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
## [Unreleased]
|
5
5
|
|
6
|
+
## [0.2.1] - 2017-10-05
|
7
|
+
### Changed
|
8
|
+
- Class structure improvement
|
9
|
+
- move optional requires into if block
|
10
|
+
|
6
11
|
## [0.2.0] - 2017-10-05
|
7
12
|
### Added
|
8
13
|
- smps cli query script
|
9
14
|
|
10
|
-
### Changed
|
11
|
-
- ...
|
12
|
-
|
13
|
-
### Removed
|
14
|
-
- ...
|
15
|
-
|
16
15
|
## [0.1.3] - 2017-10-05
|
17
16
|
### Added
|
18
17
|
- ...
|
data/exe/smps
CHANGED
@@ -51,10 +51,10 @@ opts.each do |opt, arg|
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
require 'awssession'
|
55
|
-
require 'aws_config'
|
56
|
-
|
57
54
|
if role
|
55
|
+
require 'awssession'
|
56
|
+
require 'aws_config'
|
57
|
+
|
58
58
|
profile_name = role
|
59
59
|
profile = AWSConfig[profile_name]
|
60
60
|
profile['name'] = profile_name
|
data/lib/smps/parameter.rb
CHANGED
@@ -1,49 +1,52 @@
|
|
1
1
|
|
2
|
-
class SmPs
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
class SmPs
|
3
|
+
# SmPs Parameter management
|
4
|
+
class Parameter
|
5
|
+
def initialize(options)
|
6
|
+
@ssm = options[:ssm]
|
7
|
+
@name = options[:name]
|
8
|
+
parameter
|
9
|
+
end
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
def parameter(decrypt = true)
|
12
|
+
resp = @ssm.get_parameter(
|
13
|
+
name: @name,
|
14
|
+
with_decryption: decrypt
|
15
|
+
)
|
16
|
+
@type = resp.parameter.type
|
17
|
+
@value = resp.parameter.value
|
18
|
+
@exists = true
|
19
|
+
rescue Aws::SSM::Errors::ParameterNotFound
|
20
|
+
@exists = false
|
21
|
+
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
def to_s
|
24
|
+
@value
|
25
|
+
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
27
|
+
def exists?
|
28
|
+
@exists
|
29
|
+
end
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
31
|
+
def write!(value, type = 'String', description = nil, key_id = nil)
|
32
|
+
raise ArgumentError unless %w[String StringList SecureString].include? type
|
33
|
+
true if value == @value
|
34
|
+
@ssm.put_parameter(
|
35
|
+
name: @name, description: description,
|
36
|
+
value: value, type: type,
|
37
|
+
key_id: key_id, overwrite: @exists,
|
38
|
+
# allowed_pattern: "AllowedPattern",
|
39
|
+
)
|
40
|
+
@value = value
|
41
|
+
end
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
-
|
43
|
+
def history
|
44
|
+
# get_parameter_history
|
45
|
+
end
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
47
|
+
def tag
|
48
|
+
# add_tags_to_resource
|
49
|
+
# remove_tags_from_resource
|
50
|
+
end
|
48
51
|
end
|
49
52
|
end
|
data/lib/smps/version.rb
CHANGED