@@ -25,7 +25,7 @@ import (
2525 log "github.com/mongodb/mongodbatlas-cloudformation-resources/util/logger"
2626 "github.com/mongodb/mongodbatlas-cloudformation-resources/util/progressevent"
2727 "github.com/mongodb/mongodbatlas-cloudformation-resources/util/validator"
28- "go.mongodb.org/atlas-sdk/v20231115002 /admin"
28+ "go.mongodb.org/atlas-sdk/v20250312005 /admin"
2929)
3030
3131var RequiredFields = []string {constants .IntegrationType , constants .ProjectID }
@@ -76,7 +76,7 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
7676 }
7777
7878 requestBody := modelToIntegration (currentModel )
79- integrations , resModel , err := client .Atlas20231115002 .ThirdPartyIntegrationsApi .CreateThirdPartyIntegration (context .Background (), * IntegrationType , * ProjectID , requestBody ).Execute ()
79+ integrations , resModel , err := client .AtlasSDK .ThirdPartyIntegrationsApi .CreateThirdPartyIntegration (context .Background (), * IntegrationType , * ProjectID , requestBody ).Execute ()
8080 if err != nil {
8181 if apiError , ok := admin .AsError (err ); ok && * apiError .Error == http .StatusConflict {
8282 return progressevent .GetFailedEventByCode ("INTEGRATION_ALREADY_CONFIGURED." , cloudformation .HandlerErrorCodeAlreadyExists ), nil
@@ -108,7 +108,7 @@ func Read(req handler.Request, prevModel *Model, currentModel *Model) (handler.P
108108 ProjectID := currentModel .ProjectId
109109 IntegrationType := currentModel .Type
110110
111- integration , res , err := client .Atlas20231115002 .ThirdPartyIntegrationsApi .GetThirdPartyIntegration (context .Background (), * ProjectID , * IntegrationType ).Execute ()
111+ integration , res , err := client .AtlasSDK .ThirdPartyIntegrationsApi .GetThirdPartyIntegration (context .Background (), * ProjectID , * IntegrationType ).Execute ()
112112
113113 if err != nil {
114114 return progressevent .GetFailedEventByResponse (err .Error (), res ), nil
@@ -139,13 +139,13 @@ func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler
139139 ProjectID := currentModel .ProjectId
140140 IntegrationType := currentModel .Type
141141
142- integration , res , err := client .Atlas20231115002 .ThirdPartyIntegrationsApi .GetThirdPartyIntegration (context .Background (), * ProjectID , * IntegrationType ).Execute ()
142+ integration , res , err := client .AtlasSDK .ThirdPartyIntegrationsApi .GetThirdPartyIntegration (context .Background (), * ProjectID , * IntegrationType ).Execute ()
143143 if err != nil {
144144 return progressevent .GetFailedEventByResponse (err .Error (), res ), nil
145145 }
146146
147147 updateIntegrationFromSchema (currentModel , integration )
148- integrations , res , err := client .Atlas20231115002 .ThirdPartyIntegrationsApi .UpdateThirdPartyIntegration (context .Background (), * IntegrationType , * ProjectID , integration ).Execute ()
148+ integrations , res , err := client .AtlasSDK .ThirdPartyIntegrationsApi .UpdateThirdPartyIntegration (context .Background (), * IntegrationType , * ProjectID , integration ).Execute ()
149149 if err != nil {
150150 return progressevent .GetFailedEventByResponse (err .Error (), res ), nil
151151 }
@@ -156,7 +156,7 @@ func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler
156156 }, nil
157157}
158158
159- func updateIntegrationFromSchema (currentModel * Model , integration * admin.ThridPartyIntegration ) {
159+ func updateIntegrationFromSchema (currentModel * Model , integration * admin.ThirdPartyIntegration ) {
160160 if util .IsStringPresent (currentModel .Url ) && ! util .AreStringPtrEqual (currentModel .Url , integration .Url ) {
161161 integration .Url = currentModel .Url
162162 }
@@ -196,12 +196,13 @@ func updateIntegrationFromSchema(currentModel *Model, integration *admin.ThridPa
196196 if util .IsStringPresent (currentModel .ServiceDiscovery ) && ! util .AreStringPtrEqual (currentModel .ServiceDiscovery , integration .ServiceDiscovery ) {
197197 integration .ServiceDiscovery = currentModel .ServiceDiscovery
198198 }
199- if util .IsStringPresent (currentModel .Scheme ) && ! util .AreStringPtrEqual (currentModel .Scheme , integration .Scheme ) {
200- integration .Scheme = currentModel .Scheme
201- }
202199 if currentModel .Enabled != nil && currentModel .Enabled != integration .Enabled {
203200 integration .Enabled = currentModel .Enabled
204201 }
202+
203+ if currentModel .SendUserProvidedResourceTags != nil {
204+ integration .SendUserProvidedResourceTags = currentModel .SendUserProvidedResourceTags
205+ }
205206}
206207
207208func Delete (req handler.Request , prevModel * Model , currentModel * Model ) (handler.ProgressEvent , error ) {
@@ -223,7 +224,7 @@ func Delete(req handler.Request, prevModel *Model, currentModel *Model) (handler
223224 ProjectID := currentModel .ProjectId
224225 IntegrationType := currentModel .Type
225226
226- _ , res , err = client .Atlas20231115002 .ThirdPartyIntegrationsApi .DeleteThirdPartyIntegration (context .Background (), * IntegrationType , * ProjectID ).Execute ()
227+ res , err = client .AtlasSDK .ThirdPartyIntegrationsApi .DeleteThirdPartyIntegration (context .Background (), * IntegrationType , * ProjectID ).Execute ()
227228
228229 if err != nil {
229230 return progressevent .GetFailedEventByResponse (err .Error (), res ), nil
@@ -251,7 +252,7 @@ func List(req handler.Request, prevModel *Model, currentModel *Model) (handler.P
251252
252253 var res * http.Response
253254 ProjectID := currentModel .ProjectId
254- integrations , res , err := client .Atlas20231115002 .ThirdPartyIntegrationsApi .ListThirdPartyIntegrations (context .Background (), * ProjectID ).Execute ()
255+ integrations , res , err := client .AtlasSDK .ThirdPartyIntegrationsApi .ListThirdPartyIntegrations (context .Background (), * ProjectID ).Execute ()
255256 if err != nil {
256257 return progressevent .GetFailedEventByResponse (err .Error (), res ), nil
257258 }
@@ -270,18 +271,15 @@ func List(req handler.Request, prevModel *Model, currentModel *Model) (handler.P
270271 }, nil
271272}
272273
273- func modelToIntegration (currentModel * Model ) (out * admin.ThridPartyIntegration ) {
274- out = & admin.ThridPartyIntegration {}
274+ func modelToIntegration (currentModel * Model ) (out * admin.ThirdPartyIntegration ) {
275+ out = & admin.ThirdPartyIntegration {}
275276
276277 if util .IsStringPresent (currentModel .Type ) {
277278 out .Type = currentModel .Type
278279 }
279280 if currentModel .Enabled != nil {
280281 out .Enabled = currentModel .Enabled
281282 }
282- if util .IsStringPresent (currentModel .Scheme ) {
283- out .Scheme = currentModel .Scheme
284- }
285283 if util .IsStringPresent (currentModel .ServiceDiscovery ) {
286284 out .ServiceDiscovery = currentModel .ServiceDiscovery
287285 }
@@ -322,10 +320,13 @@ func modelToIntegration(currentModel *Model) (out *admin.ThridPartyIntegration)
322320 out .ApiKey = currentModel .ApiKey
323321 }
324322
323+ if currentModel .SendUserProvidedResourceTags != nil {
324+ out .SendUserProvidedResourceTags = currentModel .SendUserProvidedResourceTags
325+ }
325326 return out
326327}
327328
328- func integrationToModel (currentModel Model , integration * admin.ThridPartyIntegration ) Model {
329+ func integrationToModel (currentModel Model , integration * admin.ThirdPartyIntegration ) Model {
329330 // if "Enabled" is not set in the inputs we dont want to return "Enabled" in outputs
330331 enabled := currentModel .Enabled != nil
331332
@@ -341,5 +342,6 @@ func integrationToModel(currentModel Model, integration *admin.ThridPartyIntegra
341342 if ! enabled {
342343 out .Enabled = nil
343344 }
345+
344346 return out
345347}
0 commit comments