Class: OvirtSDK4::ExternalDiscoveredHostsService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::ExternalDiscoveredHostsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (ExternalDiscoveredHostService) host_service(id)
Locates the
host
service. -
- (Array<ExternalDiscoveredHost>) 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
- (ExternalDiscoveredHostService) host_service(id)
Locates the host
service.
7066 7067 7068 |
# File 'lib/ovirtsdk4/services.rb', line 7066 def host_service(id) return ExternalDiscoveredHostService.new(@connection, "#{@path}/#{id}") end |
- (Array<ExternalDiscoveredHost>) list(opts = {})
Returns the representation of the object managed by this service.
7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 |
# File 'lib/ovirtsdk4/services.rb', line 7037 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 ExternalDiscoveredHostReader.read_many(reader) ensure reader.close end else check_fault(response) end end |
- (Service) service(path)
Locates the service corresponding to the given path.
7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 |
# File 'lib/ovirtsdk4/services.rb', line 7077 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return host_service(path) end return host_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
- (String) to_s
Returns an string representation of this service.
7093 7094 7095 |
# File 'lib/ovirtsdk4/services.rb', line 7093 def to_s return "#<#{ExternalDiscoveredHostsService}:#{@path}>" end |