class Awspec::Type::Rds

Constants

STATES

Public Instance Methods

has_db_parameter_group?(name) click to toggle source
# File lib/awspec/type/rds.rb, line 40
def has_db_parameter_group?(name)
  pgs = resource_via_client.db_parameter_groups
  pgs.find do |pg|
    pg.db_parameter_group_name == name
  end
end
has_option_group?(name) click to toggle source
# File lib/awspec/type/rds.rb, line 47
def has_option_group?(name)
  ogs = resource_via_client.option_group_memberships
  ogs.find do |og|
    og.option_group_name == name
  end
end
has_security_group?(sg_id) click to toggle source
# File lib/awspec/type/rds.rb, line 33
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)
  return true if has_db_security_group_name?(sg_id)
end
has_tag?(tag_key, tag_value) click to toggle source
# File lib/awspec/type/rds.rb, line 54
def has_tag?(tag_key, tag_value)
  arn = resource_via_client.db_instance_arn
  tag_set = rds_client.list_tags_for_resource({ resource_name: arn })
  tag_set.tag_list.find do |tag|
    tag.key == tag_key && tag.value == tag_value
  end
end
id() click to toggle source
# File lib/awspec/type/rds.rb, line 9
def id
  @id ||= resource_via_client.db_instance_identifier if resource_via_client
end
resource_via_client() click to toggle source
# File lib/awspec/type/rds.rb, line 5
def resource_via_client
  @resource_via_client ||= find_rds(@display_name)
end
vpc_id() click to toggle source
# File lib/awspec/type/rds.rb, line 29
def vpc_id
  resource_via_client.db_subnet_group.vpc_id
end

Private Instance Methods

has_db_security_group_name?(sg_id) click to toggle source
# File lib/awspec/type/rds.rb, line 93
def has_db_security_group_name?(sg_id)
  sgs = resource_via_client.db_security_groups
  sgs.find do |sg|
    sg.db_security_group_name == sg_id
  end
end
has_vpc_security_group_id?(sg_id) click to toggle source
# File lib/awspec/type/rds.rb, line 64
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.rb, line 71
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.rb, line 82
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