Class: CloudProviders::RdsInstance
- Inherits:
-
Ec2Helper
show all
- Defined in:
- lib/cloud_providers/ec2/helpers/rds_instance.rb
Instance Attribute Summary
#init_opts, #name
Instance Method Summary
collapse
Methods inherited from Ec2Helper
#as, #ec2, #elb, #initialize, #pool, property, #rds
#bootstrap_nodes!, #default_keypair_path, default_keypair_path, #initialize, #method_missing
Instance Method Details
#authorize(options) ⇒ Object
5
6
7
8
9
|
# File 'lib/cloud_providers/ec2/helpers/rds_instance.rb', line 5
def authorize(options)
options.each do |key, value|
authorizations[key.to_s] = value
end
end
|
#available? ⇒ Boolean
44
45
46
|
# File 'lib/cloud_providers/ec2/helpers/rds_instance.rb', line 44
def available?
exists? && current_status.DBInstanceStatus == 'available'
end
|
18
19
20
21
22
23
|
# File 'lib/cloud_providers/ec2/helpers/rds_instance.rb', line 18
def create!
if should_create_rds_instance?
puts "-----> Creating RDS Instance: #{instance_id}"
create_rds_instance!
end
end
|
#current_status ⇒ Object
36
37
38
|
# File 'lib/cloud_providers/ec2/helpers/rds_instance.rb', line 36
def current_status
rds_instances.detect{|i| i.DBInstanceIdentifier == instance_id }
end
|
#database(*db_names) ⇒ Object
Also known as:
databases
11
12
13
14
15
|
# File 'lib/cloud_providers/ec2/helpers/rds_instance.rb', line 11
def database(*db_names)
@databases ||= []
@databases = @databases + db_names unless db_names.empty?
@databases
end
|
#exists? ⇒ Boolean
40
41
42
|
# File 'lib/cloud_providers/ec2/helpers/rds_instance.rb', line 40
def exists?
! current_status.nil?
end
|
#instance_id ⇒ Object
48
49
50
|
# File 'lib/cloud_providers/ec2/helpers/rds_instance.rb', line 48
def instance_id
name.to_s
end
|
25
26
27
28
29
|
# File 'lib/cloud_providers/ec2/helpers/rds_instance.rb', line 25
def run
create! authorize_access
end
|
31
32
33
34
|
# File 'lib/cloud_providers/ec2/helpers/rds_instance.rb', line 31
def teardown
puts "-----> Tearing down RDS Instance: #{instance_id}"
delete_rds_instance!
end
|