调用CreateTemplate创建一个编排模板。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求语法
POST /templates HTTP/1.1
Content-Type:application/json
{
"name" : "String",
"template" : "String",
"tags" : "String",
"description" : "String",
"template_type" : "String"
}
请求参数
参数名称 | 类型 | 是否必选 | 示例 | 说明 |
---|---|---|---|---|
name | String | 是 | service-account-template |
模板名称。 命名规则:由数字、汉字、英文字符或短划线(-)组成,长度范围1~63个字符,且不能以短划线(-)开头。 |
template | String | 是 | apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: test-sa |
YAML格式的模板内容。 |
tags | String | 否 | test |
编排模板标签。 |
description | String | 否 | this is test |
编排模板描述。 |
template_type | String | 否 | kubernetes |
模板类型,取值可以是任意值。
推荐设置为 默认值: |
响应体语法
HTTP/1.1 200
Content-Type:application/json
{
"template_id" : "String"
}
响应参数
参数名称 | 类型 | 示例 | 说明 |
---|---|---|---|
template_id | String | ba1fe77b-b01e-4640-b77e-8f1b80e3e3cf |
编排模板ID。 |
创建编排模板示例
请求示例
POST /templates HTTP/1.1
Content-Type:application/json
{
"name" : "service-account-template",
"template" : "apiVersion: v1\\nkind: ServiceAccount\\nmetadata:\\n name: test-sa",
"tags" : "test",
"description" : "this is test",
"template_type" : "kubernetes"
}
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<template_id>ba1fe77b-b01e-4640-b77e-8f1b80e3e3cf</template_id>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"template_id" : "ba1fe77b-b01e-4640-b77e-8f1b80e3e3cf"
}
错误码
访问错误中心查看更多错误码。
开发者资源
-
SDK
阿里云为您提供多种语言的SDK,帮助您快速通过API集成阿里云的产品和服务,推荐您使用SDK调用API,已免除您手动签名验证,详情请参见SDK参考文档链接。
-
OpenAPI Explorer
快速检索,可视化调试API,在线命令行工具,同步动态生成可执行的SDK代码示例。
-
阿里云CLI
阿里云资产管理和配置工具,可通过命令方式同时管理多个阿里云产品和服务,简单快捷,是您上云好帮手。