Class: OvirtSDK4::UserService

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

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#event_subscriptions_serviceEventSubscriptionsService

List of event-subscriptions for this user.

Returns:



29487
29488
29489
# File 'lib/ovirtsdk4/services.rb', line 29487

def event_subscriptions_service
  @event_subscriptions_service ||= EventSubscriptionsService.new(self, 'eventsubscriptions')
end

#get(opts = {}) ⇒ User

Gets the system user information.

Usage:

GET /ovirt-engine/api/users/1234

Will return the user information:

<user href="/ovirt-engine/api/users/1234" id="1234">
  <name>admin</name>
  <link href="/ovirt-engine/api/users/1234/sshpublickeys" rel="sshpublickeys"/>
  <link href="/ovirt-engine/api/users/1234/roles" rel="roles"/>
  <link href="/ovirt-engine/api/users/1234/permissions" rel="permissions"/>
  <link href="/ovirt-engine/api/users/1234/tags" rel="tags"/>
  <department></department>
  <domain_entry_id>23456</domain_entry_id>
  <email>[email protected]</email>
  <last_name>Lastname</last_name>
  <namespace>*</namespace>
  <principal>user1</principal>
  <user_name>user1@domain-authz</user_name>
  <domain href="/ovirt-engine/api/domains/45678" id="45678">
    <name>domain-authz</name>
  </domain>
</user>

Parameters:

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

    Additional options.

Options Hash (opts):

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



29394
29395
29396
# File 'lib/ovirtsdk4/services.rb', line 29394

def get(opts = {})
  internal_get(GET, opts)
end

#groups_serviceDomainUserGroupsService

Locates the groups service.

Returns:



29496
29497
29498
# File 'lib/ovirtsdk4/services.rb', line 29496

def groups_service
  @groups_service ||= DomainUserGroupsService.new(self, 'groups')
end

#options_serviceUserOptionsService

Locates the options service.

Returns:



29505
29506
29507
# File 'lib/ovirtsdk4/services.rb', line 29505

def options_service
  @options_service ||= UserOptionsService.new(self, 'options')
end

#permissions_serviceAssignedPermissionsService

Locates the permissions service.

Returns:



29514
29515
29516
# File 'lib/ovirtsdk4/services.rb', line 29514

def permissions_service
  @permissions_service ||= AssignedPermissionsService.new(self, 'permissions')
end

#remove(opts = {}) ⇒ Object

Removes the system user.

Usage:

DELETE /ovirt-engine/api/users/1234

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.



29425
29426
29427
# File 'lib/ovirtsdk4/services.rb', line 29425

def remove(opts = {})
  internal_remove(REMOVE, opts)
end

#roles_serviceAssignedRolesService

Locates the roles service.

Returns:



29523
29524
29525
# File 'lib/ovirtsdk4/services.rb', line 29523

def roles_service
  @roles_service ||= AssignedRolesService.new(self, 'roles')
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.

Raises:



29552
29553
29554
29555
29556
29557
29558
29559
29560
29561
29562
29563
29564
29565
29566
29567
29568
29569
29570
29571
29572
29573
29574
29575
29576
29577
29578
29579
29580
29581
29582
29583
29584
29585
29586
29587
29588
29589
29590
29591
29592
29593
29594
29595
29596
29597
29598
29599
# File 'lib/ovirtsdk4/services.rb', line 29552

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'eventsubscriptions'
    return event_subscriptions_service
  end
  if path.start_with?('eventsubscriptions/')
    return event_subscriptions_service.service(path[19..-1])
  end
  if path == 'groups'
    return groups_service
  end
  if path.start_with?('groups/')
    return groups_service.service(path[7..-1])
  end
  if path == 'options'
    return options_service
  end
  if path.start_with?('options/')
    return options_service.service(path[8..-1])
  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

#ssh_public_keys_serviceSshPublicKeysService

Locates the ssh_public_keys service.

Returns:



29532
29533
29534
# File 'lib/ovirtsdk4/services.rb', line 29532

def ssh_public_keys_service
  @ssh_public_keys_service ||= SshPublicKeysService.new(self, 'sshpublickeys')
end

#tags_serviceAssignedTagsService

Locates the tags service.

Returns:



29541
29542
29543
# File 'lib/ovirtsdk4/services.rb', line 29541

def tags_service
  @tags_service ||= AssignedTagsService.new(self, 'tags')
end

#update(user, opts = {}) ⇒ User

Updates information about the user.

Only the user_options field can be updated.

For example, to update user options:

PUT /ovirt-engine/api/users/123

With a request body like this:

<user>
   <user_options>
      <property>
         <name>test</name>
         <value>["any","JSON"]</value>
      </property>
   </user_options>
</user>
Important
Since version 4.4.5 of the engine this operation is deprecated, and preserved only for backwards compatibility. It will be removed in the future. Please use the options endpoint instead.

Parameters:

  • user (User)

    The user to update.

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

    Additional options.

Options Hash (opts):

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



29478
29479
29480
# File 'lib/ovirtsdk4/services.rb', line 29478

def update(user, opts = {})
  internal_update(user, User, UPDATE, opts)
end