Class: OvirtSDK4::OpenstackVolumeTypesService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary (collapse)

Instance Method Details

- (Array<OpenStackVolumeType>) list(opts = {})

Returns the representation of the object managed by this service.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :max (Integer)

    Sets the maximum number of volume types to return. If not specified all the volume types are returned.

Returns:



15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
# File 'lib/ovirtsdk4/services.rb', line 15049

def list(opts = {})
  query = {}
  value = opts[:max]
  unless value.nil?
    value = Writer.render_integer(value)
    query['max'] = value
  end
  request = Request.new(:method => :GET, :path => @path, :query => query)
  response = @connection.send(request)
  case response.code
  when 200
    begin
      reader = XmlReader.new(response.body)
      return OpenStackVolumeTypeReader.read_many(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (Service) service(path)

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.



15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
# File 'lib/ovirtsdk4/services.rb', line 15089

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return type_service(path)
  end
  return type_service(path[0..(index - 1)]).service(path[(index +1)..-1])
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


15105
15106
15107
# File 'lib/ovirtsdk4/services.rb', line 15105

def to_s
  return "#<#{OpenstackVolumeTypesService}:#{@path}>"
end

- (OpenstackVolumeTypeService) type_service(id)

Locates the type service.

Parameters:

  • id (String)

    The identifier of the type.

Returns:



15078
15079
15080
# File 'lib/ovirtsdk4/services.rb', line 15078

def type_service(id)
  return OpenstackVolumeTypeService.new(@connection, "#{@path}/#{id}")
end