class AwsClient::RdsWrapper
Public Instance Methods
all_instances()
click to toggle source
# File lib/rds_wrapper.rb, line 26 def all_instances @all_instances ||= get_all_instances.collect{|raw_instance| raw_instance.db_instances.flatten }.flatten end
get_all_instances()
click to toggle source
# File lib/rds_wrapper.rb, line 30 def get_all_instances all_instances = [] pages = client.describe_db_instances all_instances << pages.data while pages.next_page? pages = pages.next_page @all_instances << pages.data end return all_instances end
instance_by_database_name(database_name, is_master = true)
click to toggle source
# File lib/rds_wrapper.rb, line 4 def instance_by_database_name(database_name, is_master = true) if is_master all_instances.select{|db_instance| db_instance.db_name == database_name && db_instance.read_replica_source_db_instance_identifier.nil? }.first else all_instances.select{|db_instance| db_instance.db_name == database_name && !db_instance.read_replica_source_db_instance_identifier.nil? }.first end end
instance_data_by_vpc_id(vpc_id)
click to toggle source
# File lib/rds_wrapper.rb, line 12 def instance_data_by_vpc_id(vpc_id) return all_instances.select{|instance| instance.db_subnet_group.vpc_id = vpc_id } end
instance_endpoint(instance)
click to toggle source
# File lib/rds_wrapper.rb, line 16 def instance_endpoint(instance) return "UNDEFINED" if instance.nil? return instance.endpoint.address end
instance_endpoint_for_named_database(database_name, is_master = true)
click to toggle source
# File lib/rds_wrapper.rb, line 21 def instance_endpoint_for_named_database(database_name, is_master = true) instance = instance_by_database_name(database_name, is_master) return instance_endpoint(instance) end