调用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"
}
错误码
访问错误中心查看更多错误码。