diff --git a/.gitignore b/.gitignore index ddb453079..137373470 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ update.json **/functions/packages **/taskcat_outputs/ **/inputs/** +**/samples/** pytestdebug.log !/cdk/**/.* *.DS_Store diff --git a/cfn-resources/trigger/cmd/resource/resource.go b/cfn-resources/trigger/cmd/resource/resource.go index f948edf87..f630994e1 100644 --- a/cfn-resources/trigger/cmd/resource/resource.go +++ b/cfn-resources/trigger/cmd/resource/resource.go @@ -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 diff --git a/cfn-resources/trigger/index.html b/cfn-resources/trigger/index.html deleted file mode 100644 index 4b73c5abd..000000000 --- a/cfn-resources/trigger/index.html +++ /dev/null @@ -1,25 +0,0 @@ -MongoDB Documentation — MongoDB Atlas
Loading
Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.
\ No newline at end of file diff --git a/cfn-resources/trigger/test/inputs_1_create.template.json b/cfn-resources/trigger/test/inputs_1_create.template.json index b7ff5ef4c..6d1573e84 100644 --- a/cfn-resources/trigger/test/inputs_1_create.template.json +++ b/cfn-resources/trigger/test/inputs_1_create.template.json @@ -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", @@ -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}" } diff --git a/cfn-resources/trigger/test/inputs_1_update.template.json b/cfn-resources/trigger/test/inputs_1_update.template.json index 393959ed8..e863260f8 100644 --- a/cfn-resources/trigger/test/inputs_1_update.template.json +++ b/cfn-resources/trigger/test/inputs_1_update.template.json @@ -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", @@ -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}" }