Class: OvirtSDK4::SystemPermissionsService
- Inherits:
-
AssignedPermissionsService
- Object
- Service
- AssignedPermissionsService
- OvirtSDK4::SystemPermissionsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (Permission) add(permission, opts = {})
Adds a new
permission
. -
- (Array<Permission>) list(opts = {})
Returns the representation of the object managed by this service.
-
- (PermissionService) permission_service(id)
Sub-resource locator method, returns individual permission 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
- (Permission) add(permission, opts = {})
Adds a new permission
.
21130 21131 21132 21133 21134 21135 21136 21137 21138 21139 21140 21141 21142 21143 21144 21145 21146 21147 21148 21149 21150 21151 21152 21153 21154 |
# File 'lib/ovirtsdk4/services.rb', line 21130 def add(, opts = {}) if .is_a?(Hash) = OvirtSDK4::Permission.new() end request = Request.new(:method => :POST, :path => @path) begin writer = XmlWriter.new(nil, true) PermissionWriter.write_one(, writer, 'permission') 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 PermissionReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Array<Permission>) list(opts = {})
Returns the representation of the object managed by this service.
21163 21164 21165 21166 21167 21168 21169 21170 21171 21172 21173 21174 21175 21176 21177 21178 |
# File 'lib/ovirtsdk4/services.rb', line 21163 def list(opts = {}) query = {} 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 PermissionReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (PermissionService) permission_service(id)
Sub-resource locator method, returns individual permission resource on which the remainder of the URI is dispatched.
21188 21189 21190 |
# File 'lib/ovirtsdk4/services.rb', line 21188 def (id) return PermissionService.new(@connection, "#{@path}/#{id}") end |
- (Service) service(path)
Locates the service corresponding to the given path.
21199 21200 21201 21202 21203 21204 21205 21206 21207 21208 |
# File 'lib/ovirtsdk4/services.rb', line 21199 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return (path) end return (path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
21215 21216 21217 |
# File 'lib/ovirtsdk4/services.rb', line 21215 def to_s return "#<#{SystemPermissionsService}:#{@path}>" end |