Class: OvirtSDK4::VmWatchdogService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::VmWatchdogService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (Watchdog) 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(watchdog)
Updates the object managed by this service.
Instance Method Details
- (Watchdog) get(opts = {})
Returns the representation of the object managed by this service.
26439 26440 26441 26442 26443 26444 26445 26446 26447 26448 26449 26450 26451 26452 26453 26454 |
# File 'lib/ovirtsdk4/services.rb', line 26439 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 WatchdogReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
26463 26464 26465 26466 26467 26468 26469 26470 26471 26472 26473 26474 26475 |
# File 'lib/ovirtsdk4/services.rb', line 26463 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.
26514 26515 26516 26517 26518 26519 |
# File 'lib/ovirtsdk4/services.rb', line 26514 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.
26526 26527 26528 |
# File 'lib/ovirtsdk4/services.rb', line 26526 def to_s return "#<#{VmWatchdogService}:#{@path}>" end |
- (Object) update(watchdog)
Updates the object managed by this service.
26480 26481 26482 26483 26484 26485 26486 26487 26488 26489 26490 26491 26492 26493 26494 26495 26496 26497 26498 26499 26500 26501 26502 26503 26504 26505 |
# File 'lib/ovirtsdk4/services.rb', line 26480 def update(watchdog) if watchdog.is_a?(Hash) watchdog = OvirtSDK4::Watchdog.new(watchdog) end request = Request.new(:method => :PUT, :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 200 begin reader = XmlReader.new(response.body) return WatchdogReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end |