Sha256: 41daba26a6fc7851675bf262856025c37fa2d1ff09264166a9e0b99ce6f05b5f

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

require 'fog/huaweicloud/models/collection'

module Fog
  module Volume
    class HuaweiCloud
      module Volumes
        def all(options = {})
          # the parameter has been "detailed = true" before. Make sure we are
          # backwards compatible
          detailed = options.kind_of?(Hash) ? options.delete(:detailed) : options
          if detailed.nil? || detailed
            # This method gives details by default, unless false or {:detailed => false} is passed
            load_response(service.list_volumes_detailed(options), 'volumes')
          else
            Fog::Logger.deprecation('Calling HuaweiCloud[:volume].volumes.all(false) or volumes.all(:detailed => false) '\
                                    ' is deprecated, call .volumes.summary instead')
            load_response(service.list_volumes(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::Volume::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/volume/huaweicloud/models/volumes.rb
fog-huaweicloud-0.0.2 lib/fog/volume/huaweicloud/models/volumes.rb
fog-huaweicloud-0.1.3 lib/fog/volume/huaweicloud/models/volumes.rb
fog-huaweicloud-0.1.2 lib/fog/volume/huaweicloud/models/volumes.rb