Class: OvirtSDK4::VmApplicationsService

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

Instance Method Summary (collapse)

Instance Method Details

- (VmApplicationService) application_service(id)

Locates the application service.

Parameters:

  • id (String)

    The identifier of the application.

Returns:



24319
24320
24321
# File 'lib/ovirtsdk4/services.rb', line 24319

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

- (Array<Application>) 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 applications to return. If not specified all the applications are returned.

Returns:



24285
24286
24287
24288
24289
24290
24291
24292
24293
24294
24295
24296
24297
24298
24299
24300
24301
24302
24303
24304
24305
24306
24307
24308
24309
24310
# File 'lib/ovirtsdk4/services.rb', line 24285

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 ApplicationReader.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.



24330
24331
24332
24333
24334
24335
24336
24337
24338
24339
# File 'lib/ovirtsdk4/services.rb', line 24330

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


24346
24347
24348
# File 'lib/ovirtsdk4/services.rb', line 24346

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