Skip to main content

jobs

Creates, updates, deletes, gets or lists a jobs resource.

Overview​

Namejobs
TypeResource
Idoci.resource_manager.jobs

Fields​

The following fields are returned by SELECT queries:

A job object.

NameDatatypeDescription
idstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the job.
applyJobPlanResolutionobjectDeprecated. Use the property executionPlanStrategy in jobOperationDetails instead.
cancellationDetailsobjectCancellation details for a job.
compartmentIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment in which the job's associated stack resides.
configSourceobjectInformation 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 />)
definedTagsobjectDefined 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: &#123;"Operations": &#123;"CostCenter": "42"&#125;&#125;
displayNamestringA user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
failureDetailsobject
freeformTagsobjectFree-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: &#123;"Department": "Finance"&#125;
isProviderUpgradeRequiredbooleanSpecifies 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).
isThirdPartyProviderExperienceEnabledbooleanWhen 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).
jobOperationDetailsobjectJob details that are specific to the operation type.
lifecycleStatestringCurrent 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)
operationstringThe type of job executing. (PLAN, APPLY, DESTROY, IMPORT_TF_STATE, PLAN_ROLLBACK, APPLY_ROLLBACK)
resolvedPlanJobIdstringDeprecated. 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).
stackIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the stack that is associated with the job.
systemTagsobjectThe 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: &#123;orcl-cloud: &#123;free-tier-retain: true&#125;&#125;
timeCreatedstring (date-time)The date and time when the job was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
timeFinishedstring (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
variablesobjectTerraform 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: &#123;"CompartmentId": "compartment-id-value"&#125;
workingDirectorystringFile 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).

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectjobId, regionopc-request-idGets 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 />
listselectregionopc-request-id, compartmentId, stackId, id, lifecycleState, displayName, sortBy, sortOrder, limit, pageLists 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 />
createinsertregion, stackIdopc-request-id, opc-retry-tokenCreates a job.<br />For more information, see<br />[Creating a Job](/iaas/Content/ResourceManager/Tasks/create-job.htm).<br />
updateupdatejobId, regionopc-request-id, if-matchUpdates the specified job.<br />For more information, see<br />[Updating a Job](/iaas/Content/ResourceManager/Tasks/update-job.htm).<br />
cancel_jobexecjobId, regionopc-request-id, if-match, isForcedIndicates 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.

NameDatatypeDescription
jobIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the job.
regionstringOCI 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)
compartmentIdstringA filter to return only resources that exist in the compartment, identified by [OCID](/iaas/Content/General/Concepts/identifiers.htm).
displayNamestringA 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.
idstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) on which to query for jobs.
if-matchstringFor 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.
isForcedbooleanIndicates 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.
lifecycleStatestringA filter that returns all resources that match the specified lifecycle state. The state value is case-insensitive.
limitintegerThe 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-idstringUnique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
opc-retry-tokenstringA 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.
pagestringThe 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).
sortBystringThe 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.
sortOrderstringThe sort order to use when sorting returned resources. Ascending (ASC) or descending (DESC).
stackIdstringThe stack [OCID](/iaas/Content/General/Concepts/identifiers.htm) on which to filter.

SELECT examples​

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 }}'
;

INSERT examples​

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
;

UPDATE examples​

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​

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 }}
;