Import a Template
/paas/api/v1.1/instancemgmt/{identityDomainId}/templates/cst/instances
Import a new cloud stack template file or update an existing template with a new file.
The values of the templateName and templateVersion attributes in the template file are used to uniquely identify a template in Oracle Cloud Stack. To update an existing template, edit the template file and modify the templateVersion attribute.
When you import a template with the same name as an existing template in this account, you create a new version of the template. Any existing stacks that were created from previous versions of this template are not affected.
Request
- multipart/form-data
-
identityDomainId: string
Name of the Oracle Cloud identity domain
-
template: string
A YAML file containing template contents
Response
- application/json
201 Response
object
-
createdBy(optional):
string
Name of the user who imported the template
-
createdOn(optional):
string
Time when the template was imported
-
description(optional):
string
Description of the template
-
latestVersion(optional):
string
Latest version of the template
-
links(optional):
object links-response
The response body contains a list of links that are related to a template.
-
state(optional):
string
Indicates whether or not the template is published
-
templateName(optional):
string
Name of the template
-
type(optional):
string
Indicates whether this template was provided by Oracle (system template) or created by a user
object
-
items(optional):
array items
A list of links.
array
-
Array of:
object link-response
A template link
object
-
href(optional):
string
Link URL
-
rel(optional):
string
Link type
400 Response
500 Response
Examples
The following example shows how to import a template file from your local file system to Oracle Cloud Stack by submitting a POST request to the templates endpoint. The file is sent as a form parameter.
cURL Command
curl -i -X POST \ -u yourUsername:yourPassword \ -H "Content-Type:multipart/form-data" \ -H "X-ID-TENANT-NAME:MyIdentityDomain" \ -F "template=@MyTemplate.yaml" \ https://psm.us.oraclecloud.com/paas/api/v1.1/instancemgmt/MyIdentityDomain/templates/cst/instances
Note: This example uses the URL prefix for the United States. For information about the URL prefixes for other regions of the world, see Send Requests.
Example of Response Header
The following shows an example of the response header.
HTTP/1.1 201 Created Date: Thu, 25 Aug 2016 18:16:50 GMT Transfer-Encoding: chunked Content-Type: application/json
Example of Response Body
The following shows an example of the response body in JSON format.
{
"templateName":"MyTemplate",
"latestVersion":"1.0.0",
"description":"My first template",
"createdOn":"2016-08-25T18:16:50.233+0000",
"createdBy":"yourUsername",
"state":"PUBLISHED",
"type":"USER_TEMPLATE",
"links":[
{
"rel":"canonical","href":"https://psm.us.oraclecloud.com/paas/api/v1.1/instancemgmt/MyIdentityDomain/templates/cst/instances/MyTemplate"
},
{
"rel":"self","href":"https://psm.us.oraclecloud.com/paas/api/v1.1/instancemgmt/MyIdentityDomain/templates/cst/instances"
}
]
}