Class: AwsInstanceList::RDS
- Inherits:
-
Base
- Object
- Base
- AwsInstanceList::RDS
show all
- Defined in:
- lib/aws_instance_list/rds.rb
Instance Attribute Summary
Attributes inherited from Base
#client, #metric, #region
Instance Method Summary
collapse
Methods inherited from Base
#demodulize, #instances, #yaml, #yaml_default, #yaml_file
Constructor Details
#initialize(region: 'eu-west-1') ⇒ RDS
Returns a new instance of RDS.
7
8
9
10
11
12
13
|
# File 'lib/aws_instance_list/rds.rb', line 7
def initialize region: 'eu-west-1'
super region: region
@client=Aws::RDS::Client.new region: region
end
|
Instance Method Details
#db_list(options: {}, fields: nil) ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/aws_instance_list/rds.rb', line 23
def db_list options: {}, fields: nil
fields||=load_db_fields
instances(options).map do |i|
fields.map { |f| i.send(f) } << free_storage_space(i.db_instance_identifier) << region
end
end
|
#descriptions(options = {}) ⇒ Object
19
20
21
|
# File 'lib/aws_instance_list/rds.rb', line 19
def descriptions options={}
client.describe_db_instances(options)
end
|
#free_storage_space(db_instance_identifier) ⇒ Object
36
37
38
|
# File 'lib/aws_instance_list/rds.rb', line 36
def free_storage_space db_instance_identifier
metric.free_storage_space db_instance_identifier
end
|
#list_method ⇒ Object
15
16
17
|
# File 'lib/aws_instance_list/rds.rb', line 15
def list_method
:db_instances
end
|
#load_db_fields ⇒ Object
32
33
34
|
# File 'lib/aws_instance_list/rds.rb', line 32
def load_db_fields
yaml['db']['fields']
end
|