alerts.read。创建、更新、测试和删除连接器需要 alerts.manage。
连接器类型
类型列表返回运行中后端注册的每种类型的connector_type 与 capabilities。类型包括 email_smtp、lark_app、lark_webhook、slack_app、slack_webhook 和 webhook。
config 对象取决于其类型。所有 timeout_secs 默认为 10,取值范围为 1 到 60。URL 必须是绝对的 http 或 https 地址。
各服务商及其目标的说明参见通知渠道。
创建连接器
config 做静态加密。响应会把每个保存凭证的键的值替换为 ***,这些键包括 url、webhook_url、headers,以及所有以 password、secret 或 token 结尾的键。host、from、timeout_secs 等其他键保持可读。
status 在首次测试之前为 unknown,之后为 connected 或 error。last_test_status 为 success 或 failed。状态为 error 的连接器会被路由跳过,直到之后的测试成功。
列出与读取连接器
id 不存在时返回 404。
更新连接器
对已掩码的键发送
*** 可保留已保存的密钥,发送新的明文值则替换它:
测试连接器
200,sent 为 false,原因在 error 中,例如 unavailable: webhook request failed。测试还会更新连接器的 status、last_tested_at、last_test_status 与 last_test_error。
删除连接器
204,没有响应体。用户端点、通知策略、兜底路由、定时日志巡检、状态页或 IM 里的 Mole Agent 仍引用该连接器时,调用返回 409,消息为 notify connector is referenced by user endpoints, policies, default routes, scheduled log inspections, status pages, or Mole Agent in IM。请先迁移这些引用。