aws_clim 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -8
- data/lib/aws_clim/version.rb +1 -1
- data/lib/aws_clim.rb +3 -54
- metadata +1 -2
- data/aws_clim-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c71eb36c809ad34e0682ed8f122ececc8f6a71532d6256c78670cba5ee4c13a8
|
4
|
+
data.tar.gz: 66d93e4023fdd715499e17ffa9fb47f47b6676af933bfcfc7c1427008b2d59cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cba3ede4804d99f587ad7c1bda529b16ff752df71aea77497590b697f2787b4b1b03cc51dd7eadd23818b2cc1e0af56e41e1791e357f215814cf50921e0b5dcb
|
7
|
+
data.tar.gz: 65545875d1c30f02c09e34638e40865606f40de82ff9f4885b5dfe4c2741b78f42fdcf0590c2b95bb530fdd02b81ca3dea9a75ab28feb9f9f93248e84f400ec9
|
data/README.md
CHANGED
@@ -22,18 +22,31 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
With a instance of AwsClim call aws services by its name and pass subcommands and options:
|
26
26
|
|
27
|
-
|
27
|
+
Examples:
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
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).
|
32
|
-
|
33
|
-
## Contributing
|
29
|
+
```
|
30
|
+
# Subcommand
|
34
31
|
|
35
|
-
|
32
|
+
aws.iam('list-users').data.Users
|
33
|
+
```
|
36
34
|
|
35
|
+
```
|
36
|
+
# Subcommand + Arguments
|
37
|
+
|
38
|
+
result = aws.apigateway('put-method-response', {
|
39
|
+
'rest-api-id' => rest_api['id'],
|
40
|
+
'resource-id' => resource['id'],
|
41
|
+
'http-method' => 'GET',
|
42
|
+
'status-code' => '200',
|
43
|
+
'response-parameters' => 'method.response.header.access-control-allow-origin=false'
|
44
|
+
})
|
45
|
+
|
46
|
+
result.success?
|
47
|
+
result.error?
|
48
|
+
result.data
|
49
|
+
```
|
37
50
|
|
38
51
|
## License
|
39
52
|
|
data/lib/aws_clim/version.rb
CHANGED
data/lib/aws_clim.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ostruct'
|
1
2
|
require 'json'
|
2
3
|
require 'open3'
|
3
4
|
|
@@ -7,57 +8,6 @@ class AwsClim
|
|
7
8
|
@global_options = global_options
|
8
9
|
end
|
9
10
|
|
10
|
-
class SimpleResult
|
11
|
-
attr_reader :data
|
12
|
-
|
13
|
-
def initialize(data)
|
14
|
-
@data = data
|
15
|
-
end
|
16
|
-
|
17
|
-
def error?
|
18
|
-
false
|
19
|
-
end
|
20
|
-
|
21
|
-
def success?
|
22
|
-
true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class ItemsResult < SimpleResult
|
27
|
-
include Enumerable
|
28
|
-
|
29
|
-
attr_reader :data, :items
|
30
|
-
|
31
|
-
def initialize(data)
|
32
|
-
super
|
33
|
-
@items = data['items']
|
34
|
-
end
|
35
|
-
|
36
|
-
def each(&block)
|
37
|
-
@data.fetch('items').each(&block)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class ErrorResult
|
42
|
-
attr_reader :message
|
43
|
-
|
44
|
-
def initialize(message)
|
45
|
-
@message = message
|
46
|
-
end
|
47
|
-
|
48
|
-
def to_s
|
49
|
-
"Error: #{@message}"
|
50
|
-
end
|
51
|
-
|
52
|
-
def success?
|
53
|
-
false
|
54
|
-
end
|
55
|
-
|
56
|
-
def error?
|
57
|
-
true
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
11
|
%w(
|
62
12
|
accessanalyzer
|
63
13
|
account
|
@@ -388,10 +338,9 @@ class AwsClim
|
|
388
338
|
out, err, status = Open3.capture3(cmd)
|
389
339
|
|
390
340
|
if status.success?
|
391
|
-
|
392
|
-
result.key?('items') ? ItemsResult.new(result) : SimpleResult.new(result)
|
341
|
+
OpenStruct.new(success?: true, error?: false, data: OpenStruct.new(JSON.parse(out)))
|
393
342
|
else
|
394
|
-
|
343
|
+
OpenStruct.new(success?: false, error?: true, data: err)
|
395
344
|
end
|
396
345
|
end
|
397
346
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws_clim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew S Aguiar
|
@@ -24,7 +24,6 @@ files:
|
|
24
24
|
- Gemfile.lock
|
25
25
|
- LICENSE.txt
|
26
26
|
- README.md
|
27
|
-
- aws_clim-0.1.0.gem
|
28
27
|
- aws_clim.gemspec
|
29
28
|
- bin/console
|
30
29
|
- lib/aws_clim.rb
|
data/aws_clim-0.1.0.gem
DELETED
Binary file
|