Class: OvirtSDK4::StorageServerConnectionExtensionService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::StorageServerConnectionExtensionService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (StorageConnectionExtension) 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(extension)
Updates the object managed by this service.
Instance Method Details
- (StorageConnectionExtension) get(opts = {})
Returns the representation of the object managed by this service.
20180 20181 20182 20183 20184 20185 20186 20187 20188 20189 20190 20191 20192 20193 20194 20195 |
# File 'lib/ovirtsdk4/services.rb', line 20180 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 StorageConnectionExtensionReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
20204 20205 20206 20207 20208 20209 20210 20211 20212 20213 20214 20215 20216 |
# File 'lib/ovirtsdk4/services.rb', line 20204 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.
20255 20256 20257 20258 20259 20260 |
# File 'lib/ovirtsdk4/services.rb', line 20255 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.
20267 20268 20269 |
# File 'lib/ovirtsdk4/services.rb', line 20267 def to_s return "#<#{StorageServerConnectionExtensionService}:#{@path}>" end |
- (Object) update(extension)
Updates the object managed by this service.
20221 20222 20223 20224 20225 20226 20227 20228 20229 20230 20231 20232 20233 20234 20235 20236 20237 20238 20239 20240 20241 20242 20243 20244 20245 20246 |
# File 'lib/ovirtsdk4/services.rb', line 20221 def update(extension) if extension.is_a?(Hash) extension = OvirtSDK4::StorageConnectionExtension.new(extension) end request = Request.new(:method => :PUT, :path => @path) begin writer = XmlWriter.new(nil, true) StorageConnectionExtensionWriter.write_one(extension, writer, 'extension') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return StorageConnectionExtensionReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end |