Class: OvirtSDK4::DiskService
- Inherits:
-
MeasurableService
- Object
- Service
- MeasurableService
- OvirtSDK4::DiskService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (Object) copy(opts = {})
Executes the
copy
method. -
- (Object) export(opts = {})
Executes the
export
method. -
- (Disk) get(opts = {})
Returns the representation of the object managed by this service.
-
- (Object) move(opts = {})
Executes the
move
method. -
- (AssignedPermissionsService) permissions_service
Locates the
permissions
service. -
- (Object) remove(opts = {})
Deletes the object managed by this service.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (StatisticsService) statistics_service
Locates the
statistics
service. -
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (Object) copy(opts = {})
Executes the copy
method.
27446 27447 27448 27449 27450 27451 27452 27453 27454 27455 27456 27457 27458 27459 27460 27461 27462 27463 27464 |
# File 'lib/ovirtsdk4/services.rb', line 27446 def copy(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}/copy", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (Object) export(opts = {})
Executes the export
method.
27469 27470 27471 27472 27473 27474 27475 27476 27477 27478 27479 27480 27481 27482 27483 27484 27485 27486 27487 |
# File 'lib/ovirtsdk4/services.rb', line 27469 def export(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}/export", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (Disk) get(opts = {})
Returns the representation of the object managed by this service.
27496 27497 27498 27499 27500 27501 27502 27503 27504 27505 27506 27507 27508 27509 27510 27511 |
# File 'lib/ovirtsdk4/services.rb', line 27496 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 DiskReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Object) move(opts = {})
Executes the move
method.
27516 27517 27518 27519 27520 27521 27522 27523 27524 27525 27526 27527 27528 27529 27530 27531 27532 27533 27534 |
# File 'lib/ovirtsdk4/services.rb', line 27516 def move(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}/move", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (AssignedPermissionsService) permissions_service
Locates the permissions
service.
27561 27562 27563 |
# File 'lib/ovirtsdk4/services.rb', line 27561 def return AssignedPermissionsService.new(@connection, "#{@path}/permissions") end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
27543 27544 27545 27546 27547 27548 27549 27550 27551 27552 27553 27554 27555 |
# File 'lib/ovirtsdk4/services.rb', line 27543 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.
27580 27581 27582 27583 27584 27585 27586 27587 27588 27589 27590 27591 27592 27593 27594 27595 27596 27597 |
# File 'lib/ovirtsdk4/services.rb', line 27580 def service(path) if path.nil? || path == '' return self end if path == 'permissions' return end if path.start_with?('permissions/') return .service(path[12..-1]) end if path == 'statistics' return statistics_service end if path.start_with?('statistics/') return statistics_service.service(path[11..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
- (StatisticsService) statistics_service
Locates the statistics
service.
27569 27570 27571 |
# File 'lib/ovirtsdk4/services.rb', line 27569 def statistics_service return StatisticsService.new(@connection, "#{@path}/statistics") end |
- (String) to_s
Returns an string representation of this service.
27604 27605 27606 |
# File 'lib/ovirtsdk4/services.rb', line 27604 def to_s return "#<#{DiskService}:#{@path}>" end |