-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
notifychannels add vms and email channel (#3287)
* add vms and email notify channel * add email and vms type in GetNotifyChannelTypes function * modify cs-i18n.yml voice to phone * refactor GetNotifyChannelTypes function * modify notify-channels page size * use Telephone and set email is default notify channel * modify cs-i18n.yml * modify short_message to sms * delete notifychannel id is null logic * delete analyzer-alert * delete analyzer-alert * delete org config in email,sms and vms
- Loading branch information
1 parent
9c11834
commit fb01cc4
Showing
17 changed files
with
384 additions
and
231 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
.erda/migrations/core-services/20211207-erda_notify_channel.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
update erda_notify_channel set type='sms' where type='short_message'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
304 changes: 159 additions & 145 deletions
304
api/proto-go/core/services/notify/channel/pb/channel.pb.go
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
en: | ||
aliyun_sms: "Ali Short Message Service" | ||
short_message: "Short Message" | ||
aliyun_vms: "Ali Voice Service" | ||
sms: "Short Message" | ||
vms: "Telephone" | ||
enabled_exception: "There are other enabled channel of this type %s" | ||
dingtalk: "DingTalk" | ||
dingtalk_work_notice: "DingTalk Work Notice" | ||
smtp: "SMTP" | ||
email: "Email" | ||
zh: | ||
aliyun_sms: "阿里云短信服务" | ||
short_message: "短信" | ||
aliyun_vms: "阿里云语音服务" | ||
sms: "短信" | ||
vms: "电话" | ||
enabled_exception: "%s类型已经存在开启状态的渠道" | ||
dingtalk: "钉钉" | ||
dingtalk_work_notice: "钉钉工作通知" | ||
email: "邮箱" | ||
smtp: "SMTP" |
36 changes: 36 additions & 0 deletions
36
modules/core-services/services/notify/channel/kind/aliyun_vms.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) 2021 Terminus, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package kind | ||
|
||
import "github.com/erda-project/erda/pkg/common/errors" | ||
|
||
type AliyunVMS struct { | ||
AccessKeyId string `json:"accessKeyId"` | ||
AccessKeySecret string `json:"accessKeySecret"` | ||
VMSTtsCode string `json:"vmsTtsCode"` | ||
} | ||
|
||
func (vms *AliyunVMS) Validate() error { | ||
if vms.AccessKeySecret == "" { | ||
return errors.NewMissingParameterError("accessKeySecret") | ||
} | ||
if vms.AccessKeyId == "" { | ||
return errors.NewMissingParameterError("accessKeyId") | ||
} | ||
if vms.VMSTtsCode == "" { | ||
return errors.NewMissingParameterError("vmsTtsCode") | ||
} | ||
return nil | ||
} |
45 changes: 45 additions & 0 deletions
45
modules/core-services/services/notify/channel/kind/email.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) 2021 Terminus, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package kind | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/erda-project/erda/pkg/common/errors" | ||
) | ||
|
||
type Email struct { | ||
SMTPHost string `json:"smtpHost"` | ||
SMTPUser string `json:"smtpUser"` | ||
SMTPPassword string `json:"smtpPassword"` | ||
SMTPPort int64 `json:"smtpPort"` | ||
SMTPIsSSL bool `json:"smtpIsSSL"` | ||
} | ||
|
||
func (email *Email) Validate() error { | ||
if email.SMTPHost == "" { | ||
return errors.NewMissingParameterError("smtpHost") | ||
} | ||
if email.SMTPUser == "" { | ||
return errors.NewMissingParameterError("smtpUser") | ||
} | ||
if email.SMTPPassword == "" { | ||
return errors.NewMissingParameterError("smtpPassword") | ||
} | ||
if email.SMTPPort < 0 || email.SMTPPort > 65535 { | ||
return fmt.Errorf("invalidate parameter %d", email.SMTPPort) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.