class Awspec::Type::RdsDbCluster

Constants

STATES

Public Instance Methods

has_cluster_member?(db_instance_identifier, is_writer = nil) click to toggle source
# File lib/awspec/type/rds_db_cluster.rb, line 31
def has_cluster_member?(db_instance_identifier, is_writer = nil)
  members = resource_via_client.db_cluster_members
  members.find do |member|
    if is_writer.nil?
      member.db_instance_identifier == db_instance_identifier
    else
      member.db_instance_identifier == db_instance_identifier && member.is_cluster_writer == is_writer
    end
  end
end
has_security_group?(sg_id) click to toggle source
# File lib/awspec/type/rds_db_cluster.rb, line 25
def has_security_group?(sg_id)
  return true if has_vpc_security_group_id?(sg_id)
  return true if has_vpc_security_group_name?(sg_id)
  return true if has_vpc_security_group_tag_name?(sg_id)
end
id() click to toggle source
# File lib/awspec/type/rds_db_cluster.rb, line 11
def id
  @id ||= resource_via_client.db_cluster_identifier if resource_via_client
end
resource_via_client() click to toggle source
# File lib/awspec/type/rds_db_cluster.rb, line 7
def resource_via_client
  @resource_via_client ||= find_db_cluster(@display_name)
end

Private Instance Methods

has_vpc_security_group_id?(sg_id) click to toggle source
# File lib/awspec/type/rds_db_cluster.rb, line 44
def has_vpc_security_group_id?(sg_id)
  sgs = resource_via_client.vpc_security_groups
  sgs.find do |sg|
    sg.vpc_security_group_id == sg_id
  end
end
has_vpc_security_group_name?(sg_id) click to toggle source
# File lib/awspec/type/rds_db_cluster.rb, line 51
def has_vpc_security_group_name?(sg_id)
  sgs = resource_via_client.vpc_security_groups
  res = ec2_client.describe_security_groups({
                                              filters: [{ name: 'group-name', values: [sg_id] }]
                                            })
  return false unless res.security_groups.count == 1

  sgs.find do |sg|
    sg.vpc_security_group_id == res.security_groups.first.group_id
  end
end
has_vpc_security_group_tag_name?(sg_id) click to toggle source
# File lib/awspec/type/rds_db_cluster.rb, line 63
def has_vpc_security_group_tag_name?(sg_id)
  sgs = resource_via_client.vpc_security_groups
  res = ec2_client.describe_security_groups({
                                              filters: [{ name: 'tag:Name', values: [sg_id] }]
                                            })
  return false unless res.security_groups.count == 1

  sgs.find do |sg|
    sg.vpc_security_group_id == res.security_groups.first.group_id
  end
end