UpdateAlertNotifyTemplate - 更新通知模板

更新时间:
复制 MD 格式

更新通知模板

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

cms:UpdateAlertNotifyTemplate

update

*Contact

acs:cms:{#regionId}:{#accountId}:alertNotifyTemplate/{#alertNotifyTemplateId}

无 无

请求语法

PATCH /alertNotifyTemplate/{alertNotifyTemplateId} HTTP/1.1

路径参数

名称

类型

必填

描述

示例值

alertNotifyTemplateId

string

是

通知模板 ID。

test

请求参数

名称

类型

必填

描述

示例值

body

object

否

请求 Body

alertNotifyTemplateName

string

否

通知模板名称。

test

templates

object

否

多语言通知模板。key 为语言代码:zh(中文)、en(英文);value 为该语言的模板配置对象。发送通知时按收件人语言选择对应模板。正文格式随 type 不同:DING、WEIXIN、FEISHU 为 Markdown,EMAIL 为 HTML,SMS、CALL、SLACK 为纯文本,CUSTOM 为 JSON。

{"zh":{"title":"云监控报警: {{.incident.title}}","content":"**报警标题:** {{.incident.title}}\n**级别:** {{.incident.severity}}\n**事件数:** {{len .events}}","incidentLifeCycleNotifyTemplates":"{\"IncidentCreationNotify\":{\"title\":\"云监控报警: {{.incident.title}}\",\"content\":\"**报警标题:** {{.incident.title}}\\n**级别:** {{.incident.severity}}\",\"enable\":true},\"IncidentResolutionNotify\":{\"title\":\"云监控报警已解决: {{.incident.title}}\",\"content\":\"**报警标题:** {{.incident.title}}\\n**级别:** {{.incident.severity}}\",\"enable\":true}}"},"en":{"title":"CloudMonitor Alert: {{.incident.title}}","content":"**Alert Title:** {{.incident.title}}\n**Severity:** {{.incident.severity}}\n**Events:** {{len .events}}","incidentLifeCycleNotifyTemplates":"{\"IncidentCreationNotify\":{\"title\":\"CloudMonitor Alert: {{.incident.title}}\",\"content\":\"**Alert Title:** {{.incident.title}}\\n**Severity:** {{.incident.severity}}\",\"enable\":true},\"IncidentResolutionNotify\":{\"title\":\"CloudMonitor Alert Resolved: {{.incident.title}}\",\"content\":\"**Alert Title:** {{.incident.title}}\\n**Severity:** {{.incident.severity}}\",\"enable\":true}}"}}

object

否

指定语言的模板配置对象,可包含 title(标题模板)、content(正文模板)和 incidentLifeCycleNotifyTemplates(按问题生命周期事件配置的 JSON 字符串)。事件类型支持 IncidentCreationNotify(问题创建)、IncidentCycleNotify(问题未恢复期间按重复通知间隔发送)、IncidentResolutionNotify(问题恢复)、IncidentEscalationNotify(问题升级)。未配置的字段或事件使用系统默认模板。

{"title":"云监控报警: {{.incident.title}}","content":"**报警标题:** {{.incident.title}}\n**级别:** {{.incident.severity}}\n**事件数:** {{len .events}}","incidentLifeCycleNotifyTemplates":"{\"IncidentCreationNotify\":{\"title\":\"云监控报警: {{.incident.title}}\",\"content\":\"**报警标题:** {{.incident.title}}\\n**级别:** {{.incident.severity}}\",\"enable\":true},\"IncidentResolutionNotify\":{\"title\":\"云监控报警已解决: {{.incident.title}}\",\"content\":\"**报警标题:** {{.incident.title}}\\n**级别:** {{.incident.severity}}\",\"enable\":true}}"}

string

否

模板字段值,均为字符串。title、content 直接填写 Go template 模板;incidentLifeCycleNotifyTemplates 填写 JSON 字符串,例如 {"IncidentCreationNotify":{"title":"...","content":"...","enable":true}},每个事件包含 title、content 和 enable。事件未配置或 enable 为 false 时,回退使用同语言的 title、content,仍为空时使用系统默认模板。可用 Go template 变量如 {{.incident.title}}、{{.incident.severity}}、{{.incident.state}}、{{len .events}}。

云监控报警: {{.incident.title}}

返回参数

名称

类型

描述

示例值

object

Schema of Response

requestId

string

请求 ID。

264C3E89-XXXX-XXXX-XXXX-CE9C2196C7DC

示例

正常返回示例

JSON格式

{
  "requestId": "264C3E89-XXXX-XXXX-XXXX-CE9C2196C7DC"
}

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidParameter %s is missing or invalid. 参数%s缺失或不合法。
400 InvalidParameterValue Invalid request: %s
500 InternalUnknownError The request processing has failed due to some unknown error. 服务运行错误。
404 ResourceNotFound The specified resource %s is not found. 指定资源%s不存在。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。