Class: Jets::Cfn::Resource::Route53::RecordSet
- Inherits:
-
Base
- Object
- Base
- Jets::Cfn::Resource::Route53::RecordSet
show all
- Defined in:
- lib/jets/cfn/resource/route53/record_set.rb
Instance Method Summary
collapse
Methods inherited from Base
#attributes, #logical_id, #parameters, #permission, #properties, #replacements, #replacer, #standarize, #template, truncate_id, #type
#camelize
Instance Method Details
#cname ⇒ Object
63
64
65
66
67
68
69
|
# File 'lib/jets/cfn/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/cfn/resource/route53/record_set.rb', line 17
def definition
{
DnsRecord: {
Type: "AWS::Route53::RecordSet",
Properties: record_set_properties
}
}
end
|
#domain_name_hosted_zone ⇒ Object
55
56
57
58
59
60
61
|
# File 'lib/jets/cfn/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/cfn/resource/route53/record_set.rb', line 76
def endpoint_types
domain_name.endpoint_types
end
|
#hosted_zone_name ⇒ Object
87
88
89
90
|
# File 'lib/jets/cfn/resource/route53/record_set.rb', line 87
def hosted_zone_name
name = Jets.config.domain.hosted_zone_name
name.ends_with?('.') ? name : "#{name}." end
|
#name ⇒ Object
IE: demo-dev.mydomain.com
81
82
83
84
|
# File 'lib/jets/cfn/resource/route53/record_set.rb', line 81
def name
domain_name.domain_name
end
|
#outputs ⇒ Object
92
93
94
95
96
|
# File 'lib/jets/cfn/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/cfn/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[:HostedZoneId] = hosted_zone_id
else
base[:HostedZoneName] = hosted_zone_name
end
if Jets.config.domain.apex
base.merge(
AliasTarget: {
DNSName: cname,
HostedZoneId: domain_name_hosted_zone,
},
Type: "A",
)
else
base.merge({
Type: "CNAME",
TTL: "60",
ResourceRecords: [cname],
})
end
end
|