Class: OvirtSDK4::StorageDomainTemplateService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::StorageDomainTemplateService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (StorageDomainContentDisksService) disks_service
Locates the
disks
service. -
- (Template) get(opts = {})
Returns the representation of the object managed by this service.
-
- (Object) import(opts = {})
Executes the
import
method. -
- (Object) register(opts = {})
Executes the
register
method. -
- (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.
Instance Method Details
- (StorageDomainContentDisksService) disks_service
Locates the disks
service.
19543 19544 19545 |
# File 'lib/ovirtsdk4/services.rb', line 19543 def disks_service return StorageDomainContentDisksService.new(@connection, "#{@path}/disks") end |
- (Template) get(opts = {})
Returns the representation of the object managed by this service.
19455 19456 19457 19458 19459 19460 19461 19462 19463 19464 19465 19466 19467 19468 19469 19470 |
# File 'lib/ovirtsdk4/services.rb', line 19455 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 TemplateReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Object) import(opts = {})
Executes the import
method.
19475 19476 19477 19478 19479 19480 19481 19482 19483 19484 19485 19486 19487 19488 19489 19490 19491 19492 19493 |
# File 'lib/ovirtsdk4/services.rb', line 19475 def import(opts = {}) action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = Request.new({ :method => :POST, :path => "#{@path}/import", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (Object) register(opts = {})
Executes the register
method.
19498 19499 19500 19501 19502 19503 19504 19505 19506 19507 19508 19509 19510 19511 19512 19513 19514 19515 19516 |
# File 'lib/ovirtsdk4/services.rb', line 19498 def register(opts = {}) action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = Request.new({ :method => :POST, :path => "#{@path}/register", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
19525 19526 19527 19528 19529 19530 19531 19532 19533 19534 19535 19536 19537 |
# File 'lib/ovirtsdk4/services.rb', line 19525 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.
19554 19555 19556 19557 19558 19559 19560 19561 19562 19563 19564 19565 |
# File 'lib/ovirtsdk4/services.rb', line 19554 def service(path) if path.nil? || path == '' return self end if path == 'disks' return disks_service end if path.start_with?('disks/') return disks_service.service(path[6..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
- (String) to_s
Returns an string representation of this service.
19572 19573 19574 |
# File 'lib/ovirtsdk4/services.rb', line 19572 def to_s return "#<#{StorageDomainTemplateService}:#{@path}>" end |