Class: Awsborn::Route53
- Inherits:
-
Object
show all
- Extended by:
- Forwardable
- Includes:
- AwsConstants
- Defined in:
- lib/awsborn/route53.rb
Constant Summary
AwsConstants::AVAILABILITY_ZONES, AwsConstants::INSTANCE_TYPES, AwsConstants::INSTANCE_TYPES_32_BIT, AwsConstants::INSTANCE_TYPES_64_BIT, AwsConstants::REGIONS, AwsConstants::SYMBOL_CONSTANT_MAP
Instance Attribute Summary collapse
Instance Method Summary
collapse
#aws_constant, #aws_instance_type_to_symbol, #aws_zone_to_symbol, #endpoint_for_zone_and_service, #symbol_to_aws_instance_type, #symbol_to_aws_zone, #zone_to_aws_region
Constructor Details
#initialize(zone = nil) ⇒ Route53
Returns a new instance of Route53.
15
16
|
# File 'lib/awsborn/route53.rb', line 15
def initialize (zone = nil)
end
|
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
6
7
8
|
# File 'lib/awsborn/route53.rb', line 6
def connection
@connection
end
|
Instance Method Details
#add_alias_record(options) ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/awsborn/route53.rb', line 43
def add_alias_record (options)
name = with_final_dot(options[:alias])
zone = zone_id_for(name)
alias_target = { :hosted_zone_id => options[:lb_zone], :dns_name => options[:lb_fqdn] }
alias_record = { :name => options[:alias], :type => 'A', :alias_target => alias_target }
connection.create_resource_record_sets(zone, [alias_record])
end
|
#alias_target(name) ⇒ Object
36
37
38
39
40
41
|
# File 'lib/awsborn/route53.rb', line 36
def alias_target (name)
name = with_final_dot(name)
zone = zone_id_for(name)
alias_record = connection.list_resource_record_sets(zone).detect { |rr| rr[:name] == name && rr[:alias_target] }
alias_record && alias_record[:alias_target]
end
|
#create_zone(name) ⇒ Object
32
33
34
|
# File 'lib/awsborn/route53.rb', line 32
def create_zone (name)
connection.create_hosted_zone({:name => with_final_dot(name), :config => {:comment => ''}})
end
|
#remove_alias_records(name) ⇒ Object
51
52
53
54
55
56
|
# File 'lib/awsborn/route53.rb', line 51
def remove_alias_records (name)
name = with_final_dot(name)
zone = zone_id_for(name)
alias_records = connection.list_resource_record_sets(zone).select { |rr| rr[:name] == name && rr[:alias_target] }
connection.delete_resource_record_sets(zone, alias_records)
end
|
#zone_exists?(name) ⇒ Boolean
18
19
20
|
# File 'lib/awsborn/route53.rb', line 18
def zone_exists? (name)
!! zone_overview_for(name)
end
|
#zone_for(name) ⇒ Object
22
23
24
25
|
# File 'lib/awsborn/route53.rb', line 22
def zone_for (name)
zone_id = zone_id_for(name)
connection.get_hosted_zone(zone_id) if zone_id
end
|
#zone_id_for(name) ⇒ Object
27
28
29
30
|
# File 'lib/awsborn/route53.rb', line 27
def zone_id_for (name)
overview = zone_overview_for(name)
overview[:aws_id] if overview
end
|