Class: AwsAuditor::Scripts::Inspect

Inherits:
Object
  • Object
show all
Extended by:
AWSWrapper, OpsWorksWrapper
Defined in:
lib/aws_auditor/scripts/inspect.rb

Instance Attribute Summary

Attributes included from AWSWrapper

#aws

Attributes included from OpsWorksWrapper

#opsworks

Class Method Summary collapse

Class Method Details

.execute(environment, options = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/aws_auditor/scripts/inspect.rb', line 7

def self.execute(environment, options=nil)
  aws(environment)
  if options[:ec2]
    inspect_stacks
  elsif options[:rds]
    inspect_dbs
  elsif options[:cache]
    inspect_caches
  else
    puts "You must use a switch. See `aws-auditor inspect --help` for more info."
  end
end

.inspect_cachesObject



36
37
38
39
40
41
42
43
44
# File 'lib/aws_auditor/scripts/inspect.rb', line 36

def self.inspect_caches
  CacheInstance.get_instances.each do |cache|
    puts "========================"
    puts "#{cache.name}"
    puts "========================"
    puts cache.to_s
    puts "\n"
  end
end

.inspect_dbsObject



26
27
28
29
30
31
32
33
34
# File 'lib/aws_auditor/scripts/inspect.rb', line 26

def self.inspect_dbs
  RDSInstance.get_instances.each do |db|
    puts "========================"
    puts "#{db.name}"
    puts "========================"
    puts db.to_s
    puts "\n"
  end
end

.inspect_stacksObject



20
21
22
23
24
# File 'lib/aws_auditor/scripts/inspect.rb', line 20

def self.inspect_stacks
  Stack.all.each do |stack|
    stack.pretty_print
  end
end