Class: Microstatic::Route53Dns

Inherits:
Object
  • Object
show all
Includes:
UsesFog
Defined in:
lib/microstatic/route53_dns.rb

Instance Method Summary collapse

Methods included from UsesFog

#check_and_store_aws_creds, #connection, #dns

Constructor Details

#initialize(aws_creds) ⇒ Route53Dns

Returns a new instance of Route53Dns.



6
7
8
# File 'lib/microstatic/route53_dns.rb', line 6

def initialize( aws_creds )
  check_and_store_aws_creds(aws_creds)
end

Instance Method Details

#add_s3_record_for_bucket(bucket_name, hostname = false) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/microstatic/route53_dns.rb', line 10

def add_s3_record_for_bucket( bucket_name, hostname = false )
  subdomain ||= bucket_name

  zone = parent_zone_for_subdomain( subdomain )
  cname_value = website_endpoint_for_bucket_named( bucket_name )

  record = zone.records.create(
    :name => subdomain,
    :value => cname_value,
    :type => 'CNAME',
    :ttl => 86400
  )
  record
end