Sha256: c120ca023ff33aec857867b01cee0eace463b3d6bc030c65b5401278045367d3

Contents?: true

Size: 1.19 KB

Versions: 22

Compression:

Stored size: 1.19 KB

Contents

module Fog
  module OpenStack
    class Compute
      class Real
        def list_snapshots(options = true)
          if options.kind_of?(Hash)
            path = 'os-snapshots'
            query = options
          else
            # Backwards compatibility layer, when 'detailed' boolean was sent as first param
            if options
              Fog::Logger.deprecation('Calling OpenStack[:compute].list_snapshots(true) is deprecated, use .list_snapshots_detail instead')
            else
              Fog::Logger.deprecation('Calling OpenStack[:compute].list_snapshots(false) is deprecated, use .list_snapshots({}) instead')
            end
            path = options ? 'os-snapshots/detail' : 'os-snapshots'
            query = {}
          end

          request(
            :expects => 200,
            :method  => 'GET',
            :path    => path,
            :query   => query
          )
        end
      end

      class Mock
        def list_snapshots(_options = true)
          response = Excon::Response.new
          response.status = 200
          snapshots = data[:snapshots].values
          response.body = {'snapshots' => snapshots}
          response
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 3 rubygems

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