Class: PrettyAws::RdsSnapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/pretty_aws/rds_snapshot.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ RdsSnapshot

Returns a new instance of RdsSnapshot.



26
27
28
# File 'lib/pretty_aws/rds_snapshot.rb', line 26

def initialize(params)
  @params=params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



4
5
6
# File 'lib/pretty_aws/rds_snapshot.rb', line 4

def params
  @params
end

Class Method Details

.allObject



10
11
12
# File 'lib/pretty_aws/rds_snapshot.rb', line 10

def self.all
  Base.rds.describe_db_snapshots.collect { |params| new(params) }
end

.find_all_and_groupObject



6
7
8
# File 'lib/pretty_aws/rds_snapshot.rb', line 6

def self.find_all_and_group
  group_by_db(all)
end

.group_by_db(items) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pretty_aws/rds_snapshot.rb', line 14

def self.group_by_db(items)
  if items.nil?
    return {}
  end
  grouped = { }
  items.each do |item|
    grouped[item.db_id] ||= [ ]
    grouped[item.db_id] << item
  end
  grouped
end

Instance Method Details

#created_atObject



42
43
44
# File 'lib/pretty_aws/rds_snapshot.rb', line 42

def created_at
  @params[:instance_create_time]
end

#db_idObject



38
39
40
# File 'lib/pretty_aws/rds_snapshot.rb', line 38

def db_id
  @params[:db_instance_identifier]
end

#idObject



30
31
32
# File 'lib/pretty_aws/rds_snapshot.rb', line 30

def id
  @params[:db_snapshot_identifier]
end

#statusObject



46
47
48
# File 'lib/pretty_aws/rds_snapshot.rb', line 46

def status
  @params[:status]
end

#storageObject



34
35
36
# File 'lib/pretty_aws/rds_snapshot.rb', line 34

def storage
  @params[:allocated_storage]
end