Class: OvirtSDK4::AttachedStorageDomainsService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::AttachedStorageDomainsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (StorageDomain) add(storage_domain, opts = {})
Adds a new
storage_domain
. -
- (Array<StorageDomain>) list(opts = {})
Returns the representation of the object managed by this service.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (AttachedStorageDomainService) storage_domain_service(id)
Locates the
storage_domain
service. -
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (StorageDomain) add(storage_domain, opts = {})
Adds a new storage_domain
.
3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 |
# File 'lib/ovirtsdk4/services.rb', line 3446 def add(storage_domain, opts = {}) if storage_domain.is_a?(Hash) storage_domain = OvirtSDK4::StorageDomain.new(storage_domain) end request = Request.new(:method => :POST, :path => @path) begin writer = XmlWriter.new(nil, true) StorageDomainWriter.write_one(storage_domain, writer, 'storage_domain') 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 StorageDomainReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Array<StorageDomain>) list(opts = {})
Returns the representation of the object managed by this service.
3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 |
# File 'lib/ovirtsdk4/services.rb', line 3481 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 StorageDomainReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 |
# File 'lib/ovirtsdk4/services.rb', line 3521 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return storage_domain_service(path) end return storage_domain_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (AttachedStorageDomainService) storage_domain_service(id)
Locates the storage_domain
service.
3510 3511 3512 |
# File 'lib/ovirtsdk4/services.rb', line 3510 def storage_domain_service(id) return AttachedStorageDomainService.new(@connection, "#{@path}/#{id}") end |
- (String) to_s
Returns an string representation of this service.
3537 3538 3539 |
# File 'lib/ovirtsdk4/services.rb', line 3537 def to_s return "#<#{AttachedStorageDomainsService}:#{@path}>" end |