首页 / API 文档 / 运维中心 / 通知策略 / 查看指定命名空间下的通知列表

查看指定命名空间下的通知列表

请求信息

请求行

GET /apis/aiops.alauda.io/v1beta1/namespaces/{namespace}/notifications

查看类型为 Notification 的资源对象的列表。

请求行参数

名称 类型 是否必填项 描述
namespace string 命名空间。对象名称和身份验证范围,例如团队和项目。

请求参数

名称 类型 是否必填项 描述
allowWatchBookmarks boolean allowWatchBookmarks 请求使用 BOOKMARK 类型监视事件。没有实现书签的服务器可能会忽略此标志,而书签是由服务器自行发送的。客户端不应该假定书签在任何特定的间隔被返回,也不应该假定服务器将在会话期间发送任何 BOOKMARK 事件。如果这不是 watch 请求,这个字段将被忽略。如果在 apiserver 中未启用特性门 WatchBookmarks,则忽略该字段。
continue string 服务器定义的值,⽤于从服务器中查询更多的返回结果。客户端只能从上⼀个查询结果中获取该值。当查询列表时设置了limit 参数,返回结果未包含服务器上可以查询到的所有数据,此时,会返回 continue 参数,并为 continue 参数赋值⼀个 Token。需要查询更多返回结果时,可将 continue 参数及其值作为查询参数查询更多结果。说明:如果列表配置发⽣变化或查询过期,输⼊此查询参数后,会返回 410 错误码,如果继续输⼊该查询参数进⾏查询,返回的查询结果可能不是最新的数据。
fieldSelector string 字段选择器,可通过资源对象的字段过滤、筛选资源对象,默认返回所有资源对象。
labelSelector string 标签选择器,可通过标签过滤、筛选资源对象,默认返回所有资源对象。
limit integer limit 是查询列表请求返回的最大响应数。 如果存在更多项,则服务器会将列表元数据上的 “continue” 字段设置为一个值,该值可与相同的初始查询一起使用用来检索下一组结果。如果所有请求的对象都被过滤掉了,则设置的限制返回的项目数可能少于请求的项目数(最多为零),并且客户端应仅使用 continue 字段的存在来确定是否有更多结果可用。服务器可能选择不支持 limit 参数,并将返回所有可用结果。如果指定了限制,并且 continue 字段为空,则客户端可能会认为没有更多结果可用。如果 watch 为 true,则不支持此字段。 服务器保证使用 continue 时返回的对象与发出单个列表调用无限制地相同,也就是说,在发出第一个请求后,任何创建、修改或删除的对象都不会包含在任何后续的继续请求中。有时这被称为一致快照,并确保使用限制接收非常大结果的较小块的客户端可以确保它们看到所有可能的对象。如果在分块列表期间更新对象,则将返回在计算第一个列表结果时存在的对象版本。
resourceVersion string 当指定使用 watch 请求时,将显示在资源的特定版本之后发生的更改。默认从历史开始更改。当为 list 指定时:-如果未设置,则基于 quora -read 标志从远程存储返回结果;-如果它是 0,那么我们只是返回我们目前在缓存,没有保证;-如果设置为非零,那么结果至少与给定的 resourceVersion 一样为最新的值。
timeoutSeconds integer list/watch 方法的调用超时时长。这限制了调用的持续时间,不管是否活跃。
watch boolean 观察对所描述的资源的更改,并将其作为添加、更新和删除通知的流返回。需要指定 resourceVersion。
pretty string 如果为 true,则会将返回结果输出成适合打印的格式。

返回信息

Content-Type application/json, application/yaml

状态码: 200

OK

返回体示例

通知列表。

{
   "apiVersion": "aiops.alauda.io/v1beta1",
   "items": [
     {
       "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": "aiops.alauda.io/v1beta1",
       "kind": "Notification",
       "metadata": {
         "annotations": {
           "cpaas.io/creator": "admin@cpaas.io",
           "cpaas.io/description": "",
           "cpaas.io/display-name": "huzl-wechat",
           "cpaas.io/updated-at": "2021-06-11T10:22:44Z"
         },
         "creationTimestamp": "2021-06-11T10:22:44Z",
         "generation": 1,
         "labels": {
           "notificationtemplate.cpaas.io/test-wechat": "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-11T10:22:44Z"
           }
         ],
         "name": "huzl-wechat",
         "namespace": "cpaas-system",
         "resourceVersion": "10512438",
         "selfLink": "/apis/aiops.alauda.io/v1beta1/namespaces/cpaas-system/notifications/huzl-wechat",
         "uid": "594c41a0-4e42-43c2-875d-2d9c2cdb7746"
       },
       "spec": {
         "subscriptions": [
           {
             "method": "wechat",
             "receivers": [
               {
                 "name": "https---qyapi-weixin-qq-com-cgi-bin-webhook-send-key-29a3522e-8ffb-44e2-a4da-4498daee033c-4fj3k",
                 "namespace": "cpaas-system"
               }
             ],
             "template": "test-wechat"
           }
         ]
       }
     },
     {
       "apiVersion": "aiops.alauda.io/v1beta1",
       "kind": "Notification",
       "metadata": {
         "annotations": {
           "cpaas.io/creator": "admin@cpaas.io",
           "cpaas.io/description": "create test",
           "cpaas.io/display-name": "create notification",
           "cpaas.io/updated-at": "2021-06-17T08:12:46Z"
         },
         "creationTimestamp": "2021-06-17T08:12:46Z",
         "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": "python-requests",
             "operation": "Update",
             "time": "2021-06-17T08:12:46Z"
           }
         ],
         "name": "local-ares-template-notification",
         "namespace": "cpaas-system",
         "resourceVersion": "22729862",
         "selfLink": "/apis/aiops.alauda.io/v1beta1/namespaces/cpaas-system/notifications/local-ares-template-notification",
         "uid": "6761d3b4-7cd0-43cf-b430-6ab9f407cb15"
       },
       "spec": {
         "subscriptions": [
           {
             "method": "webhook",
             "receivers": [
               {
                 "name": "local-ares-template-receiver",
                 "namespace": "cpaas-system"
               }
             ],
             "template": "local-ares-template-template"
           }
         ]
       }
     },
     {
       "apiVersion": "aiops.alauda.io/v1beta1",
       "kind": "Notification",
       "metadata": {
         "annotations": {
           "cpaas.io/creator": "lhsun",
           "cpaas.io/description": "通知的方式",
           "cpaas.io/display-name": "songmin",
           "cpaas.io/updated-at": "2021-06-15T06:56:34Z"
         },
         "creationTimestamp": "2021-06-15T06:47:26Z",
         "generation": 1,
         "labels": {
           "notificationtemplate.cpaas.io/test-wechat": "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-15T06:47:26Z"
           }
         ],
         "name": "shashijian",
         "namespace": "cpaas-system",
         "resourceVersion": "16930153",
         "selfLink": "/apis/aiops.alauda.io/v1beta1/namespaces/cpaas-system/notifications/shashijian",
         "uid": "9fbf0037-c630-49da-8272-0bd547e3757d"
       },
       "spec": {
         "subscriptions": [
           {
             "method": "wechat",
             "receivers": [
               {
                 "name": "https---qyapi-weixin-qq-com-cgi-bin-webhook-send-key-29a3522e-8ffb-44e2-a4da-4498daee033c-4fj3k",
                 "namespace": "cpaas-system"
               }
             ],
             "template": "test-wechat"
           }
         ]
       }
     }
   ],
   "kind": "NotificationList",
   "metadata": {
     "continue": "",
     "resourceVersion": "35536548",
     "selfLink": "/apis/aiops.alauda.io/v1beta1/namespaces/cpaas-system/notifications"
   }
 }

返回体说明

名称 类型 描述
apiVersion string 查看公共参数
items array 通知列表。更多信息:https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md
字段路径:items
items[] object Notification 是 notifications API 的结构。
字段路径:items[]
items[].apiVersion string 查看公共参数
items[].kind string 查看公共参数
items[].metadata object 查看公共参数
items[].spec object Spec 定义了一个通知策略的详细信息,描述了通知策略的期望状态。
字段路径:items[].spec
spec.subscriptions array 通知的订阅信息列表。
字段路径:items[].spec.subscriptions
spec.subscriptions[] object NotificationSubscription 定义了通知策略的订阅方式。
字段路径:items[].spec.subscriptions[]
subscriptions[].method string 订阅方式。sms:短信;email:邮箱;webhook:Webhook;dingding:钉钉。
字段路径:items[].spec.subscriptions[].method
subscriptions[].receivers array 通知对象,至少要添加一个通知对象。
字段路径:items[].spec.subscriptions[].receivers
subscriptions[].receivers[] object
字段路径:items[].spec.subscriptions[].receivers[]
receivers[].name string
字段路径:items[].spec.subscriptions[].receivers[].name
receivers[].namespace string
字段路径:items[].spec.subscriptions[].receivers[].namespace
subscriptions[].template string 通知消息模板。
字段路径:items[].spec.subscriptions[].template
kind string 查看公共参数
metadata object 查看公共参数

其他状态码

状态码: 401

Unauthorized