Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
Add new tasks to load sample data and create test user + editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jkahn117 committed Jun 8, 2018
1 parent 7b2775f commit f73ce37
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
MY_EMAIL ?= [email protected]

AWS_BUCKET_NAME ?= jkahn-appsync-session-manager
AWS_STACK_NAME ?= appsync-session-manager
AWS_REGION ?= us-east-2
Expand Down Expand Up @@ -50,12 +52,39 @@ outputs:
@ make describe \
| jq -r '.Stacks[0].Outputs'

cleanup:
@ rm $(SAM_PACKAGED_TEMPLATE)

setup:
## Loads sample session data to the DynamoDB table
load-session-data:
@ node setup/setup.js


## Helper functions to create a Session Manager user and editor in Cognito
create-user:
@ aws cognito-idp sign-up \
--region $(AWS_REGION) \
--client-id $(shell make outputs | jq '.[] | select(.OutputKey=="CognitoClientId") | .OutputValue') \
--username user --password NewPassword1% \
--user-attributes Name=email,Value=$(MY_EMAIL) Name=name,Value=user

@ aws cognito-idp admin-confirm-sign-up \
--region $(AWS_REGION) \
--user-pool-id $(shell make outputs | jq '.[] | select(.OutputKey=="CognitoUserPoolId") | .OutputValue') \
--username user

create-editor:
@ aws cognito-idp sign-up \
--region $(AWS_REGION) \
--client-id $(shell make outputs | jq '.[] | select(.OutputKey=="CognitoClientId") | .OutputValue') \
--username editor --password NewPassword1% \
--user-attributes Name=email,Value=$(MY_EMAIL) Name=name,Value=editor

@ aws cognito-idp admin-confirm-sign-up \
--region $(AWS_REGION) \
--user-pool-id $(shell make outputs | jq '.[] | select(.OutputKey=="CognitoUserPoolId") | .OutputValue') \
--username editor

@ aws cognito-idp admin-add-user-to-group \
--region $(AWS_REGION) \
--user-pool-id $(shell make outputs | jq '.[] | select(.OutputKey=="CognitoUserPoolId") | .OutputValue') \
--group-name Editors \
--username editor

# add setup of DDB data, cognito?

0 comments on commit f73ce37

Please sign in to comment.