Class: Jets::Resource::Route53::RecordSet

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/resource/route53/record_set.rb

Instance Method Summary collapse

Methods inherited from Base

#replacements, #resource

Instance Method Details

#cnameObject



35
36
37
38
39
40
41
# File 'lib/jets/resource/route53/record_set.rb', line 35

def cname
  if endpoint_types.include?("REGIONAL")
    "!GetAtt DomainName.RegionalDomainName"
  else
    "!GetAtt DomainName.DistributionDomainName"
  end
end

#definitionObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/jets/resource/route53/record_set.rb', line 17

def definition
  {
    dns_record: {
      type: "AWS::Route53::RecordSet",
      properties: {
        hosted_zone_name: hosted_zone_name,
        comment: "DNS record managed by Jets",
        name: name,
        type: "CNAME",
        ttl: "60",
        resource_records: [
          cname,
        ],
      }
    }
  }
end

#domain_nameObject



43
44
45
# File 'lib/jets/resource/route53/record_set.rb', line 43

def domain_name
  Jets::Resource::ApiGateway::DomainName.new
end

#endpoint_typesObject



48
49
50
# File 'lib/jets/resource/route53/record_set.rb', line 48

def endpoint_types
  domain_name.endpoint_types
end

#hosted_zone_nameObject

IE: mydomain.com



59
60
61
62
# File 'lib/jets/resource/route53/record_set.rb', line 59

def hosted_zone_name
  name = Jets.config.domain.hosted_zone_name
  name.ends_with?('.') ? name : "#{name}." # add trailing period if missing
end

#nameObject

IE: demo-dev.mydomain.com



53
54
55
56
# File 'lib/jets/resource/route53/record_set.rb', line 53

def name
  # Weird looking but correct: domain_name is object and domain_name is also method
  domain_name.domain_name
end

#outputsObject



64
65
66
67
68
# File 'lib/jets/resource/route53/record_set.rb', line 64

def outputs
  {
    "DnsRecord" => "!Ref DnsRecord",
  }
end