Class: SprinkleDNS::HostedZoneAlias
- Inherits:
-
Object
- Object
- SprinkleDNS::HostedZoneAlias
- Defined in:
- lib/sprinkle_dns/hosted_zone_alias.rb
Instance Attribute Summary collapse
-
#changed_name ⇒ Object
Returns the value of attribute changed_name.
-
#changed_target_dns_name ⇒ Object
Returns the value of attribute changed_target_dns_name.
-
#changed_target_hosted_zone_id ⇒ Object
Returns the value of attribute changed_target_hosted_zone_id.
-
#changed_type ⇒ Object
Returns the value of attribute changed_type.
-
#hosted_zone ⇒ Object
Returns the value of attribute hosted_zone.
-
#name ⇒ Object
Returns the value of attribute name.
-
#new_entry ⇒ Object
Returns the value of attribute new_entry.
-
#persisted ⇒ Object
Returns the value of attribute persisted.
-
#referenced ⇒ Object
Returns the value of attribute referenced.
-
#target_dns_name ⇒ Object
Returns the value of attribute target_dns_name.
-
#target_hosted_zone_id ⇒ Object
Returns the value of attribute target_hosted_zone_id.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #changed? ⇒ Boolean
-
#initialize(type, name, target_hosted_zone_id, target_dns_name, hosted_zone) ⇒ HostedZoneAlias
constructor
A new instance of HostedZoneAlias.
- #mark_new! ⇒ Object
- #mark_referenced! ⇒ Object
- #new? ⇒ Boolean
- #new_value(new_entry) ⇒ Object
- #persisted! ⇒ Object
- #persisted? ⇒ Boolean
- #referenced? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(type, name, target_hosted_zone_id, target_dns_name, hosted_zone) ⇒ HostedZoneAlias
Returns a new instance of HostedZoneAlias.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 8 def initialize(type, name, target_hosted_zone_id, target_dns_name, hosted_zone) @type = type @name = zonify!(name) @target_hosted_zone_id = target_hosted_zone_id @target_dns_name = target_dns_name @hosted_zone = hosted_zone @new_entry = nil raise if [@type, @name, @target_hosted_zone_id, @target_dns_name, @hosted_zone].any?(&:nil?) @changed_type = false @changed_name = false @changed_target_hosted_zone_id = false @changed_target_dns_name = false @referenced = false @persisted = false end |
Instance Attribute Details
#changed_name ⇒ Object
Returns the value of attribute changed_name.
4 5 6 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 4 def changed_name @changed_name end |
#changed_target_dns_name ⇒ Object
Returns the value of attribute changed_target_dns_name.
4 5 6 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 4 def changed_target_dns_name @changed_target_dns_name end |
#changed_target_hosted_zone_id ⇒ Object
Returns the value of attribute changed_target_hosted_zone_id.
4 5 6 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 4 def changed_target_hosted_zone_id @changed_target_hosted_zone_id end |
#changed_type ⇒ Object
Returns the value of attribute changed_type.
4 5 6 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 4 def changed_type @changed_type end |
#hosted_zone ⇒ Object
Returns the value of attribute hosted_zone.
3 4 5 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 3 def hosted_zone @hosted_zone end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 3 def name @name end |
#new_entry ⇒ Object
Returns the value of attribute new_entry.
6 7 8 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 6 def new_entry @new_entry end |
#persisted ⇒ Object
Returns the value of attribute persisted.
5 6 7 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 5 def persisted @persisted end |
#referenced ⇒ Object
Returns the value of attribute referenced.
5 6 7 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 5 def referenced @referenced end |
#target_dns_name ⇒ Object
Returns the value of attribute target_dns_name.
3 4 5 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 3 def target_dns_name @target_dns_name end |
#target_hosted_zone_id ⇒ Object
Returns the value of attribute target_hosted_zone_id.
3 4 5 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 3 def target_hosted_zone_id @target_hosted_zone_id end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 3 def type @type end |
Instance Method Details
#changed? ⇒ Boolean
43 44 45 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 43 def changed? [@changed_type, @changed_name, @changed_target_hosted_zone_id, @changed_target_dns_name].any? end |
#mark_new! ⇒ Object
27 28 29 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 27 def mark_new! @changed_type, @changed_name, @changed_target_hosted_zone_id, @changed_target_dns_name = [true, true, true, true] end |
#mark_referenced! ⇒ Object
47 48 49 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 47 def mark_referenced! @referenced = true end |
#new? ⇒ Boolean
31 32 33 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 31 def new? [@changed_type, @changed_name, @changed_target_hosted_zone_id, @changed_target_dns_name].all? end |
#new_value(new_entry) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 55 def new_value(new_entry) if new_entry.class == SprinkleDNS::HostedZoneAlias @changed_target_hosted_zone_id = true if @target_hosted_zone_id != new_entry.target_hosted_zone_id @changed_target_dns_name = true if @target_dns_name != new_entry.target_dns_name else @changed_target_hosted_zone_id = true @changed_target_dns_name = true end # TODO test this if @changed_target_hosted_zone_id || @changed_target_dns_name @new_entry = new_entry end self.changed? end |
#persisted! ⇒ Object
35 36 37 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 35 def persisted! @persisted = true end |
#persisted? ⇒ Boolean
39 40 41 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 39 def persisted? @persisted end |
#referenced? ⇒ Boolean
51 52 53 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 51 def referenced? @referenced end |
#to_s ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/sprinkle_dns/hosted_zone_alias.rb', line 72 def to_s [ "Alias", sprintf("%4s", type), sprintf("%30s", name), sprintf("%10s", target_hosted_zone_id), sprintf("%30s", target_dns_name), sprintf("%6s", hosted_zone), ].join(" ") end |