Class: OvirtSDK4::RoleService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#get(opts = {}) ⇒ Role
Get the role.
-
#permits_service ⇒ PermitsService
Sub-resource locator method, returns permits service.
-
#remove(opts = {}) ⇒ Object
Removes the role.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
-
#update(role, opts = {}) ⇒ Role
Updates a role.
Methods inherited from Service
Instance Method Details
#get(opts = {}) ⇒ Role
Get the role.
GET /ovirt-engine/api/roles/123 HTTP/1.1
You will receive XML response like this one:
<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>
19890 19891 19892 |
# File 'lib/ovirtsdk4/services.rb', line 19890 def get(opts = {}) internal_get(GET, opts) end |
#permits_service ⇒ PermitsService
Sub-resource locator method, returns permits service.
19977 19978 19979 |
# File 'lib/ovirtsdk4/services.rb', line 19977 def permits_service @permits_service ||= PermitsService.new(self, 'permits') end |
#remove(opts = {}) ⇒ Object
Removes the role.
To remove the role you need to know its id, then send request like this:
DELETE /ovirt-engine/api/roles/{role_id} HTTP/1.1
19921 19922 19923 |
# File 'lib/ovirtsdk4/services.rb', line 19921 def remove(opts = {}) internal_remove(REMOVE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
19988 19989 19990 19991 19992 19993 19994 19995 19996 19997 19998 19999 |
# File 'lib/ovirtsdk4/services.rb', line 19988 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 |
#update(role, opts = {}) ⇒ Role
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
service that manages permits of role.
For example to update role’s name, description and administrative attributes send a request like this:
PUT /ovirt-engine/api/roles/123 HTTP/1.1
With a request body like this:
<role>
<name>MyNewRoleName</name>
<description>My new description of the role</description>
<administrative>true</administrative>
</group>
19968 19969 19970 |
# File 'lib/ovirtsdk4/services.rb', line 19968 def update(role, opts = {}) internal_update(role, Role, UPDATE, opts) end |