jobs
Creates, updates, deletes, gets or lists a jobs resource.
Overview​
| Name | jobs |
| Type | Resource |
| Id | oci.resource_manager.jobs |
Fields​
The following fields are returned by SELECT queries:
- get
- list
A job object.
| Name | Datatype | Description |
|---|---|---|
id | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the job. |
applyJobPlanResolution | object | Deprecated. Use the property executionPlanStrategy in jobOperationDetails instead. |
cancellationDetails | object | Cancellation details for a job. |
compartmentId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment in which the job's associated stack resides. |
configSource | object | Information about the Terraform configuration. (x-example: Sample 1: Local Terraform configuration (zip file)<br /><br />{<br /> "configSourceRecordType": "ZIP_UPLOAD"<br />}<br /><br />Sample 2: Remote Terraform configuration (Git)<br /><br />{<br /> "configSourceType": "GIT_CONFIG_SOURCE",<br /> "workingDirectory": "<var><file_path_to_directory></var>",<br /> "configurationSourceProviderId": "ocid1.ormconfigsourceprovider.oc1..<var><unique_ID></var>",<br /> "repositoryUrl": "https:​//github.com/user/repo.git",<br /> "branchName": "MyBranch",<br /> "commitId": "2dc979a95e86abb211eda8515e1655dfa4275a00"<br />}<br />) |
definedTags | object | Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/iaas/Content/General/Concepts/resourcetags.htm). Example: {"Operations": {"CostCenter": "42"}} |
displayName | string | A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. |
failureDetails | object | |
freeformTags | object | Free-form tags associated with the resource. Each tag is a key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](/iaas/Content/General/Concepts/resourcetags.htm). Example: {"Department": "Finance"} |
isProviderUpgradeRequired | boolean | Specifies whether or not to upgrade provider versions. Within the version constraints of your Terraform configuration, use the latest versions available from the source of Terraform providers. For more information about this option, see [Dependency Lock File (terraform.io)](https:​//www.terraform.io/language/files/dependency-lock). |
isThirdPartyProviderExperienceEnabled | boolean | When true, the stack sources third-party Terraform providers from [Terraform Registry](https:​//registry.terraform.io/browse/providers) and allows [custom providers](#/en/resourcemanager/latest/datatypes/CustomTerraformProvider). For more information about stack sourcing of third-party Terraform providers, see [Third-party Provider Configuration](/iaas/Content/ResourceManager/Concepts/terraformconfigresourcemanager.htm#third-party-providers). |
jobOperationDetails | object | Job details that are specific to the operation type. |
lifecycleState | string | Current state of the specified job. For more information about job lifecycle states in Resource Manager, see [Key Concepts](/iaas/Content/ResourceManager/Concepts/resourcemanager.htm#concepts__JobStates). (ACCEPTED, IN_PROGRESS, FAILED, SUCCEEDED, CANCELING, CANCELED) |
operation | string | The type of job executing. (PLAN, APPLY, DESTROY, IMPORT_TF_STATE, PLAN_ROLLBACK, APPLY_ROLLBACK) |
resolvedPlanJobId | string | Deprecated. Use the property executionPlanJobId in jobOperationDetails instead. The plan job [OCID](/iaas/Content/General/Concepts/identifiers.htm) that was used (if this was an apply job and was not auto-approved). |
stackId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the stack that is associated with the job. |
systemTags | object | The system tags associated with this resource, if any. The system tags are set by Oracle cloud infrastructure services. Each key is predefined and scoped to namespaces. For more information, see [Resource Tags](https:​//docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: {orcl-cloud: {free-tier-retain: true}} |
timeCreated | string (date-time) | The date and time when the job was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z |
timeFinished | string (date-time) | The date and time when the job stopped running, irrespective of whether the job ran successfully. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z |
variables | object | Terraform variables associated with this resource. Maximum number of variables supported is 250. The maximum size of each variable, including both name and value, is 8192 bytes. Example: {"CompartmentId": "compartment-id-value"} |
workingDirectory | string | File path to the directory to use for running Terraform. If not specified, the root directory is used. Required when using a zip Terraform configuration (configSourceType value of ZIP_UPLOAD) that contains folders. Ignored for the configSourceType value of COMPARTMENT_CONFIG_SOURCE. For more information about required and recommended file structure, see [File Structure (Terraform Configurations for Resource Manager)](/iaas/Content/ResourceManager/Concepts/terraformconfigresourcemanager.htm#filestructure). |
Summary information for a job.
| Name | Datatype | Description |
|---|---|---|
id | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the job. |
applyJobPlanResolution | object | Deprecated. Use the property executionPlanStrategy in jobOperationDetails instead. |
compartmentId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment where the stack of the associated job resides. |
definedTags | object | Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/iaas/Content/General/Concepts/resourcetags.htm). Example: {"Operations": {"CostCenter": "42"}} |
displayName | string | A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. |
freeformTags | object | Free-form tags associated with the resource. Each tag is a key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](/iaas/Content/General/Concepts/resourcetags.htm). Example: {"Department": "Finance"} |
jobOperationDetails | object | A summary of job details that is specific to the operation type. |
lifecycleState | string | Current state of the specified job. For more information about job lifecycle states in Resource Manager, see [Key Concepts](/iaas/Content/ResourceManager/Concepts/resourcemanager.htm#concepts__JobStates). (x-obmcs-enumref: #/definitions/Job/lifecycleState) |
operation | string | The type of job executing (x-obmcs-enumref: #/definitions/Job/operation) |
resolvedPlanJobId | string | Deprecated. Use the property executionPlanJobId in jobOperationDetails instead. The plan job [OCID](/iaas/Content/General/Concepts/identifiers.htm) that was used (if this was an apply job and was not auto-approved). |
stackId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the stack that is associated with the specified job. |
systemTags | object | The system tags associated with this resource, if any. The system tags are set by Oracle cloud infrastructure services. Each key is predefined and scoped to namespaces. For more information, see [Resource Tags](https:​//docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: {orcl-cloud: {free-tier-retain: true}} |
timeCreated | string (date-time) | The date and time the job was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z |
timeFinished | string (date-time) | The date and time the job succeeded or failed. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | jobId, region | opc-request-id | Gets the properties of the specified job.<br />For more information, see<br />[Getting a Job's Details](/iaas/Content/ResourceManager/Tasks/get-job.htm).<br /> |
list | select | region | opc-request-id, compartmentId, stackId, id, lifecycleState, displayName, sortBy, sortOrder, limit, page | Lists jobs according to the specified filter. By default, the list is ordered by time created.<br />For more information, see<br />[Listing Jobs](/iaas/Content/ResourceManager/Tasks/list-jobs.htm).<br /><br />- To list all jobs in a stack, provide the stack [OCID](/iaas/Content/General/Concepts/identifiers.htm).<br />- To list all jobs in a compartment, provide the compartment [OCID](/iaas/Content/General/Concepts/identifiers.htm).<br />- To return a specific job, provide the job [OCID](/iaas/Content/General/Concepts/identifiers.htm). (Equivalent to [GetStack](#/en/resourcemanager/latest/Stack/GetStack).)<br /> |
create | insert | region, stackId | opc-request-id, opc-retry-token | Creates a job.<br />For more information, see<br />[Creating a Job](/iaas/Content/ResourceManager/Tasks/create-job.htm).<br /> |
update | update | jobId, region | opc-request-id, if-match | Updates the specified job.<br />For more information, see<br />[Updating a Job](/iaas/Content/ResourceManager/Tasks/update-job.htm).<br /> |
cancel_job | exec | jobId, region | opc-request-id, if-match, isForced | Indicates the intention to cancel the specified job.<br />Cancellation of the job is not immediate, and may be delayed,<br />or may not happen at all.<br />You can optionally choose forced cancellation by setting isForced to true.<br />A forced cancellation can result in an incorrect state file.<br />For example, the state file might not reflect the exact state of the provisioned resources.<br />For more information, see<br />[Canceling a Job](/iaas/Content/ResourceManager/Tasks/cancel-job.htm).<br /> |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
jobId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the job. |
region | string | OCI region identifier (e.g. us-ashburn-1, ap-sydney-1); resolves from OCI_REGION when not supplied in the query. (default: us-ashburn-1, x-stackQL-envVar: OCI_REGION) |
compartmentId | string | A filter to return only resources that exist in the compartment, identified by [OCID](/iaas/Content/General/Concepts/identifiers.htm). |
displayName | string | A filter to return only resources that match the given display name exactly. Use this filter to list a resource by name. Requires sortBy set to DISPLAYNAME. Alternatively, when you know the resource OCID, use the related Get operation. |
id | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) on which to query for jobs. |
if-match | string | For optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value. |
isForced | boolean | Indicates whether a forced cancellation is requested for the job while it was running. A forced cancellation can result in an incorrect state file. For example, the state file might not reflect the exact state of the provisioned resources. |
lifecycleState | string | A filter that returns all resources that match the specified lifecycle state. The state value is case-insensitive. |
limit | integer | The number of items returned in a paginated List call. For information about pagination, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine). |
opc-request-id | string | Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID. |
opc-retry-token | string | A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of retrying the same action. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected. |
page | string | The value of the opc-next-page response header from the preceding List call. For information about pagination, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine). |
sortBy | string | The field to use when sorting returned resources. By default, TIMECREATED is ordered descending. By default, DISPLAYNAME is ordered ascending. Note that you can sort only on one field. |
sortOrder | string | The sort order to use when sorting returned resources. Ascending (ASC) or descending (DESC). |
stackId | string | The stack [OCID](/iaas/Content/General/Concepts/identifiers.htm) on which to filter. |
SELECT examples​
- get
- list
Gets the properties of the specified job.<br />For more information, see<br />[Getting a Job's Details](/iaas/Content/ResourceManager/Tasks/get-job.htm).<br />
SELECT
id,
applyJobPlanResolution,
cancellationDetails,
compartmentId,
configSource,
definedTags,
displayName,
failureDetails,
freeformTags,
isProviderUpgradeRequired,
isThirdPartyProviderExperienceEnabled,
jobOperationDetails,
lifecycleState,
operation,
resolvedPlanJobId,
stackId,
systemTags,
timeCreated,
timeFinished,
variables,
workingDirectory
FROM oci.resource_manager.jobs
WHERE jobId = '{{ jobId }}' -- required
AND region = '{{ region }}' -- required
AND opc-request-id = '{{ opc-request-id }}'
;
Lists jobs according to the specified filter. By default, the list is ordered by time created.<br />For more information, see<br />[Listing Jobs](/iaas/Content/ResourceManager/Tasks/list-jobs.htm).<br /><br />- To list all jobs in a stack, provide the stack [OCID](/iaas/Content/General/Concepts/identifiers.htm).<br />- To list all jobs in a compartment, provide the compartment [OCID](/iaas/Content/General/Concepts/identifiers.htm).<br />- To return a specific job, provide the job [OCID](/iaas/Content/General/Concepts/identifiers.htm). (Equivalent to [GetStack](#/en/resourcemanager/latest/Stack/GetStack).)<br />
SELECT
id,
applyJobPlanResolution,
compartmentId,
definedTags,
displayName,
freeformTags,
jobOperationDetails,
lifecycleState,
operation,
resolvedPlanJobId,
stackId,
systemTags,
timeCreated,
timeFinished
FROM oci.resource_manager.jobs
WHERE region = '{{ region }}' -- required
AND opc-request-id = '{{ opc-request-id }}'
AND compartmentId = '{{ compartmentId }}'
AND stackId = '{{ stackId }}'
AND id = '{{ id }}'
AND lifecycleState = '{{ lifecycleState }}'
AND displayName = '{{ displayName }}'
AND sortBy = '{{ sortBy }}'
AND sortOrder = '{{ sortOrder }}'
AND limit = '{{ limit }}'
AND page = '{{ page }}'
;
INSERT examples​
- create
- Manifest
Creates a job.<br />For more information, see<br />[Creating a Job](/iaas/Content/ResourceManager/Tasks/create-job.htm).<br />
INSERT INTO oci.resource_manager.jobs (
applyJobPlanResolution,
definedTags,
displayName,
freeformTags,
jobOperationDetails,
operation,
stackId,
region,
opc-request-id,
opc-retry-token
)
SELECT
'{{ applyJobPlanResolution }}',
'{{ definedTags }}',
'{{ displayName }}',
'{{ freeformTags }}',
'{{ jobOperationDetails }}',
'{{ operation }}',
'{{ stackId }}' /* required */,
'{{ region }}',
'{{ opc-request-id }}',
'{{ opc-retry-token }}'
RETURNING
id,
applyJobPlanResolution,
cancellationDetails,
compartmentId,
configSource,
definedTags,
displayName,
failureDetails,
freeformTags,
isProviderUpgradeRequired,
isThirdPartyProviderExperienceEnabled,
jobOperationDetails,
lifecycleState,
operation,
resolvedPlanJobId,
stackId,
systemTags,
timeCreated,
timeFinished,
variables,
workingDirectory
;
# Description fields are for documentation purposes
- name: jobs
props:
- name: region
value: "{{ region }}"
description: Required parameter for the jobs resource.
- name: applyJobPlanResolution
description: |
Deprecated. Use the property `executionPlanStrategy` in `jobOperationDetails` instead.
value:
isAutoApproved: {{ isAutoApproved }}
isUseLatestJobId: {{ isUseLatestJobId }}
planJobId: "{{ planJobId }}"
- name: definedTags
value: "{{ definedTags }}"
description: |
Defined tags for this resource. Each key is predefined and scoped to a namespace.
For more information, see [Resource Tags](/iaas/Content/General/Concepts/resourcetags.htm).
Example: `{"Operations": {"CostCenter": "42"}}`
- name: displayName
value: "{{ displayName }}"
description: |
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- name: freeformTags
value: "{{ freeformTags }}"
description: |
Free-form tags associated with this resource. Each tag is a key-value pair with no predefined name, type, or namespace.
For more information, see [Resource Tags](/iaas/Content/General/Concepts/resourcetags.htm).
Example: `{"Department": "Finance"}`
- name: jobOperationDetails
description: |
Job details that are specific to the operation type.
value:
isProviderUpgradeRequired: {{ isProviderUpgradeRequired }}
operation: "{{ operation }}"
- name: operation
value: "{{ operation }}"
description: |
Terraform-specific operation to execute.
- name: stackId
value: "{{ stackId }}"
description: |
The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the stack that is associated with the current job.
- name: opc-request-id
value: "{{ opc-request-id }}"
description: Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
description: Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
- name: opc-retry-token
value: "{{ opc-retry-token }}"
description: A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of retrying the same action. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected.
description: A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of retrying the same action. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected.
UPDATE examples​
- update
Updates the specified job.<br />For more information, see<br />[Updating a Job](/iaas/Content/ResourceManager/Tasks/update-job.htm).<br />
UPDATE oci.resource_manager.jobs
SET
definedTags = '{{ definedTags }}',
displayName = '{{ displayName }}',
freeformTags = '{{ freeformTags }}'
WHERE
jobId = '{{ jobId }}' --required
AND region = '{{ region }}' --required
AND opc-request-id = '{{ opc-request-id}}'
AND if-match = '{{ if-match}}'
RETURNING
id,
applyJobPlanResolution,
cancellationDetails,
compartmentId,
configSource,
definedTags,
displayName,
failureDetails,
freeformTags,
isProviderUpgradeRequired,
isThirdPartyProviderExperienceEnabled,
jobOperationDetails,
lifecycleState,
operation,
resolvedPlanJobId,
stackId,
systemTags,
timeCreated,
timeFinished,
variables,
workingDirectory;
Lifecycle Methods​
- cancel_job
Indicates the intention to cancel the specified job.<br />Cancellation of the job is not immediate, and may be delayed,<br />or may not happen at all.<br />You can optionally choose forced cancellation by setting isForced to true.<br />A forced cancellation can result in an incorrect state file.<br />For example, the state file might not reflect the exact state of the provisioned resources.<br />For more information, see<br />[Canceling a Job](/iaas/Content/ResourceManager/Tasks/cancel-job.htm).<br />
EXEC oci.resource_manager.jobs.cancel_job
@jobId='{{ jobId }}' --required,
@region='{{ region }}' --required,
@opc-request-id='{{ opc-request-id }}',
@if-match='{{ if-match }}',
@isForced={{ isForced }}
;