Differentiated update notification template
Requests
HTTP request
PATCH /apis/aiops.alauda.io/v1beta1/notificationtemplates/{name}
partially update the specified NotificationTemplate
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | True | name of the NotificationTemplate |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
| dryRun | string | False | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed |
| fieldManager | string | False | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. |
| pretty | string | False | If 'true', then the output is pretty printed. |
Request body
Content-Type
application/json-patch+json,
application/merge-patch+json,
application/apply-patch+yaml
Sample request
Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.
{
"metadata": {
"annotations": {
"cpaas.io/description": "adsfadfaxx"
}
}
}Responses
Content-Type
application/json,
application/yaml
Status code: 200
OK
Sample response
NotificationTemplate is the Schema for the templates API NotificationTemplate define a notification template to template notification
{
"apiVersion": "aiops.alauda.io/v1beta1",
"kind": "NotificationTemplate",
"metadata": {
"annotations": {
"cpaas.io/description": "sms-notice-temp-update",
"cpaas.io/display-name": "sms-notice-temp-update",
"cpaas.io/operator": "huzl",
"cpaas.io/updated-at": "2021-06-17T09:50:09Z"
},
"creationTimestamp": "2021-06-17T09:48:05Z",
"generation": 1,
"labels": {
"cpaas.io/type": "sms"
},
"managedFields": [
{
"apiVersion": "aiops.alauda.io/v1beta1",
"fieldsType": "FieldsV1",
"fieldsV1": {
"f:metadata": {
"f:annotations": {
".": {},
"f:cpaas.io/description": {},
"f:cpaas.io/display-name": {}
},
"f:labels": {
".": {},
"f:cpaas.io/type": {}
}
},
"f:spec": {
".": {},
"f:content": {}
}
},
"manager": "Mozilla",
"operation": "Update",
"time": "2021-06-17T09:48:05Z"
}
],
"name": "sms-notice-temp",
"resourceVersion": "97181",
"selfLink": "/apis/aiops.alauda.io/v1beta1/notificationtemplates/sms-notice-temp",
"uid": "f06c1835-eba7-4251-b459-62eeb800a31e"
},
"spec": {
"content": "{{- if eq .externalLabels.status \"告警中\" }}\n告警状态:{{ .externalLabels.status }}\n告警等级:{{ .externalLabels.severity }}\n告警集群:{{ .labels.alert_cluster }}\n告警对象:{{ .externalLabels.object }}\n策略名称:{{ .labels.alert_resource }}\n告警描述:{{ .externalLabels.summary }}\n触发数值:{{ .externalLabels.currentValue }}\n告警时间:{{ dateFormatWithZone .startsAt \"2006-01-02 15:04:05\" \"Asia/Chongqing\" }}\n{{- else }}\n告警状态:{{ .externalLabels.status }}\n告警等级:{{ .externalLabels.severity }}\n告警集群:{{ .labels.alert_cluster }}\n告警对象:{{ .externalLabels.object }}\n策略名称:{{ .labels.alert_resource }}\n告警描述:{{ .externalLabels.summary }}\n触发数值:{{ .externalLabels.currentValue }}\n告警时间:{{ dateFormatWithZone .startsAt \"2006-01-02 15:04:05\" \"Asia/Chongqing\" }}\n恢复时间:{{ dateFormatWithZone .endsAt \"2006-01-02 15:04:05\" \"Asia/Chongqing\" }}\n{{- end}}"
}
}Parameters
| Name | Type | Description |
|---|---|---|
| apiVersion | string | See common parameters |
| kind | string | See common parameters |
| metadata | object | See common parameters |
| spec | object |
Spec define the content of a template
Path: spec |
| spec.content | string |
Content template to render notification message
Path: spec.content |