Skip to content

Commit

Permalink
Remove notifiers v1 from terraform
Browse files Browse the repository at this point in the history
Co-authored-by: Diogo <[email protected]>
  • Loading branch information
rohitsakala and diogoasouza committed Jul 17, 2024
1 parent 2ab9421 commit cf22612
Show file tree
Hide file tree
Showing 38 changed files with 0 additions and 3,124 deletions.
36 changes: 0 additions & 36 deletions docs/data-sources/notifier.md

This file was deleted.

127 changes: 0 additions & 127 deletions docs/resources/notifier.md

This file was deleted.

26 changes: 0 additions & 26 deletions rancher2/0_provider_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@ provider "rancher2" {
` + testAccRancher2NodeTemplateOpennebulaConfig + `
` + testAccRancher2NodeTemplateOpenstack + `
` + testAccRancher2NodeTemplateVsphere + `
` + testAccRancher2NotifierPagerduty + `
` + testAccRancher2NotifierSlack + `
` + testAccRancher2NotifierSMTP + `
` + testAccRancher2NotifierWebhook + `
` + testAccRancher2NotifierWechat + `
` + testAccCheckRancher2PodSecurityPolicyTemplate + `
` + testAccRancher2ProjectRoleTemplateBinding + `
` + testAccRancher2Project + `
Expand Down Expand Up @@ -175,13 +170,6 @@ provider "rancher2" {
` + testAccRancher2NodeTemplateOpennebulaConfig + `
` + testAccRancher2NodeTemplateOpenstack + `
` + testAccRancher2NodeTemplateVsphere + `
` + testAccRancher2NotifierDingtalk + `
` + testAccRancher2NotifierMSTeams + `
` + testAccRancher2NotifierPagerduty + `
` + testAccRancher2NotifierSlack + `
` + testAccRancher2NotifierSMTP + `
` + testAccRancher2NotifierWebhook + `
` + testAccRancher2NotifierWechat + `
` + testAccCheckRancher2PodSecurityPolicyTemplate + `
` + testAccRancher2ProjectRoleTemplateBinding + `
` + testAccRancher2Project + `
Expand Down Expand Up @@ -228,13 +216,6 @@ provider "rancher2" {
` + testAccRancher2NodeTemplateOpennebulaConfig + `
` + testAccRancher2NodeTemplateOpenstack + `
` + testAccRancher2NodeTemplateVsphere + `
` + testAccRancher2NotifierDingtalk + `
` + testAccRancher2NotifierMSTeams + `
` + testAccRancher2NotifierPagerduty + `
` + testAccRancher2NotifierSlack + `
` + testAccRancher2NotifierSMTP + `
` + testAccRancher2NotifierWebhook + `
` + testAccRancher2NotifierWechat + `
` + testAccCheckRancher2PodSecurityPolicyTemplate + `
` + testAccRancher2ProjectRoleTemplateBinding + `
` + testAccRancher2Project + `
Expand Down Expand Up @@ -285,13 +266,6 @@ provider "rancher2" {
` + testAccRancher2NodeTemplateOpennebulaConfig + `
` + testAccRancher2NodeTemplateOpenstack + `
` + testAccRancher2NodeTemplateVsphere + `
` + testAccRancher2NotifierDingtalk + `
` + testAccRancher2NotifierMSTeams + `
` + testAccRancher2NotifierPagerduty + `
` + testAccRancher2NotifierSlack + `
` + testAccRancher2NotifierSMTP + `
` + testAccRancher2NotifierWebhook + `
` + testAccRancher2NotifierWechat + `
` + testAccCheckRancher2PodSecurityPolicyTemplate + `
` + testAccRancher2ProjectRoleTemplateBinding + `
` + testAccRancher2Project + `
Expand Down
42 changes: 0 additions & 42 deletions rancher2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1831,45 +1831,3 @@ func (c *Config) DeleteCertificate(cert interface{}) error {
return fmt.Errorf("[ERROR] Certificate type %s isn't supported", t)
}
}

func (c *Config) GetRecipientByNotifier(id string) (*managementClient.Recipient, error) {
if len(id) == 0 {
return nil, fmt.Errorf("[ERROR] Notifier ID can't be nil")
}

client, err := c.ManagementClient()
if err != nil {
return nil, err
}

notifier, err := client.Notifier.ByID(id)
if err != nil {
return nil, err
}

out := &managementClient.Recipient{}

out.NotifierID = notifier.ID
if notifier.DingtalkConfig != nil {
out.NotifierType = recipientTypeDingtalk
} else if notifier.MSTeamsConfig != nil {
out.NotifierType = recipientTypeMsTeams
} else if notifier.PagerdutyConfig != nil {
out.NotifierType = recipientTypePagerduty
out.Recipient = notifier.PagerdutyConfig.ServiceKey
} else if notifier.SlackConfig != nil {
out.NotifierType = recipientTypeSlack
out.Recipient = notifier.SlackConfig.DefaultRecipient
} else if notifier.SMTPConfig != nil {
out.NotifierType = recipientTypeSMTP
out.Recipient = notifier.SMTPConfig.DefaultRecipient
} else if notifier.WebhookConfig != nil {
out.NotifierType = recipientTypeWebhook
out.Recipient = notifier.WebhookConfig.URL
} else if notifier.WechatConfig != nil {
out.NotifierType = recipientTypeWechat
out.Recipient = notifier.WechatConfig.DefaultRecipient
}

return out, nil
}
133 changes: 0 additions & 133 deletions rancher2/data_source_rancher2_notifier.go

This file was deleted.

Loading

0 comments on commit cf22612

Please sign in to comment.