Class: Cumulus::Route53::AliasTarget

Inherits:
Struct
  • Object
show all
Defined in:
lib/route53/models/AliasTarget.rb

Overview

Public: A struct that matches the structure of the AWS alias target struct

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#local_zone_idObject

Returns the value of attribute local_zone_id

Returns:

  • (Object)

    the current value of local_zone_id



8
9
10
# File 'lib/route53/models/AliasTarget.rb', line 8

def local_zone_id
  @local_zone_id
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



8
9
10
# File 'lib/route53/models/AliasTarget.rb', line 8

def name
  @name
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



8
9
10
# File 'lib/route53/models/AliasTarget.rb', line 8

def type
  @type
end

Instance Method Details

#dns_nameObject

Public: Produce the dns_name for this alias

Returns the dns_name



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/route53/models/AliasTarget.rb', line 12

def dns_name
  if is_elb?
    "dualstack.#{ELB::get_aws(name).dns_name}"
  elsif is_s3?
    "s3-website-#{S3::get_aws(name).location}.amazonaws.com"
  elsif is_cloudfront?
    CloudFront::get_aws(name).domain_name
  else
    name
  end
end

#evaluate_target_healthObject

Public: Determine whether to evaluate the health check on the target. Always false.

Returns false



53
54
55
# File 'lib/route53/models/AliasTarget.rb', line 53

def evaluate_target_health
  false
end

#hosted_zone_idObject

Public: Produce the hosted_zone_id for this alias

Returns the hosted_zone_id



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/route53/models/AliasTarget.rb', line 37

def hosted_zone_id
  if is_elb?
    ELB::get_aws(name).canonical_hosted_zone_name_id
  elsif is_record_set?
    local_zone_id
  elsif is_s3?
    S3::zone_ids[S3::get_aws(name).location]
  elsif is_cloudfront?
    "Z2FDTNDATAQYW2" # AWS hard codes this
  end
end

#is_cloudfront?Boolean

Public: Determine if this alias is for a Cloudfront distribution

Returns true if the alias is for a Cloudfront distribution

Returns:

  • (Boolean)


81
82
83
# File 'lib/route53/models/AliasTarget.rb', line 81

def is_cloudfront?
  type.downcase == "cloudfront"
end

#is_elb?Boolean

Public: Determine if this alias is for an ELB

Returns true if the alias is an ELB

Returns:

  • (Boolean)


60
61
62
# File 'lib/route53/models/AliasTarget.rb', line 60

def is_elb?
  type.downcase == "elb"
end

#is_record_set?Boolean

Public: Determine if this alias is for a record set

Returns true if the alias is for a record set

Returns:

  • (Boolean)


67
68
69
# File 'lib/route53/models/AliasTarget.rb', line 67

def is_record_set?
  type.downcase == "record"
end

#is_s3?Boolean

Public: Determine if this alias is for an s3 website

Returns true if the alias is for an s3 website

Returns:

  • (Boolean)


74
75
76
# File 'lib/route53/models/AliasTarget.rb', line 74

def is_s3?
  type.downcase == "s3"
end

#to_hashObject

Public: Produce a hash representing this alias target

Returns the hash



27
28
29
30
31
32
# File 'lib/route53/models/AliasTarget.rb', line 27

def to_hash
  {
    "name" => name,
    "type" => type
  }.reject { |k, v| v.nil? }
end