Class: Route53::DNSRecord
- Inherits:
-
Object
- Object
- Route53::DNSRecord
- Defined in:
- lib/route53.rb
Instance Attribute Summary collapse
-
#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.
Instance Method Summary collapse
- #create(comment = nil) ⇒ Object
- #delete(comment = nil) ⇒ Object
- #gen_change_xml(xml, action) ⇒ Object
-
#initialize(name, type, ttl, values, zone) ⇒ DNSRecord
constructor
A new instance of DNSRecord.
- #to_s ⇒ Object
-
#update(name, type, ttl, values, comment = nil) ⇒ Object
Need to modify to a param hash.
-
#update_dirty(name, type, ttl, values) ⇒ 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) ⇒ DNSRecord
Returns a new instance of DNSRecord.
302 303 304 305 306 307 308 309 310 311 |
# File 'lib/route53.rb', line 302 def initialize(name,type,ttl,values,zone) @name = name unless @name.end_with?(".") @name += "." end @type = type @ttl = ttl.upcase @values = values @zone = zone end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
297 298 299 |
# File 'lib/route53.rb', line 297 def name @name end |
#ttl ⇒ Object (readonly)
Returns the value of attribute ttl.
299 300 301 |
# File 'lib/route53.rb', line 299 def ttl @ttl end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
298 299 300 |
# File 'lib/route53.rb', line 298 def type @type end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
300 301 302 |
# File 'lib/route53.rb', line 300 def values @values end |
Instance Method Details
#create(comment = nil) ⇒ Object
335 336 337 |
# File 'lib/route53.rb', line 335 def create(comment=nil) @zone.perform_actions([{:action => "CREATE", :record => self}],comment) end |
#delete(comment = nil) ⇒ Object
331 332 333 |
# File 'lib/route53.rb', line 331 def delete(comment=nil) @zone.perform_actions([{:action => "DELETE", :record => self}],comment) end |
#gen_change_xml(xml, action) ⇒ Object
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/route53.rb', line 313 def gen_change_xml(xml,action) xml.Change { |change| change.Action(action.upcase) change.ResourceRecordSet { |record| record.Name(@name) record.Type(@type) record.TTL(@ttl) record.ResourceRecords { |resources| @values.each { |val| resources.ResourceRecord { |record| record.Value(val) } } } } } end |
#to_s ⇒ Object
364 365 366 |
# File 'lib/route53.rb', line 364 def to_s return "#{@name} #{@type} #{@ttl} #{@values.join(",")}" end |
#update(name, type, ttl, values, comment = nil) ⇒ Object
Need to modify to a param hash
340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/route53.rb', line 340 def update(name,type,ttl,values,comment=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.perform_actions([ {:action => "DELETE", :record => prev}, {:action => "CREATE", :record => self}, ],comment) end |
#update_dirty(name, type, ttl, values) ⇒ Object
Returns the raw array so the developer can update large batches manually Need to modify to a param hash
354 355 356 357 358 359 360 361 362 |
# File 'lib/route53.rb', line 354 def update_dirty(name,type,ttl,values) prev = self.clone @name = name unless name.nil? @type = type unless type.nil? @ttl = ttl unless ttl.nil? @values = values unless values.nil? return [{:action => "DELETE", :record => prev}, {:action => "CREATE", :record => self}] end |