Class: OvirtSDK4::TemplateWatchdogsService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::TemplateWatchdogsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (Watchdog) add(watchdog, opts = {})
Adds a new
watchdog
. -
- (Array<Watchdog>) list(opts = {})
Returns the representation of 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.
-
- (TemplateWatchdogService) watchdog_service(id)
Locates the
watchdog
service.
Instance Method Details
- (Watchdog) add(watchdog, opts = {})
Adds a new watchdog
.
22447 22448 22449 22450 22451 22452 22453 22454 22455 22456 22457 22458 22459 22460 22461 22462 22463 22464 22465 22466 22467 22468 22469 22470 22471 |
# File 'lib/ovirtsdk4/services.rb', line 22447 def add(watchdog, opts = {}) if watchdog.is_a?(Hash) watchdog = OvirtSDK4::Watchdog.new(watchdog) end request = Request.new(:method => :POST, :path => @path) begin writer = XmlWriter.new(nil, true) WatchdogWriter.write_one(watchdog, writer, 'watchdog') 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 WatchdogReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Array<Watchdog>) list(opts = {})
Returns the representation of the object managed by this service.
22482 22483 22484 22485 22486 22487 22488 22489 22490 22491 22492 22493 22494 22495 22496 22497 22498 22499 22500 22501 22502 |
# File 'lib/ovirtsdk4/services.rb', line 22482 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 WatchdogReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
22522 22523 22524 22525 22526 22527 22528 22529 22530 22531 |
# File 'lib/ovirtsdk4/services.rb', line 22522 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return watchdog_service(path) end return watchdog_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
22538 22539 22540 |
# File 'lib/ovirtsdk4/services.rb', line 22538 def to_s return "#<#{TemplateWatchdogsService}:#{@path}>" end |
- (TemplateWatchdogService) watchdog_service(id)
Locates the watchdog
service.
22511 22512 22513 |
# File 'lib/ovirtsdk4/services.rb', line 22511 def watchdog_service(id) return TemplateWatchdogService.new(@connection, "#{@path}/#{id}") end |