Class: OvirtSDK4::GraphicsConsolesService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::GraphicsConsolesService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (GraphicsConsole) add(console, opts = {})
Adds a new
console
. -
- (GraphicsConsoleService) console_service(id)
Locates the
console
service. -
- (Array<GraphicsConsole>) list(opts = {})
Returns the representation of 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
- (GraphicsConsole) add(console, opts = {})
Adds a new console
.
9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 |
# File 'lib/ovirtsdk4/services.rb', line 9118 def add(console, opts = {}) if console.is_a?(Hash) console = OvirtSDK4::GraphicsConsole.new(console) end request = Request.new(:method => :POST, :path => @path) begin writer = XmlWriter.new(nil, true) GraphicsConsoleWriter.write_one(console, writer, 'console') 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 GraphicsConsoleReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (GraphicsConsoleService) console_service(id)
Locates the console
service.
9182 9183 9184 |
# File 'lib/ovirtsdk4/services.rb', line 9182 def console_service(id) return GraphicsConsoleService.new(@connection, "#{@path}/#{id}") end |
- (Array<GraphicsConsole>) list(opts = {})
Returns the representation of the object managed by this service.
9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 |
# File 'lib/ovirtsdk4/services.rb', line 9153 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 GraphicsConsoleReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 |
# File 'lib/ovirtsdk4/services.rb', line 9193 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return console_service(path) end return console_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
9209 9210 9211 |
# File 'lib/ovirtsdk4/services.rb', line 9209 def to_s return "#<#{GraphicsConsolesService}:#{@path}>" end |