awful 0.0.36 → 0.0.37

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
  SHA1:
3
- metadata.gz: 0e4aa9e317381692d25c4f59ed46074cda3d16f5
4
- data.tar.gz: a39626808424accf9a7b7415f2f202cd4500474c
3
+ metadata.gz: dc01ff7e05945c5a7df17207a7a33331b5189899
4
+ data.tar.gz: d117f8ea9bb1db41aac08ae8733baf9b90a8d82f
5
5
  SHA512:
6
- metadata.gz: aa0648dfd5b6cceb238e3d4c6d8f2ef6ec18a1ef050680faa9a9681447fd07b0ffd8059d7a502aae1be2a9e59a83b02b6dfc37c8da39a59603184c8529eeaa22
7
- data.tar.gz: 547ba3ea49d5568c650abf36007de21b67f9875441c4c4e0df979fa949a2426a4862aabff5b61000d7592308ca9c6cf074337625d64edf1fa5ab12095e466dfe
6
+ metadata.gz: a799784f0ca082b810950637a8eb93b25194fe9396447e47bedf51e53c2ecc1c5e6f63d3a734801f90ac728fe44380a4cf953bb6ef678b281478dad1a786127f
7
+ data.tar.gz: c8d37aafefc44a9fad6caf96d3283c4e3e9b4842e874bace1ef06e27b5cdf58ea89305cc077a5cd93e66443c96078f49a5373039363050b5de800a776c3bcde7
data/bin/ta ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby
2
+ #-*- mode: ruby; -*-
3
+
4
+ require 'awful'
5
+ require 'awful/trusted_advisor'
6
+
7
+ Awful::TrustedAdvisor.start(ARGV)
data/lib/awful.rb CHANGED
@@ -59,6 +59,10 @@ module Awful
59
59
  @s3 ||= Aws::S3::Client.new
60
60
  end
61
61
 
62
+ def support
63
+ @support ||= Aws::Support::Client.new
64
+ end
65
+
62
66
  def symbolize_keys(thing)
63
67
  if thing.is_a?(Hash)
64
68
  Hash[ thing.map { |k,v| [ k.to_sym, symbolize_keys(v) ] } ]
@@ -0,0 +1,53 @@
1
+ module Awful
2
+
3
+ class TrustedAdvisor < Cli
4
+
5
+ desc 'ls', 'list trusted advisor checks'
6
+ method_option :long, aliases: '-l', default: false, desc: 'Long listing'
7
+ def ls(name = '.')
8
+ support.describe_trusted_advisor_checks(language: 'en').checks.select do |check|
9
+ check.name.match(/#{name}/i)
10
+ end.tap do |checks|
11
+ if options[:long]
12
+ print_table(checks.map { |c| [c.name, c.id, c.category] }.sort)
13
+ else
14
+ puts checks.map(&:name).sort
15
+ end
16
+ end
17
+ end
18
+
19
+ desc 'check ID', 'describe check result for given ID'
20
+ method_option :long, aliases: '-l', default: false, desc: 'Long listing'
21
+ method_option :all, aliases: '-a', default: false, desc: 'List all flagged resources'
22
+ def check(id)
23
+ support.describe_trusted_advisor_check_result(check_id: id).result.tap do |r|
24
+ if options[:long]
25
+ flagged = "#{r.resources_summary.resources_flagged}/#{r.resources_summary.resources_processed}"
26
+ puts "#{r.check_id} #{r.status} #{flagged}"
27
+ elsif options[:all]
28
+ print_table r.flagged_resources.map { |f| f.metadata }.sort
29
+ else
30
+ puts r.status
31
+ end
32
+ end
33
+ end
34
+
35
+ desc 'summary NAME', 'check summaries matching name'
36
+ def summary(name = '.')
37
+ checks = support.describe_trusted_advisor_checks(language: 'en').checks.select do |check|
38
+ check.name.match(/#{name}/i)
39
+ end.each_with_object({}) do |check, hash|
40
+ hash[check.id] = check
41
+ end
42
+ support.describe_trusted_advisor_check_summaries(check_ids: checks.keys).summaries.tap do |summaries|
43
+ summaries.map do |s|
44
+ check = checks[s.check_id]
45
+ flagged = "#{s.resources_summary.resources_flagged}/#{s.resources_summary.resources_processed}"
46
+ [check.name, s.check_id, s.status, flagged, s.timestamp]
47
+ end.tap { |list| print_table list.sort }
48
+ end
49
+ end
50
+
51
+ end
52
+
53
+ end
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = "0.0.36"
2
+ VERSION = "0.0.37"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.36
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
11
+ date: 2015-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,6 +98,7 @@ executables:
98
98
  - s3
99
99
  - sg
100
100
  - subnet
101
+ - ta
101
102
  - vpc
102
103
  extensions: []
103
104
  extra_rdoc_files: []
@@ -122,6 +123,7 @@ files:
122
123
  - bin/s3
123
124
  - bin/sg
124
125
  - bin/subnet
126
+ - bin/ta
125
127
  - bin/vpc
126
128
  - lib/awful.rb
127
129
  - lib/awful/ami.rb
@@ -138,6 +140,7 @@ files:
138
140
  - lib/awful/s3.rb
139
141
  - lib/awful/security_group.rb
140
142
  - lib/awful/subnet.rb
143
+ - lib/awful/trusted_advisor.rb
141
144
  - lib/awful/version.rb
142
145
  - lib/awful/vpc.rb
143
146
  homepage: ''