如何使用OpenAPI管理应用中心所管理的应用触发器
示例,应用中心组件安装cluster id为c6ec8c1161cb442978e49a99055a01e37的集群; 创建的应用名称为deployment-a01e37; 如下图所示
创建触发器
参考文档:https://help.aliyun.com/document_detail/303763.html
创建触发器的命令如下:
arc-cs trigger create \
--cluster-id c6ec8c1161cb442978e49a99055a01e37 \
--project-id appcenter/deployment-a01e37 \
--action redeploy \
--type application
--cluster-id 为安装应用中心组件的集群id;
--project-id 为namespace/application_name, namespace=appcenter是固定不变的;
--action 值为redeploy固定不变;
--type 值为application固定不变;
返回内容如下:
{
"id": "152781",
"clusterId": "c6ec8c1161cb442978e49a99055a01e37",
"projectId": "appcenter/deployment-a01e37",
"type": "",
"action": "redeploy"
}
获取触发器
参考文档:https://help.aliyun.com/document_detail/303766.html
获取触发器的命令如下:
arc-cs trigger get c6ec8c1161cb442978e49a99055a01e37 \
--namespace appcenter \
--type application \
--name deployment-a01e37 \
--action redeploy
返回内容为:
[
{
"id": "152781",
"name": "",
"clusterId": "c6ec8c1161cb442978e49a99055a01e37",
"projectId": "appcenter/deployment-a01e37",
"type": "application",
"action": "redeploy",
"token": "xxxxxx"
}
]
则触发器URL地址为:
https://cs.console.aliyun.com/hook/trigger?token=<token>
删除触发器
参考文档:https://help.aliyun.com/document_detail/303767.html
删除触发器的命令如下所示:
arc-cs trigger delete 152781