Class: ShootsDeploy::HostedZone
- Inherits:
-
Object
- Object
- ShootsDeploy::HostedZone
- Defined in:
- lib/shoots_deploy/hosted_zone.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
Instance Method Summary collapse
- #configure_alias_record ⇒ Object
- #configure_cname_record ⇒ Object
-
#initialize(configuration) ⇒ HostedZone
constructor
A new instance of HostedZone.
- #ns_resource_records ⇒ Object
- #transfer_existing_dns_settings ⇒ Object
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
#configuration ⇒ Object
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_record ⇒ Object
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_record ⇒ Object
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_records ⇒ Object
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_settings ⇒ Object
25 26 27 |
# File 'lib/shoots_deploy/hosted_zone.rb', line 25 def transfer_existing_dns_settings puts "pending implementation" end |