@@ -21,13 +21,15 @@ import (
2121 "net/http"
2222 "strings"
2323
24+ admin20231115002 "go.mongodb.org/atlas-sdk/v20231115002/admin"
25+
2426 "github.com/aws-cloudformation/cloudformation-cli-go-plugin/cfn/handler"
25- "github.com/aws/aws-sdk-go/service/cloudformation"
27+ "github.com/aws/aws-sdk-go-v2/service/cloudformation/types"
28+
2629 "github.com/mongodb/mongodbatlas-cloudformation-resources/util"
2730 "github.com/mongodb/mongodbatlas-cloudformation-resources/util/constants"
2831 "github.com/mongodb/mongodbatlas-cloudformation-resources/util/progressevent"
2932 "github.com/mongodb/mongodbatlas-cloudformation-resources/util/validator"
30- admin20231115002 "go.mongodb.org/atlas-sdk/v20231115002/admin"
3133)
3234
3335var CreateRequiredFields = []string {constants .FederationSettingsID , constants .OrgID , constants .ExternalGroupName , constants .RoleAssignments }
@@ -70,7 +72,7 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
7072 if err != nil {
7173 if resp .StatusCode == http .StatusBadRequest && strings .Contains (err .Error (), "DUPLICATE_ROLE_MAPPING" ) {
7274 return progressevent .GetFailedEventByCode ("Resource already exists" ,
73- cloudformation .HandlerErrorCodeAlreadyExists ), nil
75+ string ( types .HandlerErrorCodeAlreadyExists ) ), nil
7476 }
7577 return progressevent .GetFailedEventByResponse (fmt .Sprintf ("Error getting resource : %s" , err .Error ()),
7678 resp ), nil
@@ -132,15 +134,15 @@ func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler
132134 roleMappingID := currentModel .Id
133135
134136 if ! isRoleMappingExists (currentModel , client ) {
135- return progressevent .GetFailedEventByCode ("Not Found" , cloudformation .HandlerErrorCodeNotFound ), nil
137+ return progressevent .GetFailedEventByCode ("Not Found" , string ( types .HandlerErrorCodeNotFound ) ), nil
136138 }
137139
138140 if (currentModel .RoleAssignments ) == nil || len (currentModel .RoleAssignments ) == 0 {
139141 err := errors .New (RoleAssignementShouldBeSet )
140142 return handler.ProgressEvent {
141143 OperationStatus : handler .Failed ,
142144 Message : err .Error (),
143- HandlerErrorCode : cloudformation .HandlerErrorCodeInvalidRequest }, nil
145+ HandlerErrorCode : string ( types .HandlerErrorCodeInvalidRequest ) }, nil
144146 }
145147 // preparing model request
146148 requestBody , _ , _ := modelToRoleMappingRequest (currentModel )
@@ -175,7 +177,7 @@ func Delete(req handler.Request, prevModel *Model, currentModel *Model) (handler
175177
176178 // Check if already exist
177179 if ! isRoleMappingExists (currentModel , client ) {
178- return progressevent .GetFailedEventByCode ("Not Found" , cloudformation .HandlerErrorCodeNotFound ), nil
180+ return progressevent .GetFailedEventByCode ("Not Found" , string ( types .HandlerErrorCodeNotFound ) ), nil
179181 }
180182
181183 federationSettingsID := currentModel .FederationSettingsId
0 commit comments