Class: Fog::Compute::Google::Snapshots

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/google/models/compute/snapshots.rb

Instance Method Summary collapse

Instance Method Details

#allObject



12
13
14
15
16
# File 'lib/fog/google/models/compute/snapshots.rb', line 12

def all
  data = service.list_snapshots
  snapshots = data.body['items'] || []
  load(snapshots)
end

#get(snap_id) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/fog/google/models/compute/snapshots.rb', line 18

def get(snap_id)
  response = service.get_snapshot(snap_id)
  return nil if response.nil?
  new(response.body)
rescue Fog::Errors::NotFound
  nil
end