Class: OvirtSDK4::DiskProfileService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::DiskProfileService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (DiskProfile) get(opts = {})
Returns the representation of the object managed by this service.
-
- (AssignedPermissionsService) permissions_service
Locates the
permissions
service. -
- (Object) remove(opts = {})
Deletes the object managed by this service.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (String) to_s
Returns an string representation of this service.
-
- (Object) update(profile)
Updates the object managed by this service.
Instance Method Details
- (DiskProfile) get(opts = {})
Returns the representation of the object managed by this service.
5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 |
# File 'lib/ovirtsdk4/services.rb', line 5502 def get(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 DiskProfileReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (AssignedPermissionsService) permissions_service
Locates the permissions
service.
5574 5575 5576 |
# File 'lib/ovirtsdk4/services.rb', line 5574 def return AssignedPermissionsService.new(@connection, "#{@path}/permissions") end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 |
# File 'lib/ovirtsdk4/services.rb', line 5526 def remove(opts = {}) query = {} value = opts[:async] unless value.nil? value = Writer.render_boolean(value) query['async'] = value end request = Request.new(:method => :DELETE, :path => @path, :query => query) response = @connection.send(request) unless response.code == 200 check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 |
# File 'lib/ovirtsdk4/services.rb', line 5585 def service(path) if path.nil? || path == '' return self end if path == 'permissions' return end if path.start_with?('permissions/') return .service(path[12..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
- (String) to_s
Returns an string representation of this service.
5603 5604 5605 |
# File 'lib/ovirtsdk4/services.rb', line 5603 def to_s return "#<#{DiskProfileService}:#{@path}>" end |
- (Object) update(profile)
Updates the object managed by this service.
5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 |
# File 'lib/ovirtsdk4/services.rb', line 5543 def update(profile) if profile.is_a?(Hash) profile = OvirtSDK4::DiskProfile.new(profile) end request = Request.new(:method => :PUT, :path => @path) begin writer = XmlWriter.new(nil, true) DiskProfileWriter.write_one(profile, writer, 'profile') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return DiskProfileReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end |