class OvirtSDK4::ClusterLevelService
Public Class Methods
Creates a new implementation of the service.
@param connection [Connection] The connection to be used by this service.
@param path [String] The relative path of this service, for example `vms/123/disks`.
@api private
# File lib/ovirtsdk4/services.rb, line 5135 def initialize(connection, path) @connection = connection @path = path end
Public Instance Methods
Provides the information about the capabilities of the specific cluster level managed by this service.
For example, to find what CPU types are supported by level 3.6 you can send a request like this:
- source
GET /ovirt-engine/api/clusterlevels/3.6
That will return a <<types/cluster_level, ClusterLevel>> object containing the supported CPU types, and other information which describes the cluster level:
- source,xml
<cluster_level id=“3.6”>
<cpu_types> <cpu_type> <name>Intel Conroe Family</name> <level>3</level> <architecture>x86_64</architecture> </cpu_type> ... </cpu_types> <permits> <permit id="1"> <name>create_vm</name> <administrative>false</administrative> </permit> ... </permits>
</cluster_level>
@param opts [Hash] Additional options.
@option opts [Hash] :headers Additional HTTP headers.
@option opts [Hash] :query Additional URL query parameters.
@return [ClusterLevel]
# File lib/ovirtsdk4/services.rb, line 5182 def get(opts = {}) headers = opts[:headers] || {} query = opts[:query] || {} request = HttpRequest.new(method: :GET, url: @path, headers: headers, query: query) response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return ClusterLevelReader.read_one(reader) ensure reader.close end else check_fault(response) end end
Locates the service corresponding to the given path.
@param path [String] The path of the service.
@return [Service] A reference to the service.
# File lib/ovirtsdk4/services.rb, line 5207 def service(path) if path.nil? || path == '' return self end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end
Returns an string representation of this service.
@return [String]
# File lib/ovirtsdk4/services.rb, line 5219 def to_s "#<#{ClusterLevelService}:#{@path}>" end