Class: Fog::Google::DNS::Changes

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

Instance Method Summary collapse

Instance Method Details

#allArray<Fog::Google::DNS::Change>

Enumerates the list of Changes

Returns:



13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/google/dns/models/changes.rb', line 13

def all
  requires :zone

  data = service.list_changes(zone.identity).to_h[:changes] || []
  load(data)
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404

  []
end

#get(identity) ⇒ Fog::Google::DNS::Change

Fetches the representation of an existing Change

Parameters:

  • identity (String)

    Change identity

Returns:



29
30
31
32
33
34
35
36
37
38
# File 'lib/fog/google/dns/models/changes.rb', line 29

def get(identity)
  requires :zone
  if change = service.get_change(zone.identity, identity).to_h
    new(change)
  end
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404

  nil
end

#new(attributes = {}) ⇒ Fog::Google::DNS::Change

Creates a new instance of a Change

Returns:



44
45
46
47
48
# File 'lib/fog/google/dns/models/changes.rb', line 44

def new(attributes = {})
  requires :zone

  super({ :zone => zone }.merge!(attributes))
end