Sha256: 31ccf2ccdabdd19c07ac82e9bd0becf3c564c8f8e5cbe867e8fe6632dd328063

Contents?: true

Size: 1.44 KB

Versions: 3

Compression:

Stored size: 1.44 KB

Contents

module Fog
  module Compute
    class RackspaceV2
      class Real
        
        # Retrieves flavor detail
        # @param [Sring] flavor_id
        # @return [Excon::Response] response:
        #   * body [Hash]:
        #     * flavor [Hash]:
        #       * disk [Fixnum] - disk size in GB
        #       * id [String] - id of flavor
        #       * name [String] - name of flavor 
        #       * ram [Fixnum] - amount of ram in MB
        #       * swap [Fixnum] - amount of swap in GB
        #       * vcpus [Fixnum] - number of virtual CPUs
        #       * links [Array] - links to flavor
        # @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/Get_Flavor_Details-d1e4317.html
        def get_flavor(flavor_id)
          request(
            :expects => [200, 203],
            :method => 'GET',
            :path => "flavors/#{flavor_id}"
          )
        end
      end

      class Mock
        def get_flavor(flavor_id)
          flavor = self.data[:flavors][flavor_id]
          if flavor.nil?
            raise Fog::Compute::RackspaceV2::NotFound
          else
            response(:body => {"flavor" => flavor})
          end
        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/get_flavor.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/rackspace/requests/compute_v2/get_flavor.rb
fog-1.10.1 lib/fog/rackspace/requests/compute_v2/get_flavor.rb