@@ -20,7 +20,7 @@ import (
20
20
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/flag"
21
21
)
22
22
23
- func validateConfigOpts (opts * ConfigOpts ) error {
23
+ func (opts * ConfigOpts ) validateConfigOpts ( ) error {
24
24
if opts .event == "" {
25
25
return fmt .Errorf ("--%s flag is required" , flag .Event )
26
26
}
@@ -31,94 +31,94 @@ func validateConfigOpts(opts *ConfigOpts) error {
31
31
return fmt .Errorf ("--%s is required" , flag .NotificationType )
32
32
}
33
33
34
- return validateAlertSettingsTypes (opts )
34
+ return opts . validateAlertSettingsTypes ()
35
35
}
36
36
37
- func validateAlertSettingsTypes (opts * ConfigOpts ) error {
37
+ func (opts * ConfigOpts ) validateAlertSettingsTypes ( ) error {
38
38
switch opts .notificationType {
39
39
case datadog :
40
- return validateDatadog (opts )
40
+ return opts . validateDatadog ()
41
41
case email :
42
- return validateEmail (opts )
42
+ return opts . validateEmail ()
43
43
case microsoftTeams :
44
- return validateMicrosoftTeams (opts )
44
+ return opts . validateMicrosoftTeams ()
45
45
case opsGenie :
46
- return validateOpsGenie (opts )
46
+ return opts . validateOpsGenie ()
47
47
case pagerDuty :
48
- return validatePagerDuty (opts )
48
+ return opts . validatePagerDuty ()
49
49
case slack :
50
- return validateSlack (opts )
50
+ return opts . validateSlack ()
51
51
case sms :
52
- return validateSMS (opts )
52
+ return opts . validateSMS ()
53
53
case team :
54
- return validateTeams (opts )
54
+ return opts . validateTeams ()
55
55
case user :
56
- return validateUser (opts )
56
+ return opts . validateUser ()
57
57
case victor :
58
58
return validateVictor (opts )
59
59
case webhook :
60
- return validateWebhook (opts )
60
+ return opts . validateWebhook ()
61
61
}
62
62
return nil
63
63
}
64
64
65
- func validateDatadog (opts * ConfigOpts ) error {
65
+ func (opts * ConfigOpts ) validateDatadog ( ) error {
66
66
if opts .apiKey == "" || opts .notificationRegion == "" {
67
67
return fmt .Errorf ("--%s and --%s are required when --%s is DATADOG" , flag .APIKey , flag .NotificationRegion , flag .NotificationType )
68
68
}
69
69
return nil
70
70
}
71
71
72
- func validateEmail (opts * ConfigOpts ) error {
72
+ func (opts * ConfigOpts ) validateEmail ( ) error {
73
73
if opts .notificationEmailAddress == "" {
74
74
return fmt .Errorf ("--%s is required when --%s is EMAIL" , flag .NotificationEmailAddress , flag .NotificationType )
75
75
}
76
76
return nil
77
77
}
78
78
79
- func validateMicrosoftTeams (opts * ConfigOpts ) error {
79
+ func (opts * ConfigOpts ) validateMicrosoftTeams ( ) error {
80
80
if opts .notificationWebhookURL == "" {
81
81
return fmt .Errorf ("--%s is required when --%s is MICROSOFT_TEAMS" , flag .NotificationWebhookURL , flag .NotificationType )
82
82
}
83
83
return nil
84
84
}
85
85
86
- func validateOpsGenie (opts * ConfigOpts ) error {
86
+ func (opts * ConfigOpts ) validateOpsGenie ( ) error {
87
87
if opts .apiKey == "" || opts .notificationRegion == "" {
88
88
return fmt .Errorf ("--%s and --%s are required when --%s is OPS_GENIE" , flag .APIKey , flag .NotificationRegion , flag .NotificationType )
89
89
}
90
90
return nil
91
91
}
92
92
93
- func validatePagerDuty (opts * ConfigOpts ) error {
93
+ func (opts * ConfigOpts ) validatePagerDuty ( ) error {
94
94
if opts .notificationServiceKey == "" || opts .notificationRegion == "" {
95
95
return fmt .Errorf ("--%s and --%s are required when --%s is PAGER_DUTY" , flag .NotificationServiceKey , flag .NotificationRegion , flag .NotificationType )
96
96
}
97
97
return nil
98
98
}
99
99
100
- func validateSlack (opts * ConfigOpts ) error {
100
+ func (opts * ConfigOpts ) validateSlack ( ) error {
101
101
if opts .notificationToken == "" || opts .notificationChannelName == "" {
102
102
return fmt .Errorf ("--%s and --%s are required when --%s is SLACK" , flag .NotificationToken , flag .NotificationChannelName , flag .NotificationType )
103
103
}
104
104
return nil
105
105
}
106
106
107
- func validateSMS (opts * ConfigOpts ) error {
107
+ func (opts * ConfigOpts ) validateSMS ( ) error {
108
108
if opts .notificationMobileNumber == "" {
109
109
return fmt .Errorf ("--%s is required when --%s is SMS" , flag .NotificationMobileNumber , flag .NotificationType )
110
110
}
111
111
return nil
112
112
}
113
113
114
- func validateTeams (opts * ConfigOpts ) error {
114
+ func (opts * ConfigOpts ) validateTeams ( ) error {
115
115
if opts .notificationTeamID == "" {
116
116
return fmt .Errorf ("--%s is required when --%s is TEAM" , flag .NotificationTeamID , flag .NotificationType )
117
117
}
118
118
return nil
119
119
}
120
120
121
- func validateUser (opts * ConfigOpts ) error {
121
+ func (opts * ConfigOpts ) validateUser ( ) error {
122
122
if opts .notificationUsername == "" {
123
123
return fmt .Errorf ("--%s is required when --%s is USER" , flag .NotificationUsername , flag .NotificationType )
124
124
}
@@ -132,7 +132,7 @@ func validateVictor(opts *ConfigOpts) error {
132
132
return nil
133
133
}
134
134
135
- func validateWebhook (opts * ConfigOpts ) error {
135
+ func (opts * ConfigOpts ) validateWebhook ( ) error {
136
136
if opts .notificationWebhookURL == "" {
137
137
return fmt .Errorf ("--%s is required when --%s is WEBHOOK" , flag .NotificationWebhookURL , flag .NotificationType )
138
138
}
0 commit comments