Class: OvirtSDK4::JobsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#add(job, opts = {}) ⇒ Job
Add an external job.
-
#job_service(id) ⇒ JobService
Reference to the job service.
-
#list(opts = {}) ⇒ Array<Job>
Retrieves the representation of the jobs.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
Methods inherited from Service
Instance Method Details
#add(job, opts = {}) ⇒ Job
Add an external job.
For example, to add a job with the following request:
POST /ovirt-engine/api/jobs
With the following request body:
<job>
<description>Doing some work</description>
<auto_cleared>true</auto_cleared>
</job>
The response should look like:
<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>
15179 15180 15181 |
# File 'lib/ovirtsdk4/services.rb', line 15179 def add(job, opts = {}) internal_add(job, Job, ADD, opts) end |
#job_service(id) ⇒ JobService
Reference to the job service.
15261 15262 15263 |
# File 'lib/ovirtsdk4/services.rb', line 15261 def job_service(id) JobService.new(self, id) end |
#list(opts = {}) ⇒ Array<Job>
Retrieves the representation of the jobs.
GET /ovirt-engine/api/jobs
You will receive response in XML like this one:
<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.
15250 15251 15252 |
# File 'lib/ovirtsdk4/services.rb', line 15250 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 |
# 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 |