Class: Chef::Knife::RdsInstanceList

Inherits:
Chef::Knife show all
Includes:
RdsBase
Defined in:
lib/chef/knife/rds_instance_list.rb

Constant Summary collapse

INSTANCE_INFO =

Key = attribute of DBInstance. Value = label to display

{
  id: 'ID',
  status: 'Status',
  db_name: 'DB Name',
  engine: 'Engine',
  engine_version: 'Engine Version',
  iops: 'IOPS',
  master_username: 'Master Username',
  multi_az: 'Multi-AZ?',
  endpoint_address: 'Endpoint',
  created_at: 'Created At',
  size: 'Size (GB)',
  availability_zone_name: 'AZ',
  db_instance_class: 'Instance Type',

}

Constants included from RdsBase

Chef::Knife::RdsBase::APPLY_METHODS

Instance Method Summary collapse

Methods included from RdsBase

#assert_name_args_at_least!, #assert_valid_apply_method!, #authenticate!, #connect!, included, #rds

Instance Method Details

#present_instance(instance) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/chef/knife/rds_instance_list.rb', line 39

def present_instance(instance)
  ui.info "-----"
  INSTANCE_INFO.each do |k, v|
    ui.info("#{v} - #{instance.send(k) || 'n/a'}")
  end
  ui.info '-----'
end

#runObject



34
35
36
37
# File 'lib/chef/knife/rds_instance_list.rb', line 34

def run
  authenticate!
  rds.db_instances.each { |instance| present_instance(instance) }
end