Class: OvirtSDK4::GroupService

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

Instance Method Summary (collapse)

Instance Method Details

- (Group) get(opts = {})

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Returns:



9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
# File 'lib/ovirtsdk4/services.rb', line 9238

def get(opts = {})
  query = {}
  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 GroupReader.read_one(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (AssignedPermissionsService) permissions_service

Locates the permissions service.

Returns:



9280
9281
9282
# File 'lib/ovirtsdk4/services.rb', line 9280

def permissions_service
  return AssignedPermissionsService.new(@connection, "#{@path}/permissions")
end

- (Object) remove(opts = {})

Deletes the object managed by this service.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.



9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
# File 'lib/ovirtsdk4/services.rb', line 9262

def remove(opts = {})
  query = {}
  value = opts[:async]
  unless value.nil?
    value = Writer.render_boolean(value)
    query['async'] = value
  end
  request = Request.new(:method => :DELETE, :path => @path, :query => query)
  response = @connection.send(request)
  unless response.code == 200
    check_fault(response)
  end
end

- (AssignedRolesService) roles_service

Locates the roles service.

Returns:



9288
9289
9290
# File 'lib/ovirtsdk4/services.rb', line 9288

def roles_service
  return AssignedRolesService.new(@connection, "#{@path}/roles")
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.

Raises:

  • (Error)


9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
# File 'lib/ovirtsdk4/services.rb', line 9307

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'permissions'
    return permissions_service
  end
  if path.start_with?('permissions/')
    return permissions_service.service(path[12..-1])
  end
  if path == 'roles'
    return roles_service
  end
  if path.start_with?('roles/')
    return roles_service.service(path[6..-1])
  end
  if path == 'tags'
    return tags_service
  end
  if path.start_with?('tags/')
    return tags_service.service(path[5..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

- (AssignedTagsService) tags_service

Locates the tags service.

Returns:



9296
9297
9298
# File 'lib/ovirtsdk4/services.rb', line 9296

def tags_service
  return AssignedTagsService.new(@connection, "#{@path}/tags")
end

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


9337
9338
9339
# File 'lib/ovirtsdk4/services.rb', line 9337

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