Sha256: e931e69a7b754f9584a9328ff61e65e82e6b4ff355d081ab1ebea62c394ee489

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

module Fog
  module Compute
    class HuaweiCloud
      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 HuaweiCloud[:compute].list_snapshots(true) is deprecated, use .list_snapshots_detail instead')
            else
              Fog::Logger.deprecation('Calling HuaweiCloud[: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

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/compute/huaweicloud/requests/list_snapshots.rb
fog-huaweicloud-0.0.2 lib/fog/compute/huaweicloud/requests/list_snapshots.rb
fog-huaweicloud-0.1.3 lib/fog/compute/huaweicloud/requests/list_snapshots.rb
fog-huaweicloud-0.1.2 lib/fog/compute/huaweicloud/requests/list_snapshots.rb