smps 0.5.4 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +36 -60
- data/changelog.md +18 -0
- data/lib/smps/aws.rb +29 -6
- data/lib/smps/version.rb +1 -1
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f96c8e9ae3647f188be9954b4329d83225dc9f304d210db4ee814054b7ad637
|
4
|
+
data.tar.gz: b950c5a34727aa05eb1fafa79b84ebf75ecac4c85f607186238fc851667bcfa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5de9fd79a6fb9aa583b279c4022093f9cba3e3a75862f3b473ca6a423221b608d88fa1e385780f651b849b5d18acb7d20956b24268b07e89ec8e0b8db53550d5
|
7
|
+
data.tar.gz: 461c7551bb6ad0ee04befd9867ef3a233e42578d878addd63ca42c79b43206556bfcf1a369500bd3e910ae3247e855fd87572d7598f57d9d5f940b3dbc5f888c
|
data/README.md
CHANGED
@@ -4,7 +4,9 @@ A command line tool and library to interact with the Amazon System Manager Param
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
```bash
|
8
|
+
gem install smps
|
9
|
+
```
|
8
10
|
|
9
11
|
## Usage
|
10
12
|
|
@@ -18,20 +20,19 @@ gem 'smps'
|
|
18
20
|
|
19
21
|
And then execute:
|
20
22
|
|
21
|
-
|
23
|
+
```bash
|
24
|
+
bundle
|
25
|
+
```
|
22
26
|
|
23
27
|
### CLI
|
24
28
|
|
25
|
-
After installation
|
26
|
-
|
27
|
-
- smps: the simple version of this utility.
|
28
|
-
- smps-cli: The thor cli executable offers a different interface.
|
29
|
+
After installation the `smps` executable will be available.
|
29
30
|
|
30
31
|
#### smps
|
31
32
|
|
32
33
|
Run the command with `--help` for more information.
|
33
34
|
|
34
|
-
```
|
35
|
+
```text
|
35
36
|
smps [OPTION]
|
36
37
|
|
37
38
|
-h, --help:
|
@@ -61,83 +62,58 @@ smps [OPTION]
|
|
61
62
|
Debug level.
|
62
63
|
```
|
63
64
|
|
64
|
-
|
65
|
+
## Development
|
65
66
|
|
66
|
-
|
67
|
+
After checking out the repo, install dependencies.
|
67
68
|
|
68
|
-
|
69
|
-
|
69
|
+
```bash
|
70
|
+
./bin/setup
|
71
|
+
```
|
70
72
|
|
71
|
-
|
73
|
+
Then run the tests.
|
72
74
|
|
73
|
-
```
|
74
|
-
|
75
|
-
smps-cli get NAME # Get path or path indicated by the name
|
76
|
-
smps-cli help [COMMAND] # Describe available commands or one s...
|
77
|
-
smps-cli set NAME VALUE --type=TYPE # Set the parameter to this value
|
78
|
-
|
79
|
-
Options:
|
80
|
-
[--role=PROFILE] # IAM profile/role to use. From ~/.aws/config
|
81
|
-
[--region=REGION] # Override the aws region
|
82
|
-
[--debug=N] # AwsSession debug level.
|
83
|
-
# Default: 0
|
84
|
-
[--user-data], [--no-user-data] # Retrieve the name or path, and the key values from the userdata
|
75
|
+
```bash
|
76
|
+
bundle exec rake spec
|
85
77
|
```
|
86
78
|
|
87
|
-
|
79
|
+
To install this gem onto your local machine.
|
88
80
|
|
89
|
-
```
|
90
|
-
|
91
|
-
smps-cli get NAME
|
92
|
-
|
93
|
-
Options:
|
94
|
-
[--role=PROFILE] # IAM profile/role to use. From ~/.aws/config
|
95
|
-
[--region=REGION] # Override the aws region
|
96
|
-
[--debug=N] # AwsSession debug level.
|
97
|
-
# Default: 0
|
98
|
-
[--user-data], [--no-user-data] # Retrieve the name or path, and the key values from the userdata
|
99
|
-
|
100
|
-
Description:
|
101
|
-
Gets a value from the parameter store.
|
81
|
+
```bash
|
82
|
+
bundle exec rake install
|
102
83
|
```
|
103
84
|
|
104
|
-
|
85
|
+
To create a package that can be installed on a different machine.
|
105
86
|
|
106
|
-
```
|
107
|
-
|
108
|
-
smps-cli set NAME VALUE --type=TYPE
|
109
|
-
|
110
|
-
Options:
|
111
|
-
--type=TYPE
|
112
|
-
# Default: String
|
113
|
-
[--key=ARN] # KMS key for SecureString encryption/decryption
|
114
|
-
[--role=PROFILE] # IAM profile/role to use. From ~/.aws/config
|
115
|
-
[--region=REGION] # Override the aws region
|
116
|
-
[--debug=N] # AwsSession debug level.
|
117
|
-
# Default: 0
|
118
|
-
[--user-data], [--no-user-data] # Retrieve the name or path, and the key values from the userdata
|
119
|
-
|
120
|
-
Set the parameter to this value
|
87
|
+
```bash
|
88
|
+
bundle exec rake build
|
121
89
|
```
|
122
90
|
|
123
|
-
|
91
|
+
This will create a `.gem` file in the `pkg` directory.
|
124
92
|
|
125
|
-
|
93
|
+
To release a new version, update the version number in `version.rb` and then run
|
126
94
|
|
127
|
-
|
95
|
+
```bash
|
96
|
+
bundle exec rake release
|
97
|
+
```
|
128
98
|
|
129
|
-
|
99
|
+
This will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
100
|
+
|
101
|
+
To test the `smps` utility on your local machine, run the command below to see command-line options.
|
102
|
+
|
103
|
+
```bash
|
104
|
+
bundle exec smps --help
|
105
|
+
```
|
130
106
|
|
131
107
|
## Contributing
|
132
108
|
|
133
109
|
We use git flow in this project. To create your pull request, you can either use the git-flow helper or
|
134
110
|
manually create a new feature branch and pull request.
|
135
111
|
|
136
|
-
1. Fork it ( https://github.com/vrtdev/smps/fork )
|
112
|
+
1. Fork it ( <https://github.com/vrtdev/smps/fork> )
|
137
113
|
2. Clone your forked repository.
|
138
114
|
3. Create your feature branch (`git checkout -b feature/my-new-feature`)
|
139
115
|
4. Commit your changes (`git commit -am 'Add some feature'`)
|
140
116
|
5. Push to the branch (`git push origin feature/my-new-feature`)
|
141
117
|
6. Create a new Pull Request. Remember to make the pull request against the `develop` branch.
|
142
118
|
|
143
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/vrtdev/smps
|
119
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/vrtdev/smps>.
|
data/changelog.md
CHANGED
@@ -5,6 +5,24 @@ Version format based on http://semver.org/
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [1.0.1] - 2024-12-17
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Update dependencies.
|
13
|
+
|
14
|
+
## [1.0.0] - 2024-12-16
|
15
|
+
|
16
|
+
### Removed
|
17
|
+
|
18
|
+
- Removed Thor CLI version.
|
19
|
+
|
20
|
+
## [0.5.5] - 2024-12-16
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
|
24
|
+
- Added automatic discovery of instance type. EC2 Vs ECS.
|
25
|
+
|
8
26
|
## [0.5.4] - 2021-09-17
|
9
27
|
|
10
28
|
### Changed
|
data/lib/smps/aws.rb
CHANGED
@@ -9,15 +9,24 @@ module SmPs
|
|
9
9
|
# Some helpers to setup and interact with various aws services.
|
10
10
|
module AwsHelpers
|
11
11
|
SSM_PARAMETER_TYPES = %w[String StringList SecureString].freeze
|
12
|
-
DEFAULT_USERDATA_URI = 'http://169.254.169.254/latest/user-data'
|
13
12
|
|
14
|
-
def
|
15
|
-
@
|
13
|
+
def instance_type
|
14
|
+
@instance_type ||= initialize_instance_type
|
16
15
|
end
|
17
16
|
|
18
|
-
def
|
19
|
-
|
20
|
-
|
17
|
+
def initialize_instance_type
|
18
|
+
i_type = nil
|
19
|
+
if ENV['ECS_CONTAINER_METADATA_URI_V4']
|
20
|
+
i_type = 'ecs'
|
21
|
+
else
|
22
|
+
get_resource('http://169.254.169.254/latest')
|
23
|
+
i_type = 'ec2'
|
24
|
+
end
|
25
|
+
i_type
|
26
|
+
end
|
27
|
+
|
28
|
+
def aws_region
|
29
|
+
@aws_region ||= initialize_aws_region
|
21
30
|
end
|
22
31
|
|
23
32
|
def user_data(source, type = :auto)
|
@@ -83,6 +92,20 @@ module SmPs
|
|
83
92
|
end
|
84
93
|
|
85
94
|
def initialize_aws_region
|
95
|
+
if instance_type == 'ecs'
|
96
|
+
return initialize_ecs_aws_region
|
97
|
+
elsif instance_type == 'ec2'
|
98
|
+
return initialize_ec2_aws_region
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def initialize_ecs_aws_region
|
103
|
+
url = ENV['ECS_CONTAINER_METADATA_URI_V4']
|
104
|
+
c_arn = JSON.parse(get_resource(url))['ContainerARN']
|
105
|
+
c_arn.split(':')[3]
|
106
|
+
end
|
107
|
+
|
108
|
+
def initialize_ec2_aws_region
|
86
109
|
url = 'http://169.254.169.254/latest/dynamic/instance-identity/document'
|
87
110
|
JSON.parse(get_resource(url))['region']
|
88
111
|
end
|
data/lib/smps/version.rb
CHANGED
metadata
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan - Zipkid - Goethals
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-17 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
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
17
20
|
- - ">"
|
18
21
|
- !ruby/object:Gem::Version
|
19
22
|
version: '3.0'
|
@@ -21,6 +24,9 @@ dependencies:
|
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
24
30
|
- - ">"
|
25
31
|
- !ruby/object:Gem::Version
|
26
32
|
version: '3.0'
|
@@ -28,6 +34,9 @@ dependencies:
|
|
28
34
|
name: aws-sdk-ssm
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.0'
|
31
40
|
- - ">"
|
32
41
|
- !ruby/object:Gem::Version
|
33
42
|
version: '1.0'
|
@@ -35,6 +44,9 @@ dependencies:
|
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.0'
|
38
50
|
- - ">"
|
39
51
|
- !ruby/object:Gem::Version
|
40
52
|
version: '1.0'
|
@@ -75,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
87
|
- !ruby/object:Gem::Version
|
76
88
|
version: '0'
|
77
89
|
requirements: []
|
78
|
-
rubygems_version: 3.
|
90
|
+
rubygems_version: 3.4.21
|
79
91
|
signing_key:
|
80
92
|
specification_version: 4
|
81
93
|
summary: SMPS - Systems Manager Parameter Store
|