Class: OvirtSDK4::ImageService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::ImageService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (Image) get(opts = {})
Returns the representation of the object managed by this service.
-
- (Object) import(opts = {})
Executes the
import
method. -
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (String) to_s
Returns an string representation of this service.
Instance Method Details
- (Image) get(opts = {})
Returns the representation of the object managed by this service.
10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 |
# File 'lib/ovirtsdk4/services.rb', line 10409 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 ImageReader.read_one(reader) ensure reader.close end else check_fault(response) end end |
- (Object) import(opts = {})
Executes the import
method.
10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 |
# File 'lib/ovirtsdk4/services.rb', line 10429 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 |
- (Service) service(path)
Locates the service corresponding to the given path.
10456 10457 10458 10459 10460 10461 |
# File 'lib/ovirtsdk4/services.rb', line 10456 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.
10468 10469 10470 |
# File 'lib/ovirtsdk4/services.rb', line 10468 def to_s return "#<#{ImageService}:#{@path}>" end |