Class: Fog::OpenStack::Compute::Snapshots

Inherits:
Fog::OpenStack::Collection show all
Defined in:
lib/fog/openstack/compute/models/snapshots.rb

Instance Attribute Summary

Attributes inherited from Fog::OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from Fog::OpenStack::Collection

#destroy, #find_by_id, #load_response

Instance Method Details

#all(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fog/openstack/compute/models/snapshots.rb', line 10

def all(options = {})
  if !options.kind_of?(Hash)
    if options
      Fog::Logger.deprecation('Calling OpenStack[:compute].snapshots.all(true) is deprecated, use .snapshots.all')
    else
      Fog::Logger.deprecation('Calling OpenStack[:compute].snapshots.all(false) is deprecated, use .snapshots.summary')
    end
    load_response(service.list_snapshots(options), 'snapshots')
  else
    load_response(service.list_snapshots_detail(options), 'snapshots')
  end
end

#get(snapshot_id) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/fog/openstack/compute/models/snapshots.rb', line 27

def get(snapshot_id)
  if snapshot = service.get_snapshot_details(snapshot_id).body['snapshot']
    new(snapshot)
  end
rescue Fog::OpenStack::Compute::NotFound
  nil
end

#summary(options = {}) ⇒ Object



23
24
25
# File 'lib/fog/openstack/compute/models/snapshots.rb', line 23

def summary(options = {})
  load_response(service.list_snapshots(options), 'snapshots')
end