class OvirtSDK4::RoleService
Constants
- GET
- REMOVE
- UPDATE
Public Instance Methods
Get the role.
- source
GET
/ovirt-engine/api/roles/123
You will receive XML response like this one:
- source,xml
<role id=“123”>
<name>MyRole</name> <description>MyRole description</description> <link href="/ovirt-engine/api/roles/123/permits" rel="permits"/> <administrative>true</administrative> <mutable>false</mutable>
</role>
@param opts [Hash] Additional options.
@option opts [String] :follow Indicates which inner links should be followed. The objects referenced by these links will be fetched as part
of the current request. See <<documents/003_common_concepts/follow, here>> for details.
@option opts [Hash] :headers ({}) Additional HTTP headers.
@option opts [Hash] :query ({}) Additional URL query parameters.
@option opts [Integer] :timeout (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.
@option opts [Boolean] :wait (true) If `true` wait for the response.
@return [Role]
# File lib/ovirtsdk4/services.rb, line 20159 def get(opts = {}) internal_get(GET, opts) end
Sub-resource locator method, returns permits service.
@return [PermitsService] A reference to `permits` service.
# File lib/ovirtsdk4/services.rb, line 20249 def permits_service @permits_service ||= PermitsService.new(self, 'permits') end
Removes the role.
To remove the role you need to know its id, then send request like this:
- source
DELETE /ovirt-engine/api/roles/{role_id}
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the remove should be performed asynchronously. @option opts [Hash] :headers ({}) Additional HTTP headers.
@option opts [Hash] :query ({}) Additional URL query parameters.
@option opts [Integer] :timeout (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.
@option opts [Boolean] :wait (true) If `true` wait for the response.
# File lib/ovirtsdk4/services.rb, line 20191 def remove(opts = {}) internal_remove(REMOVE, opts) end
Locates the service corresponding to the given path.
@param path [String] The path of the service.
@return [Service] A reference to the service.
# File lib/ovirtsdk4/services.rb, line 20260 def service(path) if path.nil? || path == '' return self end if path == 'permits' return permits_service end if path.start_with?('permits/') return permits_service.service(path[8..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end
Updates a role. You are allowed to update `name`, `description` and `administrative` attributes after role is created. Within this endpoint you can't add or remove roles permits you need to use xref:services-permits that manages permits of role.
For example to update role's `name`, `description` and `administrative` attributes send a request like this:
- source
PUT /ovirt-engine/api/roles/123
With a request body like this:
- source,xml
<role>
<name>MyNewRoleName</name> <description>My new description of the role</description> <administrative>true</administrative>
</group>
@param role [Role] Updated role. @param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the update should be performed asynchronously.
@option opts [Hash] :headers ({}) Additional HTTP headers.
@option opts [Hash] :query ({}) Additional URL query parameters.
@option opts [Integer] :timeout (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.
@option opts [Boolean] :wait (true) If `true` wait for the response.
@return [Role]
# File lib/ovirtsdk4/services.rb, line 20240 def update(role, opts = {}) internal_update(role, Role, UPDATE, opts) end