创建通知信息
请求信息
请求行
POST /apis/aiops.alauda.io/v1beta1/namespaces/{namespace}/notificationmessages
创建一个通知信息。
请求行参数
名称 | 类型 | 是否必填项 | 描述 |
---|---|---|---|
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
请求体示例
NotificationMessage 是 templates API 的结构。
{
"apiVersion": "aiops.alauda.io/v1beta3",
"kind": "NotificationMessage",
"metadata": {
"creationTimestamp": null,
"name": "alert-global-cpaas-auth-controller2-rules-workload.replicas.available-42c6y-0kxtibw",
"namespace": "cpaas-system"
},
"spec": {
"body": {
"annotations": {
"alert_current_value": "0",
"alert_notifications": "[{\"namespace\":\"cpaas-system\",\"name\":\"cpaas-admin-notification\"}]"
},
"endsAt": "2021-06-24T07:59:19.480389856Z",
"labels": {
"alert_cluster": "global",
"alert_indicator": "workload.replicas.available",
"alert_indicator_aggregate_range": "0",
"alert_indicator_comparison": "\u003c",
"alert_indicator_threshold": "1",
"alert_involved_object_kind": "Deployment",
"alert_involved_object_name": "auth-controller2",
"alert_involved_object_namespace": "cpaas-system",
"alert_name": "workload.replicas.available-42c6y",
"alert_project": "system",
"alert_resource": "cpaas-auth-controller2-rules",
"alertname": "workload.replicas.available-42c6y-2889db663056b1879842e72460165f2b",
"severity": "Medium"
},
"startsAt": "2021-06-24T07:46:19.480389856Z",
"status": "resolved"
},
"notifications": [
{
"name": "cpaas-admin-notification"
}
]
}
}
请求体说明
名称 | 类型 | 是否必填项 | 描述 |
---|---|---|---|
apiVersion | string | 是 | 查看公共参数 |
kind | string | 是 | 查看公共参数 |
metadata | object | 是 | 查看公共参数 |
spec | object | 是 |
Spec 定义了 NotificationMessage 的详细信息,描述了 NotificationMessage 的期望状态。
字段路径:spec |
spec.body | object | 是 |
消息体,为任何形式的 Json。
字段路径:spec.body |
spec.notifications | array | 是 |
此消息关联的通知。
字段路径:spec.notifications |
spec.notifications[] | object | 是 |
NotificationItem 定义了关联到 NotificationMessage 的 Notification 的信息。
字段路径:spec.notifications[] |
notifications[].name | string | 是 |
通知策略的名称。
字段路径:spec.notifications[].name |
返回信息
Content-Type
application/json
,
application/yaml
状态码: 201
Created
返回体示例
NotificationMessage 是 templates API 的结构。
{
"apiVersion": "aiops.alauda.io/v1beta3",
"kind": "NotificationMessage",
"metadata": {
"creationTimestamp": null,
"name": "alert-global-cpaas-auth-controller2-rules-workload.replicas.available-42c6y-0kxtibw",
"namespace": "cpaas-system"
},
"spec": {
"body": {
"annotations": {
"alert_current_value": "0",
"alert_notifications": "[{\"namespace\":\"cpaas-system\",\"name\":\"cpaas-admin-notification\"}]"
},
"endsAt": "2021-06-24T07:59:19.480389856Z",
"labels": {
"alert_cluster": "global",
"alert_indicator": "workload.replicas.available",
"alert_indicator_aggregate_range": "0",
"alert_indicator_comparison": "\u003c",
"alert_indicator_threshold": "1",
"alert_involved_object_kind": "Deployment",
"alert_involved_object_name": "auth-controller2",
"alert_involved_object_namespace": "cpaas-system",
"alert_name": "workload.replicas.available-42c6y",
"alert_project": "system",
"alert_resource": "cpaas-auth-controller2-rules",
"alertname": "workload.replicas.available-42c6y-2889db663056b1879842e72460165f2b",
"severity": "Medium"
},
"startsAt": "2021-06-24T07:46:19.480389856Z",
"status": "resolved"
},
"notifications": [
{
"name": "cpaas-admin-notification"
}
]
}
}
返回体说明
名称 | 类型 | 描述 |
---|---|---|
apiVersion | string | 查看公共参数 |
kind | string | 查看公共参数 |
metadata | object | 查看公共参数 |
spec | object |
Spec 定义了 NotificationMessage 的详细信息,描述了 NotificationMessage 的期望状态。
字段路径:spec |
spec.body | object |
消息体,为任何形式的 Json。
字段路径:spec.body |
spec.notifications | array |
此消息关联的通知。
字段路径:spec.notifications |
spec.notifications[] | object |
NotificationItem 定义了关联到 NotificationMessage 的 Notification 的信息。
字段路径:spec.notifications[] |
notifications[].name | string |
通知策略的名称。
字段路径:spec.notifications[].name |
status | object |
通知信息的当前状态。
字段路径:status |
status.conditions | array |
Conditions 包含了通知信息的一个或多个状态信息。
字段路径:status.conditions |
status.conditions[] | object |
通知信息的状态。
字段路径:status.conditions[] |
conditions[].lastTransitionTime | string (date-time) |
条件从一个状态转向另一个状态时的时间。
字段路径:status.conditions[].lastTransitionTime |
conditions[].message | string |
状态转换的详细可读信息。
字段路径:status.conditions[].message |
conditions[].reason | string |
最后一次状态转换的原因。
字段路径:status.conditions[].reason |
conditions[].retryTimes | integer (int64) |
此通知消息的重试次数。
字段路径:status.conditions[].retryTimes |
conditions[].status | string |
条件的状态,包括:True、False、Unknown。
字段路径:status.conditions[].status |
conditions[].type | string |
通知消息条件的类型。
字段路径:status.conditions[].type |