Class: OvirtSDK4::TemplateWatchdogService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::TemplateWatchdogService
- 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.
22331 22332 22333 22334 22335 22336 22337 22338 22339 22340 22341 22342 22343 22344 22345 22346 |
# File 'lib/ovirtsdk4/services.rb', line 22331 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.
22355 22356 22357 22358 22359 22360 22361 22362 22363 22364 22365 22366 22367 |
# File 'lib/ovirtsdk4/services.rb', line 22355 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.
22406 22407 22408 22409 22410 22411 |
# File 'lib/ovirtsdk4/services.rb', line 22406 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.
22418 22419 22420 |
# File 'lib/ovirtsdk4/services.rb', line 22418 def to_s return "#<#{TemplateWatchdogService}:#{@path}>" end |
- (Object) update(watchdog)
Updates the object managed by this service.
22372 22373 22374 22375 22376 22377 22378 22379 22380 22381 22382 22383 22384 22385 22386 22387 22388 22389 22390 22391 22392 22393 22394 22395 22396 22397 |
# File 'lib/ovirtsdk4/services.rb', line 22372 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 |