Class: OvirtSDK4::NetworkAttachmentService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::NetworkAttachmentService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (NetworkAttachment) 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(attachment)
Updates the object managed by this service.
Instance Method Details
- (NetworkAttachment) get(opts = {})
Returns the representation of the object managed by this service.
12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 |
# File 'lib/ovirtsdk4/services.rb', line 12508 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 NetworkAttachmentReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Object) remove(opts = {})
Deletes the object managed by this service.
12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 |
# File 'lib/ovirtsdk4/services.rb', line 12532 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.
12583 12584 12585 12586 12587 12588 |
# File 'lib/ovirtsdk4/services.rb', line 12583 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.
12595 12596 12597 |
# File 'lib/ovirtsdk4/services.rb', line 12595 def to_s return "#<#{NetworkAttachmentService}:#{@path}>" end |
- (Object) update(attachment)
Updates the object managed by this service.
12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 |
# File 'lib/ovirtsdk4/services.rb', line 12549 def update() if .is_a?(Hash) = OvirtSDK4::NetworkAttachment.new() end request = Request.new(:method => :PUT, :path => @path) begin writer = XmlWriter.new(nil, true) NetworkAttachmentWriter.write_one(, writer, 'attachment') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return NetworkAttachmentReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end |