From cb30add2b456b0447e2aeb2a9ee1b59792fc8ada Mon Sep 17 00:00:00 2001 From: Andrew Mostello Date: Mon, 19 Aug 2019 06:05:02 -0400 Subject: [PATCH] Add usernameParameter to CognitoEventUserPoolsCustomMessageRequest (#219) The CustomMessage_AdminCreateUser trigger returns a user name and verification code, so the request must include both request.usernameParameter and request.codeParameter. Add the usernameParameter field to the CognitoEventUserPoolsCustomMessageRequest struct to meet this requirement. https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html --- events/cognito.go | 5 +++-- events/testdata/cognito-event-userpools-custommessage.json | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/events/cognito.go b/events/cognito.go index 9de9a615..6e120b4f 100644 --- a/events/cognito.go +++ b/events/cognito.go @@ -226,8 +226,9 @@ type CognitoEventUserPoolsCustomMessage struct { // CognitoEventUserPoolsCustomMessageRequest contains the request portion of a CustomMessage event type CognitoEventUserPoolsCustomMessageRequest struct { - UserAttributes map[string]interface{} `json:"userAttributes"` - CodeParameter string `json:"codeParameter"` + UserAttributes map[string]interface{} `json:"userAttributes"` + CodeParameter string `json:"codeParameter"` + UsernameParameter string `json:"usernameParameter"` } // CognitoEventUserPoolsCustomMessageResponse contains the response portion of a CustomMessage event diff --git a/events/testdata/cognito-event-userpools-custommessage.json b/events/testdata/cognito-event-userpools-custommessage.json index 48c43f29..5a431d5b 100644 --- a/events/testdata/cognito-event-userpools-custommessage.json +++ b/events/testdata/cognito-event-userpools-custommessage.json @@ -13,7 +13,8 @@ "phone_number_verified": true, "email_verified": false }, - "codeParameter": "####" + "codeParameter": "####", + "usernameParameter": "{username}" }, "response": { "smsMessage": "",