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>
13906 13907 13908 |
# File 'lib/ovirtsdk4/services.rb', line 13906 def add(job, opts = {}) internal_add(job, Job, ADD, opts) end |
#job_service(id) ⇒ JobService
Reference to the job service.
13988 13989 13990 |
# File 'lib/ovirtsdk4/services.rb', line 13988 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.
13977 13978 13979 |
# File 'lib/ovirtsdk4/services.rb', line 13977 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 |
# File 'lib/ovirtsdk4/services.rb', line 13999 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 |