Sha256: cb0deb1f1e978a4971cd39e42998d49d1a80f66d677872aceaecb31f56c91231

Contents?: true

Size: 1.2 KB

Versions: 11

Compression:

Stored size: 1.2 KB

Contents

module Fog
  module Compute
    class OpenStack
      class Real
        def list_snapshots(options = true)
          if options.is_a?(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 = self.data[:snapshots].values
          response.body = { 'snapshots' => snapshots }
          response
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/requests/compute/list_snapshots.rb
fog-openstack-0.1.9 lib/fog/openstack/requests/compute/list_snapshots.rb
fog-openstack-0.1.8 lib/fog/openstack/requests/compute/list_snapshots.rb
fog-openstack-0.1.7 lib/fog/openstack/requests/compute/list_snapshots.rb
fog-openstack-0.1.6 lib/fog/openstack/requests/compute/list_snapshots.rb
fog-openstack-0.1.5 lib/fog/openstack/requests/compute/list_snapshots.rb
fog-openstack-0.1.4 lib/fog/openstack/requests/compute/list_snapshots.rb
fog-openstack-0.1.3 lib/fog/openstack/requests/compute/list_snapshots.rb
fog-openstack-0.1.2 lib/fog/openstack/requests/compute/list_snapshots.rb
fog-openstack-0.1.1 lib/fog/openstack/requests/compute/list_snapshots.rb
fog-openstack-0.1.0 lib/fog/openstack/requests/compute/list_snapshots.rb