templates
Creates, updates, deletes, gets or lists a templates resource.
Overview​
| Name | templates |
| Type | Resource |
| Id | oci.resource_manager.templates |
Fields​
The following fields are returned by SELECT queries:
- get
- list
Returns the template.
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier ([OCID](/iaas/Content/General/Concepts/identifiers.htm)) for the template. |
categoryId | string | Unique identifier for the category where the template is located. Possible values are 0 (Quick Starts), 1 (Service), 2 (Architecture), and 3 (Private). |
compartmentId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing this template. |
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"}} |
description | string | Brief description of the template. |
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"} |
isFreeTier | boolean | whether the template will work for free tier tenancy. |
lifecycleState | string | The current lifecycle state of the template. (ACTIVE) |
longDescription | string | Detailed description of the template. This description is displayed in the Console page listing templates when the template is expanded. Avoid entering confidential information. |
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}} |
templateConfigSource | object | Information about the Template. (x-example: Sample 1: Directly uploaded Template zip file<br />{<br /> "templateConfigSourceType": "ZIP_UPLOAD",<br />}<br />) |
timeCreated | string (date-time) | The date and time at which the template was created. Format is defined by RFC3339. Example: 2020-11-25T21:10:29.600Z |
A list of templates.
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier of the specified template. |
compartmentId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing this template. |
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"}} |
description | string | Brief description of the template. |
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"} |
isFreeTier | boolean | whether the template will work for free tier tenancy. |
lifecycleState | string | The current lifecycle state of the template. (x-obmcs-enumref: #/definitions/Template/lifecycleState) |
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 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | templateId, region | opc-request-id | Gets the specified template.<br />For more information, see<br />[Getting a Private Template's Details](/iaas/Content/ResourceManager/Tasks/get-template.htm).<br /> |
list | select | region | opc-request-id, compartmentId, templateCategoryId, templateId, displayName, sortBy, sortOrder, limit, page | Lists 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 /> |
create | insert | region, compartmentId, displayName, description, templateConfigSource | opc-request-id, opc-retry-token | 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 /> |
update | update | templateId, region | opc-request-id, if-match | Updates the specified template.<br />For more information, see<br />[Updating a Private Template](/iaas/Content/ResourceManager/Tasks/update-template.htm).<br /> |
delete | delete | templateId, region | opc-request-id, if-match | Deletes the specified template.<br />For more information, see<br />[Deleting a Private Template](/iaas/Content/ResourceManager/Tasks/delete-template.htm).<br /> |
change_compartment | exec | templateId, region, compartmentId | if-match, opc-request-id, opc-retry-token | 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 /> |
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 |
|---|---|---|
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) |
templateId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the template. |
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. |
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. |
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). |
templateCategoryId | string | Unique 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. |
templateId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the template. |
SELECT examples​
- get
- list
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 }}'
;
Lists 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 />
SELECT
id,
compartmentId,
definedTags,
description,
displayName,
freeformTags,
isFreeTier,
lifecycleState,
systemTags,
timeCreated
FROM oci.resource_manager.templates
WHERE region = '{{ region }}' -- required
AND opc-request-id = '{{ opc-request-id }}'
AND compartmentId = '{{ compartmentId }}'
AND templateCategoryId = '{{ templateCategoryId }}'
AND templateId = '{{ templateId }}'
AND displayName = '{{ displayName }}'
AND sortBy = '{{ sortBy }}'
AND sortOrder = '{{ sortOrder }}'
AND limit = '{{ limit }}'
AND page = '{{ page }}'
;
INSERT examples​
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: templates
props:
- name: region
value: "{{ region }}"
description: Required parameter for the templates resource.
- name: compartmentId
value: "{{ compartmentId }}"
description: |
The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing this template.
- 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: description
value: "{{ description }}"
description: |
Description of the template. Avoid entering confidential information.
- 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 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"}`
- name: logoFileBase64Encoded
value: "{{ logoFileBase64Encoded }}"
description: |
Base64-encoded logo to use as the template icon.
Template icon file requirements: PNG format, 50 KB maximum, 110 x 110 pixels.
- name: longDescription
value: "{{ longDescription }}"
description: |
Detailed description of the template. This description is displayed in the Console page listing templates when the template is expanded. Avoid entering confidential information.
- name: templateConfigSource
description: |
Creation details for a configuration source used for a template.
value:
templateConfigSourceType: "{{ templateConfigSourceType }}"
- 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 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​
- delete
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​
- change_compartment
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 }}"
}'
;