Class: Route53::DNSRecord
- Inherits:
-
Object
- Object
- Route53::DNSRecord
- Defined in:
- lib/route53/dns_record.rb
Instance Attribute Summary collapse
-
#health_id ⇒ Object
readonly
Returns the value of attribute health_id.
-
#ident ⇒ Object
readonly
Returns the value of attribute ident.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ttl ⇒ Object
readonly
Returns the value of attribute ttl.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
-
#zone_apex ⇒ Object
readonly
Returns the value of attribute zone_apex.
Instance Method Summary collapse
- #create(comment = nil) ⇒ Object
- #delete(comment = nil) ⇒ Object
- #gen_change_xml(xml, action) ⇒ Object
-
#initialize(name, type, ttl, values, zone, zone_apex = nil, weight = nil, ident = nil, evaluate_target_health = false, health_id = nil) ⇒ DNSRecord
constructor
A new instance of DNSRecord.
- #to_s ⇒ Object
-
#update(name, type, ttl, values, comment = nil, zone_apex = nil) ⇒ Object
Need to modify to a param hash.
-
#update_dirty(name, type, ttl, values, zone_apex = nil) ⇒ Object
Returns the raw array so the developer can update large batches manually Need to modify to a param hash.
Constructor Details
#initialize(name, type, ttl, values, zone, zone_apex = nil, weight = nil, ident = nil, evaluate_target_health = false, health_id = nil) ⇒ DNSRecord
Returns a new instance of DNSRecord.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/route53/dns_record.rb', line 12 def initialize(name,type,ttl,values,zone,zone_apex=nil,weight=nil,ident=nil, evaluate_target_health=false, health_id=nil) @name = name unless @name.end_with?(".") @name += "." end @type = type.upcase @ttl = ttl @values = values @zone = zone @zone_apex = zone_apex @weight = weight @ident = ident @evaluate_target_health = evaluate_target_health @health_id = health_id end |
Instance Attribute Details
#health_id ⇒ Object (readonly)
Returns the value of attribute health_id.
10 11 12 |
# File 'lib/route53/dns_record.rb', line 10 def health_id @health_id end |
#ident ⇒ Object (readonly)
Returns the value of attribute ident.
8 9 10 |
# File 'lib/route53/dns_record.rb', line 8 def ident @ident end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/route53/dns_record.rb', line 3 def name @name end |
#ttl ⇒ Object (readonly)
Returns the value of attribute ttl.
5 6 7 |
# File 'lib/route53/dns_record.rb', line 5 def ttl @ttl end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/route53/dns_record.rb', line 4 def type @type end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
6 7 8 |
# File 'lib/route53/dns_record.rb', line 6 def values @values end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
7 8 9 |
# File 'lib/route53/dns_record.rb', line 7 def weight @weight end |
#zone_apex ⇒ Object (readonly)
Returns the value of attribute zone_apex.
9 10 11 |
# File 'lib/route53/dns_record.rb', line 9 def zone_apex @zone_apex end |
Instance Method Details
#create(comment = nil) ⇒ Object
61 62 63 |
# File 'lib/route53/dns_record.rb', line 61 def create(comment=nil) @zone.perform_actions([{:action => "CREATE", :record => self}],comment) end |
#delete(comment = nil) ⇒ Object
57 58 59 |
# File 'lib/route53/dns_record.rb', line 57 def delete(comment=nil) @zone.perform_actions([{:action => "DELETE", :record => self}],comment) end |
#gen_change_xml(xml, action) ⇒ Object
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 54 55 |
# File 'lib/route53/dns_record.rb', line 28 def gen_change_xml(xml,action) xml.Change { |change| change.Action(action.upcase) change.ResourceRecordSet { |record| record.Name(@name) record.Type(@type) record.SetIdentifier(@ident) if @ident record.Weight(@weight) if @weight record.TTL(@ttl) unless @zone_apex record.HealthCheckId(@health_id) if @health_id if @zone_apex record.AliasTarget { |targets| targets.HostedZoneId(@zone_apex) targets.DNSName(@values.first) targets.EvaluateTargetHealth(@evaluate_target_health) } else record.ResourceRecords { |resources| @values.each { |val| resources.ResourceRecord { |record| record.Value(val) } } } end } } end |
#to_s ⇒ Object
92 93 94 95 96 97 98 99 100 |
# File 'lib/route53/dns_record.rb', line 92 def to_s if @weight "#{@name} #{@type} #{@ttl} '#{@ident}' #{@weight} #{@values.join(",")}" elsif @zone_apex "#{@name} #{@type} #{@zone_apex} #{@values.join(",")}" else "#{@name} #{@type} #{@ttl} #{@values.join(",")}" end end |
#update(name, type, ttl, values, comment = nil, zone_apex = nil) ⇒ Object
Need to modify to a param hash
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/route53/dns_record.rb', line 66 def update(name,type,ttl,values,comment=nil, zone_apex = nil) prev = self.clone @name = name unless name.nil? @type = type unless type.nil? @ttl = ttl unless ttl.nil? @values = values unless values.nil? @zone_apex = zone_apex unless zone_apex.nil? @zone.perform_actions([ {:action => "DELETE", :record => prev}, {:action => "CREATE", :record => self}, ],comment) end |
#update_dirty(name, type, ttl, values, zone_apex = nil) ⇒ Object
Returns the raw array so the developer can update large batches manually Need to modify to a param hash
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/route53/dns_record.rb', line 81 def update_dirty(name,type,ttl,values,zone_apex = nil) prev = self.clone @name = name unless name.nil? @type = type unless type.nil? @ttl = ttl unless ttl.nil? @values = values unless values.nil? @zone_apex = zone_apex unless zone_apex.nil? return [{:action => "DELETE", :record => prev}, {:action => "CREATE", :record => self}] end |