Class: Jets::Resource::Route53::RecordSet
- Defined in:
- lib/jets/resource/route53/record_set.rb
Instance Method Summary collapse
- #cname ⇒ Object
- #definition ⇒ Object
- #domain_name ⇒ Object
- #domain_name_hosted_zone ⇒ Object
- #endpoint_types ⇒ Object
-
#hosted_zone_name ⇒ Object
IE: mydomain.com.
-
#name ⇒ Object
IE: demo-dev.mydomain.com.
- #outputs ⇒ Object
- #record_set_properties ⇒ Object
Methods inherited from Base
Instance Method Details
#cname ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/jets/resource/route53/record_set.rb', line 63 def cname if endpoint_types.include?("REGIONAL") "!GetAtt DomainName.RegionalDomainName" else "!GetAtt DomainName.DistributionDomainName" end end |
#definition ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/jets/resource/route53/record_set.rb', line 17 def definition { dns_record: { type: "AWS::Route53::RecordSet", properties: record_set_properties } } end |
#domain_name ⇒ Object
71 72 73 |
# File 'lib/jets/resource/route53/record_set.rb', line 71 def domain_name Jets::Resource::ApiGateway::DomainName.new end |
#domain_name_hosted_zone ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/jets/resource/route53/record_set.rb', line 55 def domain_name_hosted_zone if endpoint_types.include?("REGIONAL") "!GetAtt DomainName.RegionalHostedZoneId" else "!GetAtt DomainName.DistributionHostedZoneId" end end |
#endpoint_types ⇒ Object
76 77 78 |
# File 'lib/jets/resource/route53/record_set.rb', line 76 def endpoint_types domain_name.endpoint_types end |
#hosted_zone_name ⇒ Object
IE: mydomain.com
87 88 89 90 |
# File 'lib/jets/resource/route53/record_set.rb', line 87 def hosted_zone_name name = Jets.config.domain.hosted_zone_name name.ends_with?('.') ? name : "#{name}." # add trailing period if missing end |
#name ⇒ Object
IE: demo-dev.mydomain.com
81 82 83 84 |
# File 'lib/jets/resource/route53/record_set.rb', line 81 def name # Weird looking but correct: domain_name is object and domain_name is also method domain_name.domain_name end |
#outputs ⇒ Object
92 93 94 95 96 |
# File 'lib/jets/resource/route53/record_set.rb', line 92 def outputs { "DnsRecord" => "!Ref DnsRecord", } end |
#record_set_properties ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/jets/resource/route53/record_set.rb', line 26 def record_set_properties base = { comment: "DNS record managed by Jets", name: name, } hosted_zone_id = Jets.config.domain.hosted_zone_id if hosted_zone_id base[:hosted_zone_id] = hosted_zone_id else base[:hosted_zone_name] = hosted_zone_name end if Jets.config.domain.apex base.merge( alias_target: { dns_name: cname, hosted_zone_id: domain_name_hosted_zone, }, type: "A", ) else base.merge({ type: "CNAME", ttl: "60", resource_records: [cname], }) end end |