Class: Awful::Rds
  
  
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  Methods inherited from Cli
  #initialize, #ll, #version
  
  Constructor Details
  
    This class inherits a constructor from Awful::Cli
  
 
  
    Instance Method Details
    
      
  
  
    #dns(name)  ⇒ Object 
  
  
  
  
    
      
34
35
36
37
38
39
40 
     | 
    
      # File 'lib/awful/rds.rb', line 34
def dns(name)
  rds.describe_db_instances.map(&:db_instances).flatten.find do |db|
    db.db_instance_identifier == name
  end.tap do |db|
    puts "#{db.endpoint.address}:#{db.endpoint.port}"
  end
end
     | 
  
 
    
      
  
  
    #dump(name)  ⇒ Object 
  
  
  
  
    
      
25
26
27
28
29
30
31 
     | 
    
      # File 'lib/awful/rds.rb', line 25
def dump(name)
  rds.describe_db_instances.map(&:db_instances).flatten.find do |db|
    db.db_instance_identifier == name
  end.tap do |db|
    puts YAML.dump(stringify_keys(db.to_hash))
  end
end
     | 
  
 
    
      
  
  
    #ls(name = /./)  ⇒ Object 
  
  
  
  
    
      
9
10
11
12
13
14
15
16
17
18
19
20
21
22 
     | 
    
      # File 'lib/awful/rds.rb', line 9
def ls(name = /./)
  fields = options[:long] ?
    ->(d) { [d.db_instance_identifier, d.availability_zone, d.db_instance_class, d.db_instance_status, d.preferred_maintenance_window, d.storage_type, d.allocated_storage,
             d.engine, d.engine_version] } :
    ->(d) { [d.db_instance_identifier] }
  rds.describe_db_instances.map(&:db_instances).flatten.select do |db|
    db.db_instance_identifier.match(name)
  end.map do |db|
    fields.call(db)
  end.tap do |list|
    print_table list
  end
end
     |