Sha256: 72a0bb41a868f51ced2b395dd3ed004a8abf7fbff7c2aa996372348060c8ebd5

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 KB

Contents

module Fog
  module Compute
    class RackspaceV2
      class Real
        
        # Retrieves list of attached volumes
        # @param [String] server_id
        # @return [Excon::Response] response:
        #   * body [Hash]:
        #     * volumeAttachment [Array]:
        #       * [Hash]:
        #         * device [String] - The name of the device, such as /dev/xvdb. Specify auto for auto-assignment.
        #         * serverId [String] - The id of the server that attached the volume
        #         * id [String] - The id of the attachment
        #         * volumeId [String] - The id of the volume that was attached
        # @raise [Fog::Rackspace::Errors::NotFound] - HTTP 404
        # @raise [Fog::Rackspace::Errors::BadRequest] - HTTP 400
        # @raise [Fog::Rackspace::Errors::InternalServerError] - HTTP 500
        # @raise [Fog::Rackspace::Errors::ServiceError]
        # @see http://docs.rackspace.com/servers/api/v2/cs-devguide/content/List_Volume_Attachments.html
        def list_attachments(server_id)
          request(
            :expects => [200, 203, 300],
            :method => 'GET',
            :path => "servers/#{server_id}/os-volume_attachments"
          )
        end
      end

      class Mock
        def list_attachments(server_id)
          volumes_array = self.data[:volume_attachments].select { |va| va["serverId"] == server_id }
          response(:body => {"volumeAttachments" => volumes_array})
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/rackspace/requests/compute_v2/list_attachments.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/rackspace/requests/compute_v2/list_attachments.rb
fog-1.10.1 lib/fog/rackspace/requests/compute_v2/list_attachments.rb