Class: OvirtSDK4::PermitsService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::PermitsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (Permit) add(permit, opts = {})
Adds a permit to the set aggregated by parent role.
-
- (Array<Permit>) list(opts = {})
Returns the representation of the object managed by this service.
-
- (PermitService) permit_service(id)
Sub-resource locator method, returns individual permit resource on which the remainder of the URI is dispatched.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (Permit) add(permit, opts = {})
Adds a permit to the set aggregated by parent role. The permit must be one retrieved from the capabilities resource.
15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 |
# File 'lib/ovirtsdk4/services.rb', line 15459 def add(permit, opts = {}) if permit.is_a?(Hash) permit = OvirtSDK4::Permit.new(permit) end request = Request.new(:method => :POST, :path => @path) begin writer = XmlWriter.new(nil, true) PermitWriter.write_one(permit, writer, 'permit') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 201, 202 begin reader = XmlReader.new(response.body) return PermitReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Array<Permit>) list(opts = {})
Returns the representation of the object managed by this service.
15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 |
# File 'lib/ovirtsdk4/services.rb', line 15494 def list(opts = {}) query = {} value = opts[:max] unless value.nil? value = Writer.render_integer(value) query['max'] = value end request = Request.new(:method => :GET, :path => @path, :query => query) response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return PermitReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (PermitService) permit_service(id)
Sub-resource locator method, returns individual permit resource on which the remainder of the URI is dispatched.
15523 15524 15525 |
# File 'lib/ovirtsdk4/services.rb', line 15523 def permit_service(id) return PermitService.new(@connection, "#{@path}/#{id}") end |
- (Service) service(path)
Locates the service corresponding to the given path.
15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 |
# File 'lib/ovirtsdk4/services.rb', line 15534 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 |
- (String) to_s
Returns an string representation of this service.
15550 15551 15552 |
# File 'lib/ovirtsdk4/services.rb', line 15550 def to_s return "#<#{PermitsService}:#{@path}>" end |