Class: OvirtSDK4::StorageServerConnectionExtensionsService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::StorageServerConnectionExtensionsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (StorageConnectionExtension) add(extension, opts = {})
Adds a new
extension
. -
- (Array<StorageConnectionExtension>) list(opts = {})
Returns the representation of the object managed by this service.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (StorageServerConnectionExtensionService) storage_connection_extension_service(id)
Locates the
storage_connection_extension
service. -
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (StorageConnectionExtension) add(extension, opts = {})
Adds a new extension
.
20296 20297 20298 20299 20300 20301 20302 20303 20304 20305 20306 20307 20308 20309 20310 20311 20312 20313 20314 20315 20316 20317 20318 20319 20320 |
# File 'lib/ovirtsdk4/services.rb', line 20296 def add(extension, opts = {}) if extension.is_a?(Hash) extension = OvirtSDK4::StorageConnectionExtension.new(extension) end request = Request.new(:method => :POST, :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 201, 202 begin reader = XmlReader.new(response.body) return StorageConnectionExtensionReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Array<StorageConnectionExtension>) list(opts = {})
Returns the representation of the object managed by this service.
20331 20332 20333 20334 20335 20336 20337 20338 20339 20340 20341 20342 20343 20344 20345 20346 20347 20348 20349 20350 20351 |
# File 'lib/ovirtsdk4/services.rb', line 20331 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 StorageConnectionExtensionReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
20371 20372 20373 20374 20375 20376 20377 20378 20379 20380 |
# File 'lib/ovirtsdk4/services.rb', line 20371 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return storage_connection_extension_service(path) end return storage_connection_extension_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (StorageServerConnectionExtensionService) storage_connection_extension_service(id)
Locates the storage_connection_extension
service.
20360 20361 20362 |
# File 'lib/ovirtsdk4/services.rb', line 20360 def storage_connection_extension_service(id) return StorageServerConnectionExtensionService.new(@connection, "#{@path}/#{id}") end |
- (String) to_s
Returns an string representation of this service.
20387 20388 20389 |
# File 'lib/ovirtsdk4/services.rb', line 20387 def to_s return "#<#{StorageServerConnectionExtensionsService}:#{@path}>" end |