Constructor
new Jobs(endPointopt, optionsopt)
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
endPoint |
String |
<optional> |
Cloud Controller API endpoint URL | |
options |
Object |
<optional> |
{} | Options (same as CloudControllerBase) |
- Source:
Methods
add(appGuid, taskOptions) → {Promise}
Create a Task (v3 only).
NOTE: Tasks are a v3-only concept. v2 does not support task creation.
Parameters:
| Name | Type | Description |
|---|---|---|
appGuid |
String | Application unique identifier |
taskOptions |
Object | Task creation options |
- Source:
Throws:
-
If using v2 API (tasks not supported)
- Type
- Error
Returns:
Resolves with JSON task object
- Type
- Promise
cancel(guid) → {Promise}
Cancel a Task (v3) or delete a Job (v2).
Parameters:
| Name | Type | Description |
|---|---|---|
guid |
String | Task/Job unique identifier |
- Source:
Returns:
Resolves when task is cancelled / job is deleted
- Type
- Promise
getJob(guid) → {Promise}
Get a single Job (v2) or Task (v3) by GUID.
NOTE: For v3 async operation Jobs (from 202 Location headers), use getV3Job().
Parameters:
| Name | Type | Description |
|---|---|---|
guid |
String | Job/Task unique identifier |
- Source:
Returns:
Resolves with JSON job/task object
- Type
- Promise
getJobs(filteropt) → {Promise}
Get Jobs list (v2) or Tasks list (v3).
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
filter |
Object |
<optional> |
Query-string filter options |
- Source:
Returns:
Resolves with JSON jobs/tasks list
- Type
- Promise
getV3Job(jobGuid) → {Promise}
Get a v3 async operation Job by GUID.
v3 Jobs track background CC operations (org delete, service provisioning, etc.).
They are separate from v3 Tasks (which run inside app containers).
Parameters:
| Name | Type | Description |
|---|---|---|
jobGuid |
String | Job GUID (from Location header of 202 responses) |
- Source:
Returns:
Resolves with job object { guid, state, operation, errors, ... }
state: "PROCESSING" | "POLLING" | "COMPLETE" | "FAILED"
- Type
- Promise
pollJob(jobGuid, optionsopt) → {Promise}
Poll a v3 async operation Job until it completes or fails.
Repeatedly queries GET /v3/jobs/:guid until state is COMPLETE or FAILED.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jobGuid |
String | Job GUID | ||||||||||||||||
options |
Object |
<optional> |
Polling options
Properties
|
- Source:
Returns:
Resolves with completed job object, rejects on FAILED or timeout
- Type
- Promise