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
With a request body like this:
<permit>
<name>create_vm</name>
</permit>
19076 19077 19078 |
# File 'lib/ovirtsdk4/services.rb', line 19076 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.
19132 19133 19134 |
# File 'lib/ovirtsdk4/services.rb', line 19132 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.
19143 19144 19145 |
# File 'lib/ovirtsdk4/services.rb', line 19143 def permit_service(id) PermitService.new(self, id) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
19154 19155 19156 19157 19158 19159 19160 19161 19162 19163 |
# File 'lib/ovirtsdk4/services.rb', line 19154 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 |