From 38e15304067d13364089e17f3e27a56f14e5d2b0 Mon Sep 17 00:00:00 2001 From: loganhz Date: Thu, 20 Dec 2018 13:17:46 +0800 Subject: [PATCH] Support WeChat as notifier Feature: Now we don't support WeChat as a notifier. So user can not send the alert to wechat. We needto support it https://github.com/rancher/rancher/issues/17121 --- apis/management.cattle.io/v3/alerting_types.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apis/management.cattle.io/v3/alerting_types.go b/apis/management.cattle.io/v3/alerting_types.go index 7833dc8e..f8cc4aef 100644 --- a/apis/management.cattle.io/v3/alerting_types.go +++ b/apis/management.cattle.io/v3/alerting_types.go @@ -62,7 +62,7 @@ type ProjectAlertSpec struct { type Recipient struct { Recipient string `json:"recipient,omitempty"` NotifierName string `json:"notifierName,omitempty" norman:"required,type=reference[notifier]"` - NotifierType string `json:"notifierType,omitempty" norman:"required,options=slack|email|pagerduty|webhook"` + NotifierType string `json:"notifierType,omitempty" norman:"required,options=slack|email|pagerduty|webhook|wechat"` } type TargetNode struct { @@ -267,6 +267,7 @@ type NotifierSpec struct { SlackConfig *SlackConfig `json:"slackConfig,omitempty"` PagerdutyConfig *PagerdutyConfig `json:"pagerdutyConfig,omitempty"` WebhookConfig *WebhookConfig `json:"webhookConfig,omitempty"` + WechatConfig *WechatConfig `json:"wechatConfig,omitempty"` } type Notification struct { @@ -275,6 +276,7 @@ type Notification struct { SlackConfig *SlackConfig `json:"slackConfig,omitempty"` PagerdutyConfig *PagerdutyConfig `json:"pagerdutyConfig,omitempty"` WebhookConfig *WebhookConfig `json:"webhookConfig,omitempty"` + WechatConfig *WechatConfig `json:"wechatConfig,omitempty"` } type SMTPConfig struct { @@ -300,6 +302,14 @@ type WebhookConfig struct { URL string `json:"url,omitempty" norman:"required"` } +type WechatConfig struct { + DefaultRecipient string `json:"defaultRecipient,omitempty" norman:"required"` + Secret string `json:"secret,omitempty" norman:"type=password,required"` + Agent string `json:"agent,omitempty" norman:"required"` + Corp string `json:"corp,omitempty" norman:"required"` + RecipientType string `json:"recipientType,omitempty" norman:"required,options=tag|party|user,default=party"` +} + type NotifierStatus struct { }