Class: OvirtSDK4::UserService

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

Instance Method Summary (collapse)

Instance Method Details

- (User) get(opts = {})

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Returns:



22882
22883
22884
22885
22886
22887
22888
22889
22890
22891
22892
22893
22894
22895
22896
22897
# File 'lib/ovirtsdk4/services.rb', line 22882

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 UserReader.read_one(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (AssignedPermissionsService) permissions_service

Locates the permissions service.

Returns:



22924
22925
22926
# File 'lib/ovirtsdk4/services.rb', line 22924

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.



22906
22907
22908
22909
22910
22911
22912
22913
22914
22915
22916
22917
22918
# File 'lib/ovirtsdk4/services.rb', line 22906

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:



22932
22933
22934
# File 'lib/ovirtsdk4/services.rb', line 22932

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)


22959
22960
22961
22962
22963
22964
22965
22966
22967
22968
22969
22970
22971
22972
22973
22974
22975
22976
22977
22978
22979
22980
22981
22982
22983
22984
22985
22986
22987
22988
# File 'lib/ovirtsdk4/services.rb', line 22959

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 == 'sshpublickeys'
    return ssh_public_keys_service
  end
  if path.start_with?('sshpublickeys/')
    return ssh_public_keys_service.service(path[14..-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

- (SshPublicKeysService) ssh_public_keys_service

Locates the ssh_public_keys service.

Returns:



22940
22941
22942
# File 'lib/ovirtsdk4/services.rb', line 22940

def ssh_public_keys_service
  return SshPublicKeysService.new(@connection, "#{@path}/sshpublickeys")
end

- (AssignedTagsService) tags_service

Locates the tags service.

Returns:



22948
22949
22950
# File 'lib/ovirtsdk4/services.rb', line 22948

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


22995
22996
22997
# File 'lib/ovirtsdk4/services.rb', line 22995

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