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 [services/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
With a request body like this:
<permit>
<name>create_vm</name>
</permit>
17771 17772 17773 |
# File 'lib/ovirtsdk4/services.rb', line 17771 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
<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.
17827 17828 17829 |
# File 'lib/ovirtsdk4/services.rb', line 17827 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.
17838 17839 17840 |
# File 'lib/ovirtsdk4/services.rb', line 17838 def permit_service(id) PermitService.new(self, id) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
17849 17850 17851 17852 17853 17854 17855 17856 17857 17858 |
# File 'lib/ovirtsdk4/services.rb', line 17849 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 |