Class: OvirtSDK4::QossService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::QossService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (Qos) add(qos, opts = {})
Adds a new
qos
. -
- (Array<Qos>) list(opts = {})
Returns the representation of the object managed by this service.
-
- (QosService) qos_service(id)
Locates the
qos
service. -
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (Qos) add(qos, opts = {})
Adds a new qos
.
15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 |
# File 'lib/ovirtsdk4/services.rb', line 15695 def add(qos, opts = {}) if qos.is_a?(Hash) qos = OvirtSDK4::Qos.new(qos) end request = Request.new(:method => :POST, :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 201, 202 begin reader = XmlReader.new(response.body) return QosReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Array<Qos>) list(opts = {})
Returns the representation of the object managed by this service.
15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 |
# File 'lib/ovirtsdk4/services.rb', line 15730 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 QosReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (QosService) qos_service(id)
Locates the qos
service.
15759 15760 15761 |
# File 'lib/ovirtsdk4/services.rb', line 15759 def qos_service(id) return QosService.new(@connection, "#{@path}/#{id}") end |
- (Service) service(path)
Locates the service corresponding to the given path.
15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 |
# File 'lib/ovirtsdk4/services.rb', line 15770 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return qos_service(path) end return qos_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
15786 15787 15788 |
# File 'lib/ovirtsdk4/services.rb', line 15786 def to_s return "#<#{QossService}:#{@path}>" end |