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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ update.json
**/functions/packages
**/taskcat_outputs/
**/inputs/**
**/samples/**
pytestdebug.log
!/cdk/**/.*
*.DS_Store
Expand Down
36 changes: 17 additions & 19 deletions cfn-resources/trigger/cmd/resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,28 +230,26 @@ func newEventTrigger(model *Model) (*appservices.EventTriggerRequest, error) {
conf.Database = *model.DatabaseTrigger.Database
}
dTrigger := model.DatabaseTrigger

if dTrigger.Match != nil {
jsonData := []byte(*dTrigger.Match)
// convert the JSON string to a map
var m interface{}
if err := json.Unmarshal(jsonData, &m); err != nil {
return nil, errors.New("error unmarshalling Match field - " + err.Error())
if dTrigger != nil {
if dTrigger.Match != nil {
jsonData := []byte(*dTrigger.Match)
// convert the JSON string to a map
var m interface{}
if err := json.Unmarshal(jsonData, &m); err != nil {
return nil, errors.New("error unmarshalling Match field - " + err.Error())
}
conf.Match = m
}
conf.Match = m
}

if dTrigger.Project != nil {
jsonData := []byte(*dTrigger.Project)
// convert the JSON string to a map
var m interface{}
if err := json.Unmarshal(jsonData, &m); err != nil {
return nil, errors.New("error unmarshalling Project field - " + err.Error())
if dTrigger.Project != nil {
jsonData := []byte(*dTrigger.Project)
// convert the JSON string to a map
var m interface{}
if err := json.Unmarshal(jsonData, &m); err != nil {
return nil, errors.New("error unmarshalling Project field - " + err.Error())
}
conf.Project = m
}
conf.Project = m
}

if dTrigger != nil {
conf.Collection = aws.StringValue(dTrigger.Collection)
conf.ServiceID = aws.StringValue(dTrigger.ServiceId)
conf.OperationTypes = dTrigger.OperationTypes
Expand Down
25 changes: 0 additions & 25 deletions cfn-resources/trigger/index.html

This file was deleted.

14 changes: 7 additions & 7 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": "materializeMonthlyProductSales46",
"Name": "cfn-test-trigger-${RANDOM_INT_100K}",
"Type": "DATABASE",
"Profile": "default",
"Profile": "${MONGODB_ATLAS_PROFILE}",
"DatabaseTrigger": {
"OperationTypes": [
"INSERT"
],
"Database": "store",
"Collection": "sales",
"ServiceId": "6387aee08659af5254b0a51e",
"ServiceId": "${MONGODB_REALM_SERVICE_ID}",
"FullDocument": "true",
"FullDocumentBeforeChange": "false",
"Unordered": "false",
Expand All @@ -20,14 +20,14 @@
"EventProcessors": {
"FUNCTION": {
"FuncConfig": {
"FunctionName": "cfn_func",
"FunctionId": "63862553ac0702272aa701ba"
"FunctionName": "${MONGODB_REALM_FUNCTION_NAME}",
"FunctionId": "${MONGODB_REALM_FUNCTION_ID}"
}
},
"AWSEVENTBRIDGE": {
"AWSConfig": {}
}
},
"AppId": "638624a5167f5659feb75971",
"ProjectId": "625454459c4e6108393d650d"
"AppId": "${MONGODB_REALM_APP_ID}",
"ProjectId": "${MONGODB_ATLAS_PROJECT_ID}"
}
14 changes: 7 additions & 7 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": "materializeMonthlyProductSales46",
"Name": "cfn-test-trigger-${RANDOM_INT_100K}",
"Type": "DATABASE",
"Profile": "default",
"Profile": "${MONGODB_ATLAS_PROFILE}",
"DatabaseTrigger": {
"OperationTypes": [
"INSERT"
],
"Database": "store",
"Collection": "sales",
"ServiceId": "6387aee08659af5254b0a51e",
"ServiceId": "${MONGODB_REALM_SERVICE_ID}",
"FullDocument": "true",
"FullDocumentBeforeChange": "false",
"Unordered": "false",
Expand All @@ -20,14 +20,14 @@
"EventProcessors": {
"FUNCTION": {
"FuncConfig": {
"FunctionName": "cfn_func",
"FunctionId": "63862553ac0702272aa701ba"
"FunctionName": "${MONGODB_REALM_FUNCTION_NAME}",
"FunctionId": "${MONGODB_REALM_FUNCTION_ID}"
}
},
"AWSEVENTBRIDGE": {
"AWSConfig": {}
}
},
"AppId": "638624a5167f5659feb75971",
"ProjectId": "625454459c4e6108393d650d"
"AppId": "${MONGODB_REALM_APP_ID}",
"ProjectId": "${MONGODB_ATLAS_PROJECT_ID}"
}
Loading