Home / API Documentation / Operations center / Templates / View the notification template for details

View the notification template for details

Requests

HTTP request

GET /apis/aiops.alauda.io/v1beta1/notificationtemplates/{name}

read the specified NotificationTemplate

Path parameters

Name Type Required Description
name string Truename of the NotificationTemplate

Query parameters

Name Type Required Description
resourceVersion string FalseWhen specified: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it's 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
pretty string FalseIf 'true', then the output is pretty printed.

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

Other status codes

Status code: 401

Unauthorized