Class: ShootsDeploy::HostedZone

Inherits:
Object
  • Object
show all
Defined in:
lib/shoots_deploy/hosted_zone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ HostedZone

Returns a new instance of HostedZone.



6
7
8
9
10
# File 'lib/shoots_deploy/hosted_zone.rb', line 6

def initialize(configuration)
  r53 = AWS::Route53.new
  @configuration = configuration
  @hosted_zone = r53.hosted_zones.create(configuration.root_domain)
end

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



4
5
6
# File 'lib/shoots_deploy/hosted_zone.rb', line 4

def configuration
  @configuration
end

Instance Method Details

#configure_alias_recordObject



12
13
14
15
16
17
18
# File 'lib/shoots_deploy/hosted_zone.rb', line 12

def configure_alias_record
  @hosted_zone.rrsets.create(configuration.root_domain, 'A', alias_target: {
    dns_name: "s3-website-#{configuration.region}.amazonaws.com",
    evaluate_target_health: false,
    hosted_zone_id: AWS::Route53::HostedZone::S3_HOSTED_ZONE_IDS[configuration.region]
  })
end

#configure_cname_recordObject



20
21
22
23
# File 'lib/shoots_deploy/hosted_zone.rb', line 20

def configure_cname_record
  @hosted_zone.rrsets.create(configuration.subdomain_url, 'CNAME', :ttl => 300, :resource_records => [{:value => "#{configuration.subdomain_url}.s3-website-#{configuration.region}.amazonaws.com"}])

end

#ns_resource_recordsObject



29
30
31
# File 'lib/shoots_deploy/hosted_zone.rb', line 29

def ns_resource_records
  @hosted_zone.resource_record_sets.to_a.reject { |r| r.type != 'NS' }[0].resource_records.map { |v| v[:value].gsub(/[.]$/, '') }
end

#transfer_existing_dns_settingsObject



25
26
27
# File 'lib/shoots_deploy/hosted_zone.rb', line 25

def transfer_existing_dns_settings
  puts "pending implementation"
end