Skip to content

Commit

Permalink
pipeline resolver functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mjzone committed Jul 9, 2020
1 parent 9d4a107 commit c039c4a
Show file tree
Hide file tree
Showing 54 changed files with 971 additions and 361 deletions.
2 changes: 1 addition & 1 deletion .graphqlconfig.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
projects:
bookstorev2:
BookstoreBeta:
schemaPath: src/graphql/schema.json
includes:
- src/graphql/**/*.js
Expand Down
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/start"
}
]
}
2 changes: 1 addition & 1 deletion amplify/.config/project-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"projectName": "bookstorev2",
"projectName": "BookstoreBeta",
"version": "3.0",
"frontend": "javascript",
"javascript": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"AppSyncApiName": "bookstorev2",
"AppSyncApiName": "BookstoreBeta",
"DynamoDBBillingMode": "PAY_PER_REQUEST",
"DynamoDBEnableServerSideEncryption": "false",
"AuthCognitoUserPoolId": {
"Fn::GetAtt": [
"authbookstorev26c74adc1",
"authBookstoreAuth",
"Outputs.UserPoolId"
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ type Book
id: ID!
title: String!
description: String
imageURL: String
author: String!
image: String
author: String
featured: Boolean
price: Float
orders: [BookOrder] @connection(keyName:"byBook", fields:["id"])
}

type BookOrder
@model(queries: null, subscriptions: null)
@key(name: "byBook", fields: ["bookId", "orderId"])
@key(name: "byOrder", fields: ["orderId", "bookId"])
@key(name: "byBook", fields: ["book_id", "order_id"])
@key(name: "byOrder", fields: ["order_id", "book_id"])
@auth(
rules: [
# allow admins to create bookorders for customers by using customer email in lambda
Expand All @@ -34,10 +34,10 @@ type BookOrder
]
){
id: ID!
bookId: ID!
orderId: ID!
book: Book @connection(fields: ["bookId"])
order: Order @connection(fields: ["orderId"])
book_id: ID!
order_id: ID!
book: Book @connection(fields: ["book_id"])
order: Order @connection(fields: ["order_id"])
}

type Order
Expand Down Expand Up @@ -66,7 +66,7 @@ enum OrderStatus{
}

input CartItem {
id: ID
id: ID!
title: String
image: String
price: Float
Expand All @@ -77,12 +77,12 @@ input ProcessOrderInput {
id: ID!
cart: [CartItem]
total: Float!
tokenId: String!
token: String!
address: String
}

type Mutation{
processOrder(input: ProcessOrderInput!): OrderStatus
@function(name: "process-stripe-payment-${env}")
@function(name: "create-order-${env}")
@function(name: "collectPaymentLambda-${env}")
@function(name: "createOrderLambda-${env}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,35 @@ Parameters:
userpoolClientSetAttributes:
Type: String

sharedId:
useDefault:
Type: String

authSelections:
Type: String

resourceName:
Type: String

userPoolGroups:
Type: String

authSelections:
adminQueries:
Type: String
useDefault:

triggers:
Type: String


hostedUI:
Type: String

userPoolGroupList:
Type: CommaDelimitedList

parentStack:
Type: String

permissions:
Type: CommaDelimitedList

dependsOn:
Type: CommaDelimitedList
Expand All @@ -103,7 +118,7 @@ Resources:
# Created to allow the UserPool SMS Config to publish via the Simple Notification Service during MFA Process
Type: AWS::IAM::Role
Properties:
RoleName: !If [ShouldNotCreateEnvResources, 'bookst6c74adc1_sns-role', !Join ['',[ 'sns', '6c74adc1', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]]
RoleName: !If [ShouldNotCreateEnvResources, 'Bookste1218640_sns-role', !Join ['',[ 'sns', 'undefined', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]]
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
Expand All @@ -115,10 +130,10 @@ Resources:
- "sts:AssumeRole"
Condition:
StringEquals:
sts:ExternalId: bookst6c74adc1_role_external_id
sts:ExternalId: Bookste1218640_role_external_id
Policies:
-
PolicyName: bookst6c74adc1-sns-policy
PolicyName: Bookste1218640-sns-policy
PolicyDocument:
Version: "2012-10-17"
Statement:
Expand All @@ -143,6 +158,11 @@ Resources:
Required: true
Mutable: true

-
Name: name
Required: true
Mutable: true




Expand All @@ -164,15 +184,30 @@ Resources:
SmsVerificationMessage: !Ref smsVerificationMessage
SmsConfiguration:
SnsCallerArn: !GetAtt SNSRole.Arn
ExternalId: bookst6c74adc1_role_external_id
ExternalId: Bookste1218640_role_external_id











# Updating lambda role with permissions to Cognito


UserPoolClientWeb:
# Created provide application access to user pool
# Depends on UserPool for ID reference
Type: "AWS::Cognito::UserPoolClient"
Properties:
ClientName: bookst6c74adc1_app_clientWeb
ClientName: Bookste1218640_app_clientWeb

ReadAttributes: !Ref userpoolClientReadAttributes
WriteAttributes: !Ref userpoolClientWriteAttributes

RefreshTokenValidity: !Ref userpoolClientRefreshTokenValidity
UserPoolId: !Ref UserPool
Expand All @@ -182,7 +217,10 @@ Resources:
# Depends on UserPool for ID reference
Type: "AWS::Cognito::UserPoolClient"
Properties:
ClientName: bookst6c74adc1_app_client
ClientName: Bookste1218640_app_client

ReadAttributes: !Ref userpoolClientReadAttributes
WriteAttributes: !Ref userpoolClientWriteAttributes

GenerateSecret: !Ref userpoolClientGenerateSecret
RefreshTokenValidity: !Ref userpoolClientRefreshTokenValidity
Expand All @@ -193,7 +231,7 @@ Resources:
# Created to execute Lambda which gets userpool app client config values
Type: 'AWS::IAM::Role'
Properties:
RoleName: !If [ShouldNotCreateEnvResources, !Ref userpoolClientLambdaRole, !Join ['',['upClientLambdaRole', '6c74adc1', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]]
RoleName: !If [ShouldNotCreateEnvResources, !Ref userpoolClientLambdaRole, !Join ['',['upClientLambdaRole', 'undefined', !Select [3, !Split ['-', !Ref 'AWS::StackName']], '-', !Ref env]]]
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
Expand Down Expand Up @@ -247,7 +285,7 @@ Resources:
# Marked as depending on UserPoolClientRole for easier to understand CFN sequencing
Type: 'AWS::IAM::Policy'
Properties:
PolicyName: bookst6c74adc1_userpoolclient_lambda_iam_policy
PolicyName: Bookste1218640_userpoolclient_lambda_iam_policy
Roles:
- !Ref UserPoolClientRole
PolicyDocument:
Expand All @@ -264,7 +302,7 @@ Resources:
# Marked as depending on UserPoolClientLambdaPolicy for easier to understand CFN sequencing
Type: 'AWS::IAM::Policy'
Properties:
PolicyName: bookst6c74adc1_userpoolclient_lambda_log_policy
PolicyName: Bookste1218640_userpoolclient_lambda_log_policy
Roles:
- !Ref UserPoolClientRole
PolicyDocument:
Expand Down Expand Up @@ -304,7 +342,7 @@ Resources:
# Always created
Type: AWS::Cognito::IdentityPool
Properties:
IdentityPoolName: !If [ShouldNotCreateEnvResources, 'bookstorev26c74adc1_identitypool_6c74adc1', !Join ['',['bookstorev26c74adc1_identitypool_6c74adc1', '__', !Ref env]]]
IdentityPoolName: !If [ShouldNotCreateEnvResources, 'BookstoreAuth_identitypool_ba954e84', !Join ['',['BookstoreAuth_identitypool_ba954e84', '__', !Ref env]]]

CognitoIdentityProviders:
- ClientId: !Ref UserPoolClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"identityPoolName": "bookstorev26c74adc1_identitypool_6c74adc1",
"identityPoolName": "BookstoreAuth_identitypool_ba954e84",
"allowUnauthenticatedIdentities": true,
"resourceNameTruncated": "bookst6c74adc1",
"userPoolName": "bookstorev26c74adc1_userpool_6c74adc1",
"resourceNameTruncated": "Bookste1218640",
"userPoolName": "BookstoreBetaAuth",
"autoVerifiedAttributes": [
"email"
],
Expand All @@ -18,21 +18,31 @@
"passwordPolicyMinLength": 8,
"passwordPolicyCharacters": [],
"requiredAttributes": [
"email"
"email",
"name"
],
"userpoolClientGenerateSecret": true,
"userpoolClientRefreshTokenValidity": 30,
"userpoolClientWriteAttributes": [
"email"
"email",
"name"
],
"userpoolClientReadAttributes": [
"email"
"email",
"name"
],
"userpoolClientLambdaRole": "bookst6c74adc1_userpoolclient_lambda_role",
"userpoolClientSetAttributes": false,
"sharedId": "6c74adc1",
"resourceName": "bookstorev26c74adc1",
"userpoolClientLambdaRole": "Bookste1218640_userpoolclient_lambda_role",
"userpoolClientSetAttributes": true,
"useDefault": "manual",
"authSelections": "identityPoolAndUserPool",
"resourceName": "BookstoreAuth",
"userPoolGroups": true,
"adminQueries": false,
"triggers": "{}",
"hostedUI": false,
"userPoolGroupList": [
"Admin"
],
"authRoleArn": {
"Fn::GetAtt": [
"AuthRole",
Expand All @@ -45,7 +55,9 @@
"Arn"
]
},
"useDefault": "default",
"userPoolGroupList": [],
"parentStack": {
"Ref": "AWS::StackId"
},
"permissions": [],
"dependsOn": []
}
14 changes: 14 additions & 0 deletions amplify/backend/auth/userPoolGroups/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"AuthRoleArn": {
"Fn::GetAtt": [
"AuthRole",
"Arn"
]
},
"UnauthRoleArn": {
"Fn::GetAtt": [
"UnauthRole",
"Arn"
]
}
}
Loading

0 comments on commit c039c4a

Please sign in to comment.