Skip to content

Commit d3d88a3

Browse files
authored
fix: Add support to MongoDB::Atlas::Trigger for tolerateResumeErrors, SkipCatchupEvents and MaximumThroughput attributes (#1312)
1 parent b62298a commit d3d88a3

File tree

10 files changed

+61
-49
lines changed

10 files changed

+61
-49
lines changed

cfn-resources/go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ require (
1313
github.com/getkin/kin-openapi v0.130.0
1414
github.com/ghodss/yaml v1.0.0
1515
github.com/mongodb-forks/digest v1.1.0
16+
github.com/mongodb-labs/go-client-mongodb-atlas-app-services v1.0.0
1617
github.com/rs/xid v1.6.0
1718
github.com/spf13/cast v1.7.1
1819
github.com/stretchr/testify v1.10.0
1920
github.com/tidwall/pretty v1.2.1
2021
go.mongodb.org/atlas-sdk/v20231115002 v20231115002.1.0
2122
go.mongodb.org/atlas-sdk/v20231115014 v20231115014.0.0
2223
go.mongodb.org/atlas-sdk/v20241113004 v20241113004.1.0
23-
go.mongodb.org/realm v0.1.0
2424
)
2525

2626
require (
@@ -45,7 +45,6 @@ require (
4545
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
4646
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect
4747
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect
48-
github.com/openlyinc/pointy v1.2.0 // indirect
4948
github.com/perimeterx/marshmallow v1.1.5 // indirect
5049
github.com/pmezard/go-difflib v1.0.0 // indirect
5150
github.com/segmentio/ksuid v1.0.4 // indirect

cfn-resources/go.sum

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1
4747
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
4848
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
4949
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
50-
github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
5150
github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U=
5251
github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
5352
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
6160
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
6261
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
6362
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
64-
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
6563
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
6664
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
67-
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
68-
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
6965
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
7066
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
7167
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
@@ -74,11 +70,12 @@ github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9
7470
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
7571
github.com/mongodb-forks/digest v1.1.0 h1:7eUdsR1BtqLv0mdNm4OXs6ddWvR4X2/OsLwdKksrOoc=
7672
github.com/mongodb-forks/digest v1.1.0/go.mod h1:rb+EX8zotClD5Dj4NdgxnJXG9nwrlx3NWKJ8xttz1Dg=
73+
github.com/mongodb-labs/go-client-mongodb-atlas-app-services v1.0.0 h1:96odFUHQA0qn/7OP7L8CieQbuDhm6s2JBIvqY4suptk=
74+
github.com/mongodb-labs/go-client-mongodb-atlas-app-services v1.0.0/go.mod h1:AJpBaQM0zT9fIFib9E0GPKS0HHjS2Qm6Ti/cPJDgsJw=
7775
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 h1:G7ERwszslrBzRxj//JalHPu/3yz+De2J+4aLtSRlHiY=
7876
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037/go.mod h1:2bpvgLBZEtENV5scfDFEtB/5+1M4hkQhDQrccEJ/qGw=
7977
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 h1:bQx3WeLcUWy+RletIKwUIt4x3t8n2SxavmoclizMb8c=
8078
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o=
81-
github.com/openlyinc/pointy v1.1.2/go.mod h1:w2Sytx+0FVuMKn37xpXIAyBNhFNBIJGR/v2m7ik1WtM=
8279
github.com/openlyinc/pointy v1.2.0 h1:vbb/WoPbshyTH8j3/XYu3enlZfv+NHxAD15qTm1zbk0=
8380
github.com/openlyinc/pointy v1.2.0/go.mod h1:JodZOTJoBNaAQHeU0F/SwA4PL0lg4pKF7fYFpX291P0=
8481
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
9693
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
9794
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
9895
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
99-
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
100-
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
10196
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
10297
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
10398
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
10499
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
105100
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
106101
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
107-
go.mongodb.org/atlas v0.12.0/go.mod h1:wVCnHcm/7/IfTjEB6K8K35PLG70yGz8BdkRwX0oK9/M=
108102
go.mongodb.org/atlas v0.37.0 h1:zQnO1o5+bVP9IotpAYpres4UjMD2F4nwNEFTZhNL4ck=
109103
go.mongodb.org/atlas v0.37.0/go.mod h1:DJYtM+vsEpPEMSkQzJnFHrT0sP7ev6cseZc/GGjJYG8=
110104
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
113107
go.mongodb.org/atlas-sdk/v20231115014 v20231115014.0.0/go.mod h1:pCl46YnWOIde8lq27whXDwUseNeUvtAy3vy5ZDeTcBA=
114108
go.mongodb.org/atlas-sdk/v20241113004 v20241113004.1.0 h1:AvrgNUpVMFnqZZJo4m/Bynr0wlDWM4xjhugCSdX/7mM=
115109
go.mongodb.org/atlas-sdk/v20241113004 v20241113004.1.0/go.mod h1:CABkQ0sbsqRBXR55UwS+0rX91Dx7et0xxq4QBB6qRog=
116-
go.mongodb.org/realm v0.1.0 h1:zJiXyLaZrznQ+Pz947ziSrDKUep39DO4SfA0Fzx8M4M=
117-
go.mongodb.org/realm v0.1.0/go.mod h1:4Vj6iy+Puo1TDERcoh4XZ+pjtwbOzPpzqy3Cwe8ZmDM=
118110
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
119111
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
120112
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
121-
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
122113
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
123-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
124114
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
125115
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
126116
gopkg.in/validator.v2 v2.0.1 h1:xF0KWyGWXm/LM2G1TrEjqOu4pa6coO9AlWSf3msVfDY=
127117
gopkg.in/validator.v2 v2.0.1/go.mod h1:lIUZBlB3Im4s/eYp39Ry/wkR02yOPhZ9IwIRBjuPuG8=
128-
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
129118
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
130119
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
131120
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=

cfn-resources/trigger/cmd/resource/model.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cfn-resources/trigger/cmd/resource/resource.go

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ import (
2424
"github.com/aws-cloudformation/cloudformation-cli-go-plugin/cfn/handler"
2525
"github.com/aws/aws-sdk-go/aws"
2626
"github.com/aws/aws-sdk-go/service/cloudformation"
27+
"github.com/mongodb-labs/go-client-mongodb-atlas-app-services/appservices"
28+
2729
"github.com/mongodb/mongodbatlas-cloudformation-resources/profile"
2830
"github.com/mongodb/mongodbatlas-cloudformation-resources/util"
2931
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/constants"
3032
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/logger"
3133
progressevents "github.com/mongodb/mongodbatlas-cloudformation-resources/util/progressevent"
3234
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/validator"
33-
"go.mongodb.org/realm/realm"
3435
)
3536

3637
type TriggerType string
@@ -63,9 +64,9 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
6364
setProfileIfAbsent(currentModel)
6465

6566
ctx := context.Background()
66-
client, err := util.GetRealmClient(ctx, req, currentModel.Profile)
67+
client, err := util.GetAppServicesClient(ctx, req, currentModel.Profile)
6768
if err != nil {
68-
return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating realm client : %s", err.Error()),
69+
return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating App Services client : %s", err.Error()),
6970
cloudformation.HandlerErrorCodeInvalidRequest), nil
7071
}
7172

@@ -99,9 +100,9 @@ func Read(req handler.Request, prevModel *Model, currentModel *Model) (handler.P
99100
setProfileIfAbsent(currentModel)
100101

101102
ctx := context.Background()
102-
client, err := util.GetRealmClient(ctx, req, currentModel.Profile)
103+
client, err := util.GetAppServicesClient(ctx, req, currentModel.Profile)
103104
if err != nil {
104-
return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating realm client : %s", err.Error()),
105+
return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating App Services client : %s", err.Error()),
105106
cloudformation.HandlerErrorCodeInvalidRequest), nil
106107
}
107108

@@ -130,9 +131,9 @@ func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler
130131
setProfileIfAbsent(currentModel)
131132

132133
ctx := context.Background()
133-
client, err := util.GetRealmClient(ctx, req, currentModel.Profile)
134+
client, err := util.GetAppServicesClient(ctx, req, currentModel.Profile)
134135
if err != nil {
135-
return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating realm client : %s", err.Error()),
136+
return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating App Services client : %s", err.Error()),
136137
cloudformation.HandlerErrorCodeInvalidRequest), nil
137138
}
138139

@@ -165,9 +166,9 @@ func Delete(req handler.Request, prevModel *Model, currentModel *Model) (handler
165166
setProfileIfAbsent(currentModel)
166167

167168
ctx := context.Background()
168-
client, err := util.GetRealmClient(ctx, req, currentModel.Profile)
169+
client, err := util.GetAppServicesClient(ctx, req, currentModel.Profile)
169170
if err != nil {
170-
return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating realm client : %s", err.Error()),
171+
return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating App Services client : %s", err.Error()),
171172
cloudformation.HandlerErrorCodeInvalidRequest), nil
172173
}
173174

@@ -189,9 +190,9 @@ func List(req handler.Request, prevModel *Model, currentModel *Model) (handler.P
189190
setProfileIfAbsent(currentModel)
190191

191192
ctx := context.Background()
192-
client, err := util.GetRealmClient(ctx, req, currentModel.Profile)
193+
client, err := util.GetAppServicesClient(ctx, req, currentModel.Profile)
193194
if err != nil {
194-
return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating realm client : %s", err.Error()),
195+
return progressevents.GetFailedEventByCode(fmt.Sprintf("Error creating App Services client : %s", err.Error()),
195196
cloudformation.HandlerErrorCodeInvalidRequest), nil
196197
}
197198

@@ -213,8 +214,8 @@ func setProfileIfAbsent(model *Model) {
213214
}
214215
}
215216

216-
func newEventTrigger(model *Model) (*realm.EventTriggerRequest, error) {
217-
et := realm.EventTriggerRequest{Disabled: model.Disabled}
217+
func newEventTrigger(model *Model) (*appservices.EventTriggerRequest, error) {
218+
et := appservices.EventTriggerRequest{Disabled: model.Disabled}
218219
if model.Name != nil {
219220
et.Name = *model.Name
220221
}
@@ -224,7 +225,7 @@ func newEventTrigger(model *Model) (*realm.EventTriggerRequest, error) {
224225
if model.FunctionId != nil {
225226
et.FunctionID = *model.FunctionId
226227
}
227-
conf := realm.EventTriggerConfig{}
228+
conf := appservices.EventTriggerConfig{}
228229
if model.DatabaseTrigger != nil {
229230
conf.Database = *model.DatabaseTrigger.Database
230231
}
@@ -257,6 +258,9 @@ func newEventTrigger(model *Model) (*realm.EventTriggerRequest, error) {
257258
conf.FullDocument = dTrigger.FullDocument
258259
conf.FullDocumentBeforeChange = dTrigger.FullDocumentBeforeChange
259260
conf.Unordered = dTrigger.Unordered
261+
conf.TolerateResumeErrors = dTrigger.TolerateResumeErrors
262+
conf.SkipCatchupEvents = dTrigger.SkipCatchupEvents
263+
conf.MaximumThroughput = dTrigger.MaximumThroughput
260264
}
261265

262266
if model.ScheduleTrigger != nil &&
@@ -298,7 +302,7 @@ func newEventTrigger(model *Model) (*realm.EventTriggerRequest, error) {
298302
return &et, nil
299303
}
300304

301-
func newEventProcessor(model *Model, et realm.EventTriggerRequest) (realm.EventTriggerRequest, error) {
305+
func newEventProcessor(model *Model, et appservices.EventTriggerRequest) (appservices.EventTriggerRequest, error) {
302306
ep := EventProcess{}
303307
if model.EventProcessors.FUNCTION != nil && model.EventProcessors.FUNCTION.FuncConfig != nil {
304308
ep.FUNCTION = new(FUNC)

cfn-resources/trigger/docs/databaseconfig.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ To declare this entity in your AWS CloudFormation template, use the following sy
1818
"<a href="#fulldocumentbeforechange" title="FullDocumentBeforeChange">FullDocumentBeforeChange</a>" : <i>Boolean</i>,
1919
"<a href="#skipcatchupevents" title="SkipCatchupEvents">SkipCatchupEvents</a>" : <i>Boolean</i>,
2020
"<a href="#tolerateresumeerrors" title="TolerateResumeErrors">TolerateResumeErrors</a>" : <i>Boolean</i>,
21+
"<a href="#maximumthroughput" title="MaximumThroughput">MaximumThroughput</a>" : <i>Boolean</i>,
2122
"<a href="#unordered" title="Unordered">Unordered</a>" : <i>Boolean</i>
2223
}
2324
</pre>
@@ -36,6 +37,7 @@ To declare this entity in your AWS CloudFormation template, use the following sy
3637
<a href="#fulldocumentbeforechange" title="FullDocumentBeforeChange">FullDocumentBeforeChange</a>: <i>Boolean</i>
3738
<a href="#skipcatchupevents" title="SkipCatchupEvents">SkipCatchupEvents</a>: <i>Boolean</i>
3839
<a href="#tolerateresumeerrors" title="TolerateResumeErrors">TolerateResumeErrors</a>: <i>Boolean</i>
40+
<a href="#maximumthroughput" title="MaximumThroughput">MaximumThroughput</a>: <i>Boolean</i>
3941
<a href="#unordered" title="Unordered">Unordered</a>: <i>Boolean</i>
4042
</pre>
4143

@@ -161,6 +163,16 @@ _Type_: Boolean
161163

162164
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
163165

166+
#### MaximumThroughput
167+
168+
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).
169+
170+
_Required_: No
171+
172+
_Type_: Boolean
173+
174+
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
175+
164176
#### Unordered
165177

166178
If `true`, event ordering is disabled and this Trigger

cfn-resources/trigger/mongodb-atlas-trigger.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@
146146
"default": false,
147147
"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."
148148
},
149+
"MaximumThroughput": {
150+
"type": "boolean",
151+
"default": false,
152+
"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)."
153+
},
149154
"Unordered": {
150155
"type": "boolean",
151156
"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."

cfn-resources/trigger/test/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ The following components use this resource and are potentially impacted by any c
1212
All these resources need to be manually provided. Follow the steps below.
1313
- Atlas project (PROJECT_ID)
1414
- Atlas Cluster loaded with database and a collection (DB_NAME,COLLECTION_NAME)
15-
- Realm App (APP_ID)
16-
- Realm Service (SERVICE_ID)
15+
- App Services App (APP_ID)
16+
- App Services Service (SERVICE_ID)
1717
- Atlas Function (FUNC_NAME,FUNC_ID)
1818

1919

cfn-resources/trigger/test/inputs_1_create.template.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
"FullDocument": "true",
1313
"FullDocumentBeforeChange": "false",
1414
"Unordered": "false",
15-
"SkipCatchupEvents": "false",
16-
"Match" : "{\"$and\":[{\"fullDocument.availability.value\":\"AVAILABLE\"},{\"$ne\":[\"fullDocument.retailPrice\",\"fullDocumentBeforeChange.retailPrice\"]}]}"
15+
"SkipCatchupEvents": "true",
16+
"TolerateResumeErrors": "true",
17+
"Match": "{\"$and\":[{\"fullDocument.availability.value\":\"AVAILABLE\"},{\"$ne\":[\"fullDocument.retailPrice\",\"fullDocumentBeforeChange.retailPrice\"]}]}"
1718
},
1819
"Disabled": "false",
1920
"EventProcessors": {

cfn-resources/trigger/test/inputs_1_update.template.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"FullDocumentBeforeChange": "false",
1414
"Unordered": "false",
1515
"SkipCatchupEvents": "false",
16-
"Match" : "{\"$and\":[{\"fullDocument.availability.value\":\"AVAILABLE\"},{\"$ne\":[\"fullDocument.retailPrice\",\"fullDocumentBeforeChange.retailPrice\"]}]}"
16+
"MaximumThroughput": "true",
17+
"Match": "{\"$and\":[{\"fullDocument.availability.value\":\"AVAILABLE\"},{\"$ne\":[\"fullDocument.retailPrice\",\"fullDocumentBeforeChange.retailPrice\"]}]}"
1718
},
1819
"Disabled": "false",
1920
"EventProcessors": {

cfn-resources/util/util.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import (
2929
admin20231115002 "go.mongodb.org/atlas-sdk/v20231115002/admin"
3030
admin20231115014 "go.mongodb.org/atlas-sdk/v20231115014/admin"
3131
"go.mongodb.org/atlas-sdk/v20241113004/admin"
32-
realmAuth "go.mongodb.org/realm/auth"
33-
"go.mongodb.org/realm/realm"
3432

3533
"github.com/aws-cloudformation/cloudformation-cli-go-plugin/cfn/handler"
3634
"github.com/aws-cloudformation/cloudformation-cli-go-plugin/cfn/logging"
@@ -39,6 +37,8 @@ import (
3937
"github.com/aws/aws-sdk-go/service/cloudformation"
4038
"github.com/aws/aws-sdk-go/service/ssm"
4139
"github.com/mongodb-forks/digest"
40+
"github.com/mongodb-labs/go-client-mongodb-atlas-app-services/appservices"
41+
appServicesAuth "github.com/mongodb-labs/go-client-mongodb-atlas-app-services/auth"
4242

4343
"github.com/mongodb/mongodbatlas-cloudformation-resources/profile"
4444
"github.com/mongodb/mongodbatlas-cloudformation-resources/util/logger"
@@ -59,12 +59,12 @@ type MongoDBClient struct {
5959
}
6060

6161
type Config struct {
62-
AssumeRole *AssumeRole
63-
PublicKey string
64-
PrivateKey string
65-
BaseURL string
66-
RealmBaseURL string
67-
DebugClient bool
62+
AssumeRole *AssumeRole
63+
PublicKey string
64+
PrivateKey string
65+
BaseURL string
66+
AppServicesBaseURL string
67+
DebugClient bool
6868
}
6969

7070
type AssumeRole struct {
@@ -101,26 +101,26 @@ func EnsureAWSRegion(region string) string {
101101
return r
102102
}
103103

104-
func GetRealmClient(ctx context.Context, req handler.Request, profileName *string) (*realm.Client, error) {
104+
func GetAppServicesClient(ctx context.Context, req handler.Request, profileName *string) (*appservices.Client, error) {
105105
p, err := profile.NewProfile(&req, profileName, true)
106106
if err != nil {
107107
return nil, err
108108
}
109109

110-
optsRealm := []realm.ClientOpt{realm.SetUserAgent(userAgent)}
111-
authConfig := realmAuth.NewConfig(nil)
110+
optsAppServices := []appservices.ClientOpt{appservices.SetUserAgent(userAgent)}
111+
authConfig := appServicesAuth.NewConfig(nil)
112112
token, err := authConfig.NewTokenFromCredentials(ctx, p.PublicKey, p.PrivateKey)
113113
if err != nil {
114114
return nil, err
115115
}
116116

117-
clientRealm := realmAuth.NewClient(realmAuth.BasicTokenSource(token))
118-
realmClient, err := realm.New(clientRealm, optsRealm...)
117+
clientAppServices := appServicesAuth.NewClient(appServicesAuth.BasicTokenSource(token))
118+
appServicesClient, err := appservices.New(clientAppServices, optsAppServices...)
119119
if err != nil {
120120
return nil, err
121121
}
122122

123-
return realmClient, nil
123+
return appServicesClient, nil
124124
}
125125

126126
func NewAtlasClient(req *handler.Request, profileName *string) (*MongoDBClient, *handler.ProgressEvent) {

0 commit comments

Comments
 (0)