创建通知策略
请求信息
请求行
POST /apis/aiops.alauda.io/v1beta1/namespaces/{namespace}/notifications
创建一个通知。
请求行参数
| 名称 | 类型 | 是否必填项 | 描述 | 
|---|---|---|---|
| namespace | string | 是 | 命名空间。对象名称和身份验证范围,例如团队和项目。 | 
请求参数
| 名称 | 类型 | 是否必填项 | 描述 | 
|---|---|---|---|
| dryRun | string | 否 | 当该参数出现时,表示不应该持久化修改。一个无效的或无法识别的 dryRun 指令将导致错误响应,并且不会进一步处理请求。有效值为:All,将处理所有的试运行阶段。 | 
| fieldManager | string | 否 | fieldManager 是与正在进行这些更改的参与者或实体相关联的名称。值必须少于 128 字符,且仅包含可打印字符,参见 https://golang.org/pkg/unicode/#IsPrint。 | 
| pretty | string | 否 | 如果为 true,则会将返回结果输出成适合打印的格式。 | 
请求体
Content-Type 
                application/json,
                application/yaml
请求体示例
Notification 是 notifications API 的结构。
{
   "apiVersion": "aiops.alauda.io/v1beta1",
   "kind": "Notification",
   "metadata": {
     "annotations": {
       "cpaas.io/description": "adfsdfa",
       "cpaas.io/display-name": "fadfadsf"
     },
     "name": "fdsfa",
     "namespace": "cpaas-system"
   },
   "spec": {
     "subscriptions": [
       {
         "method": "wechat",
         "receivers": [
           {
             "name": "https---abc232-9vo0f",
             "namespace": "cpaas-system"
           }
         ],
         "template": "local-ares-template-template"
       }
     ]
   }
 }请求体说明
| 名称 | 类型 | 是否必填项 | 描述 | 
|---|---|---|---|
| apiVersion | string | 是 | 查看公共参数 | 
| kind | string | 是 | 查看公共参数 | 
| metadata | object | 是 | 查看公共参数 | 
| spec | object | 是 | Spec 定义了一个通知策略的详细信息,描述了通知策略的期望状态。 字段路径:spec | 
| spec.subscriptions | array | 是 | 通知的订阅信息列表。 字段路径:spec.subscriptions | 
| spec.subscriptions[] | object | 是 | NotificationSubscription 定义了通知策略的订阅方式。 字段路径:spec.subscriptions[] | 
| subscriptions[].method | string | 是 | 订阅方式。sms:短信;email:邮箱;webhook:Webhook;dingding:钉钉。 字段路径:spec.subscriptions[].method | 
| subscriptions[].receivers | array | 是 | 通知对象,至少要添加一个通知对象。 字段路径:spec.subscriptions[].receivers | 
| subscriptions[].receivers[] | object | 是 | 字段路径:spec.subscriptions[].receivers[] | 
| receivers[].name | string | 是 | 字段路径:spec.subscriptions[].receivers[].name | 
| receivers[].namespace | string | 是 | 字段路径:spec.subscriptions[].receivers[].namespace | 
| subscriptions[].template | string | 是 | 通知消息模板。 字段路径:spec.subscriptions[].template | 
返回信息
Content-Type 
                application/json,
                application/yaml
状态码: 201
Created
返回体示例
Notification 是 notifications API 的结构。
{
   "apiVersion": "aiops.alauda.io/v1beta1",
   "kind": "Notification",
   "metadata": {
     "annotations": {
       "cpaas.io/creator": "admin@cpaas.io",
       "cpaas.io/description": "adfsdfa",
       "cpaas.io/display-name": "fadfadsf",
       "cpaas.io/updated-at": "2021-06-24T08:52:22Z"
     },
     "creationTimestamp": "2021-06-24T08:52:22Z",
     "generation": 1,
     "labels": {
       "notificationtemplate.cpaas.io/local-ares-template-template": "true"
     },
     "managedFields": [
       {
         "apiVersion": "aiops.alauda.io/v1beta1",
         "fieldsType": "FieldsV1",
         "fieldsV1": {
           "f:metadata": {
             "f:annotations": {
               ".": {},
               "f:cpaas.io/description": {},
               "f:cpaas.io/display-name": {}
             }
           },
           "f:spec": {
             ".": {},
             "f:subscriptions": {}
           }
         },
         "manager": "Mozilla",
         "operation": "Update",
         "time": "2021-06-24T08:52:22Z"
       }
     ],
     "name": "fdsfa",
     "namespace": "cpaas-system",
     "resourceVersion": "35533758",
     "selfLink": "/apis/aiops.alauda.io/v1beta1/namespaces/cpaas-system/notifications/fdsfa",
     "uid": "0f1d1c15-f070-4b32-a3eb-ee213acca18e"
   },
   "spec": {
     "subscriptions": [
       {
         "method": "wechat",
         "receivers": [
           {
             "name": "https---abc232-9vo0f",
             "namespace": "cpaas-system"
           }
         ],
         "template": "local-ares-template-template"
       }
     ]
   }
 }返回体说明
| 名称 | 类型 | 描述 | 
|---|---|---|
| apiVersion | string | 查看公共参数 | 
| kind | string | 查看公共参数 | 
| metadata | object | 查看公共参数 | 
| spec | object | Spec 定义了一个通知策略的详细信息,描述了通知策略的期望状态。 字段路径:spec | 
| spec.subscriptions | array | 通知的订阅信息列表。 字段路径:spec.subscriptions | 
| spec.subscriptions[] | object | NotificationSubscription 定义了通知策略的订阅方式。 字段路径:spec.subscriptions[] | 
| subscriptions[].method | string | 订阅方式。sms:短信;email:邮箱;webhook:Webhook;dingding:钉钉。 字段路径:spec.subscriptions[].method | 
| subscriptions[].receivers | array | 通知对象,至少要添加一个通知对象。 字段路径:spec.subscriptions[].receivers | 
| subscriptions[].receivers[] | object | 字段路径:spec.subscriptions[].receivers[] | 
| receivers[].name | string | 字段路径:spec.subscriptions[].receivers[].name | 
| receivers[].namespace | string | 字段路径:spec.subscriptions[].receivers[].namespace | 
| subscriptions[].recipient | string | 订阅信息的接收者,多个接收者之间用“,”分隔。 字段路径:spec.subscriptions[].recipient | 
| subscriptions[].sender | string | 通知发送人。 字段路径:spec.subscriptions[].sender | 
| subscriptions[].template | string | 通知消息模板。 字段路径:spec.subscriptions[].template |