Class: OvirtSDK4::SchedulingPolicyUnitsService

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

Instance Method Summary (collapse)

Instance Method Details

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

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :filter (Boolean)

    Indicates if the results should be filtered according to the permissions of the user.

  • :max (Integer)

    Sets the maximum number of policy units to return. If not specified all the policy units are returned.

Returns:



17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
# File 'lib/ovirtsdk4/services.rb', line 17144

def list(opts = {})
  query = {}
  value = opts[:filter]
  unless value.nil?
    value = Writer.render_boolean(value)
    query['filter'] = value
  end
  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 SchedulingPolicyUnitReader.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.



17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
# File 'lib/ovirtsdk4/services.rb', line 17189

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


17205
17206
17207
# File 'lib/ovirtsdk4/services.rb', line 17205

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

- (SchedulingPolicyUnitService) unit_service(id)

Locates the unit service.

Parameters:

  • id (String)

    The identifier of the unit.

Returns:



17178
17179
17180
# File 'lib/ovirtsdk4/services.rb', line 17178

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