diff --git a/cfn-resources/go.mod b/cfn-resources/go.mod index 3565dcfc8..339133765 100644 --- a/cfn-resources/go.mod +++ b/cfn-resources/go.mod @@ -13,6 +13,7 @@ require ( github.com/getkin/kin-openapi v0.130.0 github.com/ghodss/yaml v1.0.0 github.com/mongodb-forks/digest v1.1.0 + github.com/mongodb-labs/go-client-mongodb-atlas-app-services v1.0.0 github.com/rs/xid v1.6.0 github.com/spf13/cast v1.7.1 github.com/stretchr/testify v1.10.0 @@ -20,7 +21,6 @@ require ( go.mongodb.org/atlas-sdk/v20231115002 v20231115002.1.0 go.mongodb.org/atlas-sdk/v20231115014 v20231115014.0.0 go.mongodb.org/atlas-sdk/v20241113004 v20241113004.1.0 - go.mongodb.org/realm v0.1.0 ) require ( @@ -45,7 +45,6 @@ require ( github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect - github.com/openlyinc/pointy v1.2.0 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/segmentio/ksuid v1.0.4 // indirect diff --git a/cfn-resources/go.sum b/cfn-resources/go.sum index 520b12b0e..450519e0a 100644 --- a/cfn-resources/go.sum +++ b/cfn-resources/go.sum @@ -47,7 +47,6 @@ github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1 github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= -github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8= github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -61,11 +60,8 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= @@ -74,11 +70,12 @@ github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= github.com/mongodb-forks/digest v1.1.0 h1:7eUdsR1BtqLv0mdNm4OXs6ddWvR4X2/OsLwdKksrOoc= github.com/mongodb-forks/digest v1.1.0/go.mod h1:rb+EX8zotClD5Dj4NdgxnJXG9nwrlx3NWKJ8xttz1Dg= +github.com/mongodb-labs/go-client-mongodb-atlas-app-services v1.0.0 h1:96odFUHQA0qn/7OP7L8CieQbuDhm6s2JBIvqY4suptk= +github.com/mongodb-labs/go-client-mongodb-atlas-app-services v1.0.0/go.mod h1:AJpBaQM0zT9fIFib9E0GPKS0HHjS2Qm6Ti/cPJDgsJw= github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 h1:G7ERwszslrBzRxj//JalHPu/3yz+De2J+4aLtSRlHiY= github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037/go.mod h1:2bpvgLBZEtENV5scfDFEtB/5+1M4hkQhDQrccEJ/qGw= github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 h1:bQx3WeLcUWy+RletIKwUIt4x3t8n2SxavmoclizMb8c= github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o= -github.com/openlyinc/pointy v1.1.2/go.mod h1:w2Sytx+0FVuMKn37xpXIAyBNhFNBIJGR/v2m7ik1WtM= github.com/openlyinc/pointy v1.2.0 h1:vbb/WoPbshyTH8j3/XYu3enlZfv+NHxAD15qTm1zbk0= github.com/openlyinc/pointy v1.2.0/go.mod h1:JodZOTJoBNaAQHeU0F/SwA4PL0lg4pKF7fYFpX291P0= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= @@ -96,15 +93,12 @@ github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cA github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= -go.mongodb.org/atlas v0.12.0/go.mod h1:wVCnHcm/7/IfTjEB6K8K35PLG70yGz8BdkRwX0oK9/M= go.mongodb.org/atlas v0.37.0 h1:zQnO1o5+bVP9IotpAYpres4UjMD2F4nwNEFTZhNL4ck= go.mongodb.org/atlas v0.37.0/go.mod h1:DJYtM+vsEpPEMSkQzJnFHrT0sP7ev6cseZc/GGjJYG8= go.mongodb.org/atlas-sdk/v20231115002 v20231115002.1.0 h1:x6nnq2pUIP9mN4WLD4/EseBzV88OmSgexxYchPilgno= @@ -113,19 +107,14 @@ go.mongodb.org/atlas-sdk/v20231115014 v20231115014.0.0 h1:hN7x3m6THf03q/tE48up1j go.mongodb.org/atlas-sdk/v20231115014 v20231115014.0.0/go.mod h1:pCl46YnWOIde8lq27whXDwUseNeUvtAy3vy5ZDeTcBA= go.mongodb.org/atlas-sdk/v20241113004 v20241113004.1.0 h1:AvrgNUpVMFnqZZJo4m/Bynr0wlDWM4xjhugCSdX/7mM= go.mongodb.org/atlas-sdk/v20241113004 v20241113004.1.0/go.mod h1:CABkQ0sbsqRBXR55UwS+0rX91Dx7et0xxq4QBB6qRog= -go.mongodb.org/realm v0.1.0 h1:zJiXyLaZrznQ+Pz947ziSrDKUep39DO4SfA0Fzx8M4M= -go.mongodb.org/realm v0.1.0/go.mod h1:4Vj6iy+Puo1TDERcoh4XZ+pjtwbOzPpzqy3Cwe8ZmDM= golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/validator.v2 v2.0.1 h1:xF0KWyGWXm/LM2G1TrEjqOu4pa6coO9AlWSf3msVfDY= gopkg.in/validator.v2 v2.0.1/go.mod h1:lIUZBlB3Im4s/eYp39Ry/wkR02yOPhZ9IwIRBjuPuG8= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/cfn-resources/trigger/cmd/resource/model.go b/cfn-resources/trigger/cmd/resource/model.go index 1ec56bb15..9e3238ba6 100644 --- a/cfn-resources/trigger/cmd/resource/model.go +++ b/cfn-resources/trigger/cmd/resource/model.go @@ -31,6 +31,7 @@ type DatabaseConfig struct { FullDocumentBeforeChange *bool `json:",omitempty"` SkipCatchupEvents *bool `json:",omitempty"` TolerateResumeErrors *bool `json:",omitempty"` + MaximumThroughput *bool `json:",omitempty"` Unordered *bool `json:",omitempty"` } diff --git a/cfn-resources/trigger/cmd/resource/resource.go b/cfn-resources/trigger/cmd/resource/resource.go index 183e988fc..f948edf87 100644 --- a/cfn-resources/trigger/cmd/resource/resource.go +++ b/cfn-resources/trigger/cmd/resource/resource.go @@ -24,13 +24,14 @@ import ( "github.com/aws-cloudformation/cloudformation-cli-go-plugin/cfn/handler" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/cloudformation" + "github.com/mongodb-labs/go-client-mongodb-atlas-app-services/appservices" + "github.com/mongodb/mongodbatlas-cloudformation-resources/profile" "github.com/mongodb/mongodbatlas-cloudformation-resources/util" "github.com/mongodb/mongodbatlas-cloudformation-resources/util/constants" "github.com/mongodb/mongodbatlas-cloudformation-resources/util/logger" progressevents "github.com/mongodb/mongodbatlas-cloudformation-resources/util/progressevent" "github.com/mongodb/mongodbatlas-cloudformation-resources/util/validator" - "go.mongodb.org/realm/realm" ) type TriggerType string @@ -63,9 +64,9 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler setProfileIfAbsent(currentModel) ctx := context.Background() - client, err := util.GetRealmClient(ctx, req, currentModel.Profile) + client, err := util.GetAppServicesClient(ctx, req, currentModel.Profile) if err != nil { - return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating realm client : %s", err.Error()), + return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating App Services client : %s", err.Error()), cloudformation.HandlerErrorCodeInvalidRequest), nil } @@ -99,9 +100,9 @@ func Read(req handler.Request, prevModel *Model, currentModel *Model) (handler.P setProfileIfAbsent(currentModel) ctx := context.Background() - client, err := util.GetRealmClient(ctx, req, currentModel.Profile) + client, err := util.GetAppServicesClient(ctx, req, currentModel.Profile) if err != nil { - return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating realm client : %s", err.Error()), + return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating App Services client : %s", err.Error()), cloudformation.HandlerErrorCodeInvalidRequest), nil } @@ -130,9 +131,9 @@ func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler setProfileIfAbsent(currentModel) ctx := context.Background() - client, err := util.GetRealmClient(ctx, req, currentModel.Profile) + client, err := util.GetAppServicesClient(ctx, req, currentModel.Profile) if err != nil { - return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating realm client : %s", err.Error()), + return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating App Services client : %s", err.Error()), cloudformation.HandlerErrorCodeInvalidRequest), nil } @@ -165,9 +166,9 @@ func Delete(req handler.Request, prevModel *Model, currentModel *Model) (handler setProfileIfAbsent(currentModel) ctx := context.Background() - client, err := util.GetRealmClient(ctx, req, currentModel.Profile) + client, err := util.GetAppServicesClient(ctx, req, currentModel.Profile) if err != nil { - return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating realm client : %s", err.Error()), + return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating App Services client : %s", err.Error()), cloudformation.HandlerErrorCodeInvalidRequest), nil } @@ -189,9 +190,9 @@ func List(req handler.Request, prevModel *Model, currentModel *Model) (handler.P setProfileIfAbsent(currentModel) ctx := context.Background() - client, err := util.GetRealmClient(ctx, req, currentModel.Profile) + client, err := util.GetAppServicesClient(ctx, req, currentModel.Profile) if err != nil { - return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating realm client : %s", err.Error()), + return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating App Services client : %s", err.Error()), cloudformation.HandlerErrorCodeInvalidRequest), nil } @@ -213,8 +214,8 @@ func setProfileIfAbsent(model *Model) { } } -func newEventTrigger(model *Model) (*realm.EventTriggerRequest, error) { - et := realm.EventTriggerRequest{Disabled: model.Disabled} +func newEventTrigger(model *Model) (*appservices.EventTriggerRequest, error) { + et := appservices.EventTriggerRequest{Disabled: model.Disabled} if model.Name != nil { et.Name = *model.Name } @@ -224,7 +225,7 @@ func newEventTrigger(model *Model) (*realm.EventTriggerRequest, error) { if model.FunctionId != nil { et.FunctionID = *model.FunctionId } - conf := realm.EventTriggerConfig{} + conf := appservices.EventTriggerConfig{} if model.DatabaseTrigger != nil { conf.Database = *model.DatabaseTrigger.Database } @@ -257,6 +258,9 @@ func newEventTrigger(model *Model) (*realm.EventTriggerRequest, error) { conf.FullDocument = dTrigger.FullDocument conf.FullDocumentBeforeChange = dTrigger.FullDocumentBeforeChange conf.Unordered = dTrigger.Unordered + conf.TolerateResumeErrors = dTrigger.TolerateResumeErrors + conf.SkipCatchupEvents = dTrigger.SkipCatchupEvents + conf.MaximumThroughput = dTrigger.MaximumThroughput } if model.ScheduleTrigger != nil && @@ -298,7 +302,7 @@ func newEventTrigger(model *Model) (*realm.EventTriggerRequest, error) { return &et, nil } -func newEventProcessor(model *Model, et realm.EventTriggerRequest) (realm.EventTriggerRequest, error) { +func newEventProcessor(model *Model, et appservices.EventTriggerRequest) (appservices.EventTriggerRequest, error) { ep := EventProcess{} if model.EventProcessors.FUNCTION != nil && model.EventProcessors.FUNCTION.FuncConfig != nil { ep.FUNCTION = new(FUNC) diff --git a/cfn-resources/trigger/docs/databaseconfig.md b/cfn-resources/trigger/docs/databaseconfig.md index 789f268eb..7a7331ee5 100644 --- a/cfn-resources/trigger/docs/databaseconfig.md +++ b/cfn-resources/trigger/docs/databaseconfig.md @@ -18,6 +18,7 @@ To declare this entity in your AWS CloudFormation template, use the following sy "FullDocumentBeforeChange" : Boolean, "SkipCatchupEvents" : Boolean, "TolerateResumeErrors" : Boolean, + "MaximumThroughput" : Boolean, "Unordered" : Boolean } @@ -36,6 +37,7 @@ To declare this entity in your AWS CloudFormation template, use the following sy FullDocumentBeforeChange: Boolean SkipCatchupEvents: Boolean TolerateResumeErrors: Boolean +MaximumThroughput: Boolean Unordered: Boolean @@ -161,6 +163,16 @@ _Type_: Boolean _Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) +#### MaximumThroughput + +If `true`, the trigger will use the maximize throughput option (https://www.mongodb.com/docs/atlas/app-services/triggers/database-triggers/#std-label-triggers-maximum-throughput). + +_Required_: No + +_Type_: Boolean + +_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) + #### Unordered If `true`, event ordering is disabled and this Trigger diff --git a/cfn-resources/trigger/mongodb-atlas-trigger.json b/cfn-resources/trigger/mongodb-atlas-trigger.json index c1aca5dc0..617a7b28d 100644 --- a/cfn-resources/trigger/mongodb-atlas-trigger.json +++ b/cfn-resources/trigger/mongodb-atlas-trigger.json @@ -146,6 +146,11 @@ "default": false, "description": "If `true`, when this Trigger's resume token\ncannot be found in the cluster's oplog, the Trigger automatically resumes\nprocessing events at the next relevant change stream event.\nAll change stream events from when the Trigger was suspended until the Trigger\nresumes execution do not have the Trigger fire for them." }, + "MaximumThroughput": { + "type": "boolean", + "default": false, + "description": "If `true`, the trigger will use the maximize throughput option (https://www.mongodb.com/docs/atlas/app-services/triggers/database-triggers/#std-label-triggers-maximum-throughput)." + }, "Unordered": { "type": "boolean", "description": "If `true`, event ordering is disabled and this Trigger\ncan process events in parallel. If `false`, event\nordering is enabled and the Trigger executes events\nserially." diff --git a/cfn-resources/trigger/test/README.md b/cfn-resources/trigger/test/README.md index dee643574..d01c6fcda 100644 --- a/cfn-resources/trigger/test/README.md +++ b/cfn-resources/trigger/test/README.md @@ -12,8 +12,8 @@ The following components use this resource and are potentially impacted by any c All these resources need to be manually provided. Follow the steps below. - Atlas project (PROJECT_ID) - Atlas Cluster loaded with database and a collection (DB_NAME,COLLECTION_NAME) -- Realm App (APP_ID) -- Realm Service (SERVICE_ID) +- App Services App (APP_ID) +- App Services Service (SERVICE_ID) - Atlas Function (FUNC_NAME,FUNC_ID) diff --git a/cfn-resources/trigger/test/inputs_1_create.template.json b/cfn-resources/trigger/test/inputs_1_create.template.json index 100237fe3..b7ff5ef4c 100644 --- a/cfn-resources/trigger/test/inputs_1_create.template.json +++ b/cfn-resources/trigger/test/inputs_1_create.template.json @@ -12,8 +12,9 @@ "FullDocument": "true", "FullDocumentBeforeChange": "false", "Unordered": "false", - "SkipCatchupEvents": "false", - "Match" : "{\"$and\":[{\"fullDocument.availability.value\":\"AVAILABLE\"},{\"$ne\":[\"fullDocument.retailPrice\",\"fullDocumentBeforeChange.retailPrice\"]}]}" + "SkipCatchupEvents": "true", + "TolerateResumeErrors": "true", + "Match": "{\"$and\":[{\"fullDocument.availability.value\":\"AVAILABLE\"},{\"$ne\":[\"fullDocument.retailPrice\",\"fullDocumentBeforeChange.retailPrice\"]}]}" }, "Disabled": "false", "EventProcessors": { diff --git a/cfn-resources/trigger/test/inputs_1_update.template.json b/cfn-resources/trigger/test/inputs_1_update.template.json index 100237fe3..393959ed8 100644 --- a/cfn-resources/trigger/test/inputs_1_update.template.json +++ b/cfn-resources/trigger/test/inputs_1_update.template.json @@ -13,7 +13,8 @@ "FullDocumentBeforeChange": "false", "Unordered": "false", "SkipCatchupEvents": "false", - "Match" : "{\"$and\":[{\"fullDocument.availability.value\":\"AVAILABLE\"},{\"$ne\":[\"fullDocument.retailPrice\",\"fullDocumentBeforeChange.retailPrice\"]}]}" + "MaximumThroughput": "true", + "Match": "{\"$and\":[{\"fullDocument.availability.value\":\"AVAILABLE\"},{\"$ne\":[\"fullDocument.retailPrice\",\"fullDocumentBeforeChange.retailPrice\"]}]}" }, "Disabled": "false", "EventProcessors": { diff --git a/cfn-resources/util/util.go b/cfn-resources/util/util.go index d376c8b6f..90e3e87e2 100644 --- a/cfn-resources/util/util.go +++ b/cfn-resources/util/util.go @@ -29,8 +29,6 @@ import ( admin20231115002 "go.mongodb.org/atlas-sdk/v20231115002/admin" admin20231115014 "go.mongodb.org/atlas-sdk/v20231115014/admin" "go.mongodb.org/atlas-sdk/v20241113004/admin" - realmAuth "go.mongodb.org/realm/auth" - "go.mongodb.org/realm/realm" "github.com/aws-cloudformation/cloudformation-cli-go-plugin/cfn/handler" "github.com/aws-cloudformation/cloudformation-cli-go-plugin/cfn/logging" @@ -39,6 +37,8 @@ import ( "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/aws/aws-sdk-go/service/ssm" "github.com/mongodb-forks/digest" + "github.com/mongodb-labs/go-client-mongodb-atlas-app-services/appservices" + appServicesAuth "github.com/mongodb-labs/go-client-mongodb-atlas-app-services/auth" "github.com/mongodb/mongodbatlas-cloudformation-resources/profile" "github.com/mongodb/mongodbatlas-cloudformation-resources/util/logger" @@ -59,12 +59,12 @@ type MongoDBClient struct { } type Config struct { - AssumeRole *AssumeRole - PublicKey string - PrivateKey string - BaseURL string - RealmBaseURL string - DebugClient bool + AssumeRole *AssumeRole + PublicKey string + PrivateKey string + BaseURL string + AppServicesBaseURL string + DebugClient bool } type AssumeRole struct { @@ -101,26 +101,26 @@ func EnsureAWSRegion(region string) string { return r } -func GetRealmClient(ctx context.Context, req handler.Request, profileName *string) (*realm.Client, error) { +func GetAppServicesClient(ctx context.Context, req handler.Request, profileName *string) (*appservices.Client, error) { p, err := profile.NewProfile(&req, profileName, true) if err != nil { return nil, err } - optsRealm := []realm.ClientOpt{realm.SetUserAgent(userAgent)} - authConfig := realmAuth.NewConfig(nil) + optsAppServices := []appservices.ClientOpt{appservices.SetUserAgent(userAgent)} + authConfig := appServicesAuth.NewConfig(nil) token, err := authConfig.NewTokenFromCredentials(ctx, p.PublicKey, p.PrivateKey) if err != nil { return nil, err } - clientRealm := realmAuth.NewClient(realmAuth.BasicTokenSource(token)) - realmClient, err := realm.New(clientRealm, optsRealm...) + clientAppServices := appServicesAuth.NewClient(appServicesAuth.BasicTokenSource(token)) + appServicesClient, err := appservices.New(clientAppServices, optsAppServices...) if err != nil { return nil, err } - return realmClient, nil + return appServicesClient, nil } func NewAtlasClient(req *handler.Request, profileName *string) (*MongoDBClient, *handler.ProgressEvent) {