Class: Awful::TrustedAdvisor
- Inherits:
-
Cli
show all
- Defined in:
- lib/awful/trusted_advisor.rb
Instance Method Summary
collapse
Methods inherited from Cli
#initialize, #ll, #version
Constructor Details
This class inherits a constructor from Awful::Cli
Instance Method Details
#check(id) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/awful/trusted_advisor.rb', line 22
def check(id)
support.describe_trusted_advisor_check_result(check_id: id).result.tap do |r|
if options[:long]
flagged = "#{r.resources_summary.resources_flagged}/#{r.resources_summary.resources_processed}"
puts "#{r.check_id} #{r.status} #{flagged}"
elsif options[:all]
print_table r.flagged_resources.map { |f| f.metadata }.sort
else
puts r.status
end
end
end
|
#ls(name = '.') ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/awful/trusted_advisor.rb', line 7
def ls(name = '.')
support.describe_trusted_advisor_checks(language: 'en').checks.select do |check|
check.name.match(/#{name}/i)
end.tap do |checks|
if options[:long]
print_table(checks.map { |c| [c.name, c.id, c.category] }.sort)
else
puts checks.map(&:name).sort
end
end
end
|
#summary(name = '.') ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/awful/trusted_advisor.rb', line 36
def summary(name = '.')
checks = support.describe_trusted_advisor_checks(language: 'en').checks.select do |check|
check.name.match(/#{name}/i)
end.each_with_object({}) do |check, hash|
hash[check.id] = check
end
support.describe_trusted_advisor_check_summaries(check_ids: checks.keys).summaries.tap do |summaries|
summaries.map do |s|
check = checks[s.check_id]
flagged = "#{s.resources_summary.resources_flagged}/#{s.resources_summary.resources_processed}"
[check.name, s.check_id, s.status, flagged, s.timestamp]
end.tap { |list| print_table list.sort }
end
end
|