Class: OvirtSDK4::StorageDomainServerConnectionsService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::StorageDomainServerConnectionsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (StorageConnection) add(connection, opts = {})
Adds a new
connection
. -
- (StorageDomainServerConnectionService) connection_service(id)
Locates the
connection
service. -
- (Array<StorageConnection>) list(opts = {})
Returns the representation of 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.
Instance Method Details
- (StorageConnection) add(connection, opts = {})
Adds a new connection
.
19335 19336 19337 19338 19339 19340 19341 19342 19343 19344 19345 19346 19347 19348 19349 19350 19351 19352 19353 19354 19355 19356 19357 19358 19359 |
# File 'lib/ovirtsdk4/services.rb', line 19335 def add(connection, opts = {}) if connection.is_a?(Hash) connection = OvirtSDK4::StorageConnection.new(connection) end request = Request.new(:method => :POST, :path => @path) begin writer = XmlWriter.new(nil, true) StorageConnectionWriter.write_one(connection, writer, 'connection') 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 StorageConnectionReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (StorageDomainServerConnectionService) connection_service(id)
Locates the connection
service.
19399 19400 19401 |
# File 'lib/ovirtsdk4/services.rb', line 19399 def connection_service(id) return StorageDomainServerConnectionService.new(@connection, "#{@path}/#{id}") end |
- (Array<StorageConnection>) list(opts = {})
Returns the representation of the object managed by this service.
19370 19371 19372 19373 19374 19375 19376 19377 19378 19379 19380 19381 19382 19383 19384 19385 19386 19387 19388 19389 19390 |
# File 'lib/ovirtsdk4/services.rb', line 19370 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 StorageConnectionReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
19410 19411 19412 19413 19414 19415 19416 19417 19418 19419 |
# File 'lib/ovirtsdk4/services.rb', line 19410 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return connection_service(path) end return connection_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
19426 19427 19428 |
# File 'lib/ovirtsdk4/services.rb', line 19426 def to_s return "#<#{StorageDomainServerConnectionsService}:#{@path}>" end |