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 21779 def initialize(connection, path) @connection = connection @path = path end
Marks an external step execution as ended.
For example, to terminate a step with identifier `456` which belongs to a `job` with identifier `123` send the following request:
POST /ovirt-engine/api/jobs/123/steps/456/end
With the following request body:
<action>
<force>true</force> <succeeded>true</succeeded>
</action>
@param opts [Hash] Additional options.
@option opts [Boolean] :async Indicates if the action should be performed asynchronously.
@option opts [Boolean] :force Indicates if the step should be forcibly terminated.
@option opts [Boolean] :succeeded Indicates if the step should be marked as successfully finished or as failed.
This parameter is optional, and the default value is `true`.
# File lib/ovirtsdk4/services.rb, line 21815 def end_(opts = {}) action = Action.new(opts) writer = XmlWriter.new(nil, true) ActionWriter.write_one(action, writer) body = writer.string writer.close request = HttpRequest.new( method: :POST, url: "#{@path}/end", body: body ) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_action(response) end end
Retrieves a step.
GET /ovirt-engine/api/jobs/123/steps/456
You will receive response in XML like this one:
<step href=“/ovirt-engine/api/jobs/123/steps/456” id=“456”>
<actions> <link href="/ovirt-engine/api/jobs/123/steps/456/end" rel="end"/> </actions> <description>Validating</description> <end_time>2016-12-12T23:07:26.627+02:00</end_time> <external>false</external> <number>0</number> <start_time>2016-12-12T23:07:26.605+02:00</start_time> <status>finished</status> <type>validating</type> <job href="/ovirt-engine/api/jobs/123" id="123"/>
</step>
@param opts [Hash] Additional options.
@return [Step]
# File lib/ovirtsdk4/services.rb, line 21866 def get(opts = {}) query = {} request = HttpRequest.new(method: :GET, url: @path, query: query) response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return StepReader.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 21899 def service(path) if path.nil? || path == '' return self end if path == 'statistics' return statistics_service end if path.start_with?('statistics/') return statistics_service.service(path[11..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end
Locates the `statistics` service.
@return [StatisticsService] A reference to `statistics` service.
# File lib/ovirtsdk4/services.rb, line 21888 def statistics_service StatisticsService.new(@connection, "#{@path}/statistics") end
Returns an string representation of this service.
@return [String]
# File lib/ovirtsdk4/services.rb, line 21917 def to_s "#<#{StepService}:#{@path}>" end