Class: Fog::DNS::Google::Zones

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

Instance Method Summary collapse

Instance Method Details

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

Enumerates Managed Zones that have been created but not yet deleted



11
12
13
14
# File 'lib/fog/dns/google/models/zones.rb', line 11

def all
  data = service.list_managed_zones.managed_zones.to_h || []
  load(data)
end

#get(name_or_id) ⇒ Fog::DNS::Google::Zone

Fetches the representation of an existing Managed Zone



21
22
23
24
25
26
27
28
# File 'lib/fog/dns/google/models/zones.rb', line 21

def get(name_or_id)
  if zone = service.get_managed_zone(name_or_id).to_h
    new(zone)
  end
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404
  nil
end