Sha256: 5b2cc5d11d7cc71aee5bbb92bef3c0dda482da32f7bbbd4bbdaffa953cdbedb9

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

require 'fog/huaweicloud/models/collection'
require 'fog/compute/huaweicloud/models/volume'

module Fog
  module Compute
    class HuaweiCloud
      class Volumes < Fog::HuaweiCloud::Collection
        model Fog::Compute::HuaweiCloud::Volume

        def all(options = true)
          if !options.kind_of?(Hash)
            if options
              Fog::Logger.deprecation('Calling HuaweiCloud[:compute].volumes.all(true) is deprecated, use .volumes.all')
            else
              Fog::Logger.deprecation('Calling HuaweiCloud[:compute].volumes.all(false) is deprecated, use .volumes.summary')
            end
            load_response(service.list_volumes(options), 'volumes')
          else
            load_response(service.list_volumes_detail(options), 'volumes')
          end
        end

        def summary(options = {})
          load_response(service.list_volumes(options), 'volumes')
        end

        def get(volume_id)
          if volume = service.get_volume_details(volume_id).body['volume']
            new(volume)
          end
        rescue Fog::Compute::HuaweiCloud::NotFound
          nil
        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/models/volumes.rb
fog-huaweicloud-0.0.2 lib/fog/compute/huaweicloud/models/volumes.rb
fog-huaweicloud-0.1.3 lib/fog/compute/huaweicloud/models/volumes.rb
fog-huaweicloud-0.1.2 lib/fog/compute/huaweicloud/models/volumes.rb