class OvirtSDK4::JobsService

Constants

ADD
LIST

Public Instance Methods

add(job, opts = {}) click to toggle source

Add an external job.

For example, to add a job with the following request:

source

POST /ovirt-engine/api/jobs


With the following request body:

source,xml

<job>

<description>Doing some work</description>
<auto_cleared>true</auto_cleared>

</job>


The response should look like:

source,xml

<job href=“/ovirt-engine/api/jobs/123” id=“123”>

<actions>
  <link href="/ovirt-engine/api/jobs/123/clear" rel="clear"/>
  <link href="/ovirt-engine/api/jobs/123/end" rel="end"/>
</actions>
<description>Doing some work</description>
<link href="/ovirt-engine/api/jobs/123/steps" rel="steps"/>
<auto_cleared>true</auto_cleared>
<external>true</external>
<last_updated>2016-12-13T02:15:42.130+02:00</last_updated>
<start_time>2016-12-13T02:15:42.130+02:00</start_time>
<status>started</status>
<owner href="/ovirt-engine/api/users/456" id="456"/>

</job>


@param job [Job] Job that will be added.

@param opts [Hash] Additional options.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [Job]

# File lib/ovirtsdk4/services.rb, line 15179
def add(job, opts = {})
  internal_add(job, Job, ADD, opts)
end
job_service(id) click to toggle source

Reference to the job service.

@param id [String] The identifier of the `job`.

@return [JobService] A reference to the `job` service.

# File lib/ovirtsdk4/services.rb, line 15261
def job_service(id)
  JobService.new(self, id)
end
list(opts = {}) click to toggle source

Retrieves the representation of the jobs.

source

GET /ovirt-engine/api/jobs


You will receive response in XML like this one:

source,xml

<jobs>

<job href="/ovirt-engine/api/jobs/123" id="123">
  <actions>
    <link href="/ovirt-engine/api/jobs/123/clear" rel="clear"/>
    <link href="/ovirt-engine/api/jobs/123/end" rel="end"/>
  </actions>
  <description>Adding Disk</description>
  <link href="/ovirt-engine/api/jobs/123/steps" rel="steps"/>
  <auto_cleared>true</auto_cleared>
  <end_time>2016-12-12T23:07:29.758+02:00</end_time>
  <external>false</external>
  <last_updated>2016-12-12T23:07:29.758+02:00</last_updated>
  <start_time>2016-12-12T23:07:26.593+02:00</start_time>
  <status>failed</status>
  <owner href="/ovirt-engine/api/users/456" id="456"/>
</job>
...

</jobs>


The order of the returned list of jobs isn't guaranteed.

@param opts [Hash] Additional options.

@option opts [Boolean] :case_sensitive Indicates if the search performed using the `search` parameter should be performed taking case into

account. The default value is `true`, which means that case is taken into account. If you want to search
ignoring case set it to `false`.

@option opts [String] :follow Indicates which inner links should be followed. The objects referenced by these links will be fetched as part

of the current request. See <<documents/003_common_concepts/follow, here>> for details.

@option opts [Integer] :max Sets the maximum number of jobs to return. If not specified all the jobs are returned.

@option opts [String] :search A query string used to restrict the returned jobs.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (nil) The timeout for this request, in seconds. If no value is explicitly

given then the timeout set globally for the connection will be used.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [Array<Job>]

# File lib/ovirtsdk4/services.rb, line 15250
def list(opts = {})
  internal_get(LIST, opts)
end
service(path) click to toggle source

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 15272
def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return job_service(path)
  end
  return job_service(path[0..(index - 1)]).service(path[(index + 1)..-1])
end