Class: OvirtSDK4::PermitsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#add(permit, opts = {}) ⇒ Permit
Adds a permit to the role.
-
#list(opts = {}) ⇒ Array<Permit>
List the permits of the role.
-
#permit_service(id) ⇒ PermitService
Sub-resource locator method, returns individual permit resource on which the remainder of the URI is dispatched.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
Methods inherited from Service
Instance Method Details
#add(permit, opts = {}) ⇒ Permit
Adds a permit to the role. The permit name can be retrieved from the cluster_levels service.
For example to assign a permit create_vm to the role with id 123 send a request like this:
POST /ovirt-engine/api/roles/123/permits HTTP/1.1
With a request body like this:
<permit>
<name>create_vm</name>
</permit>
18832 18833 18834 |
# File 'lib/ovirtsdk4/services.rb', line 18832 def add(permit, opts = {}) internal_add(permit, Permit, ADD, opts) end |
#list(opts = {}) ⇒ Array<Permit>
List the permits of the role.
For example to list the permits of the role with the id 123 send a request like this:
GET /ovirt-engine/api/roles/123/permits HTTP/1.1
<permits>
<permit href="/ovirt-engine/api/roles/123/permits/5" id="5">
<name>change_vm_cd</name>
<administrative>false</administrative>
<role href="/ovirt-engine/api/roles/123" id="123"/>
</permit>
<permit href="/ovirt-engine/api/roles/123/permits/7" id="7">
<name>connect_to_vm</name>
<administrative>false</administrative>
<role href="/ovirt-engine/api/roles/123" id="123"/>
</permit>
</permits>
The order of the returned list of permits isn’t guaranteed.
18887 18888 18889 |
# File 'lib/ovirtsdk4/services.rb', line 18887 def list(opts = {}) internal_get(LIST, opts) end |
#permit_service(id) ⇒ PermitService
Sub-resource locator method, returns individual permit resource on which the remainder of the URI is dispatched.
18898 18899 18900 |
# File 'lib/ovirtsdk4/services.rb', line 18898 def permit_service(id) PermitService.new(self, id) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
18909 18910 18911 18912 18913 18914 18915 18916 18917 18918 |
# File 'lib/ovirtsdk4/services.rb', line 18909 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return permit_service(path) end return permit_service(path[0..(index - 1)]).service(path[(index + 1)..-1]) end |