Class: OvirtSDK4::VmCdromService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::VmCdromService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (Cdrom) get(opts = {})
Returns the representation of the object managed by this service.
-
- (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.
-
- (Object) update(cdorm)
Updates the object managed by this service.
Instance Method Details
- (Cdrom) get(opts = {})
Returns the representation of the object managed by this service.
24375 24376 24377 24378 24379 24380 24381 24382 24383 24384 24385 24386 24387 24388 24389 24390 |
# File 'lib/ovirtsdk4/services.rb', line 24375 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 CdromReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
24399 24400 24401 24402 24403 24404 24405 24406 24407 24408 24409 24410 24411 |
# File 'lib/ovirtsdk4/services.rb', line 24399 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.
24450 24451 24452 24453 24454 24455 |
# File 'lib/ovirtsdk4/services.rb', line 24450 def service(path) if path.nil? || path == '' return self end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
- (String) to_s
Returns an string representation of this service.
24462 24463 24464 |
# File 'lib/ovirtsdk4/services.rb', line 24462 def to_s return "#<#{VmCdromService}:#{@path}>" end |
- (Object) update(cdorm)
Updates the object managed by this service.
24416 24417 24418 24419 24420 24421 24422 24423 24424 24425 24426 24427 24428 24429 24430 24431 24432 24433 24434 24435 24436 24437 24438 24439 24440 24441 |
# File 'lib/ovirtsdk4/services.rb', line 24416 def update(cdorm) if cdorm.is_a?(Hash) cdorm = OvirtSDK4::Cdrom.new(cdorm) end request = Request.new(:method => :PUT, :path => @path) begin writer = XmlWriter.new(nil, true) CdromWriter.write_one(cdorm, writer, 'cdorm') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return CdromReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end |