Class: OvirtSDK4::AssignedPermissionsService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::AssignedPermissionsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Direct Known Subclasses
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
.
2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 |
# File 'lib/ovirtsdk4/services.rb', line 2673 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.
2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 |
# File 'lib/ovirtsdk4/services.rb', line 2706 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.
2731 2732 2733 |
# File 'lib/ovirtsdk4/services.rb', line 2731 def (id) return PermissionService.new(@connection, "#{@path}/#{id}") end |
- (Service) service(path)
Locates the service corresponding to the given path.
2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 |
# File 'lib/ovirtsdk4/services.rb', line 2742 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.
2758 2759 2760 |
# File 'lib/ovirtsdk4/services.rb', line 2758 def to_s return "#<#{AssignedPermissionsService}:#{@path}>" end |