Skip to main content

templates

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

Overview​

Nametemplates
TypeResource
Idoci.resource_manager.templates

Fields​

The following fields are returned by SELECT queries:

Returns the template.

NameDatatypeDescription
idstringUnique identifier ([OCID](/iaas/Content/General/Concepts/identifiers.htm)) for the template.
categoryIdstringUnique identifier for the category where the template is located. Possible values are 0 (Quick Starts), 1 (Service), 2 (Architecture), and 3 (Private).
compartmentIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing this template.
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: {"Operations": {"CostCenter": "42"}}
descriptionstringBrief description of the template.
displayNamestringA user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
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: {"Department": "Finance"}
isFreeTierbooleanwhether the template will work for free tier tenancy.
lifecycleStatestringThe current lifecycle state of the template. (ACTIVE)
longDescriptionstringDetailed description of the template. This description is displayed in the Console page listing templates when the template is expanded. Avoid entering confidential information.
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: {orcl-cloud: {free-tier-retain: true}}
templateConfigSourceobjectInformation about the Template. (x-example: Sample 1: Directly uploaded Template zip file<br />{<br /> "templateConfigSourceType": "ZIP_UPLOAD",<br />}<br />)
timeCreatedstring (date-time)The date and time at which the template was created. Format is defined by RFC3339. Example: 2020-11-25T21:10:29.600Z

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselecttemplateId, regionopc-request-idGets the specified template.<br />For more information, see<br />[Getting a Private Template's Details](/iaas/Content/ResourceManager/Tasks/get-template.htm).<br />
listselectregionopc-request-id, compartmentId, templateCategoryId, templateId, displayName, sortBy, sortOrder, limit, pageLists templates according to the specified filter.<br />The attributes compartmentId and templateCategoryId are required unless templateId is specified.<br />For more information, see<br />[Listing Templates](/iaas/Content/ResourceManager/Tasks/list-template.htm).<br />
createinsertregion, compartmentId, displayName, description, templateConfigSourceopc-request-id, opc-retry-tokenCreates a private template in the specified compartment.<br />For more information, see<br />[Creating a Private Template](/iaas/Content/ResourceManager/Tasks/create-template.htm).<br />
updateupdatetemplateId, regionopc-request-id, if-matchUpdates the specified template.<br />For more information, see<br />[Updating a Private Template](/iaas/Content/ResourceManager/Tasks/update-template.htm).<br />
deletedeletetemplateId, regionopc-request-id, if-matchDeletes the specified template.<br />For more information, see<br />[Deleting a Private Template](/iaas/Content/ResourceManager/Tasks/delete-template.htm).<br />
change_compartmentexectemplateId, region, compartmentIdif-match, opc-request-id, opc-retry-tokenMoves a template into a different compartment within the same tenancy.<br />For more information, see<br />[Moving a Private Template](/iaas/Content/ResourceManager/Tasks/change-compartment-template.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
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)
templateIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the template.
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.
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.
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).
templateCategoryIdstringUnique identifier for the template category. Possible values are 0 (Quickstarts), 1 (Service), 2 (Architecture), and 3 (Private). Template category labels are displayed in the Console page listing templates. Quickstarts, Service, and Architecture templates (categories 0, 1, and 2) are available in all compartments. Each private template (category 3) is available in the compartment where it was created.
templateIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the template.

SELECT examples​

Gets the specified template.<br />For more information, see<br />[Getting a Private Template's Details](/iaas/Content/ResourceManager/Tasks/get-template.htm).<br />

SELECT
id,
categoryId,
compartmentId,
definedTags,
description,
displayName,
freeformTags,
isFreeTier,
lifecycleState,
longDescription,
systemTags,
templateConfigSource,
timeCreated
FROM oci.resource_manager.templates
WHERE templateId = '{{ templateId }}' -- required
AND region = '{{ region }}' -- required
AND opc-request-id = '{{ opc-request-id }}'
;

INSERT examples​

Creates a private template in the specified compartment.<br />For more information, see<br />[Creating a Private Template](/iaas/Content/ResourceManager/Tasks/create-template.htm).<br />

INSERT INTO oci.resource_manager.templates (
compartmentId,
definedTags,
description,
displayName,
freeformTags,
logoFileBase64Encoded,
longDescription,
templateConfigSource,
region,
opc-request-id,
opc-retry-token
)
SELECT
'{{ compartmentId }}' /* required */,
'{{ definedTags }}',
'{{ description }}' /* required */,
'{{ displayName }}' /* required */,
'{{ freeformTags }}',
'{{ logoFileBase64Encoded }}',
'{{ longDescription }}',
'{{ templateConfigSource }}' /* required */,
'{{ region }}',
'{{ opc-request-id }}',
'{{ opc-retry-token }}'
RETURNING
id,
categoryId,
compartmentId,
definedTags,
description,
displayName,
freeformTags,
isFreeTier,
lifecycleState,
longDescription,
systemTags,
templateConfigSource,
timeCreated
;

UPDATE examples​

Updates the specified template.<br />For more information, see<br />[Updating a Private Template](/iaas/Content/ResourceManager/Tasks/update-template.htm).<br />

UPDATE oci.resource_manager.templates
SET
definedTags = '{{ definedTags }}',
description = '{{ description }}',
displayName = '{{ displayName }}',
freeformTags = '{{ freeformTags }}',
logoFileBase64Encoded = '{{ logoFileBase64Encoded }}',
longDescription = '{{ longDescription }}',
templateConfigSource = '{{ templateConfigSource }}'
WHERE
templateId = '{{ templateId }}' --required
AND region = '{{ region }}' --required
AND opc-request-id = '{{ opc-request-id}}'
AND if-match = '{{ if-match}}'
RETURNING
id,
categoryId,
compartmentId,
definedTags,
description,
displayName,
freeformTags,
isFreeTier,
lifecycleState,
longDescription,
systemTags,
templateConfigSource,
timeCreated;

DELETE examples​

Deletes the specified template.<br />For more information, see<br />[Deleting a Private Template](/iaas/Content/ResourceManager/Tasks/delete-template.htm).<br />

DELETE FROM oci.resource_manager.templates
WHERE templateId = '{{ templateId }}' --required
AND region = '{{ region }}' --required
AND opc-request-id = '{{ opc-request-id }}'
AND if-match = '{{ if-match }}'
;

Lifecycle Methods​

Moves a template into a different compartment within the same tenancy.<br />For more information, see<br />[Moving a Private Template](/iaas/Content/ResourceManager/Tasks/change-compartment-template.htm).<br />

EXEC oci.resource_manager.templates.change_compartment
@templateId='{{ templateId }}' --required,
@region='{{ region }}' --required,
@if-match='{{ if-match }}',
@opc-request-id='{{ opc-request-id }}',
@opc-retry-token='{{ opc-retry-token }}'
@@json=
'{
"compartmentId": "{{ compartmentId }}"
}'
;