This repository has been archived by the owner on Jan 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new tasks to load sample data and create test user + editor
- Loading branch information
Showing
1 changed file
with
34 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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? |