All Products
Search
Document Center

CloudOps Orchestration Service:CreateTemplate

Last Updated:Oct 14, 2024

Creates a template.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
oos:CreateTemplatecreate
  • Template
    acs:oos:{#regionId}:{#accountId}:template/*
  • oos:tag
  • ram:PassRole

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringNo

The ID of the region.

cn-hangzhou
TemplateNamestringYes

The name of the template. The name can be 1 to 200 characters in length and can contain letters, digits, hyphens (-), and underscores (_). The name cannot start with ALIYUN, ACS, ALIBABA, or ALICLOUD.

MyTemplate
ContentstringYes

The content of the template. The content must be in the JSON or YAML format, and its maximum size is 64 KB.

{"FormatVersion": "OOS-2019-06-01", "Description": "Describe instances of given status", "Parameters": {"Status": {"Type": "String", "Description": "(Required) The status of the Ecs instance."}}, "Tasks": [{"Properties": {"Parameters": {"Status": "{{ Status }}"}, "API": "DescribeInstances", "Service": "Ecs"}, "Name": "foo", "Action": "ACS::ExecuteApi"}]}
TagsobjectNo

The tag keys and tag values. The number of key-value pairs ranges from 1 to 20.

{"k1":"v1","k2":"v2"}
VersionNamestringNo

The name of the version of the template.

v2
ResourceGroupIdstringNo

The ID of the resource group.

rg-acfmxsn4m4******

Response parameters

ParameterTypeDescriptionExample
object
TemplateTypestring

The type of the template.

Private
RequestIdstring

The ID of the request.

20758A-585D-4A41-A9B2-28DA8F4F534F
Templateobject

The metadata of the template.

Hashstring

The SHA-256 value of the template content.

4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4
UpdatedDatestring

The time when the template was last updated.

2019-05-16T10:26:14Z
UpdatedBystring

The Alibaba Cloud account that last modified the information about the template.

root(130900000)
Tagsobject

The tags of the resources.

{ "k1":"v1", "k2":"v2" }
TemplateNamestring

The name of the template.

MyTemplate
TemplateVersionstring

The version of the template. The name of the version consists of the letter v and a number. The number starts from 1.

v1
TemplateFormatstring

The format of the template. The system automatically determines whether the format is JSON or YAML.

JSON
Descriptionstring

The description of the template.

Describe instances of given status
ResourceGroupIdstring

The ID of the resource group.

rg-acfmxsn4m4******
CreatedBystring

The creator of the template.

root(13090000)
CreatedDatestring

The time when the template was created.

2019-05-16T10:26:14Z
TemplateIdstring

The ID of the template.

t-94753d38
HasTriggerboolean

Indicates whether the template was configured with a trigger.

true
ShareTypestring

The share type of the template. The share type of the template that you create is Private.

Private

Examples

Sample success responses

JSONformat

{
  "TemplateType": "Private",
  "RequestId": "20758A-585D-4A41-A9B2-28DA8F4F534F",
  "Template": {
    "Hash": "4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4",
    "UpdatedDate": "2019-05-16T10:26:14Z",
    "UpdatedBy": "root(130900000)",
    "Tags": {
      "k1": "v1",
      "k2": "v2"
    },
    "TemplateName": "MyTemplate",
    "TemplateVersion": "v1",
    "TemplateFormat": "JSON",
    "Description": "Describe instances of given status",
    "ResourceGroupId": "rg-acfmxsn4m4******",
    "CreatedBy": "root(13090000)",
    "CreatedDate": "2019-05-16T10:26:14Z",
    "TemplateId": "t-94753d38",
    "HasTrigger": true,
    "ShareType": "Private"
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history