Class: OvirtSDK4::InstanceTypeWatchdogService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::InstanceTypeWatchdogService
- 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.
10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 |
# File 'lib/ovirtsdk4/services.rb', line 10978 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.
11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 |
# File 'lib/ovirtsdk4/services.rb', line 11002 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.
11053 11054 11055 11056 11057 11058 |
# File 'lib/ovirtsdk4/services.rb', line 11053 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.
11065 11066 11067 |
# File 'lib/ovirtsdk4/services.rb', line 11065 def to_s return "#<#{InstanceTypeWatchdogService}:#{@path}>" end |
- (Object) update(watchdog)
Updates the object managed by this service.
11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 |
# File 'lib/ovirtsdk4/services.rb', line 11019 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 |