调用CreateTrigger为应用创建触发器。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求语法
POST /clusters/cluster_id/triggers HTTP/1.1
Content-Type:application/json
{
"cluster_id" : "String",
"project_id" : "String",
"action" : "String",
"type" : "String"
}
请求参数
参数名称 | 类型 | 是否必选 | 示例 | 说明 |
---|---|---|---|---|
cluster_id | String | 是 | c68deb844dc6d480eb775be611fdf**** |
集群ID。 |
参数名称 | 类型 | 是否必选 | 示例 | 说明 |
---|---|---|---|---|
cluster_id | String | 是 | c5cdf7e3938bc4f8eb0e44b21a80f**** |
集群ID。 |
project_id | String | 是 | default/test-app |
触发器项目名称。 由应用所在命名空间及应用名称组成,格式为 取值示例: |
action | String | 是 | redeploy |
触发器行为,取值:
|
type | String | 否 | deployment |
触发器类型。取值:
默认值: |
响应体语法
HTTP/1.1 200 OK
Content-Type:application/json
{
"id" : "String",
"cluster_id" : "String",
"project_id" : "String",
"type" : "String",
"action" : "String"
}
响应参数
参数名称 | 类型 | 示例 | 说明 |
---|---|---|---|
id | String | 102536 |
触发器ID。 |
cluster_id | String | c93095129fc41463aa455d89444fd**** |
集群ID。 |
project_id | String | default/test-app |
触发器项目名称。 |
type | String | deployment |
触发器类型。默认值为 deployment 。 |
action | String | redeploy |
触发器行为。例如, |
创建触发器示例
请求示例
POST /clusters/c68deb844dc6d480eb775be611fdf****/triggers HTTP/1.1
Host:cs.aliyuncs.com
Content-Type:application/json
{
"cluster_id" : "c5cdf7e3938bc4f8eb0e44b21a80f****",
"project_id" : "default/test-app",
"action" : "redeploy",
"type" : "deployment"
}
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateTriggerResponse>
<id>102536</id>
<cluster_id>c93095129fc41463aa455d89444fd****</cluster_id>
<project_id>default/test-app</project_id>
<type>deployment</type>
<action>redeploy</action>
</CreateTriggerResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"id" : "102536",
"cluster_id" : "c93095129fc41463aa455d89444fd****",
"project_id" : "default/test-app",
"type" : "deployment",
"action" : "redeploy"
}
错误码
访问错误中心查看更多错误码。