Sha256: 67889b2e09befa5d589da26ab76b259bb530c02e45ff45f23ff30a0aec6a86cb

Contents?: true

Size: 1.15 KB

Versions: 21

Compression:

Stored size: 1.15 KB

Contents

require 'fog/openstack/models/collection'
require 'fog/openstack/compute/models/snapshot'

module Fog
  module OpenStack
    class Compute
      class Snapshots < Fog::OpenStack::Collection
        model Fog::OpenStack::Compute::Snapshot

        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

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

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

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
fog-openstack-1.1.4 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.1.3 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.1.2 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-fork-99 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.1.0 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.1.0.pre lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-apibank-1.0.102 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.11 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-apibank-1.0.101 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.10 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.9 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.8 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.7 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.6 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.5 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.4 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.3 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.2 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.1 lib/fog/openstack/compute/models/snapshots.rb
fog-openstack-1.0.0 lib/fog/openstack/compute/models/snapshots.rb