Class: Fog::DNS::Google::Record

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/google/models/dns/record.rb

Overview

Resource Record Sets resource

Instance Method Summary collapse

Instance Method Details

#destroy(async = true) ⇒ Boolean

Deletes a previously created Resource Record Sets resource

Parameters:

  • async (Boolean) (defaults to: true)

    If the operation must be asyncronous (true by default)

Returns:

  • (Boolean)

    If the Resource Record Set has been deleted



23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/google/models/dns/record.rb', line 23

def destroy(async = true)
  requires :name, :type, :ttl, :rrdatas

  data = service.create_change(self.zone.id, [], [resource_record_set_format])
  change = Fog::DNS::Google::Changes.new(:service => service, :zone => zone).get(data.body['id'])
  unless async
    change.wait_for { ready? }
  end
  true
end

#modify(new_attributes) ⇒ Fog::DNS::Google::Record

Modifies a previously created Resource Record Sets resource

Parameters:

  • new_attributes (Hash)

    Resource Record Set new attributes

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fog/google/models/dns/record.rb', line 39

def modify(new_attributes)
  requires :name, :type, :ttl, :rrdatas

  deletions = resource_record_set_format
  merge_attributes(new_attributes)

  data = service.create_change(self.zone.id, [resource_record_set_format], [deletions])
  change = Fog::DNS::Google::Changes.new(:service => service, :zone => zone).get(data.body['id'])
  async = new_attributes.has_key?(:async) ? new_attributes[:async] : true
  unless async
    change.wait_for { ready? }
  end
  self
end

#reloadFog::DNS::Google::Record

Reloads a Resource Record Sets resource

Returns:



58
59
60
61
62
63
64
# File 'lib/fog/google/models/dns/record.rb', line 58

def reload
  requires :name, :type

  data = collection.get(self.name, self.type)
  merge_attributes(data.attributes)
  self
end

#saveFog::DNS::Google::Record

Creates a new Resource Record Sets resource

Returns:



70
71
72
73
74
75
76
77
# File 'lib/fog/google/models/dns/record.rb', line 70

def save
  requires :name, :type, :ttl, :rrdatas

  data = service.create_change(self.zone.id, [resource_record_set_format], [])
  change = Fog::DNS::Google::Changes.new(:service => service, :zone => zone).get(data.body['id'])
  change.wait_for { !pending? }
  self
end

#zoneFog::DNS::Google::Zone

Returns the Managed Zone of the Resource Record Sets resource

Returns:



83
84
85
# File 'lib/fog/google/models/dns/record.rb', line 83

def zone
  @zone
end