Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cfn-resources/trigger/mongodb-atlas-trigger.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
"EventProcessors": {
"type": "object",
"$ref": "#/definitions/Event",
"description": "An object where each field name is an event processor ID and\neach value is an object that configures its corresponding\nevent processor. For an example configuration object, see\n[Send Trigger Events to AWS\nEventBridge](https://www.mongodb.com/docs/realm/triggers/examples/send-events-aws-eventbridge#std-label-event_processor_example)."
"description": "An object where each field name is an event processor ID and\neach value is an object that configures its corresponding\nevent processor. For an example configuration object, see\n[Send Trigger Events to AWS\nEventBridge](https://www.mongodb.com/docs/atlas/app-services/triggers/aws-eventbridge/#std-label-event_processor_example)."
},
"AppId": {
"type": "string",
Expand Down
12 changes: 6 additions & 6 deletions cfn-resources/trigger/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ All these resources need to be manually provided. Follow the steps below.

### Prerequisite steps:

This guide will help you set up your MongoDB Realm configuration for testing a trigger resource.
This guide will help you set up your MongoDB App Services configuration for testing a trigger resource.
You'll define properties and create essential components such as a project, application, service, and function.

Required Properties:
Expand Down Expand Up @@ -49,7 +49,7 @@ we are going to use the application service provided by atlas, in order to use t
with this CURL:
``` bash
curl --request POST \
--url https://realm.mongodb.com/api/admin/v3.0/auth/providers/mongodb-cloud/login \
--url https://services.cloud.mongodb.com/api/admin/v3.0/auth/providers/mongodb-cloud/login \
--header 'Accept: application json' \
--header 'Content-Type: application/json' \
--data '{"username": {your pub key}, "apiKey": {your pvt key}}'
Expand All @@ -60,13 +60,13 @@ this will throw an "access_token" we need to save this access token because we w
Before creating a new app we should validate if our project already contains an app:
``` bash
curl --request GET \
--url https://realm.mongodb.com/api/admin/v3.0/groups/64bad960538ae76ec5c70050/apps \
--url https://services.cloud.mongodb.com/api/admin/v3.0/groups/64bad960538ae76ec5c70050/apps \
--header 'Authorization: Bearer {Your Access Token}'
```
if not we can create a new one with this Curl:
``` bash
curl --request POST \
--url https://realm.mongodb.com/api/admin/v3.0/groups/650e24611a33225d7e9b90d5/apps \
--url https://services.cloud.mongodb.com/api/admin/v3.0/groups/650e24611a33225d7e9b90d5/apps \
--header 'Authorization: Bearer {Your access token}' \
--header 'Content-Type: application/json' \
--data '{
Expand Down Expand Up @@ -95,7 +95,7 @@ APP_ID: Application Identifier.
to create a service we need to use the next curl:
```
curl --request POST \
--url https://realm.mongodb.com/api/admin/v3.0/groups/64bad960538ae76ec5c70050/apps/64c00d91250e0ebe36dc6bc6/services \
--url https://services.cloud.mongodb.com/api/admin/v3.0/groups/64bad960538ae76ec5c70050/apps/64c00d91250e0ebe36dc6bc6/services \
--header 'Authorization: Bearer HERE_THE_access_token' \
--header 'Content-Type: application/json' \
--data '{
Expand All @@ -114,7 +114,7 @@ we can extract the SERVICE_ID from this result
finally we require a Function we can use the next curl call:
```
curl --request POST \
--url https://realm.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appid}/functions \
--url https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appid}/functions \
--header 'Authorization: Bearer HERE_THE_access_token' \
--header 'Content-Type: application/json' \
--data '{
Expand Down
12 changes: 6 additions & 6 deletions cfn-resources/trigger/test/inputs_1_create.template.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"Name": "cfn-test-trigger-${RANDOM_INT_100K}",
"Type": "DATABASE",
"Profile": "${MONGODB_ATLAS_PROFILE}",
"Profile": "default",
"DatabaseTrigger": {
"OperationTypes": [
"INSERT"
],
"Database": "store",
"Collection": "sales",
"ServiceId": "${MONGODB_REALM_SERVICE_ID}",
"ServiceId": "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can tests work without ServiceId and FunctionId?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They can't but the test script does replace these values with the set env vars (similar to other tests). Removing these from the JSON because I found these placeholders confusing

"FullDocument": "true",
"FullDocumentBeforeChange": "false",
"Unordered": "false",
Expand All @@ -20,14 +20,14 @@
"EventProcessors": {
"FUNCTION": {
"FuncConfig": {
"FunctionName": "${MONGODB_REALM_FUNCTION_NAME}",
"FunctionId": "${MONGODB_REALM_FUNCTION_ID}"
"FunctionName": "",
"FunctionId": ""
}
},
"AWSEVENTBRIDGE": {
"AWSConfig": {}
}
},
"AppId": "${MONGODB_REALM_APP_ID}",
"ProjectId": "${MONGODB_ATLAS_PROJECT_ID}"
"AppId": "",
"ProjectId": ""
}
12 changes: 6 additions & 6 deletions cfn-resources/trigger/test/inputs_1_update.template.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"Name": "cfn-test-trigger-${RANDOM_INT_100K}",
"Type": "DATABASE",
"Profile": "${MONGODB_ATLAS_PROFILE}",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

making consistent with other test files

"Profile": "default",
"DatabaseTrigger": {
"OperationTypes": [
"INSERT"
],
"Database": "store",
"Collection": "sales",
"ServiceId": "${MONGODB_REALM_SERVICE_ID}",
"ServiceId": "",
"FullDocument": "true",
"FullDocumentBeforeChange": "false",
"Unordered": "false",
Expand All @@ -20,14 +20,14 @@
"EventProcessors": {
"FUNCTION": {
"FuncConfig": {
"FunctionName": "${MONGODB_REALM_FUNCTION_NAME}",
"FunctionId": "${MONGODB_REALM_FUNCTION_ID}"
"FunctionName": "",
"FunctionId": ""
}
},
"AWSEVENTBRIDGE": {
"AWSConfig": {}
}
},
"AppId": "${MONGODB_REALM_APP_ID}",
"ProjectId": "${MONGODB_ATLAS_PROJECT_ID}"
"AppId": "",
"ProjectId": ""
}
5 changes: 1 addition & 4 deletions cfn-resources/util/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,7 @@ const (
Serverless = "SERVERLESS"
Duplicate = "DUPLICATE"

AppID = "AppId"
RealmPubKey = "RealmConfig.PublicKey"
RealmPvtKey = "RealmConfig.PrivateKey"

AppID = "AppId"
FederationSettingsID = "FederationSettingsId"

ExportBucketID = "ExportBucketId"
Expand Down
Loading