Class: OvirtSDK4::QosService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::QosService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (Qos) get(opts = {})
Returns the representation of the object managed by this 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(qos)
Updates the object managed by this service.
Instance Method Details
- (Qos) get(opts = {})
Returns the representation of the object managed by this service.
15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 |
# File 'lib/ovirtsdk4/services.rb', line 15579 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 QosReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 15614 15615 |
# File 'lib/ovirtsdk4/services.rb', line 15603 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.
15654 15655 15656 15657 15658 15659 |
# File 'lib/ovirtsdk4/services.rb', line 15654 def service(path) if path.nil? || path == '' return self end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
- (String) to_s
Returns an string representation of this service.
15666 15667 15668 |
# File 'lib/ovirtsdk4/services.rb', line 15666 def to_s return "#<#{QosService}:#{@path}>" end |
- (Object) update(qos)
Updates the object managed by this service.
15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 |
# File 'lib/ovirtsdk4/services.rb', line 15620 def update(qos) if qos.is_a?(Hash) qos = OvirtSDK4::Qos.new(qos) end request = Request.new(:method => :PUT, :path => @path) begin writer = XmlWriter.new(nil, true) QosWriter.write_one(qos, writer, 'qos') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return QosReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end |