@@ -31,7 +31,7 @@ import (
3131 progressevents "github.com/mongodb/mongodbatlas-cloudformation-resources/util/progressevent"
3232 "github.com/mongodb/mongodbatlas-cloudformation-resources/util/validator"
3333 "github.com/spf13/cast"
34- "go.mongodb.org/atlas-sdk/v20231115014/admin"
34+ admin20231115014 "go.mongodb.org/atlas-sdk/v20231115014/admin"
3535)
3636
3737var CreateRequiredFields = []string {constants .EventTypeName , constants .ProjectID }
@@ -76,7 +76,7 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
7676 return progressevents .GetFailedEventByCode (err .Error (), cloudformation .HandlerErrorCodeInvalidRequest ), err
7777 }
7878
79- alertConfigRequest := admin .GroupAlertsConfig {
79+ alertConfigRequest := admin20231115014 .GroupAlertsConfig {
8080 GroupId : currentModel .ProjectId ,
8181 EventTypeName : currentModel .EventTypeName ,
8282 Enabled : currentModel .Enabled ,
@@ -182,13 +182,13 @@ func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler
182182 // Removing the computed attributes to recreate the original request
183183 alertReq .Created = nil
184184 alertReq .Updated = nil
185- var alertModel * admin .GroupAlertsConfig
185+ var alertModel * admin20231115014 .GroupAlertsConfig
186186
187187 // Cannot enable/disable ONLY via update (if only send enable as changed field server returns a 500 error)
188188 // so have to use different method to change enabled.
189- if reflect .DeepEqual (alertReq , & admin .GroupAlertsConfig {Enabled : aws .Bool (true )}) ||
190- reflect .DeepEqual (alertReq , & admin .GroupAlertsConfig {Enabled : aws .Bool (false )}) {
191- alertModel , res , err = atlasV2 .AlertConfigurationsApi .ToggleAlertConfiguration (context .Background (), projectID , id , & admin .AlertsToggle {Enabled : alertReq .Enabled }).Execute ()
189+ if reflect .DeepEqual (alertReq , & admin20231115014 .GroupAlertsConfig {Enabled : aws .Bool (true )}) ||
190+ reflect .DeepEqual (alertReq , & admin20231115014 .GroupAlertsConfig {Enabled : aws .Bool (false )}) {
191+ alertModel , res , err = atlasV2 .AlertConfigurationsApi .ToggleAlertConfiguration (context .Background (), projectID , id , & admin20231115014 .AlertsToggle {Enabled : alertReq .Enabled }).Execute ()
192192 } else {
193193 alertModel , res , err = atlasV2 .AlertConfigurationsApi .UpdateAlertConfiguration (context .Background (), projectID , id , alertReq ).Execute ()
194194 }
@@ -251,15 +251,15 @@ func List(req handler.Request, prevModel *Model, currentModel *Model) (handler.P
251251 HandlerErrorCode : cloudformation .HandlerErrorCodeNotFound }, nil
252252}
253253
254- func isExist (currentModel * Model , client * admin .APIClient ) bool {
254+ func isExist (currentModel * Model , client * admin20231115014 .APIClient ) bool {
255255 alert , _ , err := client .AlertConfigurationsApi .GetAlertConfiguration (context .Background (), * currentModel .ProjectId , * currentModel .Id ).Execute ()
256256 return err == nil && alert != nil
257257}
258258
259- func expandAlertConfigurationMatchers (matchers []Matcher ) * []admin .StreamsMatcher {
260- mts := make ([]admin .StreamsMatcher , 0 )
259+ func expandAlertConfigurationMatchers (matchers []Matcher ) * []admin20231115014 .StreamsMatcher {
260+ mts := make ([]admin20231115014 .StreamsMatcher , 0 )
261261 for ind := range matchers {
262- mMatcher := admin .NewStreamsMatcher (
262+ mMatcher := admin20231115014 .NewStreamsMatcher (
263263 cast .ToString (matchers [ind ].FieldName ),
264264 cast .ToString (matchers [ind ].Operator ),
265265 cast .ToString (matchers [ind ].Value ),
@@ -269,12 +269,12 @@ func expandAlertConfigurationMatchers(matchers []Matcher) *[]admin.StreamsMatche
269269 return & mts
270270}
271271
272- func expandAlertConfigurationMetricThresholdConfig (currentModel * Model ) * admin .ServerlessMetricThreshold {
272+ func expandAlertConfigurationMetricThresholdConfig (currentModel * Model ) * admin20231115014 .ServerlessMetricThreshold {
273273 threshold := currentModel .MetricThreshold
274274 if threshold == nil {
275275 return nil
276276 }
277- return & admin .ServerlessMetricThreshold {
277+ return & admin20231115014 .ServerlessMetricThreshold {
278278 MetricName : cast .ToString (threshold .MetricName ),
279279 Operator : threshold .Operator ,
280280 Threshold : threshold .Threshold ,
@@ -283,19 +283,19 @@ func expandAlertConfigurationMetricThresholdConfig(currentModel *Model) *admin.S
283283 }
284284}
285285
286- func expandAlertConfigurationThreshold (threshold * IntegerThresholdView ) * admin .GreaterThanRawThreshold {
286+ func expandAlertConfigurationThreshold (threshold * IntegerThresholdView ) * admin20231115014 .GreaterThanRawThreshold {
287287 if threshold == nil {
288288 return nil
289289 }
290- return & admin .GreaterThanRawThreshold {
290+ return & admin20231115014 .GreaterThanRawThreshold {
291291 Operator : threshold .Operator ,
292292 Threshold : util .Pointer (int (* threshold .Threshold )),
293293 Units : threshold .Units ,
294294 }
295295}
296296
297- func expandAlertConfigurationNotification (notificationList []NotificationView ) (* []admin .AlertsNotificationRootForGroup , error ) {
298- notifications := make ([]admin .AlertsNotificationRootForGroup , 0 )
297+ func expandAlertConfigurationNotification (notificationList []NotificationView ) (* []admin20231115014 .AlertsNotificationRootForGroup , error ) {
298+ notifications := make ([]admin20231115014 .AlertsNotificationRootForGroup , 0 )
299299
300300 for ind := range notificationList {
301301 if notificationList [ind ].IntervalMin != nil && * notificationList [ind ].IntervalMin > cast .ToFloat64 (0 ) {
@@ -307,7 +307,7 @@ func expandAlertConfigurationNotification(notificationList []NotificationView) (
307307 }
308308
309309 for ind := range notificationList {
310- notification := admin .AlertsNotificationRootForGroup {
310+ notification := admin20231115014 .AlertsNotificationRootForGroup {
311311 ApiToken : notificationList [ind ].ApiToken ,
312312 ChannelName : notificationList [ind ].ChannelName ,
313313 DatadogApiKey : notificationList [ind ].DatadogApiKey ,
@@ -334,9 +334,9 @@ func expandAlertConfigurationNotification(notificationList []NotificationView) (
334334 return & notifications , nil
335335}
336336
337- func convertToMongoModel (reqModel * admin .GroupAlertsConfig , currentModel * Model ) * admin .GroupAlertsConfig {
337+ func convertToMongoModel (reqModel * admin20231115014 .GroupAlertsConfig , currentModel * Model ) * admin20231115014 .GroupAlertsConfig {
338338 if reqModel == nil {
339- reqModel = & admin .GroupAlertsConfig {}
339+ reqModel = & admin20231115014 .GroupAlertsConfig {}
340340 }
341341
342342 // Only change the updated fields
@@ -361,7 +361,7 @@ func convertToMongoModel(reqModel *admin.GroupAlertsConfig, currentModel *Model)
361361 return reqModel
362362}
363363
364- func convertToUIModel (alertConfig * admin .GroupAlertsConfig , currentModel * Model ) * Model {
364+ func convertToUIModel (alertConfig * admin20231115014 .GroupAlertsConfig , currentModel * Model ) * Model {
365365 currentModel .Id = alertConfig .Id
366366 if alertConfig .Created != nil {
367367 currentModel .Created = util .TimePtrToStringPtr (alertConfig .Created )
0 commit comments