diff --git a/New_APIs/Amplify-fullstack-API/README.md b/New_APIs/Amplify-fullstack-API/README.md new file mode 100644 index 0000000..9e2efc6 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/README.md @@ -0,0 +1,41 @@ +# Fullstack AWS React Application- + +This project is a robust fullstack web application developed with React for the frontend and integrated with AWS services for authentication, GraphQL API, and infrastructure management. The application leverages AWS capabilities to deliver a scalable, secure, and efficient solution. + +## Steps:- +1. Set up a React project and configure AWS Amplify for authentication, GraphQL API, and infrastructure management. +2. Integrate Amplify libraries into React for authentication and API interactions, implementing CRUD operations. +3. Manage state with React hooks or Redux and style components using SCSS. +4. Deploy the application using AWS Amplify Hosting and monitor performance with AWS CloudWatch. + + +## Frontend: React + +use :- npx create-react-app + +**User Interface**: The frontend is developed using React, providing a dynamic and responsive user experience. It leverages React's component-based architecture for modular and maintainable code. + +### Backend: AWS + +**Authentication:** AWS Amplify is used for implementing user authentication. It supports various sign-in methods, including email, social logins, and multi-factor authentication (MFA), ensuring secure user access. + +**GraphQL API:** AWS AppSync provides a fully managed GraphQL API, allowing for efficient data querying and real-time updates. It simplifies interactions with the database and supports offline data synchronization. + +### IAM Roles and Users: + +**IAM Integration:** AWS Identity and Access Management (IAM) is used to manage permissions and control access to AWS resources. IAM roles and users are configured to ensure secure and precise access controls for different parts of the application. + +**Access Management:** Granular access policies are set up for different AWS services, enhancing security and operational efficiency. + +### Deployment & Infrastructure: + +**Hosting:**The application is deployed on AWS Amplify, providing a streamlined deployment process with continuous integration and delivery (CI/CD) capabilities. + +**Serverless Functions:**AWS Lambda functions are employed to handle backend logic and integrate with the GraphQL API, supporting a serverless architecture that scales automatically. + +**Project Strucutre:** + +Screenshot 2024-07-27 at 1 36 20 PM + + + diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/amplify-meta.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/amplify-meta.json new file mode 100644 index 0000000..5b3a553 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/amplify-meta.json @@ -0,0 +1,111 @@ +{ + "providers": { + "awscloudformation": { + "AuthRoleName": "amplify-mynotes-staging-b2b56-authRole", + "UnauthRoleArn": "arn:aws:iam::339712714202:role/amplify-mynotes-staging-b2b56-unauthRole", + "AuthRoleArn": "arn:aws:iam::339712714202:role/amplify-mynotes-staging-b2b56-authRole", + "Region": "ap-southeast-2", + "DeploymentBucketName": "amplify-mynotes-staging-b2b56-deployment", + "UnauthRoleName": "amplify-mynotes-staging-b2b56-unauthRole", + "StackName": "amplify-mynotes-staging-b2b56", + "StackId": "arn:aws:cloudformation:ap-southeast-2:339712714202:stack/amplify-mynotes-staging-b2b56/5d40cab0-4b32-11ef-8fd8-06f396c97ee1", + "AmplifyAppId": "d2nrrgvsn5u7rq" + } + }, + "api": { + "mynotes": { + "dependsOn": [], + "output": { + "authConfig": { + "additionalAuthenticationProviders": [], + "defaultAuthentication": { + "apiKeyConfig": { + "apiKeyExpirationDays": 7 + }, + "authenticationType": "API_KEY" + } + }, + "GraphQLAPIIdOutput": "cye6ubdc6bgxddnh7pcgwbmubi", + "GraphQLAPIEndpointOutput": "https://n5edpqals5aohotum3xa72osli.appsync-api.ap-southeast-2.amazonaws.com/graphql", + "GraphQLAPIKeyOutput": "da2-kehm2qcqofd3besloumulb5vlm" + }, + "providerPlugin": "awscloudformation", + "service": "AppSync", + "lastPushTimeStamp": "2024-07-26T15:57:37.537Z", + "providerMetadata": { + "s3TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/api/cloudformation-template.json", + "logicalId": "apimynotes" + } + } + }, + "auth": { + "mynotesccae4f3b": { + "customAuth": false, + "dependsOn": [], + "frontendAuthConfig": { + "mfaConfiguration": "OFF", + "mfaTypes": [ + "SMS" + ], + "passwordProtectionSettings": { + "passwordPolicyMinLength": 8, + "passwordPolicyCharacters": [] + }, + "signupAttributes": [ + "EMAIL" + ], + "socialProviders": [], + "usernameAttributes": [], + "verificationMechanisms": [ + "EMAIL" + ] + }, + "providerPlugin": "awscloudformation", + "service": "Cognito", + "output": { + "UserPoolId": "ap-southeast-2_i03FxeqOd", + "AppClientIDWeb": "6bm1hrehfqg90vta1ifbgjr00h", + "AppClientID": "1d896vivvec1d0hvqrk6lptel2", + "IdentityPoolId": "ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4", + "UserPoolArn": "arn:aws:cognito-idp:ap-southeast-2:339712714202:userpool/ap-southeast-2_i03FxeqOd", + "IdentityPoolName": "mynotesccae4f3b_identitypool_ccae4f3b__staging", + "UserPoolName": "mynotesccae4f3b_userpool_ccae4f3b" + }, + "lastPushTimeStamp": "2024-07-26T15:57:44.008Z", + "providerMetadata": { + "s3TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/auth/mynotesccae4f3b-cloudformation-template.json", + "logicalId": "authmynotesccae4f3b" + }, + "lastPushDirHash": "Y2leA1T/brYAcNS4RPXQwBzzY/Q=" + } + }, + "function": { + "S3Triggerdc42a5d7": { + "service": "Lambda", + "providerPlugin": "awscloudformation", + "build": true, + "lastBuildTimeStamp": "2024-07-26T15:55:51.984Z", + "lastBuildType": "PROD", + "lastPackageTimeStamp": "2024-07-26T15:55:52.014Z", + "distZipFilename": "S3Triggerdc42a5d7-6a475541666d35456861-build.zip", + "s3Bucket": { + "deploymentBucketName": "amplify-mynotes-staging-b2b56-deployment", + "s3Key": "amplify-builds/S3Triggerdc42a5d7-6a475541666d35456861-build.zip" + }, + "providerMetadata": { + "s3TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/function/S3Triggerdc42a5d7-cloudformation-template.json", + "logicalId": "functionS3Triggerdc42a5d7" + }, + "lastPushTimeStamp": "2024-07-26T15:57:44.008Z", + "output": { + "LambdaExecutionRoleArn": "arn:aws:iam::339712714202:role/S3Triggerdc42a5d7LambdaRoledc42a5d7-staging", + "Region": "ap-southeast-2", + "Arn": "arn:aws:lambda:ap-southeast-2:339712714202:function:S3Triggerdc42a5d7-staging", + "Name": "S3Triggerdc42a5d7-staging", + "LambdaExecutionRole": "S3Triggerdc42a5d7LambdaRoledc42a5d7-staging" + }, + "lastPushDirHash": "1B2Qj8YebkkXB424dBxxW7J3vvM=" + } + }, + "storage": {} +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/cloudformation-template.json new file mode 100644 index 0000000..b01c0ea --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/cloudformation-template.json @@ -0,0 +1,316 @@ +{ + "Parameters": { + "env": { + "Type": "String", + "Default": "NONE" + }, + "AppSyncApiName": { + "Type": "String", + "Default": "AppSyncSimpleTransform" + }, + "DynamoDBModelTableReadIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of read IOPS the table should support." + }, + "DynamoDBModelTableWriteIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of write IOPS the table should support." + }, + "DynamoDBBillingMode": { + "Type": "String", + "Default": "PAY_PER_REQUEST", + "AllowedValues": [ + "PAY_PER_REQUEST", + "PROVISIONED" + ], + "Description": "Configure @model types to create DynamoDB tables with PAY_PER_REQUEST or PROVISIONED billing modes." + }, + "DynamoDBEnablePointInTimeRecovery": { + "Type": "String", + "Default": "false", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Whether to enable Point in Time Recovery on the table." + }, + "DynamoDBEnableServerSideEncryption": { + "Type": "String", + "Default": "true", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Enable server side encryption powered by KMS." + }, + "S3DeploymentBucket": { + "Type": "String", + "Description": "An S3 Bucket name where assets are deployed" + }, + "S3DeploymentRootKey": { + "Type": "String", + "Description": "An S3 key relative to the S3DeploymentBucket that points to the root of the deployment directory." + } + }, + "Resources": { + "GraphQLAPI": { + "Type": "AWS::AppSync::GraphQLApi", + "Properties": { + "AuthenticationType": "API_KEY", + "Name": { + "Fn::Join": [ + "", + [ + { + "Ref": "AppSyncApiName" + }, + "-", + { + "Ref": "env" + } + ] + ] + } + } + }, + "GraphQLAPITransformerSchema3CB2AE18": { + "Type": "AWS::AppSync::GraphQLSchema", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "DefinitionS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "S3DeploymentBucket" + }, + "/", + { + "Ref": "S3DeploymentRootKey" + }, + "/schema.graphql" + ] + ] + } + } + }, + "GraphQLAPIDefaultApiKey215A6DD7": { + "Type": "AWS::AppSync::ApiKey", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Expires": 1722608188 + } + }, + "GraphQLAPINONEDS95A13CF0": { + "Type": "AWS::AppSync::DataSource", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Description": "None Data Source for Pipeline functions", + "Name": "NONE_DS", + "Type": "NONE" + } + }, + "Todo": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "Parameters": { + "DynamoDBModelTableReadIOPS": { + "Ref": "DynamoDBModelTableReadIOPS" + }, + "DynamoDBModelTableWriteIOPS": { + "Ref": "DynamoDBModelTableWriteIOPS" + }, + "DynamoDBBillingMode": { + "Ref": "DynamoDBBillingMode" + }, + "DynamoDBEnablePointInTimeRecovery": { + "Ref": "DynamoDBEnablePointInTimeRecovery" + }, + "DynamoDBEnableServerSideEncryption": { + "Ref": "DynamoDBEnableServerSideEncryption" + }, + "referencetotransformerrootstackenv10C5A902Ref": { + "Ref": "env" + }, + "referencetotransformerrootstackGraphQLAPI20497F53ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name": { + "Fn::GetAtt": [ + "GraphQLAPINONEDS95A13CF0", + "Name" + ] + }, + "referencetotransformerrootstackS3DeploymentBucket7592718ARef": { + "Ref": "S3DeploymentBucket" + }, + "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref": { + "Ref": "S3DeploymentRootKey" + } + }, + "TemplateURL": { + "Fn::Join": [ + "", + [ + "https://s3.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "S3DeploymentBucket" + }, + "/", + { + "Ref": "S3DeploymentRootKey" + }, + "/stacks/Todo.json" + ] + ] + } + }, + "DependsOn": [ + "GraphQLAPITransformerSchema3CB2AE18" + ] + }, + "CustomResourcesjson": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "Parameters": { + "AppSyncApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "AppSyncApiName": { + "Ref": "AppSyncApiName" + }, + "env": { + "Ref": "env" + }, + "S3DeploymentBucket": { + "Ref": "S3DeploymentBucket" + }, + "S3DeploymentRootKey": { + "Ref": "S3DeploymentRootKey" + } + }, + "TemplateURL": { + "Fn::Join": [ + "/", + [ + "https://s3.amazonaws.com", + { + "Ref": "S3DeploymentBucket" + }, + { + "Ref": "S3DeploymentRootKey" + }, + "stacks", + "CustomResources.json" + ] + ] + } + }, + "DependsOn": [ + "GraphQLAPI", + "GraphQLAPITransformerSchema3CB2AE18", + "Todo" + ] + } + }, + "Outputs": { + "GraphQLAPIKeyOutput": { + "Description": "Your GraphQL API ID.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPIDefaultApiKey215A6DD7", + "ApiKey" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiKey" + ] + ] + } + } + }, + "GraphQLAPIIdOutput": { + "Description": "Your GraphQL API ID.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiId" + ] + ] + } + } + }, + "GraphQLAPIEndpointOutput": { + "Description": "Your GraphQL API endpoint.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPI", + "GraphQLUrl" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiEndpoint" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/parameters.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/parameters.json new file mode 100644 index 0000000..70c2ce9 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/parameters.json @@ -0,0 +1,7 @@ +{ + "AppSyncApiName": "mynotes", + "DynamoDBBillingMode": "PAY_PER_REQUEST", + "DynamoDBEnableServerSideEncryption": false, + "S3DeploymentBucket": "amplify-mynotes-staging-b2b56-deployment", + "S3DeploymentRootKey": "amplify-appsync-files/c0e971ea1ba703ba5054d45b1d4a7a475f98dd0a" +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.init.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.init.1.req.vtl new file mode 100644 index 0000000..df6b4cb --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.init.1.req.vtl @@ -0,0 +1,11 @@ +## [Start] Initialization default values. ** +$util.qr($ctx.stash.put("defaultValues", $util.defaultIfNull($ctx.stash.defaultValues, {}))) +$util.qr($ctx.stash.defaultValues.put("id", $util.autoId())) +#set( $createdAt = $util.time.nowISO8601() ) +$util.qr($ctx.stash.defaultValues.put("createdAt", $createdAt)) +$util.qr($ctx.stash.defaultValues.put("updatedAt", $createdAt)) +$util.toJson({ + "version": "2018-05-29", + "payload": {} +}) +## [End] Initialization default values. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.req.vtl new file mode 100644 index 0000000..f03395e --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.req.vtl @@ -0,0 +1,66 @@ +## [Start] Create Request template. ** +#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) ) +## Set the default values to put request ** +#set( $mergedValues = $util.defaultIfNull($ctx.stash.defaultValues, {}) ) +## copy the values from input ** +$util.qr($mergedValues.putAll($util.defaultIfNull($args.input, {}))) +## set the typename ** +$util.qr($mergedValues.put("__typename", "Todo")) +#set( $PutObject = { + "version": "2018-05-29", + "operation": "PutItem", + "attributeValues": $util.dynamodb.toMapValues($mergedValues), + "condition": $condition +} ) +#if( $args.condition ) + $util.qr($ctx.stash.conditions.add($args.condition)) +#end +## Begin - key condition ** +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $keyConditionExpr = {} ) + #set( $keyConditionExprNames = {} ) + #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) + $util.qr($keyConditionExpr.put("keyCondition$velocityCount", { + "attributeExists": false +})) + $util.qr($keyConditionExprNames.put("#keyCondition$velocityCount", "$entry.key")) + #end + $util.qr($ctx.stash.conditions.add($keyConditionExpr)) +#else + $util.qr($ctx.stash.conditions.add({ + "id": { + "attributeExists": false + } +})) +#end +## End - key condition ** +## Start condition block ** +#if( $ctx.stash.conditions && $ctx.stash.conditions.size() != 0 ) + #set( $mergedConditions = { + "and": $ctx.stash.conditions +} ) + #set( $Conditions = $util.parseJson($util.transform.toDynamoDBConditionExpression($mergedConditions)) ) + #if( $Conditions.expressionValues && $Conditions.expressionValues.size() == 0 ) + #set( $Conditions = { + "expression": $Conditions.expression, + "expressionNames": $Conditions.expressionNames +} ) + #end + ## End condition block ** +#end +#if( $Conditions ) + #if( $keyConditionExprNames ) + $util.qr($Conditions.expressionNames.putAll($keyConditionExprNames)) + #end + $util.qr($PutObject.put("condition", $Conditions)) +#end +#if( $ctx.stash.metadata.modelObjectKey ) + $util.qr($PutObject.put("key", $ctx.stash.metadata.modelObjectKey)) +#else + #set( $Key = { + "id": $util.dynamodb.toDynamoDB($mergedValues.id) +} ) + $util.qr($PutObject.put("key", $Key)) +#end +$util.toJson($PutObject) +## [End] Create Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.res.vtl new file mode 100644 index 0000000..5119972 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.createTodo.res.vtl @@ -0,0 +1,8 @@ +## [Start] ResponseTemplate. ** +$util.qr($ctx.result.put("__operation", "Mutation")) +#if( $ctx.error ) + $util.error($ctx.error.message, $ctx.error.type) +#else + $util.toJson($ctx.result) +#end +## [End] ResponseTemplate. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.deleteTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.deleteTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.deleteTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.deleteTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.deleteTodo.req.vtl new file mode 100644 index 0000000..ace459b --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.deleteTodo.req.vtl @@ -0,0 +1,58 @@ +## [Start] Delete Request template. ** +#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) ) +#set( $DeleteRequest = { + "version": "2018-05-29", + "operation": "DeleteItem" +} ) +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $Key = $ctx.stash.metadata.modelObjectKey ) +#else + #set( $Key = { + "id": $util.dynamodb.toDynamoDB($args.input.id) +} ) +#end +$util.qr($DeleteRequest.put("key", $Key)) +## Begin - key condition ** +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $keyConditionExpr = {} ) + #set( $keyConditionExprNames = {} ) + #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) + $util.qr($keyConditionExpr.put("keyCondition$velocityCount", { + "attributeExists": true +})) + $util.qr($keyConditionExprNames.put("#keyCondition$velocityCount", "$entry.key")) + #end + $util.qr($ctx.stash.conditions.add($keyConditionExpr)) +#else + $util.qr($ctx.stash.conditions.add({ + "id": { + "attributeExists": true + } +})) +#end +## End - key condition ** +#if( $args.condition ) + $util.qr($ctx.stash.conditions.add($args.condition)) +#end +## Start condition block ** +#if( $ctx.stash.conditions && $ctx.stash.conditions.size() != 0 ) + #set( $mergedConditions = { + "and": $ctx.stash.conditions +} ) + #set( $Conditions = $util.parseJson($util.transform.toDynamoDBConditionExpression($mergedConditions)) ) + #if( $Conditions.expressionValues && $Conditions.expressionValues.size() == 0 ) + #set( $Conditions = { + "expression": $Conditions.expression, + "expressionNames": $Conditions.expressionNames +} ) + #end + ## End condition block ** +#end +#if( $Conditions ) + #if( $keyConditionExprNames ) + $util.qr($Conditions.expressionNames.putAll($keyConditionExprNames)) + #end + $util.qr($DeleteRequest.put("condition", $Conditions)) +#end +$util.toJson($DeleteRequest) +## [End] Delete Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.deleteTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.deleteTodo.res.vtl new file mode 100644 index 0000000..5119972 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.deleteTodo.res.vtl @@ -0,0 +1,8 @@ +## [Start] ResponseTemplate. ** +$util.qr($ctx.result.put("__operation", "Mutation")) +#if( $ctx.error ) + $util.error($ctx.error.message, $ctx.error.type) +#else + $util.toJson($ctx.result) +#end +## [End] ResponseTemplate. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.init.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.init.1.req.vtl new file mode 100644 index 0000000..ab5766f --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.init.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Initialization default values. ** +$util.qr($ctx.stash.put("defaultValues", $util.defaultIfNull($ctx.stash.defaultValues, {}))) +#set( $updatedAt = $util.time.nowISO8601() ) +$util.qr($ctx.stash.defaultValues.put("updatedAt", $updatedAt)) +$util.toJson({ + "version": "2018-05-29", + "payload": {} +}) +## [End] Initialization default values. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.req.vtl new file mode 100644 index 0000000..a1bd67d --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.req.vtl @@ -0,0 +1,130 @@ +## [Start] Mutation Update resolver. ** +#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) ) +## Set the default values to put request ** +#set( $mergedValues = $util.defaultIfNull($ctx.stash.defaultValues, {}) ) +## copy the values from input ** +$util.qr($mergedValues.putAll($util.defaultIfNull($args.input, {}))) +## set the typename ** +## Initialize the vars for creating ddb expression ** +#set( $expNames = {} ) +#set( $expValues = {} ) +#set( $expSet = {} ) +#set( $expAdd = {} ) +#set( $expRemove = [] ) +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $Key = $ctx.stash.metadata.modelObjectKey ) +#else + #set( $Key = { + "id": $util.dynamodb.toDynamoDB($args.input.id) +} ) +#end +## Model key ** +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $keyFields = [] ) + #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) + $util.qr($keyFields.add("$entry.key")) + #end +#else + #set( $keyFields = ["id"] ) +#end +#foreach( $entry in $util.map.copyAndRemoveAllKeys($mergedValues, $keyFields).entrySet() ) + #if( !$util.isNull($ctx.stash.metadata.dynamodbNameOverrideMap) && $ctx.stash.metadata.dynamodbNameOverrideMap.containsKey("$entry.key") ) + #set( $entryKeyAttributeName = $ctx.stash.metadata.dynamodbNameOverrideMap.get("$entry.key") ) + #else + #set( $entryKeyAttributeName = $entry.key ) + #end + #if( $util.isNull($entry.value) ) + #set( $discard = $expRemove.add("#$entryKeyAttributeName") ) + $util.qr($expNames.put("#$entryKeyAttributeName", "$entry.key")) + #else + $util.qr($expSet.put("#$entryKeyAttributeName", ":$entryKeyAttributeName")) + $util.qr($expNames.put("#$entryKeyAttributeName", "$entry.key")) + $util.qr($expValues.put(":$entryKeyAttributeName", $util.dynamodb.toDynamoDB($entry.value))) + #end +#end +#set( $expression = "" ) +#if( !$expSet.isEmpty() ) + #set( $expression = "SET" ) + #foreach( $entry in $expSet.entrySet() ) + #set( $expression = "$expression $entry.key = $entry.value" ) + #if( $foreach.hasNext() ) + #set( $expression = "$expression," ) + #end + #end +#end +#if( !$expAdd.isEmpty() ) + #set( $expression = "$expression ADD" ) + #foreach( $entry in $expAdd.entrySet() ) + #set( $expression = "$expression $entry.key $entry.value" ) + #if( $foreach.hasNext() ) + #set( $expression = "$expression," ) + #end + #end +#end +#if( !$expRemove.isEmpty() ) + #set( $expression = "$expression REMOVE" ) + #foreach( $entry in $expRemove ) + #set( $expression = "$expression $entry" ) + #if( $foreach.hasNext() ) + #set( $expression = "$expression," ) + #end + #end +#end +#set( $update = {} ) +$util.qr($update.put("expression", "$expression")) +#if( !$expNames.isEmpty() ) + $util.qr($update.put("expressionNames", $expNames)) +#end +#if( !$expValues.isEmpty() ) + $util.qr($update.put("expressionValues", $expValues)) +#end +## Begin - key condition ** +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $keyConditionExpr = {} ) + #set( $keyConditionExprNames = {} ) + #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) + $util.qr($keyConditionExpr.put("keyCondition$velocityCount", { + "attributeExists": true +})) + $util.qr($keyConditionExprNames.put("#keyCondition$velocityCount", "$entry.key")) + #end + $util.qr($ctx.stash.conditions.add($keyConditionExpr)) +#else + $util.qr($ctx.stash.conditions.add({ + "id": { + "attributeExists": true + } +})) +#end +## End - key condition ** +#if( $args.condition ) + $util.qr($ctx.stash.conditions.add($args.condition)) +#end +## Start condition block ** +#if( $ctx.stash.conditions && $ctx.stash.conditions.size() != 0 ) + #set( $mergedConditions = { + "and": $ctx.stash.conditions +} ) + #set( $Conditions = $util.parseJson($util.transform.toDynamoDBConditionExpression($mergedConditions)) ) + #if( $Conditions.expressionValues && $Conditions.expressionValues.size() == 0 ) + #set( $Conditions = { + "expression": $Conditions.expression, + "expressionNames": $Conditions.expressionNames +} ) + #end + ## End condition block ** +#end +#set( $UpdateItem = { + "version": "2018-05-29", + "operation": "UpdateItem", + "key": $Key, + "update": $update +} ) +#if( $Conditions ) + #if( $keyConditionExprNames ) + $util.qr($Conditions.expressionNames.putAll($keyConditionExprNames)) + #end + $util.qr($UpdateItem.put("condition", $Conditions)) +#end +$util.toJson($UpdateItem) +## [End] Mutation Update resolver. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.res.vtl new file mode 100644 index 0000000..5119972 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Mutation.updateTodo.res.vtl @@ -0,0 +1,8 @@ +## [Start] ResponseTemplate. ** +$util.qr($ctx.result.put("__operation", "Mutation")) +#if( $ctx.error ) + $util.error($ctx.error.message, $ctx.error.type) +#else + $util.toJson($ctx.result) +#end +## [End] ResponseTemplate. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.getTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.getTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.getTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.getTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.getTodo.req.vtl new file mode 100644 index 0000000..a8d7811 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.getTodo.req.vtl @@ -0,0 +1,34 @@ +## [Start] Get Request template. ** +#set( $GetRequest = { + "version": "2018-05-29", + "operation": "Query" +} ) +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $expression = "" ) + #set( $expressionNames = {} ) + #set( $expressionValues = {} ) + #foreach( $item in $ctx.stash.metadata.modelObjectKey.entrySet() ) + #set( $expression = "$expression#keyCount$velocityCount = :valueCount$velocityCount AND " ) + $util.qr($expressionNames.put("#keyCount$velocityCount", $item.key)) + $util.qr($expressionValues.put(":valueCount$velocityCount", $item.value)) + #end + #set( $expression = $expression.replaceAll("AND $", "") ) + #set( $query = { + "expression": $expression, + "expressionNames": $expressionNames, + "expressionValues": $expressionValues +} ) +#else + #set( $query = { + "expression": "id = :id", + "expressionValues": { + ":id": $util.parseJson($util.dynamodb.toDynamoDBJson($ctx.args.id)) + } +} ) +#end +$util.qr($GetRequest.put("query", $query)) +#if( !$util.isNullOrEmpty($ctx.stash.authFilter) ) + $util.qr($GetRequest.put("filter", $util.parseJson($util.transform.toDynamoDBFilterExpression($ctx.stash.authFilter)))) +#end +$util.toJson($GetRequest) +## [End] Get Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.getTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.getTodo.res.vtl new file mode 100644 index 0000000..e9ef143 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.getTodo.res.vtl @@ -0,0 +1,13 @@ +## [Start] Get Response template. ** +#if( $ctx.error ) + $util.error($ctx.error.message, $ctx.error.type) +#end +#if( !$ctx.result.items.isEmpty() && $ctx.result.scannedCount == 1 ) + $util.toJson($ctx.result.items[0]) +#else + #if( $ctx.result.items.isEmpty() && $ctx.result.scannedCount == 1 ) +$util.unauthorized() + #end + $util.toJson(null) +#end +## [End] Get Response template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.listTodos.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.listTodos.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.listTodos.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.listTodos.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.listTodos.req.vtl new file mode 100644 index 0000000..0142137 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.listTodos.req.vtl @@ -0,0 +1,50 @@ +## [Start] List Request. ** +#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) ) +#set( $limit = $util.defaultIfNull($args.limit, 100) ) +#set( $ListRequest = { + "version": "2018-05-29", + "limit": $limit +} ) +#if( $args.nextToken ) + #set( $ListRequest.nextToken = $args.nextToken ) +#end +#if( !$util.isNullOrEmpty($ctx.stash.authFilter) ) + #set( $filter = $ctx.stash.authFilter ) + #if( !$util.isNullOrEmpty($args.filter) ) + #set( $filter = { + "and": [$filter, $args.filter] +} ) + #end +#else + #if( !$util.isNullOrEmpty($args.filter) ) + #set( $filter = $args.filter ) + #end +#end +#if( !$util.isNullOrEmpty($filter) ) + #set( $filterExpression = $util.parseJson($util.transform.toDynamoDBFilterExpression($filter)) ) + #if( $util.isNullOrEmpty($filterExpression) ) + $util.error("Unable to process the filter expression", "Unrecognized Filter") + #end + #if( !$util.isNullOrBlank($filterExpression.expression) ) + #if( $filterExpression.expressionValues.size() == 0 ) + $util.qr($filterExpression.remove("expressionValues")) + #end + #set( $ListRequest.filter = $filterExpression ) + #end +#end +#if( !$util.isNull($ctx.stash.modelQueryExpression) && !$util.isNullOrEmpty($ctx.stash.modelQueryExpression.expression) ) + $util.qr($ListRequest.put("operation", "Query")) + $util.qr($ListRequest.put("query", $ctx.stash.modelQueryExpression)) + #if( !$util.isNull($args.sortDirection) && $args.sortDirection == "DESC" ) + #set( $ListRequest.scanIndexForward = false ) + #else + #set( $ListRequest.scanIndexForward = true ) + #end +#else + $util.qr($ListRequest.put("operation", "Scan")) +#end +#if( !$util.isNull($ctx.stash.metadata.index) ) + #set( $ListRequest.IndexName = $ctx.stash.metadata.index ) +#end +$util.toJson($ListRequest) +## [End] List Request. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.listTodos.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.listTodos.res.vtl new file mode 100644 index 0000000..ee8b667 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Query.listTodos.res.vtl @@ -0,0 +1,7 @@ +## [Start] ResponseTemplate. ** +#if( $ctx.error ) + $util.error($ctx.error.message, $ctx.error.type) +#else + $util.toJson($ctx.result) +#end +## [End] ResponseTemplate. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.req.vtl new file mode 100644 index 0000000..f64092d --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.req.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Request template. ** +$util.toJson({ + "version": "2018-05-29", + "payload": {} +}) +## [End] Subscription Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.res.vtl new file mode 100644 index 0000000..62769cc --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.res.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Response template. ** +#if( !$util.isNullOrEmpty($ctx.args.filter) ) +$extensions.setSubscriptionFilter($util.transform.toSubscriptionFilter($ctx.args.filter)) +#end +$util.toJson(null) +## [End] Subscription Response template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.req.vtl new file mode 100644 index 0000000..f64092d --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.req.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Request template. ** +$util.toJson({ + "version": "2018-05-29", + "payload": {} +}) +## [End] Subscription Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.res.vtl new file mode 100644 index 0000000..62769cc --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.res.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Response template. ** +#if( !$util.isNullOrEmpty($ctx.args.filter) ) +$extensions.setSubscriptionFilter($util.transform.toSubscriptionFilter($ctx.args.filter)) +#end +$util.toJson(null) +## [End] Subscription Response template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.req.vtl new file mode 100644 index 0000000..f64092d --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.req.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Request template. ** +$util.toJson({ + "version": "2018-05-29", + "payload": {} +}) +## [End] Subscription Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.res.vtl new file mode 100644 index 0000000..62769cc --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.res.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Response template. ** +#if( !$util.isNullOrEmpty($ctx.args.filter) ) +$extensions.setSubscriptionFilter($util.transform.toSubscriptionFilter($ctx.args.filter)) +#end +$util.toJson(null) +## [End] Subscription Response template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/schema.graphql b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/schema.graphql new file mode 100644 index 0000000..987aa6a --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/schema.graphql @@ -0,0 +1,226 @@ +type Todo { + id: ID! + name: String! + description: String + createdAt: AWSDateTime! + updatedAt: AWSDateTime! +} + +input ModelStringInput { + ne: String + eq: String + le: String + lt: String + ge: String + gt: String + contains: String + notContains: String + between: [String] + beginsWith: String + attributeExists: Boolean + attributeType: ModelAttributeTypes + size: ModelSizeInput +} + +input ModelIntInput { + ne: Int + eq: Int + le: Int + lt: Int + ge: Int + gt: Int + between: [Int] + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelFloatInput { + ne: Float + eq: Float + le: Float + lt: Float + ge: Float + gt: Float + between: [Float] + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelBooleanInput { + ne: Boolean + eq: Boolean + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelIDInput { + ne: ID + eq: ID + le: ID + lt: ID + ge: ID + gt: ID + contains: ID + notContains: ID + between: [ID] + beginsWith: ID + attributeExists: Boolean + attributeType: ModelAttributeTypes + size: ModelSizeInput +} + +input ModelSubscriptionStringInput { + ne: String + eq: String + le: String + lt: String + ge: String + gt: String + contains: String + notContains: String + between: [String] + beginsWith: String + in: [String] + notIn: [String] +} + +input ModelSubscriptionIntInput { + ne: Int + eq: Int + le: Int + lt: Int + ge: Int + gt: Int + between: [Int] + in: [Int] + notIn: [Int] +} + +input ModelSubscriptionFloatInput { + ne: Float + eq: Float + le: Float + lt: Float + ge: Float + gt: Float + between: [Float] + in: [Float] + notIn: [Float] +} + +input ModelSubscriptionBooleanInput { + ne: Boolean + eq: Boolean +} + +input ModelSubscriptionIDInput { + ne: ID + eq: ID + le: ID + lt: ID + ge: ID + gt: ID + contains: ID + notContains: ID + between: [ID] + beginsWith: ID + in: [ID] + notIn: [ID] +} + +enum ModelAttributeTypes { + binary + binarySet + bool + list + map + number + numberSet + string + stringSet + _null +} + +input ModelSizeInput { + ne: Int + eq: Int + le: Int + lt: Int + ge: Int + gt: Int + between: [Int] +} + +enum ModelSortDirection { + ASC + DESC +} + +type ModelTodoConnection { + items: [Todo]! + nextToken: String +} + +input ModelTodoFilterInput { + id: ModelIDInput + name: ModelStringInput + description: ModelStringInput + createdAt: ModelStringInput + updatedAt: ModelStringInput + and: [ModelTodoFilterInput] + or: [ModelTodoFilterInput] + not: ModelTodoFilterInput +} + +type Query { + getTodo(id: ID!): Todo + listTodos(filter: ModelTodoFilterInput, limit: Int, nextToken: String): ModelTodoConnection +} + +input ModelTodoConditionInput { + name: ModelStringInput + description: ModelStringInput + and: [ModelTodoConditionInput] + or: [ModelTodoConditionInput] + not: ModelTodoConditionInput + createdAt: ModelStringInput + updatedAt: ModelStringInput +} + +input CreateTodoInput { + id: ID + name: String! + description: String +} + +input UpdateTodoInput { + id: ID! + name: String + description: String +} + +input DeleteTodoInput { + id: ID! +} + +type Mutation { + createTodo(input: CreateTodoInput!, condition: ModelTodoConditionInput): Todo + updateTodo(input: UpdateTodoInput!, condition: ModelTodoConditionInput): Todo + deleteTodo(input: DeleteTodoInput!, condition: ModelTodoConditionInput): Todo +} + +input ModelSubscriptionTodoFilterInput { + id: ModelSubscriptionIDInput + name: ModelSubscriptionStringInput + description: ModelSubscriptionStringInput + createdAt: ModelSubscriptionStringInput + updatedAt: ModelSubscriptionStringInput + and: [ModelSubscriptionTodoFilterInput] + or: [ModelSubscriptionTodoFilterInput] +} + +type Subscription { + onCreateTodo(filter: ModelSubscriptionTodoFilterInput): Todo @aws_subscribe(mutations: ["createTodo"]) + onUpdateTodo(filter: ModelSubscriptionTodoFilterInput): Todo @aws_subscribe(mutations: ["updateTodo"]) + onDeleteTodo(filter: ModelSubscriptionTodoFilterInput): Todo @aws_subscribe(mutations: ["deleteTodo"]) +} diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/stacks/CustomResources.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/stacks/CustomResources.json new file mode 100644 index 0000000..0169912 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/stacks/CustomResources.json @@ -0,0 +1,61 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "An auto-generated nested stack.", + "Metadata": {}, + "Parameters": { + "AppSyncApiId": { + "Type": "String", + "Description": "The id of the AppSync API associated with this project." + }, + "AppSyncApiName": { + "Type": "String", + "Description": "The name of the AppSync API", + "Default": "AppSyncSimpleTransform" + }, + "env": { + "Type": "String", + "Description": "The environment name. e.g. Dev, Test, or Production", + "Default": "NONE" + }, + "S3DeploymentBucket": { + "Type": "String", + "Description": "The S3 bucket containing all deployment assets for the project." + }, + "S3DeploymentRootKey": { + "Type": "String", + "Description": "An S3 key relative to the S3DeploymentBucket that points to the root\nof the deployment directory." + } + }, + "Resources": { + "EmptyResource": { + "Type": "Custom::EmptyResource", + "Condition": "AlwaysFalse" + } + }, + "Conditions": { + "HasEnvironmentParameter": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + ] + }, + "AlwaysFalse": { + "Fn::Equals": [ + "true", + "false" + ] + } + }, + "Outputs": { + "EmptyOutput": { + "Description": "An empty output. You may delete this if you have at least one resource above.", + "Value": "" + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/stacks/Todo.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/stacks/Todo.json new file mode 100644 index 0000000..14d8d57 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/build/stacks/Todo.json @@ -0,0 +1,1117 @@ +{ + "Parameters": { + "DynamoDBModelTableReadIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of read IOPS the table should support." + }, + "DynamoDBModelTableWriteIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of write IOPS the table should support." + }, + "DynamoDBBillingMode": { + "Type": "String", + "Default": "PAY_PER_REQUEST", + "AllowedValues": [ + "PAY_PER_REQUEST", + "PROVISIONED" + ], + "Description": "Configure @model types to create DynamoDB tables with PAY_PER_REQUEST or PROVISIONED billing modes." + }, + "DynamoDBEnablePointInTimeRecovery": { + "Type": "String", + "Default": "false", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Whether to enable Point in Time Recovery on the table." + }, + "DynamoDBEnableServerSideEncryption": { + "Type": "String", + "Default": "true", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Enable server side encryption powered by KMS." + }, + "referencetotransformerrootstackenv10C5A902Ref": { + "Type": "String" + }, + "referencetotransformerrootstackGraphQLAPI20497F53ApiId": { + "Type": "String" + }, + "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name": { + "Type": "String" + }, + "referencetotransformerrootstackS3DeploymentBucket7592718ARef": { + "Type": "String" + }, + "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref": { + "Type": "String" + } + }, + "Conditions": { + "HasEnvironmentParameter": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "referencetotransformerrootstackenv10C5A902Ref" + }, + "NONE" + ] + } + ] + }, + "ShouldUseServerSideEncryption": { + "Fn::Equals": [ + { + "Ref": "DynamoDBEnableServerSideEncryption" + }, + "true" + ] + }, + "ShouldUsePayPerRequestBilling": { + "Fn::Equals": [ + { + "Ref": "DynamoDBBillingMode" + }, + "PAY_PER_REQUEST" + ] + }, + "ShouldUsePointInTimeRecovery": { + "Fn::Equals": [ + { + "Ref": "DynamoDBEnablePointInTimeRecovery" + }, + "true" + ] + } + }, + "Resources": { + "TodoTable": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": { + "Fn::If": [ + "ShouldUsePayPerRequestBilling", + "PAY_PER_REQUEST", + { + "Ref": "AWS::NoValue" + } + ] + }, + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "Fn::If": [ + "ShouldUsePointInTimeRecovery", + { + "PointInTimeRecoveryEnabled": true + }, + { + "Ref": "AWS::NoValue" + } + ] + }, + "ProvisionedThroughput": { + "Fn::If": [ + "ShouldUsePayPerRequestBilling", + { + "Ref": "AWS::NoValue" + }, + { + "ReadCapacityUnits": { + "Ref": "DynamoDBModelTableReadIOPS" + }, + "WriteCapacityUnits": { + "Ref": "DynamoDBModelTableWriteIOPS" + } + } + ] + }, + "SSESpecification": { + "SSEEnabled": { + "Fn::If": [ + "ShouldUseServerSideEncryption", + true, + false + ] + } + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + }, + "TableName": { + "Fn::Join": [ + "", + [ + "Todo-", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "-", + { + "Ref": "referencetotransformerrootstackenv10C5A902Ref" + } + ] + ] + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "TodoIAMRole2DA8E66E": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "appsync.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:BatchGetItem", + "dynamodb:BatchWriteItem", + "dynamodb:PutItem", + "dynamodb:DeleteItem", + "dynamodb:GetItem", + "dynamodb:Scan", + "dynamodb:Query", + "dynamodb:UpdateItem", + "dynamodb:ConditionCheckItem", + "dynamodb:DescribeTable", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Sub": [ + "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${tablename}", + { + "tablename": { + "Fn::Join": [ + "", + [ + "Todo-", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "-", + { + "Ref": "referencetotransformerrootstackenv10C5A902Ref" + } + ] + ] + } + } + ] + }, + { + "Fn::Sub": [ + "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${tablename}/*", + { + "tablename": { + "Fn::Join": [ + "", + [ + "Todo-", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "-", + { + "Ref": "referencetotransformerrootstackenv10C5A902Ref" + } + ] + ] + } + } + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "DynamoDBAccess" + } + ], + "RoleName": { + "Fn::Join": [ + "", + [ + "TodoIAMRolecfd440-", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "-", + { + "Ref": "referencetotransformerrootstackenv10C5A902Ref" + } + ] + ] + } + } + }, + "TodoDataSource": { + "Type": "AWS::AppSync::DataSource", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DynamoDBConfig": { + "AwsRegion": { + "Ref": "AWS::Region" + }, + "TableName": { + "Ref": "TodoTable" + } + }, + "Name": "TodoTable", + "ServiceRoleArn": { + "Fn::GetAtt": [ + "TodoIAMRole2DA8E66E", + "Arn" + ] + }, + "Type": "AMAZON_DYNAMODB" + }, + "DependsOn": [ + "TodoIAMRole2DA8E66E" + ] + }, + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Ref": "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name" + }, + "FunctionVersion": "2018-05-29", + "Name": "QuerygetTodopostAuth0Function", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Query.getTodo.postAuth.1.req.vtl" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson({})" + } + }, + "QueryGetTodoDataResolverFnQueryGetTodoDataResolverFnAppSyncFunctionE2B57DAD": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "FunctionVersion": "2018-05-29", + "Name": "QueryGetTodoDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Query.getTodo.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Query.getTodo.res.vtl" + ] + ] + } + }, + "DependsOn": [ + "TodoDataSource" + ] + }, + "GetTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "getTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "QueryGetTodoDataResolverFnQueryGetTodoDataResolverFnAppSyncFunctionE2B57DAD", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Query\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"getTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"AMAZON_DYNAMODB\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n$util.qr($ctx.stash.put(\"tableName\", \"", + { + "Ref": "TodoTable" + }, + "\"))\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Query" + } + }, + "QueryListTodosDataResolverFnQueryListTodosDataResolverFnAppSyncFunctionF825FE47": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "FunctionVersion": "2018-05-29", + "Name": "QueryListTodosDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Query.listTodos.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Query.listTodos.res.vtl" + ] + ] + } + }, + "DependsOn": [ + "TodoDataSource" + ] + }, + "ListTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "listTodos", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "QueryListTodosDataResolverFnQueryListTodosDataResolverFnAppSyncFunctionF825FE47", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Query\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"listTodos\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"AMAZON_DYNAMODB\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n$util.qr($ctx.stash.put(\"tableName\", \"", + { + "Ref": "TodoTable" + }, + "\"))\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Query" + } + }, + "MutationcreateTodoinit0FunctionMutationcreateTodoinit0FunctionAppSyncFunction54DE5B8B": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Ref": "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name" + }, + "FunctionVersion": "2018-05-29", + "Name": "MutationcreateTodoinit0Function", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.createTodo.init.1.req.vtl" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson({})" + } + }, + "MutationCreateTodoDataResolverFnMutationCreateTodoDataResolverFnAppSyncFunction900EC5CF": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "FunctionVersion": "2018-05-29", + "Name": "MutationCreateTodoDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.createTodo.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.createTodo.res.vtl" + ] + ] + } + }, + "DependsOn": [ + "TodoDataSource" + ] + }, + "CreateTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "createTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "MutationcreateTodoinit0FunctionMutationcreateTodoinit0FunctionAppSyncFunction54DE5B8B", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "MutationCreateTodoDataResolverFnMutationCreateTodoDataResolverFnAppSyncFunction900EC5CF", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Mutation\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"createTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"AMAZON_DYNAMODB\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n$util.qr($ctx.stash.put(\"tableName\", \"", + { + "Ref": "TodoTable" + }, + "\"))\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Mutation" + } + }, + "MutationupdateTodoinit0FunctionMutationupdateTodoinit0FunctionAppSyncFunction1B95BB19": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Ref": "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name" + }, + "FunctionVersion": "2018-05-29", + "Name": "MutationupdateTodoinit0Function", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.updateTodo.init.1.req.vtl" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson({})" + } + }, + "MutationUpdateTodoDataResolverFnMutationUpdateTodoDataResolverFnAppSyncFunctionBC238C49": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "FunctionVersion": "2018-05-29", + "Name": "MutationUpdateTodoDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.updateTodo.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.updateTodo.res.vtl" + ] + ] + } + }, + "DependsOn": [ + "TodoDataSource" + ] + }, + "UpdateTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "updateTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "MutationupdateTodoinit0FunctionMutationupdateTodoinit0FunctionAppSyncFunction1B95BB19", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "MutationUpdateTodoDataResolverFnMutationUpdateTodoDataResolverFnAppSyncFunctionBC238C49", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Mutation\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"updateTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"AMAZON_DYNAMODB\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n$util.qr($ctx.stash.put(\"tableName\", \"", + { + "Ref": "TodoTable" + }, + "\"))\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Mutation" + } + }, + "MutationDeleteTodoDataResolverFnMutationDeleteTodoDataResolverFnAppSyncFunction3879153F": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "FunctionVersion": "2018-05-29", + "Name": "MutationDeleteTodoDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.deleteTodo.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.deleteTodo.res.vtl" + ] + ] + } + }, + "DependsOn": [ + "TodoDataSource" + ] + }, + "DeleteTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "deleteTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "MutationDeleteTodoDataResolverFnMutationDeleteTodoDataResolverFnAppSyncFunction3879153F", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Mutation\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"deleteTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"AMAZON_DYNAMODB\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n$util.qr($ctx.stash.put(\"tableName\", \"", + { + "Ref": "TodoTable" + }, + "\"))\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Mutation" + } + }, + "SubscriptionOnCreateTodoDataResolverFnSubscriptionOnCreateTodoDataResolverFnAppSyncFunction462A70C9": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Ref": "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name" + }, + "FunctionVersion": "2018-05-29", + "Name": "SubscriptionOnCreateTodoDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Subscription.onCreateTodo.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Subscription.onCreateTodo.res.vtl" + ] + ] + } + } + }, + "SubscriptiononCreateTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "onCreateTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "SubscriptionOnCreateTodoDataResolverFnSubscriptionOnCreateTodoDataResolverFnAppSyncFunction462A70C9", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Subscription\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"onCreateTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"NONE\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Subscription" + } + }, + "SubscriptiononUpdateTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "onUpdateTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "SubscriptionOnCreateTodoDataResolverFnSubscriptionOnCreateTodoDataResolverFnAppSyncFunction462A70C9", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Subscription\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"onUpdateTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"NONE\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Subscription" + } + }, + "SubscriptiononDeleteTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "onDeleteTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "SubscriptionOnCreateTodoDataResolverFnSubscriptionOnCreateTodoDataResolverFnAppSyncFunction462A70C9", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Subscription\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"onDeleteTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"NONE\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Subscription" + } + } + }, + "Outputs": { + "GetAttTodoTableStreamArn": { + "Description": "Your DynamoDB table StreamArn.", + "Value": { + "Fn::GetAtt": [ + "TodoTable", + "StreamArn" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "GetAtt:TodoTable:StreamArn" + ] + ] + } + } + }, + "GetAttTodoTableName": { + "Description": "Your DynamoDB table name.", + "Value": { + "Ref": "TodoTable" + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "GetAtt:TodoTable:Name" + ] + ] + } + } + }, + "GetAttTodoDataSourceName": { + "Description": "Your model DataSource name.", + "Value": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "GetAtt:TodoDataSource:Name" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/cli-inputs.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/cli-inputs.json new file mode 100644 index 0000000..9c3f8a3 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/cli-inputs.json @@ -0,0 +1,11 @@ +{ + "version": 1, + "serviceConfiguration": { + "apiName": "mynotes", + "serviceName": "AppSync", + "defaultAuthType": { + "mode": "API_KEY", + "expirationTime": 7 + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/parameters.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/parameters.json new file mode 100644 index 0000000..41a9678 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/parameters.json @@ -0,0 +1,5 @@ +{ + "AppSyncApiName": "mynotes", + "DynamoDBBillingMode": "PAY_PER_REQUEST", + "DynamoDBEnableServerSideEncryption": false +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/resolvers/README.md b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/resolvers/README.md new file mode 100644 index 0000000..89e564c --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/resolvers/README.md @@ -0,0 +1,2 @@ +Any resolvers that you add in this directory will override the ones automatically generated by Amplify CLI and will be directly copied to the cloud. +For more information, visit [https://docs.amplify.aws/cli/graphql-transformer/resolvers](https://docs.amplify.aws/cli/graphql-transformer/resolvers) \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/schema.graphql b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/schema.graphql new file mode 100644 index 0000000..930fe64 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/schema.graphql @@ -0,0 +1,11 @@ +# This "input" configures a global authorization rule to enable public access to +# all models in this schema. Learn more about authorization rules here: https://docs.amplify.aws/react/build-a-backend/graphqlapi/customize-authorization-rules/ + +input AMPLIFY { + globalAuthRule: AuthRule = { allow: public } +} # FOR TESTING ONLY! +type Todo @model { + id: ID! + name: String! + description: String +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/stacks/CustomResources.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/stacks/CustomResources.json new file mode 100644 index 0000000..f95feea --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/stacks/CustomResources.json @@ -0,0 +1,58 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "An auto-generated nested stack.", + "Metadata": {}, + "Parameters": { + "AppSyncApiId": { + "Type": "String", + "Description": "The id of the AppSync API associated with this project." + }, + "AppSyncApiName": { + "Type": "String", + "Description": "The name of the AppSync API", + "Default": "AppSyncSimpleTransform" + }, + "env": { + "Type": "String", + "Description": "The environment name. e.g. Dev, Test, or Production", + "Default": "NONE" + }, + "S3DeploymentBucket": { + "Type": "String", + "Description": "The S3 bucket containing all deployment assets for the project." + }, + "S3DeploymentRootKey": { + "Type": "String", + "Description": "An S3 key relative to the S3DeploymentBucket that points to the root\nof the deployment directory." + } + }, + "Resources": { + "EmptyResource": { + "Type": "Custom::EmptyResource", + "Condition": "AlwaysFalse" + } + }, + "Conditions": { + "HasEnvironmentParameter": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + ] + }, + "AlwaysFalse": { + "Fn::Equals": ["true", "false"] + } + }, + "Outputs": { + "EmptyOutput": { + "Description": "An empty output. You may delete this if you have at least one resource above.", + "Value": "" + } + } +} diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/transform.conf.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/transform.conf.json new file mode 100644 index 0000000..98e1e19 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/api/mynotes/transform.conf.json @@ -0,0 +1,4 @@ +{ + "Version": 5, + "ElasticsearchWarning": true +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json new file mode 100644 index 0000000..f062515 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json @@ -0,0 +1,407 @@ +{ + "Description": "Amplify Cognito Stack for AWS Amplify CLI", + "AWSTemplateFormatVersion": "2010-09-09", + "Parameters": { + "env": { + "Type": "String" + }, + "identityPoolName": { + "Type": "String" + }, + "allowUnauthenticatedIdentities": { + "Type": "String" + }, + "resourceNameTruncated": { + "Type": "String" + }, + "userPoolName": { + "Type": "String" + }, + "autoVerifiedAttributes": { + "Type": "CommaDelimitedList" + }, + "mfaConfiguration": { + "Type": "String" + }, + "mfaTypes": { + "Type": "CommaDelimitedList" + }, + "smsAuthenticationMessage": { + "Type": "String" + }, + "smsVerificationMessage": { + "Type": "String" + }, + "emailVerificationSubject": { + "Type": "String" + }, + "emailVerificationMessage": { + "Type": "String" + }, + "defaultPasswordPolicy": { + "Type": "String" + }, + "passwordPolicyMinLength": { + "Type": "String" + }, + "passwordPolicyCharacters": { + "Type": "CommaDelimitedList" + }, + "requiredAttributes": { + "Type": "CommaDelimitedList" + }, + "aliasAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientGenerateSecret": { + "Type": "String" + }, + "userpoolClientRefreshTokenValidity": { + "Type": "String" + }, + "userpoolClientWriteAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientReadAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientLambdaRole": { + "Type": "String" + }, + "userpoolClientSetAttributes": { + "Type": "String" + }, + "sharedId": { + "Type": "String" + }, + "resourceName": { + "Type": "String" + }, + "authSelections": { + "Type": "String" + }, + "useDefault": { + "Type": "String" + }, + "userPoolGroupList": { + "Type": "CommaDelimitedList" + }, + "serviceName": { + "Type": "String" + }, + "usernameCaseSensitive": { + "Type": "String" + }, + "useEnabledMfas": { + "Type": "String" + }, + "authRoleArn": { + "Type": "String" + }, + "unauthRoleArn": { + "Type": "String" + }, + "breakCircularDependency": { + "Type": "String" + }, + "dependsOn": { + "Type": "CommaDelimitedList" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + }, + "Resources": { + "UserPool": { + "Type": "AWS::Cognito::UserPool", + "Properties": { + "AutoVerifiedAttributes": [ + "email" + ], + "EmailVerificationMessage": { + "Ref": "emailVerificationMessage" + }, + "EmailVerificationSubject": { + "Ref": "emailVerificationSubject" + }, + "MfaConfiguration": { + "Ref": "mfaConfiguration" + }, + "Policies": { + "PasswordPolicy": { + "MinimumLength": { + "Ref": "passwordPolicyMinLength" + }, + "RequireLowercase": false, + "RequireNumbers": false, + "RequireSymbols": false, + "RequireUppercase": false + } + }, + "Schema": [ + { + "Mutable": true, + "Name": "email", + "Required": true + } + ], + "UserAttributeUpdateSettings": { + "AttributesRequireVerificationBeforeUpdate": [ + "email" + ] + }, + "UserPoolName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "userPoolName" + }, + { + "Fn::Join": [ + "", + [ + { + "Ref": "userPoolName" + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "UsernameConfiguration": { + "CaseSensitive": false + } + } + }, + "UserPoolClientWeb": { + "Type": "AWS::Cognito::UserPoolClient", + "Properties": { + "ClientName": "mynoteccae4f3b_app_clientWeb", + "RefreshTokenValidity": { + "Ref": "userpoolClientRefreshTokenValidity" + }, + "TokenValidityUnits": { + "RefreshToken": "days" + }, + "UserPoolId": { + "Ref": "UserPool" + } + }, + "DependsOn": [ + "UserPool" + ] + }, + "UserPoolClient": { + "Type": "AWS::Cognito::UserPoolClient", + "Properties": { + "ClientName": "mynoteccae4f3b_app_client", + "GenerateSecret": { + "Ref": "userpoolClientGenerateSecret" + }, + "RefreshTokenValidity": { + "Ref": "userpoolClientRefreshTokenValidity" + }, + "TokenValidityUnits": { + "RefreshToken": "days" + }, + "UserPoolId": { + "Ref": "UserPool" + } + }, + "DependsOn": [ + "UserPool" + ] + }, + "UserPoolClientRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + }, + "Action": "sts:AssumeRole" + } + ] + }, + "RoleName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "userpoolClientLambdaRole" + }, + { + "Fn::Join": [ + "", + [ + "upClientLambdaRoleccae4f3b", + { + "Fn::Select": [ + 3, + { + "Fn::Split": [ + "-", + { + "Ref": "AWS::StackName" + } + ] + } + ] + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + } + } + }, + "IdentityPool": { + "Type": "AWS::Cognito::IdentityPool", + "Properties": { + "AllowUnauthenticatedIdentities": { + "Ref": "allowUnauthenticatedIdentities" + }, + "CognitoIdentityProviders": [ + { + "ClientId": { + "Ref": "UserPoolClient" + }, + "ProviderName": { + "Fn::Sub": [ + "cognito-idp.${region}.amazonaws.com/${client}", + { + "region": { + "Ref": "AWS::Region" + }, + "client": { + "Ref": "UserPool" + } + } + ] + } + }, + { + "ClientId": { + "Ref": "UserPoolClientWeb" + }, + "ProviderName": { + "Fn::Sub": [ + "cognito-idp.${region}.amazonaws.com/${client}", + { + "region": { + "Ref": "AWS::Region" + }, + "client": { + "Ref": "UserPool" + } + } + ] + } + } + ], + "IdentityPoolName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "mynotesccae4f3b_identitypool_ccae4f3b", + { + "Fn::Join": [ + "", + [ + "mynotesccae4f3b_identitypool_ccae4f3b__", + { + "Ref": "env" + } + ] + ] + } + ] + } + } + }, + "IdentityPoolRoleMap": { + "Type": "AWS::Cognito::IdentityPoolRoleAttachment", + "Properties": { + "IdentityPoolId": { + "Ref": "IdentityPool" + }, + "Roles": { + "unauthenticated": { + "Ref": "unauthRoleArn" + }, + "authenticated": { + "Ref": "authRoleArn" + } + } + }, + "DependsOn": [ + "IdentityPool" + ] + } + }, + "Outputs": { + "IdentityPoolId": { + "Description": "Id for the identity pool", + "Value": { + "Ref": "IdentityPool" + } + }, + "IdentityPoolName": { + "Value": { + "Fn::GetAtt": [ + "IdentityPool", + "Name" + ] + } + }, + "UserPoolId": { + "Description": "Id for the user pool", + "Value": { + "Ref": "UserPool" + } + }, + "UserPoolArn": { + "Description": "Arn for the user pool", + "Value": { + "Fn::GetAtt": [ + "UserPool", + "Arn" + ] + } + }, + "UserPoolName": { + "Value": { + "Ref": "userPoolName" + } + }, + "AppClientIDWeb": { + "Description": "The user pool app client id for web", + "Value": { + "Ref": "UserPoolClientWeb" + } + }, + "AppClientID": { + "Description": "The user pool app client id", + "Value": { + "Ref": "UserPoolClient" + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/auth/mynotesccae4f3b/build/parameters.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/auth/mynotesccae4f3b/build/parameters.json new file mode 100644 index 0000000..2c8bdef --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/auth/mynotesccae4f3b/build/parameters.json @@ -0,0 +1,56 @@ +{ + "identityPoolName": "mynotesccae4f3b_identitypool_ccae4f3b", + "allowUnauthenticatedIdentities": true, + "resourceNameTruncated": "mynoteccae4f3b", + "userPoolName": "mynotesccae4f3b_userpool_ccae4f3b", + "autoVerifiedAttributes": [ + "email" + ], + "mfaConfiguration": "OFF", + "mfaTypes": [ + "SMS Text Message" + ], + "smsAuthenticationMessage": "Your authentication code is {####}", + "smsVerificationMessage": "Your verification code is {####}", + "emailVerificationSubject": "Your verification code", + "emailVerificationMessage": "Your verification code is {####}", + "defaultPasswordPolicy": false, + "passwordPolicyMinLength": 8, + "passwordPolicyCharacters": [], + "requiredAttributes": [ + "email" + ], + "aliasAttributes": [], + "userpoolClientGenerateSecret": false, + "userpoolClientRefreshTokenValidity": 30, + "userpoolClientWriteAttributes": [ + "email" + ], + "userpoolClientReadAttributes": [ + "email" + ], + "userpoolClientLambdaRole": "mynoteccae4f3b_userpoolclient_lambda_role", + "userpoolClientSetAttributes": false, + "sharedId": "ccae4f3b", + "resourceName": "mynotesccae4f3b", + "authSelections": "identityPoolAndUserPool", + "useDefault": "default", + "userPoolGroupList": [], + "serviceName": "Cognito", + "usernameCaseSensitive": false, + "useEnabledMfas": true, + "authRoleArn": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + }, + "unauthRoleArn": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + }, + "breakCircularDependency": true, + "dependsOn": [] +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/auth/mynotesccae4f3b/cli-inputs.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/auth/mynotesccae4f3b/cli-inputs.json new file mode 100644 index 0000000..8d149af --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/auth/mynotesccae4f3b/cli-inputs.json @@ -0,0 +1,59 @@ +{ + "version": "1", + "cognitoConfig": { + "identityPoolName": "mynotesccae4f3b_identitypool_ccae4f3b", + "allowUnauthenticatedIdentities": true, + "resourceNameTruncated": "mynoteccae4f3b", + "userPoolName": "mynotesccae4f3b_userpool_ccae4f3b", + "autoVerifiedAttributes": [ + "email" + ], + "mfaConfiguration": "OFF", + "mfaTypes": [ + "SMS Text Message" + ], + "smsAuthenticationMessage": "Your authentication code is {####}", + "smsVerificationMessage": "Your verification code is {####}", + "emailVerificationSubject": "Your verification code", + "emailVerificationMessage": "Your verification code is {####}", + "defaultPasswordPolicy": false, + "passwordPolicyMinLength": 8, + "passwordPolicyCharacters": [], + "requiredAttributes": [ + "email" + ], + "aliasAttributes": [], + "userpoolClientGenerateSecret": false, + "userpoolClientRefreshTokenValidity": 30, + "userpoolClientWriteAttributes": [ + "email" + ], + "userpoolClientReadAttributes": [ + "email" + ], + "userpoolClientLambdaRole": "mynoteccae4f3b_userpoolclient_lambda_role", + "userpoolClientSetAttributes": false, + "sharedId": "ccae4f3b", + "resourceName": "mynotesccae4f3b", + "authSelections": "identityPoolAndUserPool", + "useDefault": "default", + "userPoolGroupList": [], + "serviceName": "Cognito", + "usernameCaseSensitive": false, + "useEnabledMfas": true, + "authRoleArn": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + }, + "unauthRoleArn": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + }, + "breakCircularDependency": true, + "dependsOn": [] + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/api/mynotes/build/cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/api/mynotes/build/cloudformation-template.json new file mode 100644 index 0000000..044e9db --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/api/mynotes/build/cloudformation-template.json @@ -0,0 +1,316 @@ +{ + "Parameters": { + "env": { + "Type": "String", + "Default": "NONE" + }, + "AppSyncApiName": { + "Type": "String", + "Default": "AppSyncSimpleTransform" + }, + "DynamoDBModelTableReadIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of read IOPS the table should support." + }, + "DynamoDBModelTableWriteIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of write IOPS the table should support." + }, + "DynamoDBBillingMode": { + "Type": "String", + "Default": "PAY_PER_REQUEST", + "AllowedValues": [ + "PAY_PER_REQUEST", + "PROVISIONED" + ], + "Description": "Configure @model types to create DynamoDB tables with PAY_PER_REQUEST or PROVISIONED billing modes." + }, + "DynamoDBEnablePointInTimeRecovery": { + "Type": "String", + "Default": "false", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Whether to enable Point in Time Recovery on the table." + }, + "DynamoDBEnableServerSideEncryption": { + "Type": "String", + "Default": "true", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Enable server side encryption powered by KMS." + }, + "S3DeploymentBucket": { + "Type": "String", + "Description": "An S3 Bucket name where assets are deployed" + }, + "S3DeploymentRootKey": { + "Type": "String", + "Description": "An S3 key relative to the S3DeploymentBucket that points to the root of the deployment directory." + } + }, + "Resources": { + "GraphQLAPI": { + "Type": "AWS::AppSync::GraphQLApi", + "Properties": { + "AuthenticationType": "API_KEY", + "Name": { + "Fn::Join": [ + "", + [ + { + "Ref": "AppSyncApiName" + }, + "-", + { + "Ref": "env" + } + ] + ] + } + } + }, + "GraphQLAPITransformerSchema3CB2AE18": { + "Type": "AWS::AppSync::GraphQLSchema", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "DefinitionS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "S3DeploymentBucket" + }, + "/", + { + "Ref": "S3DeploymentRootKey" + }, + "/schema.graphql" + ] + ] + } + } + }, + "GraphQLAPIDefaultApiKey215A6DD7": { + "Type": "AWS::AppSync::ApiKey", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Expires": 1722598000 + } + }, + "GraphQLAPINONEDS95A13CF0": { + "Type": "AWS::AppSync::DataSource", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Description": "None Data Source for Pipeline functions", + "Name": "NONE_DS", + "Type": "NONE" + } + }, + "Todo": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "Parameters": { + "DynamoDBModelTableReadIOPS": { + "Ref": "DynamoDBModelTableReadIOPS" + }, + "DynamoDBModelTableWriteIOPS": { + "Ref": "DynamoDBModelTableWriteIOPS" + }, + "DynamoDBBillingMode": { + "Ref": "DynamoDBBillingMode" + }, + "DynamoDBEnablePointInTimeRecovery": { + "Ref": "DynamoDBEnablePointInTimeRecovery" + }, + "DynamoDBEnableServerSideEncryption": { + "Ref": "DynamoDBEnableServerSideEncryption" + }, + "referencetotransformerrootstackenv10C5A902Ref": { + "Ref": "env" + }, + "referencetotransformerrootstackGraphQLAPI20497F53ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name": { + "Fn::GetAtt": [ + "GraphQLAPINONEDS95A13CF0", + "Name" + ] + }, + "referencetotransformerrootstackS3DeploymentBucket7592718ARef": { + "Ref": "S3DeploymentBucket" + }, + "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref": { + "Ref": "S3DeploymentRootKey" + } + }, + "TemplateURL": { + "Fn::Join": [ + "", + [ + "https://s3.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "S3DeploymentBucket" + }, + "/", + { + "Ref": "S3DeploymentRootKey" + }, + "/stacks/Todo.json" + ] + ] + } + }, + "DependsOn": [ + "GraphQLAPITransformerSchema3CB2AE18" + ] + }, + "CustomResourcesjson": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "Parameters": { + "AppSyncApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "AppSyncApiName": { + "Ref": "AppSyncApiName" + }, + "env": { + "Ref": "env" + }, + "S3DeploymentBucket": { + "Ref": "S3DeploymentBucket" + }, + "S3DeploymentRootKey": { + "Ref": "S3DeploymentRootKey" + } + }, + "TemplateURL": { + "Fn::Join": [ + "/", + [ + "https://s3.amazonaws.com", + { + "Ref": "S3DeploymentBucket" + }, + { + "Ref": "S3DeploymentRootKey" + }, + "stacks", + "CustomResources.json" + ] + ] + } + }, + "DependsOn": [ + "GraphQLAPI", + "GraphQLAPITransformerSchema3CB2AE18", + "Todo" + ] + } + }, + "Outputs": { + "GraphQLAPIKeyOutput": { + "Description": "Your GraphQL API ID.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPIDefaultApiKey215A6DD7", + "ApiKey" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiKey" + ] + ] + } + } + }, + "GraphQLAPIIdOutput": { + "Description": "Your GraphQL API ID.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiId" + ] + ] + } + } + }, + "GraphQLAPIEndpointOutput": { + "Description": "Your GraphQL API endpoint.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPI", + "GraphQLUrl" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiEndpoint" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json new file mode 100644 index 0000000..f062515 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json @@ -0,0 +1,407 @@ +{ + "Description": "Amplify Cognito Stack for AWS Amplify CLI", + "AWSTemplateFormatVersion": "2010-09-09", + "Parameters": { + "env": { + "Type": "String" + }, + "identityPoolName": { + "Type": "String" + }, + "allowUnauthenticatedIdentities": { + "Type": "String" + }, + "resourceNameTruncated": { + "Type": "String" + }, + "userPoolName": { + "Type": "String" + }, + "autoVerifiedAttributes": { + "Type": "CommaDelimitedList" + }, + "mfaConfiguration": { + "Type": "String" + }, + "mfaTypes": { + "Type": "CommaDelimitedList" + }, + "smsAuthenticationMessage": { + "Type": "String" + }, + "smsVerificationMessage": { + "Type": "String" + }, + "emailVerificationSubject": { + "Type": "String" + }, + "emailVerificationMessage": { + "Type": "String" + }, + "defaultPasswordPolicy": { + "Type": "String" + }, + "passwordPolicyMinLength": { + "Type": "String" + }, + "passwordPolicyCharacters": { + "Type": "CommaDelimitedList" + }, + "requiredAttributes": { + "Type": "CommaDelimitedList" + }, + "aliasAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientGenerateSecret": { + "Type": "String" + }, + "userpoolClientRefreshTokenValidity": { + "Type": "String" + }, + "userpoolClientWriteAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientReadAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientLambdaRole": { + "Type": "String" + }, + "userpoolClientSetAttributes": { + "Type": "String" + }, + "sharedId": { + "Type": "String" + }, + "resourceName": { + "Type": "String" + }, + "authSelections": { + "Type": "String" + }, + "useDefault": { + "Type": "String" + }, + "userPoolGroupList": { + "Type": "CommaDelimitedList" + }, + "serviceName": { + "Type": "String" + }, + "usernameCaseSensitive": { + "Type": "String" + }, + "useEnabledMfas": { + "Type": "String" + }, + "authRoleArn": { + "Type": "String" + }, + "unauthRoleArn": { + "Type": "String" + }, + "breakCircularDependency": { + "Type": "String" + }, + "dependsOn": { + "Type": "CommaDelimitedList" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + }, + "Resources": { + "UserPool": { + "Type": "AWS::Cognito::UserPool", + "Properties": { + "AutoVerifiedAttributes": [ + "email" + ], + "EmailVerificationMessage": { + "Ref": "emailVerificationMessage" + }, + "EmailVerificationSubject": { + "Ref": "emailVerificationSubject" + }, + "MfaConfiguration": { + "Ref": "mfaConfiguration" + }, + "Policies": { + "PasswordPolicy": { + "MinimumLength": { + "Ref": "passwordPolicyMinLength" + }, + "RequireLowercase": false, + "RequireNumbers": false, + "RequireSymbols": false, + "RequireUppercase": false + } + }, + "Schema": [ + { + "Mutable": true, + "Name": "email", + "Required": true + } + ], + "UserAttributeUpdateSettings": { + "AttributesRequireVerificationBeforeUpdate": [ + "email" + ] + }, + "UserPoolName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "userPoolName" + }, + { + "Fn::Join": [ + "", + [ + { + "Ref": "userPoolName" + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "UsernameConfiguration": { + "CaseSensitive": false + } + } + }, + "UserPoolClientWeb": { + "Type": "AWS::Cognito::UserPoolClient", + "Properties": { + "ClientName": "mynoteccae4f3b_app_clientWeb", + "RefreshTokenValidity": { + "Ref": "userpoolClientRefreshTokenValidity" + }, + "TokenValidityUnits": { + "RefreshToken": "days" + }, + "UserPoolId": { + "Ref": "UserPool" + } + }, + "DependsOn": [ + "UserPool" + ] + }, + "UserPoolClient": { + "Type": "AWS::Cognito::UserPoolClient", + "Properties": { + "ClientName": "mynoteccae4f3b_app_client", + "GenerateSecret": { + "Ref": "userpoolClientGenerateSecret" + }, + "RefreshTokenValidity": { + "Ref": "userpoolClientRefreshTokenValidity" + }, + "TokenValidityUnits": { + "RefreshToken": "days" + }, + "UserPoolId": { + "Ref": "UserPool" + } + }, + "DependsOn": [ + "UserPool" + ] + }, + "UserPoolClientRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + }, + "Action": "sts:AssumeRole" + } + ] + }, + "RoleName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "userpoolClientLambdaRole" + }, + { + "Fn::Join": [ + "", + [ + "upClientLambdaRoleccae4f3b", + { + "Fn::Select": [ + 3, + { + "Fn::Split": [ + "-", + { + "Ref": "AWS::StackName" + } + ] + } + ] + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + } + } + }, + "IdentityPool": { + "Type": "AWS::Cognito::IdentityPool", + "Properties": { + "AllowUnauthenticatedIdentities": { + "Ref": "allowUnauthenticatedIdentities" + }, + "CognitoIdentityProviders": [ + { + "ClientId": { + "Ref": "UserPoolClient" + }, + "ProviderName": { + "Fn::Sub": [ + "cognito-idp.${region}.amazonaws.com/${client}", + { + "region": { + "Ref": "AWS::Region" + }, + "client": { + "Ref": "UserPool" + } + } + ] + } + }, + { + "ClientId": { + "Ref": "UserPoolClientWeb" + }, + "ProviderName": { + "Fn::Sub": [ + "cognito-idp.${region}.amazonaws.com/${client}", + { + "region": { + "Ref": "AWS::Region" + }, + "client": { + "Ref": "UserPool" + } + } + ] + } + } + ], + "IdentityPoolName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "mynotesccae4f3b_identitypool_ccae4f3b", + { + "Fn::Join": [ + "", + [ + "mynotesccae4f3b_identitypool_ccae4f3b__", + { + "Ref": "env" + } + ] + ] + } + ] + } + } + }, + "IdentityPoolRoleMap": { + "Type": "AWS::Cognito::IdentityPoolRoleAttachment", + "Properties": { + "IdentityPoolId": { + "Ref": "IdentityPool" + }, + "Roles": { + "unauthenticated": { + "Ref": "unauthRoleArn" + }, + "authenticated": { + "Ref": "authRoleArn" + } + } + }, + "DependsOn": [ + "IdentityPool" + ] + } + }, + "Outputs": { + "IdentityPoolId": { + "Description": "Id for the identity pool", + "Value": { + "Ref": "IdentityPool" + } + }, + "IdentityPoolName": { + "Value": { + "Fn::GetAtt": [ + "IdentityPool", + "Name" + ] + } + }, + "UserPoolId": { + "Description": "Id for the user pool", + "Value": { + "Ref": "UserPool" + } + }, + "UserPoolArn": { + "Description": "Arn for the user pool", + "Value": { + "Fn::GetAtt": [ + "UserPool", + "Arn" + ] + } + }, + "UserPoolName": { + "Value": { + "Ref": "userPoolName" + } + }, + "AppClientIDWeb": { + "Description": "The user pool app client id for web", + "Value": { + "Ref": "UserPoolClientWeb" + } + }, + "AppClientID": { + "Description": "The user pool app client id", + "Value": { + "Ref": "UserPoolClient" + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/awscloudformation/build/root-cloudformation-stack.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/awscloudformation/build/root-cloudformation-stack.json new file mode 100644 index 0000000..1e3972c --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/awscloudformation/build/root-cloudformation-stack.json @@ -0,0 +1,437 @@ +{ + "Description": "Root Stack for AWS Amplify Console", + "AWSTemplateFormatVersion": "2010-09-09", + "Parameters": { + "DeploymentBucketName": { + "Type": "String", + "Default": "DeploymentBucket", + "Description": "Name of the common deployment bucket provided by the parent stack" + }, + "AuthRoleName": { + "Type": "String", + "Default": "AuthRoleName", + "Description": "Name of the common deployment bucket provided by the parent stack" + }, + "UnauthRoleName": { + "Type": "String", + "Default": "UnAuthRoleName", + "Description": "Name of the common deployment bucket provided by the parent stack" + } + }, + "Outputs": { + "Region": { + "Description": "CloudFormation provider root stack Region", + "Value": { + "Ref": "AWS::Region" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-Region" + } + } + }, + "StackName": { + "Description": "CloudFormation provider root stack ID", + "Value": { + "Ref": "AWS::StackName" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-StackName" + } + } + }, + "StackId": { + "Description": "CloudFormation provider root stack name", + "Value": { + "Ref": "AWS::StackId" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-StackId" + } + } + }, + "AuthRoleArn": { + "Value": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + } + }, + "UnauthRoleArn": { + "Value": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + } + }, + "DeploymentBucketName": { + "Description": "CloudFormation provider root stack deployment bucket name", + "Value": { + "Ref": "DeploymentBucketName" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-DeploymentBucketName" + } + } + }, + "AuthRoleName": { + "Value": { + "Ref": "AuthRole" + } + }, + "UnauthRoleName": { + "Value": { + "Ref": "UnauthRole" + } + } + }, + "Resources": { + "DeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "DeploymentBucketName" + }, + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "AuthRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "", + "Effect": "Deny", + "Principal": { + "Federated": "cognito-identity.amazonaws.com" + }, + "Action": "sts:AssumeRoleWithWebIdentity" + } + ] + }, + "RoleName": { + "Ref": "AuthRoleName" + } + } + }, + "UnauthRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "", + "Effect": "Deny", + "Principal": { + "Federated": "cognito-identity.amazonaws.com" + }, + "Action": "sts:AssumeRoleWithWebIdentity" + } + ] + }, + "RoleName": { + "Ref": "UnauthRoleName" + } + } + }, + "apimynotes": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/api/cloudformation-template.json", + "Parameters": { + "AppSyncApiName": "mynotes", + "DynamoDBBillingMode": "PAY_PER_REQUEST", + "DynamoDBEnableServerSideEncryption": false, + "S3DeploymentBucket": "amplify-mynotes-staging-b2b56-deployment", + "S3DeploymentRootKey": "amplify-appsync-files/c0e971ea1ba703ba5054d45b1d4a7a475f98dd0a", + "env": "staging" + } + } + }, + "authmynotesccae4f3b": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/auth/mynotesccae4f3b-cloudformation-template.json", + "Parameters": { + "identityPoolName": "mynotesccae4f3b_identitypool_ccae4f3b", + "allowUnauthenticatedIdentities": true, + "resourceNameTruncated": "mynoteccae4f3b", + "userPoolName": "mynotesccae4f3b_userpool_ccae4f3b", + "autoVerifiedAttributes": "email", + "mfaConfiguration": "OFF", + "mfaTypes": "SMS Text Message", + "smsAuthenticationMessage": "Your authentication code is {####}", + "smsVerificationMessage": "Your verification code is {####}", + "emailVerificationSubject": "Your verification code", + "emailVerificationMessage": "Your verification code is {####}", + "defaultPasswordPolicy": false, + "passwordPolicyMinLength": 8, + "passwordPolicyCharacters": "", + "requiredAttributes": "email", + "aliasAttributes": "", + "userpoolClientGenerateSecret": false, + "userpoolClientRefreshTokenValidity": 30, + "userpoolClientWriteAttributes": "email", + "userpoolClientReadAttributes": "email", + "userpoolClientLambdaRole": "mynoteccae4f3b_userpoolclient_lambda_role", + "userpoolClientSetAttributes": false, + "sharedId": "ccae4f3b", + "resourceName": "mynotesccae4f3b", + "authSelections": "identityPoolAndUserPool", + "useDefault": "default", + "userPoolGroupList": "", + "serviceName": "Cognito", + "usernameCaseSensitive": false, + "useEnabledMfas": true, + "authRoleArn": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + }, + "unauthRoleArn": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + }, + "breakCircularDependency": true, + "dependsOn": "", + "env": "staging" + } + } + }, + "functionS3Triggerdc42a5d7": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/function/S3Triggerdc42a5d7-cloudformation-template.json", + "Parameters": { + "deploymentBucketName": "amplify-mynotes-staging-b2b56-deployment", + "s3Key": "amplify-builds/S3Triggerdc42a5d7-6a475541666d35456861-build.zip", + "env": "staging" + } + } + }, + "UpdateRolesWithIDPFunction": { + "DependsOn": [ + "AuthRole", + "UnauthRole", + "authmynotesccae4f3b" + ], + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": { + "Fn::Join": [ + "\n", + [ + "const response = require('cfn-response');", + "const { IAMClient, GetRoleCommand, UpdateAssumeRolePolicyCommand } = require('@aws-sdk/client-iam');", + "exports.handler = function(event, context) {", + " // Don't return promise, response.send() marks context as done internally", + " const ignoredPromise = handleEvent(event, context)", + "};", + "async function handleEvent(event, context) {", + " try {", + " let authRoleName = event.ResourceProperties.authRoleName;", + " let unauthRoleName = event.ResourceProperties.unauthRoleName;", + " let idpId = event.ResourceProperties.idpId;", + " let authParamsJson = {", + " 'Version': '2012-10-17',", + " 'Statement': [{", + " 'Effect': 'Allow',", + " 'Principal': {'Federated': 'cognito-identity.amazonaws.com'},", + " 'Action': 'sts:AssumeRoleWithWebIdentity',", + " 'Condition': {", + " 'StringEquals': {'cognito-identity.amazonaws.com:aud': idpId},", + " 'ForAnyValue:StringLike': {'cognito-identity.amazonaws.com:amr': 'authenticated'}", + " }", + " }]", + " };", + " let unauthParamsJson = {", + " 'Version': '2012-10-17',", + " 'Statement': [{", + " 'Effect': 'Allow',", + " 'Principal': {'Federated': 'cognito-identity.amazonaws.com'},", + " 'Action': 'sts:AssumeRoleWithWebIdentity',", + " 'Condition': {", + " 'StringEquals': {'cognito-identity.amazonaws.com:aud': idpId},", + " 'ForAnyValue:StringLike': {'cognito-identity.amazonaws.com:amr': 'unauthenticated'}", + " }", + " }]", + " };", + " if (event.RequestType === 'Delete') {", + " try {", + " delete authParamsJson.Statement[0].Condition;", + " delete unauthParamsJson.Statement[0].Condition;", + " authParamsJson.Statement[0].Effect = 'Deny'", + " unauthParamsJson.Statement[0].Effect = 'Deny'", + " let authParams = {PolicyDocument: JSON.stringify(authParamsJson), RoleName: authRoleName};", + " let unauthParams = {PolicyDocument: JSON.stringify(unauthParamsJson), RoleName: unauthRoleName};", + " const iam = new IAMClient({region: event.ResourceProperties.region});", + " let res = await Promise.all([", + " iam.send(new GetRoleCommand({RoleName: authParams.RoleName})),", + " iam.send(new GetRoleCommand({RoleName: unauthParams.RoleName}))", + " ]);", + " res = await Promise.all([", + " iam.send(new UpdateAssumeRolePolicyCommand(authParams)),", + " iam.send(new UpdateAssumeRolePolicyCommand(unauthParams))", + " ]);", + " response.send(event, context, response.SUCCESS, {});", + " } catch (err) {", + " console.log(err.stack);", + " response.send(event, context, response.SUCCESS, {Error: err});", + " }", + " } else if (event.RequestType === 'Update' || event.RequestType === 'Create') {", + " const iam = new IAMClient({region: event.ResourceProperties.region});", + " let authParams = {PolicyDocument: JSON.stringify(authParamsJson), RoleName: authRoleName};", + " let unauthParams = {PolicyDocument: JSON.stringify(unauthParamsJson), RoleName: unauthRoleName};", + " const res = await Promise.all([", + " iam.send(new UpdateAssumeRolePolicyCommand(authParams)),", + " iam.send(new UpdateAssumeRolePolicyCommand(unauthParams))", + " ]);", + " response.send(event, context, response.SUCCESS, {});", + " }", + " } catch (err) {", + " console.log(err.stack);", + " response.send(event, context, response.FAILED, {Error: err});", + " }", + "};" + ] + ] + } + }, + "Handler": "index.handler", + "Runtime": "nodejs18.x", + "Timeout": 300, + "Role": { + "Fn::GetAtt": [ + "UpdateRolesWithIDPFunctionRole", + "Arn" + ] + } + } + }, + "UpdateRolesWithIDPFunctionOutputs": { + "Type": "Custom::LambdaCallout", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "UpdateRolesWithIDPFunction", + "Arn" + ] + }, + "region": { + "Ref": "AWS::Region" + }, + "idpId": { + "Fn::GetAtt": [ + "authmynotesccae4f3b", + "Outputs.IdentityPoolId" + ] + }, + "authRoleName": { + "Ref": "AuthRole" + }, + "unauthRoleName": { + "Ref": "UnauthRole" + } + } + }, + "UpdateRolesWithIDPFunctionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "RoleName": { + "Fn::Join": [ + "", + [ + { + "Ref": "AuthRole" + }, + "-idp" + ] + ] + }, + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": "UpdateRolesWithIDPFunctionPolicy", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": "arn:aws:logs:*:*:*" + }, + { + "Effect": "Allow", + "Action": [ + "iam:UpdateAssumeRolePolicy", + "iam:GetRole" + ], + "Resource": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + } + }, + { + "Effect": "Allow", + "Action": [ + "iam:UpdateAssumeRolePolicy", + "iam:GetRole" + ], + "Resource": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + } + } + ] + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/function/S3Trigger168e5d52/S3Trigger168e5d52-cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/function/S3Trigger168e5d52/S3Trigger168e5d52-cloudformation-template.json new file mode 100644 index 0000000..bada55f --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/function/S3Trigger168e5d52/S3Trigger168e5d52-cloudformation-template.json @@ -0,0 +1,193 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "{\"createdOn\":\"Mac\",\"createdBy\":\"Amplify\",\"createdWith\":\"12.12.4\",\"stackType\":\"function-Lambda\",\"metadata\":{}}", + "Parameters": { + "env": { + "Type": "String" + }, + "deploymentBucketName": { + "Type": "String" + }, + "s3Key": { + "Type": "String" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + }, + "Resources": { + "LambdaFunction": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "aws:asset:path": "./src", + "aws:asset:property": "Code" + }, + "Properties": { + "Handler": "index.handler", + "FunctionName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Trigger168e5d52", + { + "Fn::Join": [ + "", + [ + "S3Trigger168e5d52", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "Environment": { + "Variables": { + "ENV": { + "Ref": "env" + } + } + }, + "Role": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 25, + "Code": { + "S3Bucket": { + "Ref": "deploymentBucketName" + }, + "S3Key": { + "Ref": "s3Key" + } + } + } + }, + "LambdaExecutionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "RoleName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Trigger168e5d52LambdaRole168e5d52", + { + "Fn::Join": [ + "", + [ + "S3Trigger168e5d52LambdaRole168e5d52", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + } + } + }, + "lambdaexecutionpolicy": { + "DependsOn": [ + "LambdaExecutionRole" + ], + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyName": "lambda-execution-policy", + "Roles": [ + { + "Ref": "LambdaExecutionRole" + } + ], + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": { + "Fn::Sub": [ + "arn:aws:logs:${region}:${account}:log-group:/aws/lambda/${lambda}:log-stream:*", + { + "region": { + "Ref": "AWS::Region" + }, + "account": { + "Ref": "AWS::AccountId" + }, + "lambda": { + "Ref": "LambdaFunction" + } + } + ] + } + } + ] + } + } + } + }, + "Outputs": { + "Name": { + "Value": { + "Ref": "LambdaFunction" + } + }, + "Arn": { + "Value": { + "Fn::GetAtt": [ + "LambdaFunction", + "Arn" + ] + } + }, + "Region": { + "Value": { + "Ref": "AWS::Region" + } + }, + "LambdaExecutionRole": { + "Value": { + "Ref": "LambdaExecutionRole" + } + }, + "LambdaExecutionRoleArn": { + "Value": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json new file mode 100644 index 0000000..9972262 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json @@ -0,0 +1,193 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "{\"createdOn\":\"Mac\",\"createdBy\":\"Amplify\",\"createdWith\":\"12.12.4\",\"stackType\":\"function-Lambda\",\"metadata\":{}}", + "Parameters": { + "env": { + "Type": "String" + }, + "deploymentBucketName": { + "Type": "String" + }, + "s3Key": { + "Type": "String" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + }, + "Resources": { + "LambdaFunction": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "aws:asset:path": "./src", + "aws:asset:property": "Code" + }, + "Properties": { + "Handler": "index.handler", + "FunctionName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Triggerdc42a5d7", + { + "Fn::Join": [ + "", + [ + "S3Triggerdc42a5d7", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "Environment": { + "Variables": { + "ENV": { + "Ref": "env" + } + } + }, + "Role": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 25, + "Code": { + "S3Bucket": { + "Ref": "deploymentBucketName" + }, + "S3Key": { + "Ref": "s3Key" + } + } + } + }, + "LambdaExecutionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "RoleName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Triggerdc42a5d7LambdaRoledc42a5d7", + { + "Fn::Join": [ + "", + [ + "S3Triggerdc42a5d7LambdaRoledc42a5d7", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + } + } + }, + "lambdaexecutionpolicy": { + "DependsOn": [ + "LambdaExecutionRole" + ], + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyName": "lambda-execution-policy", + "Roles": [ + { + "Ref": "LambdaExecutionRole" + } + ], + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": { + "Fn::Sub": [ + "arn:aws:logs:${region}:${account}:log-group:/aws/lambda/${lambda}:log-stream:*", + { + "region": { + "Ref": "AWS::Region" + }, + "account": { + "Ref": "AWS::AccountId" + }, + "lambda": { + "Ref": "LambdaFunction" + } + } + ] + } + } + ] + } + } + } + }, + "Outputs": { + "Name": { + "Value": { + "Ref": "LambdaFunction" + } + }, + "Arn": { + "Value": { + "Fn::GetAtt": [ + "LambdaFunction", + "Arn" + ] + } + }, + "Region": { + "Value": { + "Ref": "AWS::Region" + } + }, + "LambdaExecutionRole": { + "Value": { + "Ref": "LambdaExecutionRole" + } + }, + "LambdaExecutionRoleArn": { + "Value": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/root-cloudformation-stack.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/root-cloudformation-stack.json new file mode 100644 index 0000000..1e3972c --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/root-cloudformation-stack.json @@ -0,0 +1,437 @@ +{ + "Description": "Root Stack for AWS Amplify Console", + "AWSTemplateFormatVersion": "2010-09-09", + "Parameters": { + "DeploymentBucketName": { + "Type": "String", + "Default": "DeploymentBucket", + "Description": "Name of the common deployment bucket provided by the parent stack" + }, + "AuthRoleName": { + "Type": "String", + "Default": "AuthRoleName", + "Description": "Name of the common deployment bucket provided by the parent stack" + }, + "UnauthRoleName": { + "Type": "String", + "Default": "UnAuthRoleName", + "Description": "Name of the common deployment bucket provided by the parent stack" + } + }, + "Outputs": { + "Region": { + "Description": "CloudFormation provider root stack Region", + "Value": { + "Ref": "AWS::Region" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-Region" + } + } + }, + "StackName": { + "Description": "CloudFormation provider root stack ID", + "Value": { + "Ref": "AWS::StackName" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-StackName" + } + } + }, + "StackId": { + "Description": "CloudFormation provider root stack name", + "Value": { + "Ref": "AWS::StackId" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-StackId" + } + } + }, + "AuthRoleArn": { + "Value": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + } + }, + "UnauthRoleArn": { + "Value": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + } + }, + "DeploymentBucketName": { + "Description": "CloudFormation provider root stack deployment bucket name", + "Value": { + "Ref": "DeploymentBucketName" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-DeploymentBucketName" + } + } + }, + "AuthRoleName": { + "Value": { + "Ref": "AuthRole" + } + }, + "UnauthRoleName": { + "Value": { + "Ref": "UnauthRole" + } + } + }, + "Resources": { + "DeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "DeploymentBucketName" + }, + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "AuthRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "", + "Effect": "Deny", + "Principal": { + "Federated": "cognito-identity.amazonaws.com" + }, + "Action": "sts:AssumeRoleWithWebIdentity" + } + ] + }, + "RoleName": { + "Ref": "AuthRoleName" + } + } + }, + "UnauthRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "", + "Effect": "Deny", + "Principal": { + "Federated": "cognito-identity.amazonaws.com" + }, + "Action": "sts:AssumeRoleWithWebIdentity" + } + ] + }, + "RoleName": { + "Ref": "UnauthRoleName" + } + } + }, + "apimynotes": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/api/cloudformation-template.json", + "Parameters": { + "AppSyncApiName": "mynotes", + "DynamoDBBillingMode": "PAY_PER_REQUEST", + "DynamoDBEnableServerSideEncryption": false, + "S3DeploymentBucket": "amplify-mynotes-staging-b2b56-deployment", + "S3DeploymentRootKey": "amplify-appsync-files/c0e971ea1ba703ba5054d45b1d4a7a475f98dd0a", + "env": "staging" + } + } + }, + "authmynotesccae4f3b": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/auth/mynotesccae4f3b-cloudformation-template.json", + "Parameters": { + "identityPoolName": "mynotesccae4f3b_identitypool_ccae4f3b", + "allowUnauthenticatedIdentities": true, + "resourceNameTruncated": "mynoteccae4f3b", + "userPoolName": "mynotesccae4f3b_userpool_ccae4f3b", + "autoVerifiedAttributes": "email", + "mfaConfiguration": "OFF", + "mfaTypes": "SMS Text Message", + "smsAuthenticationMessage": "Your authentication code is {####}", + "smsVerificationMessage": "Your verification code is {####}", + "emailVerificationSubject": "Your verification code", + "emailVerificationMessage": "Your verification code is {####}", + "defaultPasswordPolicy": false, + "passwordPolicyMinLength": 8, + "passwordPolicyCharacters": "", + "requiredAttributes": "email", + "aliasAttributes": "", + "userpoolClientGenerateSecret": false, + "userpoolClientRefreshTokenValidity": 30, + "userpoolClientWriteAttributes": "email", + "userpoolClientReadAttributes": "email", + "userpoolClientLambdaRole": "mynoteccae4f3b_userpoolclient_lambda_role", + "userpoolClientSetAttributes": false, + "sharedId": "ccae4f3b", + "resourceName": "mynotesccae4f3b", + "authSelections": "identityPoolAndUserPool", + "useDefault": "default", + "userPoolGroupList": "", + "serviceName": "Cognito", + "usernameCaseSensitive": false, + "useEnabledMfas": true, + "authRoleArn": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + }, + "unauthRoleArn": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + }, + "breakCircularDependency": true, + "dependsOn": "", + "env": "staging" + } + } + }, + "functionS3Triggerdc42a5d7": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/function/S3Triggerdc42a5d7-cloudformation-template.json", + "Parameters": { + "deploymentBucketName": "amplify-mynotes-staging-b2b56-deployment", + "s3Key": "amplify-builds/S3Triggerdc42a5d7-6a475541666d35456861-build.zip", + "env": "staging" + } + } + }, + "UpdateRolesWithIDPFunction": { + "DependsOn": [ + "AuthRole", + "UnauthRole", + "authmynotesccae4f3b" + ], + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": { + "Fn::Join": [ + "\n", + [ + "const response = require('cfn-response');", + "const { IAMClient, GetRoleCommand, UpdateAssumeRolePolicyCommand } = require('@aws-sdk/client-iam');", + "exports.handler = function(event, context) {", + " // Don't return promise, response.send() marks context as done internally", + " const ignoredPromise = handleEvent(event, context)", + "};", + "async function handleEvent(event, context) {", + " try {", + " let authRoleName = event.ResourceProperties.authRoleName;", + " let unauthRoleName = event.ResourceProperties.unauthRoleName;", + " let idpId = event.ResourceProperties.idpId;", + " let authParamsJson = {", + " 'Version': '2012-10-17',", + " 'Statement': [{", + " 'Effect': 'Allow',", + " 'Principal': {'Federated': 'cognito-identity.amazonaws.com'},", + " 'Action': 'sts:AssumeRoleWithWebIdentity',", + " 'Condition': {", + " 'StringEquals': {'cognito-identity.amazonaws.com:aud': idpId},", + " 'ForAnyValue:StringLike': {'cognito-identity.amazonaws.com:amr': 'authenticated'}", + " }", + " }]", + " };", + " let unauthParamsJson = {", + " 'Version': '2012-10-17',", + " 'Statement': [{", + " 'Effect': 'Allow',", + " 'Principal': {'Federated': 'cognito-identity.amazonaws.com'},", + " 'Action': 'sts:AssumeRoleWithWebIdentity',", + " 'Condition': {", + " 'StringEquals': {'cognito-identity.amazonaws.com:aud': idpId},", + " 'ForAnyValue:StringLike': {'cognito-identity.amazonaws.com:amr': 'unauthenticated'}", + " }", + " }]", + " };", + " if (event.RequestType === 'Delete') {", + " try {", + " delete authParamsJson.Statement[0].Condition;", + " delete unauthParamsJson.Statement[0].Condition;", + " authParamsJson.Statement[0].Effect = 'Deny'", + " unauthParamsJson.Statement[0].Effect = 'Deny'", + " let authParams = {PolicyDocument: JSON.stringify(authParamsJson), RoleName: authRoleName};", + " let unauthParams = {PolicyDocument: JSON.stringify(unauthParamsJson), RoleName: unauthRoleName};", + " const iam = new IAMClient({region: event.ResourceProperties.region});", + " let res = await Promise.all([", + " iam.send(new GetRoleCommand({RoleName: authParams.RoleName})),", + " iam.send(new GetRoleCommand({RoleName: unauthParams.RoleName}))", + " ]);", + " res = await Promise.all([", + " iam.send(new UpdateAssumeRolePolicyCommand(authParams)),", + " iam.send(new UpdateAssumeRolePolicyCommand(unauthParams))", + " ]);", + " response.send(event, context, response.SUCCESS, {});", + " } catch (err) {", + " console.log(err.stack);", + " response.send(event, context, response.SUCCESS, {Error: err});", + " }", + " } else if (event.RequestType === 'Update' || event.RequestType === 'Create') {", + " const iam = new IAMClient({region: event.ResourceProperties.region});", + " let authParams = {PolicyDocument: JSON.stringify(authParamsJson), RoleName: authRoleName};", + " let unauthParams = {PolicyDocument: JSON.stringify(unauthParamsJson), RoleName: unauthRoleName};", + " const res = await Promise.all([", + " iam.send(new UpdateAssumeRolePolicyCommand(authParams)),", + " iam.send(new UpdateAssumeRolePolicyCommand(unauthParams))", + " ]);", + " response.send(event, context, response.SUCCESS, {});", + " }", + " } catch (err) {", + " console.log(err.stack);", + " response.send(event, context, response.FAILED, {Error: err});", + " }", + "};" + ] + ] + } + }, + "Handler": "index.handler", + "Runtime": "nodejs18.x", + "Timeout": 300, + "Role": { + "Fn::GetAtt": [ + "UpdateRolesWithIDPFunctionRole", + "Arn" + ] + } + } + }, + "UpdateRolesWithIDPFunctionOutputs": { + "Type": "Custom::LambdaCallout", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "UpdateRolesWithIDPFunction", + "Arn" + ] + }, + "region": { + "Ref": "AWS::Region" + }, + "idpId": { + "Fn::GetAtt": [ + "authmynotesccae4f3b", + "Outputs.IdentityPoolId" + ] + }, + "authRoleName": { + "Ref": "AuthRole" + }, + "unauthRoleName": { + "Ref": "UnauthRole" + } + } + }, + "UpdateRolesWithIDPFunctionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "RoleName": { + "Fn::Join": [ + "", + [ + { + "Ref": "AuthRole" + }, + "-idp" + ] + ] + }, + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": "UpdateRolesWithIDPFunctionPolicy", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": "arn:aws:logs:*:*:*" + }, + { + "Effect": "Allow", + "Action": [ + "iam:UpdateAssumeRolePolicy", + "iam:GetRole" + ], + "Resource": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + } + }, + { + "Effect": "Allow", + "Action": [ + "iam:UpdateAssumeRolePolicy", + "iam:GetRole" + ], + "Resource": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + } + } + ] + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/storage/notesimage/build/cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/storage/notesimage/build/cloudformation-template.json new file mode 100644 index 0000000..e2beb9c --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/awscloudformation/build/storage/notesimage/build/cloudformation-template.json @@ -0,0 +1,750 @@ +{ + "Description": "{\"createdOn\":\"Mac\",\"createdBy\":\"Amplify\",\"createdWith\":\"12.12.4\",\"stackType\":\"storage-S3\",\"metadata\":{}}", + "AWSTemplateFormatVersion": "2010-09-09", + "Parameters": { + "env": { + "Type": "String" + }, + "bucketName": { + "Type": "String" + }, + "authRoleName": { + "Type": "String" + }, + "unauthRoleName": { + "Type": "String" + }, + "authPolicyName": { + "Type": "String" + }, + "unauthPolicyName": { + "Type": "String" + }, + "s3PublicPolicy": { + "Type": "String", + "Default": "NONE" + }, + "s3PrivatePolicy": { + "Type": "String", + "Default": "NONE" + }, + "s3ProtectedPolicy": { + "Type": "String", + "Default": "NONE" + }, + "s3UploadsPolicy": { + "Type": "String", + "Default": "NONE" + }, + "s3ReadPolicy": { + "Type": "String", + "Default": "NONE" + }, + "s3PermissionsAuthenticatedPublic": { + "Type": "String", + "Default": "DISALLOW" + }, + "s3PermissionsAuthenticatedProtected": { + "Type": "String", + "Default": "DISALLOW" + }, + "s3PermissionsAuthenticatedPrivate": { + "Type": "String", + "Default": "DISALLOW" + }, + "s3PermissionsAuthenticatedUploads": { + "Type": "String", + "Default": "DISALLOW" + }, + "s3PermissionsGuestPublic": { + "Type": "String", + "Default": "DISALLOW" + }, + "s3PermissionsGuestUploads": { + "Type": "String", + "Default": "DISALLOW" + }, + "AuthenticatedAllowList": { + "Type": "String", + "Default": "DISALLOW" + }, + "GuestAllowList": { + "Type": "String", + "Default": "DISALLOW" + }, + "selectedGuestPermissions": { + "Type": "CommaDelimitedList", + "Default": "NONE" + }, + "selectedAuthenticatedPermissions": { + "Type": "CommaDelimitedList", + "Default": "NONE" + }, + "functionS3Trigger168e5d52Arn": { + "Type": "String", + "Default": "functionS3Trigger168e5d52Arn" + }, + "functionS3Trigger168e5d52Name": { + "Type": "String", + "Default": "functionS3Trigger168e5d52Name" + }, + "functionS3Trigger168e5d52LambdaExecutionRole": { + "Type": "String", + "Default": "functionS3Trigger168e5d52LambdaExecutionRole" + }, + "triggerFunction": { + "Type": "String" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + }, + "CreateAuthPublic": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsAuthenticatedPublic" + }, + "DISALLOW" + ] + } + ] + }, + "CreateAuthProtected": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsAuthenticatedProtected" + }, + "DISALLOW" + ] + } + ] + }, + "CreateAuthPrivate": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsAuthenticatedPrivate" + }, + "DISALLOW" + ] + } + ] + }, + "CreateAuthUploads": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsAuthenticatedUploads" + }, + "DISALLOW" + ] + } + ] + }, + "CreateGuestPublic": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsGuestPublic" + }, + "DISALLOW" + ] + } + ] + }, + "CreateGuestUploads": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsGuestUploads" + }, + "DISALLOW" + ] + } + ] + }, + "AuthReadAndList": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "AuthenticatedAllowList" + }, + "DISALLOW" + ] + } + ] + }, + "GuestReadAndList": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "GuestAllowList" + }, + "DISALLOW" + ] + } + ] + } + }, + "Outputs": { + "BucketName": { + "Description": "Bucket name for the S3 bucket", + "Value": { + "Ref": "S3Bucket" + } + }, + "Region": { + "Value": { + "Ref": "AWS::Region" + } + } + }, + "Resources": { + "S3Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "bucketName" + }, + { + "Fn::Join": [ + "", + [ + { + "Ref": "bucketName" + }, + { + "Fn::Select": [ + 3, + { + "Fn::Split": [ + "-", + { + "Ref": "AWS::StackName" + } + ] + } + ] + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "CorsConfiguration": { + "CorsRules": [ + { + "AllowedHeaders": [ + "*" + ], + "AllowedMethods": [ + "GET", + "HEAD", + "PUT", + "POST", + "DELETE" + ], + "AllowedOrigins": [ + "*" + ], + "ExposedHeaders": [ + "x-amz-server-side-encryption", + "x-amz-request-id", + "x-amz-id-2", + "ETag" + ], + "Id": "S3CORSRuleId1", + "MaxAge": 3000 + } + ] + }, + "NotificationConfiguration": { + "LambdaConfigurations": [ + { + "Event": "s3:ObjectCreated:*", + "Function": { + "Ref": "functionS3Trigger168e5d52Arn" + } + }, + { + "Event": "s3:ObjectRemoved:*", + "Function": { + "Ref": "functionS3Trigger168e5d52Arn" + } + } + ] + }, + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + }, + "DependsOn": [ + "TriggerPermissions" + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "TriggerPermissions": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Ref": "functionS3Trigger168e5d52Name" + }, + "Principal": "s3.amazonaws.com", + "SourceAccount": { + "Ref": "AWS::AccountId" + }, + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "bucketName" + }, + { + "Fn::Join": [ + "", + [ + { + "Ref": "bucketName" + }, + { + "Fn::Select": [ + 3, + { + "Fn::Split": [ + "-", + { + "Ref": "AWS::StackName" + } + ] + } + ] + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + } + ] + ] + } + } + }, + "S3AuthPublicPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": { + "Fn::Split": [ + ",", + { + "Ref": "s3PermissionsAuthenticatedPublic" + } + ] + }, + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/public/*" + ] + ] + } + ] + } + ] + }, + "PolicyName": { + "Ref": "s3PublicPolicy" + }, + "Roles": [ + { + "Ref": "authRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "CreateAuthPublic" + }, + "S3AuthProtectedPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": { + "Fn::Split": [ + ",", + { + "Ref": "s3PermissionsAuthenticatedProtected" + } + ] + }, + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/protected/${cognito-identity.amazonaws.com:sub}/*" + ] + ] + } + ] + } + ] + }, + "PolicyName": { + "Ref": "s3ProtectedPolicy" + }, + "Roles": [ + { + "Ref": "authRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "CreateAuthProtected" + }, + "S3AuthPrivatePolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": { + "Fn::Split": [ + ",", + { + "Ref": "s3PermissionsAuthenticatedPrivate" + } + ] + }, + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/private/${cognito-identity.amazonaws.com:sub}/*" + ] + ] + } + ] + } + ] + }, + "PolicyName": { + "Ref": "s3PrivatePolicy" + }, + "Roles": [ + { + "Ref": "authRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "CreateAuthPrivate" + }, + "S3AuthUploadPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": { + "Fn::Split": [ + ",", + { + "Ref": "s3PermissionsAuthenticatedUploads" + } + ] + }, + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/uploads/*" + ] + ] + } + ] + } + ] + }, + "PolicyName": { + "Ref": "s3UploadsPolicy" + }, + "Roles": [ + { + "Ref": "authRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "CreateAuthUploads" + }, + "S3AuthReadPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:GetObject", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/protected/*" + ] + ] + } + }, + { + "Action": "s3:ListBucket", + "Condition": { + "StringLike": { + "s3:prefix": [ + "public/", + "public/*", + "protected/", + "protected/*", + "private/${cognito-identity.amazonaws.com:sub}/", + "private/${cognito-identity.amazonaws.com:sub}/*" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + } + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": { + "Ref": "s3ReadPolicy" + }, + "Roles": [ + { + "Ref": "authRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "AuthReadAndList" + }, + "S3GuestReadPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:GetObject", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/protected/*" + ] + ] + } + }, + { + "Action": "s3:ListBucket", + "Condition": { + "StringLike": { + "s3:prefix": [ + "public/", + "public/*", + "protected/", + "protected/*" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + } + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": { + "Ref": "s3ReadPolicy" + }, + "Roles": [ + { + "Ref": "unauthRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "GuestReadAndList" + }, + "S3TriggerBucketPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "s3:ListBucket" + ], + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + } + ] + ] + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "s3:PutObject", + "s3:GetObject", + "s3:ListBucket", + "s3:DeleteObject" + ], + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/*" + ] + ] + } + ] + } + ] + }, + "PolicyName": "amplify-lambda-execution-policy-storage", + "Roles": [ + { + "Ref": "functionS3Trigger168e5d52LambdaExecutionRole" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ] + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/backend-config.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/backend-config.json new file mode 100644 index 0000000..af6ea25 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/backend-config.json @@ -0,0 +1,72 @@ +{ + "api": { + "mynotes": { + "dependsOn": [], + "output": { + "authConfig": { + "additionalAuthenticationProviders": [], + "defaultAuthentication": { + "apiKeyConfig": { + "apiKeyExpirationDays": 7 + }, + "authenticationType": "API_KEY" + } + } + }, + "providerPlugin": "awscloudformation", + "service": "AppSync" + } + }, + "auth": { + "mynotesccae4f3b": { + "customAuth": false, + "dependsOn": [], + "frontendAuthConfig": { + "mfaConfiguration": "OFF", + "mfaTypes": [ + "SMS" + ], + "passwordProtectionSettings": { + "passwordPolicyCharacters": [], + "passwordPolicyMinLength": 8 + }, + "signupAttributes": [ + "EMAIL" + ], + "socialProviders": [], + "usernameAttributes": [], + "verificationMechanisms": [ + "EMAIL" + ] + }, + "providerPlugin": "awscloudformation", + "service": "Cognito" + } + }, + "function": { + "S3Triggerdc42a5d7": { + "build": true, + "providerPlugin": "awscloudformation", + "service": "Lambda" + } + }, + "parameters": { + "AMPLIFY_function_S3Triggerdc42a5d7_deploymentBucketName": { + "usedBy": [ + { + "category": "function", + "resourceName": "S3Triggerdc42a5d7" + } + ] + }, + "AMPLIFY_function_S3Triggerdc42a5d7_s3Key": { + "usedBy": [ + { + "category": "function", + "resourceName": "S3Triggerdc42a5d7" + } + ] + } + }, + "storage": {} +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json new file mode 100644 index 0000000..9972262 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json @@ -0,0 +1,193 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "{\"createdOn\":\"Mac\",\"createdBy\":\"Amplify\",\"createdWith\":\"12.12.4\",\"stackType\":\"function-Lambda\",\"metadata\":{}}", + "Parameters": { + "env": { + "Type": "String" + }, + "deploymentBucketName": { + "Type": "String" + }, + "s3Key": { + "Type": "String" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + }, + "Resources": { + "LambdaFunction": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "aws:asset:path": "./src", + "aws:asset:property": "Code" + }, + "Properties": { + "Handler": "index.handler", + "FunctionName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Triggerdc42a5d7", + { + "Fn::Join": [ + "", + [ + "S3Triggerdc42a5d7", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "Environment": { + "Variables": { + "ENV": { + "Ref": "env" + } + } + }, + "Role": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 25, + "Code": { + "S3Bucket": { + "Ref": "deploymentBucketName" + }, + "S3Key": { + "Ref": "s3Key" + } + } + } + }, + "LambdaExecutionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "RoleName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Triggerdc42a5d7LambdaRoledc42a5d7", + { + "Fn::Join": [ + "", + [ + "S3Triggerdc42a5d7LambdaRoledc42a5d7", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + } + } + }, + "lambdaexecutionpolicy": { + "DependsOn": [ + "LambdaExecutionRole" + ], + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyName": "lambda-execution-policy", + "Roles": [ + { + "Ref": "LambdaExecutionRole" + } + ], + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": { + "Fn::Sub": [ + "arn:aws:logs:${region}:${account}:log-group:/aws/lambda/${lambda}:log-stream:*", + { + "region": { + "Ref": "AWS::Region" + }, + "account": { + "Ref": "AWS::AccountId" + }, + "lambda": { + "Ref": "LambdaFunction" + } + } + ] + } + } + ] + } + } + } + }, + "Outputs": { + "Name": { + "Value": { + "Ref": "LambdaFunction" + } + }, + "Arn": { + "Value": { + "Fn::GetAtt": [ + "LambdaFunction", + "Arn" + ] + } + }, + "Region": { + "Value": { + "Ref": "AWS::Region" + } + }, + "LambdaExecutionRole": { + "Value": { + "Ref": "LambdaExecutionRole" + } + }, + "LambdaExecutionRoleArn": { + "Value": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/amplify.state b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/amplify.state new file mode 100644 index 0000000..2ba0f4c --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/amplify.state @@ -0,0 +1,6 @@ +{ + "pluginId": "amplify-nodejs-function-runtime-provider", + "functionRuntime": "nodejs", + "defaultEditorFile": "src/index.js", + "useLegacyBuild": true +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/event.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/event.json new file mode 100644 index 0000000..fd2722e --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/event.json @@ -0,0 +1,5 @@ +{ + "key1": "value1", + "key2": "value2", + "key3": "value3" +} diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/index.js b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/index.js new file mode 100644 index 0000000..12e2a4e --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/index.js @@ -0,0 +1,6 @@ +exports.handler = async function (event) { + console.log('Received S3 event:', JSON.stringify(event, null, 2)); + const bucket = event.Records[0].s3.bucket.name; + const key = event.Records[0].s3.object.key; + console.log(`Bucket: ${bucket}`, `Key: ${key}`); +}; \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/package.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/package.json new file mode 100644 index 0000000..0fbf74b --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/package.json @@ -0,0 +1,7 @@ +{ + "name": "S3Triggerdc42a5d7", + "version": "2.0.0", + "description": "Lambda function generated by Amplify", + "main": "index.js", + "license": "Apache-2.0" +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/yarn.lock b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/yarn.lock new file mode 100644 index 0000000..fb57ccd --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/function/S3Triggerdc42a5d7/src/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + diff --git a/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/tags.json b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/tags.json new file mode 100644 index 0000000..b9321d7 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/#current-cloud-backend/tags.json @@ -0,0 +1,10 @@ +[ + { + "Key": "user:Stack", + "Value": "{project-env}" + }, + { + "Key": "user:Application", + "Value": "{project-name}" + } +] \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/.config/local-aws-info.json b/New_APIs/Amplify-fullstack-API/amplify/.config/local-aws-info.json new file mode 100644 index 0000000..5c40f60 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/.config/local-aws-info.json @@ -0,0 +1,5 @@ +{ + "staging": { + "configLevel": "amplifyAdmin" + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/.config/local-env-info.json b/New_APIs/Amplify-fullstack-API/amplify/.config/local-env-info.json new file mode 100644 index 0000000..fc2fd44 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/.config/local-env-info.json @@ -0,0 +1,5 @@ +{ + "projectPath": "/Users/anushkajoshi/Desktop/my-notes", + "defaultEditor": "sublime", + "envName": "staging" +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/.config/project-config.json b/New_APIs/Amplify-fullstack-API/amplify/.config/project-config.json new file mode 100644 index 0000000..0ead27f --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/.config/project-config.json @@ -0,0 +1,17 @@ +{ + "providers": [ + "awscloudformation" + ], + "projectName": "mynotes", + "version": "3.1", + "frontend": "javascript", + "javascript": { + "framework": "react", + "config": { + "SourceDir": "src", + "DistributionDir": "build", + "BuildCommand": "npm run-script build", + "StartCommand": "npm run-script start" + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/README.md b/New_APIs/Amplify-fullstack-API/amplify/README.md new file mode 100644 index 0000000..46165a9 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/README.md @@ -0,0 +1,8 @@ +# Getting Started with Amplify CLI +This directory was generated by [Amplify CLI](https://docs.amplify.aws/cli). + +Helpful resources: +- Amplify documentation: https://docs.amplify.aws. +- Amplify CLI documentation: https://docs.amplify.aws/cli. +- More details on this folder & generated files: https://docs.amplify.aws/cli/reference/files. +- Join Amplify's community: https://amplify.aws/community/. diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/amplify-meta.json b/New_APIs/Amplify-fullstack-API/amplify/backend/amplify-meta.json new file mode 100644 index 0000000..5b3a553 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/amplify-meta.json @@ -0,0 +1,111 @@ +{ + "providers": { + "awscloudformation": { + "AuthRoleName": "amplify-mynotes-staging-b2b56-authRole", + "UnauthRoleArn": "arn:aws:iam::339712714202:role/amplify-mynotes-staging-b2b56-unauthRole", + "AuthRoleArn": "arn:aws:iam::339712714202:role/amplify-mynotes-staging-b2b56-authRole", + "Region": "ap-southeast-2", + "DeploymentBucketName": "amplify-mynotes-staging-b2b56-deployment", + "UnauthRoleName": "amplify-mynotes-staging-b2b56-unauthRole", + "StackName": "amplify-mynotes-staging-b2b56", + "StackId": "arn:aws:cloudformation:ap-southeast-2:339712714202:stack/amplify-mynotes-staging-b2b56/5d40cab0-4b32-11ef-8fd8-06f396c97ee1", + "AmplifyAppId": "d2nrrgvsn5u7rq" + } + }, + "api": { + "mynotes": { + "dependsOn": [], + "output": { + "authConfig": { + "additionalAuthenticationProviders": [], + "defaultAuthentication": { + "apiKeyConfig": { + "apiKeyExpirationDays": 7 + }, + "authenticationType": "API_KEY" + } + }, + "GraphQLAPIIdOutput": "cye6ubdc6bgxddnh7pcgwbmubi", + "GraphQLAPIEndpointOutput": "https://n5edpqals5aohotum3xa72osli.appsync-api.ap-southeast-2.amazonaws.com/graphql", + "GraphQLAPIKeyOutput": "da2-kehm2qcqofd3besloumulb5vlm" + }, + "providerPlugin": "awscloudformation", + "service": "AppSync", + "lastPushTimeStamp": "2024-07-26T15:57:37.537Z", + "providerMetadata": { + "s3TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/api/cloudformation-template.json", + "logicalId": "apimynotes" + } + } + }, + "auth": { + "mynotesccae4f3b": { + "customAuth": false, + "dependsOn": [], + "frontendAuthConfig": { + "mfaConfiguration": "OFF", + "mfaTypes": [ + "SMS" + ], + "passwordProtectionSettings": { + "passwordPolicyMinLength": 8, + "passwordPolicyCharacters": [] + }, + "signupAttributes": [ + "EMAIL" + ], + "socialProviders": [], + "usernameAttributes": [], + "verificationMechanisms": [ + "EMAIL" + ] + }, + "providerPlugin": "awscloudformation", + "service": "Cognito", + "output": { + "UserPoolId": "ap-southeast-2_i03FxeqOd", + "AppClientIDWeb": "6bm1hrehfqg90vta1ifbgjr00h", + "AppClientID": "1d896vivvec1d0hvqrk6lptel2", + "IdentityPoolId": "ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4", + "UserPoolArn": "arn:aws:cognito-idp:ap-southeast-2:339712714202:userpool/ap-southeast-2_i03FxeqOd", + "IdentityPoolName": "mynotesccae4f3b_identitypool_ccae4f3b__staging", + "UserPoolName": "mynotesccae4f3b_userpool_ccae4f3b" + }, + "lastPushTimeStamp": "2024-07-26T15:57:44.008Z", + "providerMetadata": { + "s3TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/auth/mynotesccae4f3b-cloudformation-template.json", + "logicalId": "authmynotesccae4f3b" + }, + "lastPushDirHash": "Y2leA1T/brYAcNS4RPXQwBzzY/Q=" + } + }, + "function": { + "S3Triggerdc42a5d7": { + "service": "Lambda", + "providerPlugin": "awscloudformation", + "build": true, + "lastBuildTimeStamp": "2024-07-26T15:55:51.984Z", + "lastBuildType": "PROD", + "lastPackageTimeStamp": "2024-07-26T15:55:52.014Z", + "distZipFilename": "S3Triggerdc42a5d7-6a475541666d35456861-build.zip", + "s3Bucket": { + "deploymentBucketName": "amplify-mynotes-staging-b2b56-deployment", + "s3Key": "amplify-builds/S3Triggerdc42a5d7-6a475541666d35456861-build.zip" + }, + "providerMetadata": { + "s3TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/function/S3Triggerdc42a5d7-cloudformation-template.json", + "logicalId": "functionS3Triggerdc42a5d7" + }, + "lastPushTimeStamp": "2024-07-26T15:57:44.008Z", + "output": { + "LambdaExecutionRoleArn": "arn:aws:iam::339712714202:role/S3Triggerdc42a5d7LambdaRoledc42a5d7-staging", + "Region": "ap-southeast-2", + "Arn": "arn:aws:lambda:ap-southeast-2:339712714202:function:S3Triggerdc42a5d7-staging", + "Name": "S3Triggerdc42a5d7-staging", + "LambdaExecutionRole": "S3Triggerdc42a5d7LambdaRoledc42a5d7-staging" + }, + "lastPushDirHash": "1B2Qj8YebkkXB424dBxxW7J3vvM=" + } + }, + "storage": {} +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/cloudformation-template.json new file mode 100644 index 0000000..3bd9fb7 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/cloudformation-template.json @@ -0,0 +1,316 @@ +{ + "Parameters": { + "env": { + "Type": "String", + "Default": "NONE" + }, + "AppSyncApiName": { + "Type": "String", + "Default": "AppSyncSimpleTransform" + }, + "DynamoDBModelTableReadIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of read IOPS the table should support." + }, + "DynamoDBModelTableWriteIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of write IOPS the table should support." + }, + "DynamoDBBillingMode": { + "Type": "String", + "Default": "PAY_PER_REQUEST", + "AllowedValues": [ + "PAY_PER_REQUEST", + "PROVISIONED" + ], + "Description": "Configure @model types to create DynamoDB tables with PAY_PER_REQUEST or PROVISIONED billing modes." + }, + "DynamoDBEnablePointInTimeRecovery": { + "Type": "String", + "Default": "false", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Whether to enable Point in Time Recovery on the table." + }, + "DynamoDBEnableServerSideEncryption": { + "Type": "String", + "Default": "true", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Enable server side encryption powered by KMS." + }, + "S3DeploymentBucket": { + "Type": "String", + "Description": "An S3 Bucket name where assets are deployed" + }, + "S3DeploymentRootKey": { + "Type": "String", + "Description": "An S3 key relative to the S3DeploymentBucket that points to the root of the deployment directory." + } + }, + "Resources": { + "GraphQLAPI": { + "Type": "AWS::AppSync::GraphQLApi", + "Properties": { + "AuthenticationType": "API_KEY", + "Name": { + "Fn::Join": [ + "", + [ + { + "Ref": "AppSyncApiName" + }, + "-", + { + "Ref": "env" + } + ] + ] + } + } + }, + "GraphQLAPITransformerSchema3CB2AE18": { + "Type": "AWS::AppSync::GraphQLSchema", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "DefinitionS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "S3DeploymentBucket" + }, + "/", + { + "Ref": "S3DeploymentRootKey" + }, + "/schema.graphql" + ] + ] + } + } + }, + "GraphQLAPIDefaultApiKey215A6DD7": { + "Type": "AWS::AppSync::ApiKey", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Expires": 1722614137 + } + }, + "GraphQLAPINONEDS95A13CF0": { + "Type": "AWS::AppSync::DataSource", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Description": "None Data Source for Pipeline functions", + "Name": "NONE_DS", + "Type": "NONE" + } + }, + "Todo": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "Parameters": { + "DynamoDBModelTableReadIOPS": { + "Ref": "DynamoDBModelTableReadIOPS" + }, + "DynamoDBModelTableWriteIOPS": { + "Ref": "DynamoDBModelTableWriteIOPS" + }, + "DynamoDBBillingMode": { + "Ref": "DynamoDBBillingMode" + }, + "DynamoDBEnablePointInTimeRecovery": { + "Ref": "DynamoDBEnablePointInTimeRecovery" + }, + "DynamoDBEnableServerSideEncryption": { + "Ref": "DynamoDBEnableServerSideEncryption" + }, + "referencetotransformerrootstackenv10C5A902Ref": { + "Ref": "env" + }, + "referencetotransformerrootstackGraphQLAPI20497F53ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name": { + "Fn::GetAtt": [ + "GraphQLAPINONEDS95A13CF0", + "Name" + ] + }, + "referencetotransformerrootstackS3DeploymentBucket7592718ARef": { + "Ref": "S3DeploymentBucket" + }, + "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref": { + "Ref": "S3DeploymentRootKey" + } + }, + "TemplateURL": { + "Fn::Join": [ + "", + [ + "https://s3.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "S3DeploymentBucket" + }, + "/", + { + "Ref": "S3DeploymentRootKey" + }, + "/stacks/Todo.json" + ] + ] + } + }, + "DependsOn": [ + "GraphQLAPITransformerSchema3CB2AE18" + ] + }, + "CustomResourcesjson": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "Parameters": { + "AppSyncApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "AppSyncApiName": { + "Ref": "AppSyncApiName" + }, + "env": { + "Ref": "env" + }, + "S3DeploymentBucket": { + "Ref": "S3DeploymentBucket" + }, + "S3DeploymentRootKey": { + "Ref": "S3DeploymentRootKey" + } + }, + "TemplateURL": { + "Fn::Join": [ + "/", + [ + "https://s3.amazonaws.com", + { + "Ref": "S3DeploymentBucket" + }, + { + "Ref": "S3DeploymentRootKey" + }, + "stacks", + "CustomResources.json" + ] + ] + } + }, + "DependsOn": [ + "GraphQLAPI", + "GraphQLAPITransformerSchema3CB2AE18", + "Todo" + ] + } + }, + "Outputs": { + "GraphQLAPIKeyOutput": { + "Description": "Your GraphQL API ID.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPIDefaultApiKey215A6DD7", + "ApiKey" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiKey" + ] + ] + } + } + }, + "GraphQLAPIIdOutput": { + "Description": "Your GraphQL API ID.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiId" + ] + ] + } + } + }, + "GraphQLAPIEndpointOutput": { + "Description": "Your GraphQL API endpoint.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPI", + "GraphQLUrl" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiEndpoint" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/parameters.json b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/parameters.json new file mode 100644 index 0000000..70c2ce9 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/parameters.json @@ -0,0 +1,7 @@ +{ + "AppSyncApiName": "mynotes", + "DynamoDBBillingMode": "PAY_PER_REQUEST", + "DynamoDBEnableServerSideEncryption": false, + "S3DeploymentBucket": "amplify-mynotes-staging-b2b56-deployment", + "S3DeploymentRootKey": "amplify-appsync-files/c0e971ea1ba703ba5054d45b1d4a7a475f98dd0a" +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.init.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.init.1.req.vtl new file mode 100644 index 0000000..df6b4cb --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.init.1.req.vtl @@ -0,0 +1,11 @@ +## [Start] Initialization default values. ** +$util.qr($ctx.stash.put("defaultValues", $util.defaultIfNull($ctx.stash.defaultValues, {}))) +$util.qr($ctx.stash.defaultValues.put("id", $util.autoId())) +#set( $createdAt = $util.time.nowISO8601() ) +$util.qr($ctx.stash.defaultValues.put("createdAt", $createdAt)) +$util.qr($ctx.stash.defaultValues.put("updatedAt", $createdAt)) +$util.toJson({ + "version": "2018-05-29", + "payload": {} +}) +## [End] Initialization default values. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.req.vtl new file mode 100644 index 0000000..f03395e --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.req.vtl @@ -0,0 +1,66 @@ +## [Start] Create Request template. ** +#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) ) +## Set the default values to put request ** +#set( $mergedValues = $util.defaultIfNull($ctx.stash.defaultValues, {}) ) +## copy the values from input ** +$util.qr($mergedValues.putAll($util.defaultIfNull($args.input, {}))) +## set the typename ** +$util.qr($mergedValues.put("__typename", "Todo")) +#set( $PutObject = { + "version": "2018-05-29", + "operation": "PutItem", + "attributeValues": $util.dynamodb.toMapValues($mergedValues), + "condition": $condition +} ) +#if( $args.condition ) + $util.qr($ctx.stash.conditions.add($args.condition)) +#end +## Begin - key condition ** +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $keyConditionExpr = {} ) + #set( $keyConditionExprNames = {} ) + #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) + $util.qr($keyConditionExpr.put("keyCondition$velocityCount", { + "attributeExists": false +})) + $util.qr($keyConditionExprNames.put("#keyCondition$velocityCount", "$entry.key")) + #end + $util.qr($ctx.stash.conditions.add($keyConditionExpr)) +#else + $util.qr($ctx.stash.conditions.add({ + "id": { + "attributeExists": false + } +})) +#end +## End - key condition ** +## Start condition block ** +#if( $ctx.stash.conditions && $ctx.stash.conditions.size() != 0 ) + #set( $mergedConditions = { + "and": $ctx.stash.conditions +} ) + #set( $Conditions = $util.parseJson($util.transform.toDynamoDBConditionExpression($mergedConditions)) ) + #if( $Conditions.expressionValues && $Conditions.expressionValues.size() == 0 ) + #set( $Conditions = { + "expression": $Conditions.expression, + "expressionNames": $Conditions.expressionNames +} ) + #end + ## End condition block ** +#end +#if( $Conditions ) + #if( $keyConditionExprNames ) + $util.qr($Conditions.expressionNames.putAll($keyConditionExprNames)) + #end + $util.qr($PutObject.put("condition", $Conditions)) +#end +#if( $ctx.stash.metadata.modelObjectKey ) + $util.qr($PutObject.put("key", $ctx.stash.metadata.modelObjectKey)) +#else + #set( $Key = { + "id": $util.dynamodb.toDynamoDB($mergedValues.id) +} ) + $util.qr($PutObject.put("key", $Key)) +#end +$util.toJson($PutObject) +## [End] Create Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.res.vtl new file mode 100644 index 0000000..5119972 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.createTodo.res.vtl @@ -0,0 +1,8 @@ +## [Start] ResponseTemplate. ** +$util.qr($ctx.result.put("__operation", "Mutation")) +#if( $ctx.error ) + $util.error($ctx.error.message, $ctx.error.type) +#else + $util.toJson($ctx.result) +#end +## [End] ResponseTemplate. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.deleteTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.deleteTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.deleteTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.deleteTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.deleteTodo.req.vtl new file mode 100644 index 0000000..ace459b --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.deleteTodo.req.vtl @@ -0,0 +1,58 @@ +## [Start] Delete Request template. ** +#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) ) +#set( $DeleteRequest = { + "version": "2018-05-29", + "operation": "DeleteItem" +} ) +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $Key = $ctx.stash.metadata.modelObjectKey ) +#else + #set( $Key = { + "id": $util.dynamodb.toDynamoDB($args.input.id) +} ) +#end +$util.qr($DeleteRequest.put("key", $Key)) +## Begin - key condition ** +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $keyConditionExpr = {} ) + #set( $keyConditionExprNames = {} ) + #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) + $util.qr($keyConditionExpr.put("keyCondition$velocityCount", { + "attributeExists": true +})) + $util.qr($keyConditionExprNames.put("#keyCondition$velocityCount", "$entry.key")) + #end + $util.qr($ctx.stash.conditions.add($keyConditionExpr)) +#else + $util.qr($ctx.stash.conditions.add({ + "id": { + "attributeExists": true + } +})) +#end +## End - key condition ** +#if( $args.condition ) + $util.qr($ctx.stash.conditions.add($args.condition)) +#end +## Start condition block ** +#if( $ctx.stash.conditions && $ctx.stash.conditions.size() != 0 ) + #set( $mergedConditions = { + "and": $ctx.stash.conditions +} ) + #set( $Conditions = $util.parseJson($util.transform.toDynamoDBConditionExpression($mergedConditions)) ) + #if( $Conditions.expressionValues && $Conditions.expressionValues.size() == 0 ) + #set( $Conditions = { + "expression": $Conditions.expression, + "expressionNames": $Conditions.expressionNames +} ) + #end + ## End condition block ** +#end +#if( $Conditions ) + #if( $keyConditionExprNames ) + $util.qr($Conditions.expressionNames.putAll($keyConditionExprNames)) + #end + $util.qr($DeleteRequest.put("condition", $Conditions)) +#end +$util.toJson($DeleteRequest) +## [End] Delete Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.deleteTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.deleteTodo.res.vtl new file mode 100644 index 0000000..5119972 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.deleteTodo.res.vtl @@ -0,0 +1,8 @@ +## [Start] ResponseTemplate. ** +$util.qr($ctx.result.put("__operation", "Mutation")) +#if( $ctx.error ) + $util.error($ctx.error.message, $ctx.error.type) +#else + $util.toJson($ctx.result) +#end +## [End] ResponseTemplate. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.init.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.init.1.req.vtl new file mode 100644 index 0000000..ab5766f --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.init.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Initialization default values. ** +$util.qr($ctx.stash.put("defaultValues", $util.defaultIfNull($ctx.stash.defaultValues, {}))) +#set( $updatedAt = $util.time.nowISO8601() ) +$util.qr($ctx.stash.defaultValues.put("updatedAt", $updatedAt)) +$util.toJson({ + "version": "2018-05-29", + "payload": {} +}) +## [End] Initialization default values. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.req.vtl new file mode 100644 index 0000000..a1bd67d --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.req.vtl @@ -0,0 +1,130 @@ +## [Start] Mutation Update resolver. ** +#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) ) +## Set the default values to put request ** +#set( $mergedValues = $util.defaultIfNull($ctx.stash.defaultValues, {}) ) +## copy the values from input ** +$util.qr($mergedValues.putAll($util.defaultIfNull($args.input, {}))) +## set the typename ** +## Initialize the vars for creating ddb expression ** +#set( $expNames = {} ) +#set( $expValues = {} ) +#set( $expSet = {} ) +#set( $expAdd = {} ) +#set( $expRemove = [] ) +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $Key = $ctx.stash.metadata.modelObjectKey ) +#else + #set( $Key = { + "id": $util.dynamodb.toDynamoDB($args.input.id) +} ) +#end +## Model key ** +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $keyFields = [] ) + #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) + $util.qr($keyFields.add("$entry.key")) + #end +#else + #set( $keyFields = ["id"] ) +#end +#foreach( $entry in $util.map.copyAndRemoveAllKeys($mergedValues, $keyFields).entrySet() ) + #if( !$util.isNull($ctx.stash.metadata.dynamodbNameOverrideMap) && $ctx.stash.metadata.dynamodbNameOverrideMap.containsKey("$entry.key") ) + #set( $entryKeyAttributeName = $ctx.stash.metadata.dynamodbNameOverrideMap.get("$entry.key") ) + #else + #set( $entryKeyAttributeName = $entry.key ) + #end + #if( $util.isNull($entry.value) ) + #set( $discard = $expRemove.add("#$entryKeyAttributeName") ) + $util.qr($expNames.put("#$entryKeyAttributeName", "$entry.key")) + #else + $util.qr($expSet.put("#$entryKeyAttributeName", ":$entryKeyAttributeName")) + $util.qr($expNames.put("#$entryKeyAttributeName", "$entry.key")) + $util.qr($expValues.put(":$entryKeyAttributeName", $util.dynamodb.toDynamoDB($entry.value))) + #end +#end +#set( $expression = "" ) +#if( !$expSet.isEmpty() ) + #set( $expression = "SET" ) + #foreach( $entry in $expSet.entrySet() ) + #set( $expression = "$expression $entry.key = $entry.value" ) + #if( $foreach.hasNext() ) + #set( $expression = "$expression," ) + #end + #end +#end +#if( !$expAdd.isEmpty() ) + #set( $expression = "$expression ADD" ) + #foreach( $entry in $expAdd.entrySet() ) + #set( $expression = "$expression $entry.key $entry.value" ) + #if( $foreach.hasNext() ) + #set( $expression = "$expression," ) + #end + #end +#end +#if( !$expRemove.isEmpty() ) + #set( $expression = "$expression REMOVE" ) + #foreach( $entry in $expRemove ) + #set( $expression = "$expression $entry" ) + #if( $foreach.hasNext() ) + #set( $expression = "$expression," ) + #end + #end +#end +#set( $update = {} ) +$util.qr($update.put("expression", "$expression")) +#if( !$expNames.isEmpty() ) + $util.qr($update.put("expressionNames", $expNames)) +#end +#if( !$expValues.isEmpty() ) + $util.qr($update.put("expressionValues", $expValues)) +#end +## Begin - key condition ** +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $keyConditionExpr = {} ) + #set( $keyConditionExprNames = {} ) + #foreach( $entry in $ctx.stash.metadata.modelObjectKey.entrySet() ) + $util.qr($keyConditionExpr.put("keyCondition$velocityCount", { + "attributeExists": true +})) + $util.qr($keyConditionExprNames.put("#keyCondition$velocityCount", "$entry.key")) + #end + $util.qr($ctx.stash.conditions.add($keyConditionExpr)) +#else + $util.qr($ctx.stash.conditions.add({ + "id": { + "attributeExists": true + } +})) +#end +## End - key condition ** +#if( $args.condition ) + $util.qr($ctx.stash.conditions.add($args.condition)) +#end +## Start condition block ** +#if( $ctx.stash.conditions && $ctx.stash.conditions.size() != 0 ) + #set( $mergedConditions = { + "and": $ctx.stash.conditions +} ) + #set( $Conditions = $util.parseJson($util.transform.toDynamoDBConditionExpression($mergedConditions)) ) + #if( $Conditions.expressionValues && $Conditions.expressionValues.size() == 0 ) + #set( $Conditions = { + "expression": $Conditions.expression, + "expressionNames": $Conditions.expressionNames +} ) + #end + ## End condition block ** +#end +#set( $UpdateItem = { + "version": "2018-05-29", + "operation": "UpdateItem", + "key": $Key, + "update": $update +} ) +#if( $Conditions ) + #if( $keyConditionExprNames ) + $util.qr($Conditions.expressionNames.putAll($keyConditionExprNames)) + #end + $util.qr($UpdateItem.put("condition", $Conditions)) +#end +$util.toJson($UpdateItem) +## [End] Mutation Update resolver. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.res.vtl new file mode 100644 index 0000000..5119972 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Mutation.updateTodo.res.vtl @@ -0,0 +1,8 @@ +## [Start] ResponseTemplate. ** +$util.qr($ctx.result.put("__operation", "Mutation")) +#if( $ctx.error ) + $util.error($ctx.error.message, $ctx.error.type) +#else + $util.toJson($ctx.result) +#end +## [End] ResponseTemplate. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.getTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.getTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.getTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.getTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.getTodo.req.vtl new file mode 100644 index 0000000..a8d7811 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.getTodo.req.vtl @@ -0,0 +1,34 @@ +## [Start] Get Request template. ** +#set( $GetRequest = { + "version": "2018-05-29", + "operation": "Query" +} ) +#if( $ctx.stash.metadata.modelObjectKey ) + #set( $expression = "" ) + #set( $expressionNames = {} ) + #set( $expressionValues = {} ) + #foreach( $item in $ctx.stash.metadata.modelObjectKey.entrySet() ) + #set( $expression = "$expression#keyCount$velocityCount = :valueCount$velocityCount AND " ) + $util.qr($expressionNames.put("#keyCount$velocityCount", $item.key)) + $util.qr($expressionValues.put(":valueCount$velocityCount", $item.value)) + #end + #set( $expression = $expression.replaceAll("AND $", "") ) + #set( $query = { + "expression": $expression, + "expressionNames": $expressionNames, + "expressionValues": $expressionValues +} ) +#else + #set( $query = { + "expression": "id = :id", + "expressionValues": { + ":id": $util.parseJson($util.dynamodb.toDynamoDBJson($ctx.args.id)) + } +} ) +#end +$util.qr($GetRequest.put("query", $query)) +#if( !$util.isNullOrEmpty($ctx.stash.authFilter) ) + $util.qr($GetRequest.put("filter", $util.parseJson($util.transform.toDynamoDBFilterExpression($ctx.stash.authFilter)))) +#end +$util.toJson($GetRequest) +## [End] Get Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.getTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.getTodo.res.vtl new file mode 100644 index 0000000..e9ef143 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.getTodo.res.vtl @@ -0,0 +1,13 @@ +## [Start] Get Response template. ** +#if( $ctx.error ) + $util.error($ctx.error.message, $ctx.error.type) +#end +#if( !$ctx.result.items.isEmpty() && $ctx.result.scannedCount == 1 ) + $util.toJson($ctx.result.items[0]) +#else + #if( $ctx.result.items.isEmpty() && $ctx.result.scannedCount == 1 ) +$util.unauthorized() + #end + $util.toJson(null) +#end +## [End] Get Response template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.listTodos.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.listTodos.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.listTodos.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.listTodos.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.listTodos.req.vtl new file mode 100644 index 0000000..0142137 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.listTodos.req.vtl @@ -0,0 +1,50 @@ +## [Start] List Request. ** +#set( $args = $util.defaultIfNull($ctx.stash.transformedArgs, $ctx.args) ) +#set( $limit = $util.defaultIfNull($args.limit, 100) ) +#set( $ListRequest = { + "version": "2018-05-29", + "limit": $limit +} ) +#if( $args.nextToken ) + #set( $ListRequest.nextToken = $args.nextToken ) +#end +#if( !$util.isNullOrEmpty($ctx.stash.authFilter) ) + #set( $filter = $ctx.stash.authFilter ) + #if( !$util.isNullOrEmpty($args.filter) ) + #set( $filter = { + "and": [$filter, $args.filter] +} ) + #end +#else + #if( !$util.isNullOrEmpty($args.filter) ) + #set( $filter = $args.filter ) + #end +#end +#if( !$util.isNullOrEmpty($filter) ) + #set( $filterExpression = $util.parseJson($util.transform.toDynamoDBFilterExpression($filter)) ) + #if( $util.isNullOrEmpty($filterExpression) ) + $util.error("Unable to process the filter expression", "Unrecognized Filter") + #end + #if( !$util.isNullOrBlank($filterExpression.expression) ) + #if( $filterExpression.expressionValues.size() == 0 ) + $util.qr($filterExpression.remove("expressionValues")) + #end + #set( $ListRequest.filter = $filterExpression ) + #end +#end +#if( !$util.isNull($ctx.stash.modelQueryExpression) && !$util.isNullOrEmpty($ctx.stash.modelQueryExpression.expression) ) + $util.qr($ListRequest.put("operation", "Query")) + $util.qr($ListRequest.put("query", $ctx.stash.modelQueryExpression)) + #if( !$util.isNull($args.sortDirection) && $args.sortDirection == "DESC" ) + #set( $ListRequest.scanIndexForward = false ) + #else + #set( $ListRequest.scanIndexForward = true ) + #end +#else + $util.qr($ListRequest.put("operation", "Scan")) +#end +#if( !$util.isNull($ctx.stash.metadata.index) ) + #set( $ListRequest.IndexName = $ctx.stash.metadata.index ) +#end +$util.toJson($ListRequest) +## [End] List Request. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.listTodos.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.listTodos.res.vtl new file mode 100644 index 0000000..ee8b667 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Query.listTodos.res.vtl @@ -0,0 +1,7 @@ +## [Start] ResponseTemplate. ** +#if( $ctx.error ) + $util.error($ctx.error.message, $ctx.error.type) +#else + $util.toJson($ctx.result) +#end +## [End] ResponseTemplate. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.req.vtl new file mode 100644 index 0000000..f64092d --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.req.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Request template. ** +$util.toJson({ + "version": "2018-05-29", + "payload": {} +}) +## [End] Subscription Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.res.vtl new file mode 100644 index 0000000..62769cc --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onCreateTodo.res.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Response template. ** +#if( !$util.isNullOrEmpty($ctx.args.filter) ) +$extensions.setSubscriptionFilter($util.transform.toSubscriptionFilter($ctx.args.filter)) +#end +$util.toJson(null) +## [End] Subscription Response template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.req.vtl new file mode 100644 index 0000000..f64092d --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.req.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Request template. ** +$util.toJson({ + "version": "2018-05-29", + "payload": {} +}) +## [End] Subscription Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.res.vtl new file mode 100644 index 0000000..62769cc --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onDeleteTodo.res.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Response template. ** +#if( !$util.isNullOrEmpty($ctx.args.filter) ) +$extensions.setSubscriptionFilter($util.transform.toSubscriptionFilter($ctx.args.filter)) +#end +$util.toJson(null) +## [End] Subscription Response template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.postAuth.1.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.postAuth.1.req.vtl new file mode 100644 index 0000000..2f6d422 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.postAuth.1.req.vtl @@ -0,0 +1,9 @@ +## [Start] Sandbox Mode Enabled, IAM Access Disabled. ** +#if( !$ctx.stash.get("hasAuth") ) + #if( $util.authType() == "API Key Authorization" ) + #return($util.toJson({})) + #end + $util.unauthorized() +#end +$util.toJson({}) +## [End] Sandbox Mode Enabled, IAM Access Disabled. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.req.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.req.vtl new file mode 100644 index 0000000..f64092d --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.req.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Request template. ** +$util.toJson({ + "version": "2018-05-29", + "payload": {} +}) +## [End] Subscription Request template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.res.vtl b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.res.vtl new file mode 100644 index 0000000..62769cc --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/resolvers/Subscription.onUpdateTodo.res.vtl @@ -0,0 +1,6 @@ +## [Start] Subscription Response template. ** +#if( !$util.isNullOrEmpty($ctx.args.filter) ) +$extensions.setSubscriptionFilter($util.transform.toSubscriptionFilter($ctx.args.filter)) +#end +$util.toJson(null) +## [End] Subscription Response template. ** \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/schema.graphql b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/schema.graphql new file mode 100644 index 0000000..987aa6a --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/schema.graphql @@ -0,0 +1,226 @@ +type Todo { + id: ID! + name: String! + description: String + createdAt: AWSDateTime! + updatedAt: AWSDateTime! +} + +input ModelStringInput { + ne: String + eq: String + le: String + lt: String + ge: String + gt: String + contains: String + notContains: String + between: [String] + beginsWith: String + attributeExists: Boolean + attributeType: ModelAttributeTypes + size: ModelSizeInput +} + +input ModelIntInput { + ne: Int + eq: Int + le: Int + lt: Int + ge: Int + gt: Int + between: [Int] + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelFloatInput { + ne: Float + eq: Float + le: Float + lt: Float + ge: Float + gt: Float + between: [Float] + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelBooleanInput { + ne: Boolean + eq: Boolean + attributeExists: Boolean + attributeType: ModelAttributeTypes +} + +input ModelIDInput { + ne: ID + eq: ID + le: ID + lt: ID + ge: ID + gt: ID + contains: ID + notContains: ID + between: [ID] + beginsWith: ID + attributeExists: Boolean + attributeType: ModelAttributeTypes + size: ModelSizeInput +} + +input ModelSubscriptionStringInput { + ne: String + eq: String + le: String + lt: String + ge: String + gt: String + contains: String + notContains: String + between: [String] + beginsWith: String + in: [String] + notIn: [String] +} + +input ModelSubscriptionIntInput { + ne: Int + eq: Int + le: Int + lt: Int + ge: Int + gt: Int + between: [Int] + in: [Int] + notIn: [Int] +} + +input ModelSubscriptionFloatInput { + ne: Float + eq: Float + le: Float + lt: Float + ge: Float + gt: Float + between: [Float] + in: [Float] + notIn: [Float] +} + +input ModelSubscriptionBooleanInput { + ne: Boolean + eq: Boolean +} + +input ModelSubscriptionIDInput { + ne: ID + eq: ID + le: ID + lt: ID + ge: ID + gt: ID + contains: ID + notContains: ID + between: [ID] + beginsWith: ID + in: [ID] + notIn: [ID] +} + +enum ModelAttributeTypes { + binary + binarySet + bool + list + map + number + numberSet + string + stringSet + _null +} + +input ModelSizeInput { + ne: Int + eq: Int + le: Int + lt: Int + ge: Int + gt: Int + between: [Int] +} + +enum ModelSortDirection { + ASC + DESC +} + +type ModelTodoConnection { + items: [Todo]! + nextToken: String +} + +input ModelTodoFilterInput { + id: ModelIDInput + name: ModelStringInput + description: ModelStringInput + createdAt: ModelStringInput + updatedAt: ModelStringInput + and: [ModelTodoFilterInput] + or: [ModelTodoFilterInput] + not: ModelTodoFilterInput +} + +type Query { + getTodo(id: ID!): Todo + listTodos(filter: ModelTodoFilterInput, limit: Int, nextToken: String): ModelTodoConnection +} + +input ModelTodoConditionInput { + name: ModelStringInput + description: ModelStringInput + and: [ModelTodoConditionInput] + or: [ModelTodoConditionInput] + not: ModelTodoConditionInput + createdAt: ModelStringInput + updatedAt: ModelStringInput +} + +input CreateTodoInput { + id: ID + name: String! + description: String +} + +input UpdateTodoInput { + id: ID! + name: String + description: String +} + +input DeleteTodoInput { + id: ID! +} + +type Mutation { + createTodo(input: CreateTodoInput!, condition: ModelTodoConditionInput): Todo + updateTodo(input: UpdateTodoInput!, condition: ModelTodoConditionInput): Todo + deleteTodo(input: DeleteTodoInput!, condition: ModelTodoConditionInput): Todo +} + +input ModelSubscriptionTodoFilterInput { + id: ModelSubscriptionIDInput + name: ModelSubscriptionStringInput + description: ModelSubscriptionStringInput + createdAt: ModelSubscriptionStringInput + updatedAt: ModelSubscriptionStringInput + and: [ModelSubscriptionTodoFilterInput] + or: [ModelSubscriptionTodoFilterInput] +} + +type Subscription { + onCreateTodo(filter: ModelSubscriptionTodoFilterInput): Todo @aws_subscribe(mutations: ["createTodo"]) + onUpdateTodo(filter: ModelSubscriptionTodoFilterInput): Todo @aws_subscribe(mutations: ["updateTodo"]) + onDeleteTodo(filter: ModelSubscriptionTodoFilterInput): Todo @aws_subscribe(mutations: ["deleteTodo"]) +} diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/stacks/CustomResources.json b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/stacks/CustomResources.json new file mode 100644 index 0000000..0169912 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/stacks/CustomResources.json @@ -0,0 +1,61 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "An auto-generated nested stack.", + "Metadata": {}, + "Parameters": { + "AppSyncApiId": { + "Type": "String", + "Description": "The id of the AppSync API associated with this project." + }, + "AppSyncApiName": { + "Type": "String", + "Description": "The name of the AppSync API", + "Default": "AppSyncSimpleTransform" + }, + "env": { + "Type": "String", + "Description": "The environment name. e.g. Dev, Test, or Production", + "Default": "NONE" + }, + "S3DeploymentBucket": { + "Type": "String", + "Description": "The S3 bucket containing all deployment assets for the project." + }, + "S3DeploymentRootKey": { + "Type": "String", + "Description": "An S3 key relative to the S3DeploymentBucket that points to the root\nof the deployment directory." + } + }, + "Resources": { + "EmptyResource": { + "Type": "Custom::EmptyResource", + "Condition": "AlwaysFalse" + } + }, + "Conditions": { + "HasEnvironmentParameter": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + ] + }, + "AlwaysFalse": { + "Fn::Equals": [ + "true", + "false" + ] + } + }, + "Outputs": { + "EmptyOutput": { + "Description": "An empty output. You may delete this if you have at least one resource above.", + "Value": "" + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/stacks/Todo.json b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/stacks/Todo.json new file mode 100644 index 0000000..14d8d57 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/build/stacks/Todo.json @@ -0,0 +1,1117 @@ +{ + "Parameters": { + "DynamoDBModelTableReadIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of read IOPS the table should support." + }, + "DynamoDBModelTableWriteIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of write IOPS the table should support." + }, + "DynamoDBBillingMode": { + "Type": "String", + "Default": "PAY_PER_REQUEST", + "AllowedValues": [ + "PAY_PER_REQUEST", + "PROVISIONED" + ], + "Description": "Configure @model types to create DynamoDB tables with PAY_PER_REQUEST or PROVISIONED billing modes." + }, + "DynamoDBEnablePointInTimeRecovery": { + "Type": "String", + "Default": "false", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Whether to enable Point in Time Recovery on the table." + }, + "DynamoDBEnableServerSideEncryption": { + "Type": "String", + "Default": "true", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Enable server side encryption powered by KMS." + }, + "referencetotransformerrootstackenv10C5A902Ref": { + "Type": "String" + }, + "referencetotransformerrootstackGraphQLAPI20497F53ApiId": { + "Type": "String" + }, + "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name": { + "Type": "String" + }, + "referencetotransformerrootstackS3DeploymentBucket7592718ARef": { + "Type": "String" + }, + "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref": { + "Type": "String" + } + }, + "Conditions": { + "HasEnvironmentParameter": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "referencetotransformerrootstackenv10C5A902Ref" + }, + "NONE" + ] + } + ] + }, + "ShouldUseServerSideEncryption": { + "Fn::Equals": [ + { + "Ref": "DynamoDBEnableServerSideEncryption" + }, + "true" + ] + }, + "ShouldUsePayPerRequestBilling": { + "Fn::Equals": [ + { + "Ref": "DynamoDBBillingMode" + }, + "PAY_PER_REQUEST" + ] + }, + "ShouldUsePointInTimeRecovery": { + "Fn::Equals": [ + { + "Ref": "DynamoDBEnablePointInTimeRecovery" + }, + "true" + ] + } + }, + "Resources": { + "TodoTable": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": { + "Fn::If": [ + "ShouldUsePayPerRequestBilling", + "PAY_PER_REQUEST", + { + "Ref": "AWS::NoValue" + } + ] + }, + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "Fn::If": [ + "ShouldUsePointInTimeRecovery", + { + "PointInTimeRecoveryEnabled": true + }, + { + "Ref": "AWS::NoValue" + } + ] + }, + "ProvisionedThroughput": { + "Fn::If": [ + "ShouldUsePayPerRequestBilling", + { + "Ref": "AWS::NoValue" + }, + { + "ReadCapacityUnits": { + "Ref": "DynamoDBModelTableReadIOPS" + }, + "WriteCapacityUnits": { + "Ref": "DynamoDBModelTableWriteIOPS" + } + } + ] + }, + "SSESpecification": { + "SSEEnabled": { + "Fn::If": [ + "ShouldUseServerSideEncryption", + true, + false + ] + } + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + }, + "TableName": { + "Fn::Join": [ + "", + [ + "Todo-", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "-", + { + "Ref": "referencetotransformerrootstackenv10C5A902Ref" + } + ] + ] + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "TodoIAMRole2DA8E66E": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "appsync.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:BatchGetItem", + "dynamodb:BatchWriteItem", + "dynamodb:PutItem", + "dynamodb:DeleteItem", + "dynamodb:GetItem", + "dynamodb:Scan", + "dynamodb:Query", + "dynamodb:UpdateItem", + "dynamodb:ConditionCheckItem", + "dynamodb:DescribeTable", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Sub": [ + "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${tablename}", + { + "tablename": { + "Fn::Join": [ + "", + [ + "Todo-", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "-", + { + "Ref": "referencetotransformerrootstackenv10C5A902Ref" + } + ] + ] + } + } + ] + }, + { + "Fn::Sub": [ + "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${tablename}/*", + { + "tablename": { + "Fn::Join": [ + "", + [ + "Todo-", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "-", + { + "Ref": "referencetotransformerrootstackenv10C5A902Ref" + } + ] + ] + } + } + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "DynamoDBAccess" + } + ], + "RoleName": { + "Fn::Join": [ + "", + [ + "TodoIAMRolecfd440-", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "-", + { + "Ref": "referencetotransformerrootstackenv10C5A902Ref" + } + ] + ] + } + } + }, + "TodoDataSource": { + "Type": "AWS::AppSync::DataSource", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DynamoDBConfig": { + "AwsRegion": { + "Ref": "AWS::Region" + }, + "TableName": { + "Ref": "TodoTable" + } + }, + "Name": "TodoTable", + "ServiceRoleArn": { + "Fn::GetAtt": [ + "TodoIAMRole2DA8E66E", + "Arn" + ] + }, + "Type": "AMAZON_DYNAMODB" + }, + "DependsOn": [ + "TodoIAMRole2DA8E66E" + ] + }, + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Ref": "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name" + }, + "FunctionVersion": "2018-05-29", + "Name": "QuerygetTodopostAuth0Function", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Query.getTodo.postAuth.1.req.vtl" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson({})" + } + }, + "QueryGetTodoDataResolverFnQueryGetTodoDataResolverFnAppSyncFunctionE2B57DAD": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "FunctionVersion": "2018-05-29", + "Name": "QueryGetTodoDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Query.getTodo.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Query.getTodo.res.vtl" + ] + ] + } + }, + "DependsOn": [ + "TodoDataSource" + ] + }, + "GetTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "getTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "QueryGetTodoDataResolverFnQueryGetTodoDataResolverFnAppSyncFunctionE2B57DAD", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Query\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"getTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"AMAZON_DYNAMODB\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n$util.qr($ctx.stash.put(\"tableName\", \"", + { + "Ref": "TodoTable" + }, + "\"))\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Query" + } + }, + "QueryListTodosDataResolverFnQueryListTodosDataResolverFnAppSyncFunctionF825FE47": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "FunctionVersion": "2018-05-29", + "Name": "QueryListTodosDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Query.listTodos.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Query.listTodos.res.vtl" + ] + ] + } + }, + "DependsOn": [ + "TodoDataSource" + ] + }, + "ListTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "listTodos", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "QueryListTodosDataResolverFnQueryListTodosDataResolverFnAppSyncFunctionF825FE47", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Query\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"listTodos\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"AMAZON_DYNAMODB\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n$util.qr($ctx.stash.put(\"tableName\", \"", + { + "Ref": "TodoTable" + }, + "\"))\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Query" + } + }, + "MutationcreateTodoinit0FunctionMutationcreateTodoinit0FunctionAppSyncFunction54DE5B8B": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Ref": "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name" + }, + "FunctionVersion": "2018-05-29", + "Name": "MutationcreateTodoinit0Function", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.createTodo.init.1.req.vtl" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson({})" + } + }, + "MutationCreateTodoDataResolverFnMutationCreateTodoDataResolverFnAppSyncFunction900EC5CF": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "FunctionVersion": "2018-05-29", + "Name": "MutationCreateTodoDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.createTodo.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.createTodo.res.vtl" + ] + ] + } + }, + "DependsOn": [ + "TodoDataSource" + ] + }, + "CreateTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "createTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "MutationcreateTodoinit0FunctionMutationcreateTodoinit0FunctionAppSyncFunction54DE5B8B", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "MutationCreateTodoDataResolverFnMutationCreateTodoDataResolverFnAppSyncFunction900EC5CF", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Mutation\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"createTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"AMAZON_DYNAMODB\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n$util.qr($ctx.stash.put(\"tableName\", \"", + { + "Ref": "TodoTable" + }, + "\"))\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Mutation" + } + }, + "MutationupdateTodoinit0FunctionMutationupdateTodoinit0FunctionAppSyncFunction1B95BB19": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Ref": "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name" + }, + "FunctionVersion": "2018-05-29", + "Name": "MutationupdateTodoinit0Function", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.updateTodo.init.1.req.vtl" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson({})" + } + }, + "MutationUpdateTodoDataResolverFnMutationUpdateTodoDataResolverFnAppSyncFunctionBC238C49": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "FunctionVersion": "2018-05-29", + "Name": "MutationUpdateTodoDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.updateTodo.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.updateTodo.res.vtl" + ] + ] + } + }, + "DependsOn": [ + "TodoDataSource" + ] + }, + "UpdateTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "updateTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "MutationupdateTodoinit0FunctionMutationupdateTodoinit0FunctionAppSyncFunction1B95BB19", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "MutationUpdateTodoDataResolverFnMutationUpdateTodoDataResolverFnAppSyncFunctionBC238C49", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Mutation\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"updateTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"AMAZON_DYNAMODB\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n$util.qr($ctx.stash.put(\"tableName\", \"", + { + "Ref": "TodoTable" + }, + "\"))\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Mutation" + } + }, + "MutationDeleteTodoDataResolverFnMutationDeleteTodoDataResolverFnAppSyncFunction3879153F": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "FunctionVersion": "2018-05-29", + "Name": "MutationDeleteTodoDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.deleteTodo.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Mutation.deleteTodo.res.vtl" + ] + ] + } + }, + "DependsOn": [ + "TodoDataSource" + ] + }, + "DeleteTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "deleteTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "MutationDeleteTodoDataResolverFnMutationDeleteTodoDataResolverFnAppSyncFunction3879153F", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Mutation\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"deleteTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"AMAZON_DYNAMODB\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n$util.qr($ctx.stash.put(\"tableName\", \"", + { + "Ref": "TodoTable" + }, + "\"))\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Mutation" + } + }, + "SubscriptionOnCreateTodoDataResolverFnSubscriptionOnCreateTodoDataResolverFnAppSyncFunction462A70C9": { + "Type": "AWS::AppSync::FunctionConfiguration", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "DataSourceName": { + "Ref": "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name" + }, + "FunctionVersion": "2018-05-29", + "Name": "SubscriptionOnCreateTodoDataResolverFn", + "RequestMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Subscription.onCreateTodo.req.vtl" + ] + ] + }, + "ResponseMappingTemplateS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "referencetotransformerrootstackS3DeploymentBucket7592718ARef" + }, + "/", + { + "Ref": "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref" + }, + "/resolvers/Subscription.onCreateTodo.res.vtl" + ] + ] + } + } + }, + "SubscriptiononCreateTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "onCreateTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "SubscriptionOnCreateTodoDataResolverFnSubscriptionOnCreateTodoDataResolverFnAppSyncFunction462A70C9", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Subscription\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"onCreateTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"NONE\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Subscription" + } + }, + "SubscriptiononUpdateTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "onUpdateTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "SubscriptionOnCreateTodoDataResolverFnSubscriptionOnCreateTodoDataResolverFnAppSyncFunction462A70C9", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Subscription\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"onUpdateTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"NONE\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Subscription" + } + }, + "SubscriptiononDeleteTodoResolver": { + "Type": "AWS::AppSync::Resolver", + "Properties": { + "ApiId": { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "FieldName": "onDeleteTodo", + "Kind": "PIPELINE", + "PipelineConfig": { + "Functions": [ + { + "Fn::GetAtt": [ + "QuerygetTodopostAuth0FunctionQuerygetTodopostAuth0FunctionAppSyncFunction6BE14593", + "FunctionId" + ] + }, + { + "Fn::GetAtt": [ + "SubscriptionOnCreateTodoDataResolverFnSubscriptionOnCreateTodoDataResolverFnAppSyncFunction462A70C9", + "FunctionId" + ] + } + ] + }, + "RequestMappingTemplate": { + "Fn::Join": [ + "", + [ + "$util.qr($ctx.stash.put(\"typeName\", \"Subscription\"))\n$util.qr($ctx.stash.put(\"fieldName\", \"onDeleteTodo\"))\n$util.qr($ctx.stash.put(\"conditions\", []))\n$util.qr($ctx.stash.put(\"metadata\", {}))\n$util.qr($ctx.stash.metadata.put(\"dataSourceType\", \"NONE\"))\n$util.qr($ctx.stash.metadata.put(\"apiId\", \"", + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "\"))\n$util.qr($ctx.stash.put(\"connectionAttributes\", {}))\n\n$util.qr($ctx.stash.put(\"identityPoolId\", \"ap-southeast-2:9db4441d-2163-440e-adba-e23a3fe75fd4\"))\n$util.qr($ctx.stash.put(\"adminRoles\", [\"ap-southeast-2_azDpi6nee_Full-access/CognitoIdentityCredentials\",\"ap-southeast-2_azDpi6nee_Manage-only/CognitoIdentityCredentials\"]))\n$util.toJson({})" + ] + ] + }, + "ResponseMappingTemplate": "$util.toJson($ctx.prev.result)", + "TypeName": "Subscription" + } + } + }, + "Outputs": { + "GetAttTodoTableStreamArn": { + "Description": "Your DynamoDB table StreamArn.", + "Value": { + "Fn::GetAtt": [ + "TodoTable", + "StreamArn" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "GetAtt:TodoTable:StreamArn" + ] + ] + } + } + }, + "GetAttTodoTableName": { + "Description": "Your DynamoDB table name.", + "Value": { + "Ref": "TodoTable" + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "GetAtt:TodoTable:Name" + ] + ] + } + } + }, + "GetAttTodoDataSourceName": { + "Description": "Your model DataSource name.", + "Value": { + "Fn::GetAtt": [ + "TodoDataSource", + "Name" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "referencetotransformerrootstackGraphQLAPI20497F53ApiId" + }, + "GetAtt:TodoDataSource:Name" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/cli-inputs.json b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/cli-inputs.json new file mode 100644 index 0000000..9c3f8a3 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/cli-inputs.json @@ -0,0 +1,11 @@ +{ + "version": 1, + "serviceConfiguration": { + "apiName": "mynotes", + "serviceName": "AppSync", + "defaultAuthType": { + "mode": "API_KEY", + "expirationTime": 7 + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/parameters.json b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/parameters.json new file mode 100644 index 0000000..41a9678 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/parameters.json @@ -0,0 +1,5 @@ +{ + "AppSyncApiName": "mynotes", + "DynamoDBBillingMode": "PAY_PER_REQUEST", + "DynamoDBEnableServerSideEncryption": false +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/resolvers/README.md b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/resolvers/README.md new file mode 100644 index 0000000..89e564c --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/resolvers/README.md @@ -0,0 +1,2 @@ +Any resolvers that you add in this directory will override the ones automatically generated by Amplify CLI and will be directly copied to the cloud. +For more information, visit [https://docs.amplify.aws/cli/graphql-transformer/resolvers](https://docs.amplify.aws/cli/graphql-transformer/resolvers) \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/schema.graphql b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/schema.graphql new file mode 100644 index 0000000..930fe64 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/schema.graphql @@ -0,0 +1,11 @@ +# This "input" configures a global authorization rule to enable public access to +# all models in this schema. Learn more about authorization rules here: https://docs.amplify.aws/react/build-a-backend/graphqlapi/customize-authorization-rules/ + +input AMPLIFY { + globalAuthRule: AuthRule = { allow: public } +} # FOR TESTING ONLY! +type Todo @model { + id: ID! + name: String! + description: String +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/stacks/CustomResources.json b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/stacks/CustomResources.json new file mode 100644 index 0000000..f95feea --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/stacks/CustomResources.json @@ -0,0 +1,58 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "An auto-generated nested stack.", + "Metadata": {}, + "Parameters": { + "AppSyncApiId": { + "Type": "String", + "Description": "The id of the AppSync API associated with this project." + }, + "AppSyncApiName": { + "Type": "String", + "Description": "The name of the AppSync API", + "Default": "AppSyncSimpleTransform" + }, + "env": { + "Type": "String", + "Description": "The environment name. e.g. Dev, Test, or Production", + "Default": "NONE" + }, + "S3DeploymentBucket": { + "Type": "String", + "Description": "The S3 bucket containing all deployment assets for the project." + }, + "S3DeploymentRootKey": { + "Type": "String", + "Description": "An S3 key relative to the S3DeploymentBucket that points to the root\nof the deployment directory." + } + }, + "Resources": { + "EmptyResource": { + "Type": "Custom::EmptyResource", + "Condition": "AlwaysFalse" + } + }, + "Conditions": { + "HasEnvironmentParameter": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + ] + }, + "AlwaysFalse": { + "Fn::Equals": ["true", "false"] + } + }, + "Outputs": { + "EmptyOutput": { + "Description": "An empty output. You may delete this if you have at least one resource above.", + "Value": "" + } + } +} diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/transform.conf.json b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/transform.conf.json new file mode 100644 index 0000000..98e1e19 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/api/mynotes/transform.conf.json @@ -0,0 +1,4 @@ +{ + "Version": 5, + "ElasticsearchWarning": true +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/backend/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json new file mode 100644 index 0000000..f062515 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json @@ -0,0 +1,407 @@ +{ + "Description": "Amplify Cognito Stack for AWS Amplify CLI", + "AWSTemplateFormatVersion": "2010-09-09", + "Parameters": { + "env": { + "Type": "String" + }, + "identityPoolName": { + "Type": "String" + }, + "allowUnauthenticatedIdentities": { + "Type": "String" + }, + "resourceNameTruncated": { + "Type": "String" + }, + "userPoolName": { + "Type": "String" + }, + "autoVerifiedAttributes": { + "Type": "CommaDelimitedList" + }, + "mfaConfiguration": { + "Type": "String" + }, + "mfaTypes": { + "Type": "CommaDelimitedList" + }, + "smsAuthenticationMessage": { + "Type": "String" + }, + "smsVerificationMessage": { + "Type": "String" + }, + "emailVerificationSubject": { + "Type": "String" + }, + "emailVerificationMessage": { + "Type": "String" + }, + "defaultPasswordPolicy": { + "Type": "String" + }, + "passwordPolicyMinLength": { + "Type": "String" + }, + "passwordPolicyCharacters": { + "Type": "CommaDelimitedList" + }, + "requiredAttributes": { + "Type": "CommaDelimitedList" + }, + "aliasAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientGenerateSecret": { + "Type": "String" + }, + "userpoolClientRefreshTokenValidity": { + "Type": "String" + }, + "userpoolClientWriteAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientReadAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientLambdaRole": { + "Type": "String" + }, + "userpoolClientSetAttributes": { + "Type": "String" + }, + "sharedId": { + "Type": "String" + }, + "resourceName": { + "Type": "String" + }, + "authSelections": { + "Type": "String" + }, + "useDefault": { + "Type": "String" + }, + "userPoolGroupList": { + "Type": "CommaDelimitedList" + }, + "serviceName": { + "Type": "String" + }, + "usernameCaseSensitive": { + "Type": "String" + }, + "useEnabledMfas": { + "Type": "String" + }, + "authRoleArn": { + "Type": "String" + }, + "unauthRoleArn": { + "Type": "String" + }, + "breakCircularDependency": { + "Type": "String" + }, + "dependsOn": { + "Type": "CommaDelimitedList" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + }, + "Resources": { + "UserPool": { + "Type": "AWS::Cognito::UserPool", + "Properties": { + "AutoVerifiedAttributes": [ + "email" + ], + "EmailVerificationMessage": { + "Ref": "emailVerificationMessage" + }, + "EmailVerificationSubject": { + "Ref": "emailVerificationSubject" + }, + "MfaConfiguration": { + "Ref": "mfaConfiguration" + }, + "Policies": { + "PasswordPolicy": { + "MinimumLength": { + "Ref": "passwordPolicyMinLength" + }, + "RequireLowercase": false, + "RequireNumbers": false, + "RequireSymbols": false, + "RequireUppercase": false + } + }, + "Schema": [ + { + "Mutable": true, + "Name": "email", + "Required": true + } + ], + "UserAttributeUpdateSettings": { + "AttributesRequireVerificationBeforeUpdate": [ + "email" + ] + }, + "UserPoolName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "userPoolName" + }, + { + "Fn::Join": [ + "", + [ + { + "Ref": "userPoolName" + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "UsernameConfiguration": { + "CaseSensitive": false + } + } + }, + "UserPoolClientWeb": { + "Type": "AWS::Cognito::UserPoolClient", + "Properties": { + "ClientName": "mynoteccae4f3b_app_clientWeb", + "RefreshTokenValidity": { + "Ref": "userpoolClientRefreshTokenValidity" + }, + "TokenValidityUnits": { + "RefreshToken": "days" + }, + "UserPoolId": { + "Ref": "UserPool" + } + }, + "DependsOn": [ + "UserPool" + ] + }, + "UserPoolClient": { + "Type": "AWS::Cognito::UserPoolClient", + "Properties": { + "ClientName": "mynoteccae4f3b_app_client", + "GenerateSecret": { + "Ref": "userpoolClientGenerateSecret" + }, + "RefreshTokenValidity": { + "Ref": "userpoolClientRefreshTokenValidity" + }, + "TokenValidityUnits": { + "RefreshToken": "days" + }, + "UserPoolId": { + "Ref": "UserPool" + } + }, + "DependsOn": [ + "UserPool" + ] + }, + "UserPoolClientRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + }, + "Action": "sts:AssumeRole" + } + ] + }, + "RoleName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "userpoolClientLambdaRole" + }, + { + "Fn::Join": [ + "", + [ + "upClientLambdaRoleccae4f3b", + { + "Fn::Select": [ + 3, + { + "Fn::Split": [ + "-", + { + "Ref": "AWS::StackName" + } + ] + } + ] + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + } + } + }, + "IdentityPool": { + "Type": "AWS::Cognito::IdentityPool", + "Properties": { + "AllowUnauthenticatedIdentities": { + "Ref": "allowUnauthenticatedIdentities" + }, + "CognitoIdentityProviders": [ + { + "ClientId": { + "Ref": "UserPoolClient" + }, + "ProviderName": { + "Fn::Sub": [ + "cognito-idp.${region}.amazonaws.com/${client}", + { + "region": { + "Ref": "AWS::Region" + }, + "client": { + "Ref": "UserPool" + } + } + ] + } + }, + { + "ClientId": { + "Ref": "UserPoolClientWeb" + }, + "ProviderName": { + "Fn::Sub": [ + "cognito-idp.${region}.amazonaws.com/${client}", + { + "region": { + "Ref": "AWS::Region" + }, + "client": { + "Ref": "UserPool" + } + } + ] + } + } + ], + "IdentityPoolName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "mynotesccae4f3b_identitypool_ccae4f3b", + { + "Fn::Join": [ + "", + [ + "mynotesccae4f3b_identitypool_ccae4f3b__", + { + "Ref": "env" + } + ] + ] + } + ] + } + } + }, + "IdentityPoolRoleMap": { + "Type": "AWS::Cognito::IdentityPoolRoleAttachment", + "Properties": { + "IdentityPoolId": { + "Ref": "IdentityPool" + }, + "Roles": { + "unauthenticated": { + "Ref": "unauthRoleArn" + }, + "authenticated": { + "Ref": "authRoleArn" + } + } + }, + "DependsOn": [ + "IdentityPool" + ] + } + }, + "Outputs": { + "IdentityPoolId": { + "Description": "Id for the identity pool", + "Value": { + "Ref": "IdentityPool" + } + }, + "IdentityPoolName": { + "Value": { + "Fn::GetAtt": [ + "IdentityPool", + "Name" + ] + } + }, + "UserPoolId": { + "Description": "Id for the user pool", + "Value": { + "Ref": "UserPool" + } + }, + "UserPoolArn": { + "Description": "Arn for the user pool", + "Value": { + "Fn::GetAtt": [ + "UserPool", + "Arn" + ] + } + }, + "UserPoolName": { + "Value": { + "Ref": "userPoolName" + } + }, + "AppClientIDWeb": { + "Description": "The user pool app client id for web", + "Value": { + "Ref": "UserPoolClientWeb" + } + }, + "AppClientID": { + "Description": "The user pool app client id", + "Value": { + "Ref": "UserPoolClient" + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/auth/mynotesccae4f3b/build/parameters.json b/New_APIs/Amplify-fullstack-API/amplify/backend/auth/mynotesccae4f3b/build/parameters.json new file mode 100644 index 0000000..2c8bdef --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/auth/mynotesccae4f3b/build/parameters.json @@ -0,0 +1,56 @@ +{ + "identityPoolName": "mynotesccae4f3b_identitypool_ccae4f3b", + "allowUnauthenticatedIdentities": true, + "resourceNameTruncated": "mynoteccae4f3b", + "userPoolName": "mynotesccae4f3b_userpool_ccae4f3b", + "autoVerifiedAttributes": [ + "email" + ], + "mfaConfiguration": "OFF", + "mfaTypes": [ + "SMS Text Message" + ], + "smsAuthenticationMessage": "Your authentication code is {####}", + "smsVerificationMessage": "Your verification code is {####}", + "emailVerificationSubject": "Your verification code", + "emailVerificationMessage": "Your verification code is {####}", + "defaultPasswordPolicy": false, + "passwordPolicyMinLength": 8, + "passwordPolicyCharacters": [], + "requiredAttributes": [ + "email" + ], + "aliasAttributes": [], + "userpoolClientGenerateSecret": false, + "userpoolClientRefreshTokenValidity": 30, + "userpoolClientWriteAttributes": [ + "email" + ], + "userpoolClientReadAttributes": [ + "email" + ], + "userpoolClientLambdaRole": "mynoteccae4f3b_userpoolclient_lambda_role", + "userpoolClientSetAttributes": false, + "sharedId": "ccae4f3b", + "resourceName": "mynotesccae4f3b", + "authSelections": "identityPoolAndUserPool", + "useDefault": "default", + "userPoolGroupList": [], + "serviceName": "Cognito", + "usernameCaseSensitive": false, + "useEnabledMfas": true, + "authRoleArn": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + }, + "unauthRoleArn": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + }, + "breakCircularDependency": true, + "dependsOn": [] +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/auth/mynotesccae4f3b/cli-inputs.json b/New_APIs/Amplify-fullstack-API/amplify/backend/auth/mynotesccae4f3b/cli-inputs.json new file mode 100644 index 0000000..8d149af --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/auth/mynotesccae4f3b/cli-inputs.json @@ -0,0 +1,59 @@ +{ + "version": "1", + "cognitoConfig": { + "identityPoolName": "mynotesccae4f3b_identitypool_ccae4f3b", + "allowUnauthenticatedIdentities": true, + "resourceNameTruncated": "mynoteccae4f3b", + "userPoolName": "mynotesccae4f3b_userpool_ccae4f3b", + "autoVerifiedAttributes": [ + "email" + ], + "mfaConfiguration": "OFF", + "mfaTypes": [ + "SMS Text Message" + ], + "smsAuthenticationMessage": "Your authentication code is {####}", + "smsVerificationMessage": "Your verification code is {####}", + "emailVerificationSubject": "Your verification code", + "emailVerificationMessage": "Your verification code is {####}", + "defaultPasswordPolicy": false, + "passwordPolicyMinLength": 8, + "passwordPolicyCharacters": [], + "requiredAttributes": [ + "email" + ], + "aliasAttributes": [], + "userpoolClientGenerateSecret": false, + "userpoolClientRefreshTokenValidity": 30, + "userpoolClientWriteAttributes": [ + "email" + ], + "userpoolClientReadAttributes": [ + "email" + ], + "userpoolClientLambdaRole": "mynoteccae4f3b_userpoolclient_lambda_role", + "userpoolClientSetAttributes": false, + "sharedId": "ccae4f3b", + "resourceName": "mynotesccae4f3b", + "authSelections": "identityPoolAndUserPool", + "useDefault": "default", + "userPoolGroupList": [], + "serviceName": "Cognito", + "usernameCaseSensitive": false, + "useEnabledMfas": true, + "authRoleArn": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + }, + "unauthRoleArn": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + }, + "breakCircularDependency": true, + "dependsOn": [] + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/api/mynotes/build/cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/api/mynotes/build/cloudformation-template.json new file mode 100644 index 0000000..044e9db --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/api/mynotes/build/cloudformation-template.json @@ -0,0 +1,316 @@ +{ + "Parameters": { + "env": { + "Type": "String", + "Default": "NONE" + }, + "AppSyncApiName": { + "Type": "String", + "Default": "AppSyncSimpleTransform" + }, + "DynamoDBModelTableReadIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of read IOPS the table should support." + }, + "DynamoDBModelTableWriteIOPS": { + "Type": "Number", + "Default": 5, + "Description": "The number of write IOPS the table should support." + }, + "DynamoDBBillingMode": { + "Type": "String", + "Default": "PAY_PER_REQUEST", + "AllowedValues": [ + "PAY_PER_REQUEST", + "PROVISIONED" + ], + "Description": "Configure @model types to create DynamoDB tables with PAY_PER_REQUEST or PROVISIONED billing modes." + }, + "DynamoDBEnablePointInTimeRecovery": { + "Type": "String", + "Default": "false", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Whether to enable Point in Time Recovery on the table." + }, + "DynamoDBEnableServerSideEncryption": { + "Type": "String", + "Default": "true", + "AllowedValues": [ + "true", + "false" + ], + "Description": "Enable server side encryption powered by KMS." + }, + "S3DeploymentBucket": { + "Type": "String", + "Description": "An S3 Bucket name where assets are deployed" + }, + "S3DeploymentRootKey": { + "Type": "String", + "Description": "An S3 key relative to the S3DeploymentBucket that points to the root of the deployment directory." + } + }, + "Resources": { + "GraphQLAPI": { + "Type": "AWS::AppSync::GraphQLApi", + "Properties": { + "AuthenticationType": "API_KEY", + "Name": { + "Fn::Join": [ + "", + [ + { + "Ref": "AppSyncApiName" + }, + "-", + { + "Ref": "env" + } + ] + ] + } + } + }, + "GraphQLAPITransformerSchema3CB2AE18": { + "Type": "AWS::AppSync::GraphQLSchema", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "DefinitionS3Location": { + "Fn::Join": [ + "", + [ + "s3://", + { + "Ref": "S3DeploymentBucket" + }, + "/", + { + "Ref": "S3DeploymentRootKey" + }, + "/schema.graphql" + ] + ] + } + } + }, + "GraphQLAPIDefaultApiKey215A6DD7": { + "Type": "AWS::AppSync::ApiKey", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Expires": 1722598000 + } + }, + "GraphQLAPINONEDS95A13CF0": { + "Type": "AWS::AppSync::DataSource", + "Properties": { + "ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Description": "None Data Source for Pipeline functions", + "Name": "NONE_DS", + "Type": "NONE" + } + }, + "Todo": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "Parameters": { + "DynamoDBModelTableReadIOPS": { + "Ref": "DynamoDBModelTableReadIOPS" + }, + "DynamoDBModelTableWriteIOPS": { + "Ref": "DynamoDBModelTableWriteIOPS" + }, + "DynamoDBBillingMode": { + "Ref": "DynamoDBBillingMode" + }, + "DynamoDBEnablePointInTimeRecovery": { + "Ref": "DynamoDBEnablePointInTimeRecovery" + }, + "DynamoDBEnableServerSideEncryption": { + "Ref": "DynamoDBEnableServerSideEncryption" + }, + "referencetotransformerrootstackenv10C5A902Ref": { + "Ref": "env" + }, + "referencetotransformerrootstackGraphQLAPI20497F53ApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "referencetotransformerrootstackGraphQLAPINONEDS2BA9D1C8Name": { + "Fn::GetAtt": [ + "GraphQLAPINONEDS95A13CF0", + "Name" + ] + }, + "referencetotransformerrootstackS3DeploymentBucket7592718ARef": { + "Ref": "S3DeploymentBucket" + }, + "referencetotransformerrootstackS3DeploymentRootKeyA71EA735Ref": { + "Ref": "S3DeploymentRootKey" + } + }, + "TemplateURL": { + "Fn::Join": [ + "", + [ + "https://s3.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "S3DeploymentBucket" + }, + "/", + { + "Ref": "S3DeploymentRootKey" + }, + "/stacks/Todo.json" + ] + ] + } + }, + "DependsOn": [ + "GraphQLAPITransformerSchema3CB2AE18" + ] + }, + "CustomResourcesjson": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "Parameters": { + "AppSyncApiId": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "AppSyncApiName": { + "Ref": "AppSyncApiName" + }, + "env": { + "Ref": "env" + }, + "S3DeploymentBucket": { + "Ref": "S3DeploymentBucket" + }, + "S3DeploymentRootKey": { + "Ref": "S3DeploymentRootKey" + } + }, + "TemplateURL": { + "Fn::Join": [ + "/", + [ + "https://s3.amazonaws.com", + { + "Ref": "S3DeploymentBucket" + }, + { + "Ref": "S3DeploymentRootKey" + }, + "stacks", + "CustomResources.json" + ] + ] + } + }, + "DependsOn": [ + "GraphQLAPI", + "GraphQLAPITransformerSchema3CB2AE18", + "Todo" + ] + } + }, + "Outputs": { + "GraphQLAPIKeyOutput": { + "Description": "Your GraphQL API ID.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPIDefaultApiKey215A6DD7", + "ApiKey" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiKey" + ] + ] + } + } + }, + "GraphQLAPIIdOutput": { + "Description": "Your GraphQL API ID.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPI", + "ApiId" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiId" + ] + ] + } + } + }, + "GraphQLAPIEndpointOutput": { + "Description": "Your GraphQL API endpoint.", + "Value": { + "Fn::GetAtt": [ + "GraphQLAPI", + "GraphQLUrl" + ] + }, + "Export": { + "Name": { + "Fn::Join": [ + ":", + [ + { + "Ref": "AWS::StackName" + }, + "GraphQLApiEndpoint" + ] + ] + } + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json new file mode 100644 index 0000000..f062515 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/auth/mynotesccae4f3b/build/mynotesccae4f3b-cloudformation-template.json @@ -0,0 +1,407 @@ +{ + "Description": "Amplify Cognito Stack for AWS Amplify CLI", + "AWSTemplateFormatVersion": "2010-09-09", + "Parameters": { + "env": { + "Type": "String" + }, + "identityPoolName": { + "Type": "String" + }, + "allowUnauthenticatedIdentities": { + "Type": "String" + }, + "resourceNameTruncated": { + "Type": "String" + }, + "userPoolName": { + "Type": "String" + }, + "autoVerifiedAttributes": { + "Type": "CommaDelimitedList" + }, + "mfaConfiguration": { + "Type": "String" + }, + "mfaTypes": { + "Type": "CommaDelimitedList" + }, + "smsAuthenticationMessage": { + "Type": "String" + }, + "smsVerificationMessage": { + "Type": "String" + }, + "emailVerificationSubject": { + "Type": "String" + }, + "emailVerificationMessage": { + "Type": "String" + }, + "defaultPasswordPolicy": { + "Type": "String" + }, + "passwordPolicyMinLength": { + "Type": "String" + }, + "passwordPolicyCharacters": { + "Type": "CommaDelimitedList" + }, + "requiredAttributes": { + "Type": "CommaDelimitedList" + }, + "aliasAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientGenerateSecret": { + "Type": "String" + }, + "userpoolClientRefreshTokenValidity": { + "Type": "String" + }, + "userpoolClientWriteAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientReadAttributes": { + "Type": "CommaDelimitedList" + }, + "userpoolClientLambdaRole": { + "Type": "String" + }, + "userpoolClientSetAttributes": { + "Type": "String" + }, + "sharedId": { + "Type": "String" + }, + "resourceName": { + "Type": "String" + }, + "authSelections": { + "Type": "String" + }, + "useDefault": { + "Type": "String" + }, + "userPoolGroupList": { + "Type": "CommaDelimitedList" + }, + "serviceName": { + "Type": "String" + }, + "usernameCaseSensitive": { + "Type": "String" + }, + "useEnabledMfas": { + "Type": "String" + }, + "authRoleArn": { + "Type": "String" + }, + "unauthRoleArn": { + "Type": "String" + }, + "breakCircularDependency": { + "Type": "String" + }, + "dependsOn": { + "Type": "CommaDelimitedList" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + }, + "Resources": { + "UserPool": { + "Type": "AWS::Cognito::UserPool", + "Properties": { + "AutoVerifiedAttributes": [ + "email" + ], + "EmailVerificationMessage": { + "Ref": "emailVerificationMessage" + }, + "EmailVerificationSubject": { + "Ref": "emailVerificationSubject" + }, + "MfaConfiguration": { + "Ref": "mfaConfiguration" + }, + "Policies": { + "PasswordPolicy": { + "MinimumLength": { + "Ref": "passwordPolicyMinLength" + }, + "RequireLowercase": false, + "RequireNumbers": false, + "RequireSymbols": false, + "RequireUppercase": false + } + }, + "Schema": [ + { + "Mutable": true, + "Name": "email", + "Required": true + } + ], + "UserAttributeUpdateSettings": { + "AttributesRequireVerificationBeforeUpdate": [ + "email" + ] + }, + "UserPoolName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "userPoolName" + }, + { + "Fn::Join": [ + "", + [ + { + "Ref": "userPoolName" + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "UsernameConfiguration": { + "CaseSensitive": false + } + } + }, + "UserPoolClientWeb": { + "Type": "AWS::Cognito::UserPoolClient", + "Properties": { + "ClientName": "mynoteccae4f3b_app_clientWeb", + "RefreshTokenValidity": { + "Ref": "userpoolClientRefreshTokenValidity" + }, + "TokenValidityUnits": { + "RefreshToken": "days" + }, + "UserPoolId": { + "Ref": "UserPool" + } + }, + "DependsOn": [ + "UserPool" + ] + }, + "UserPoolClient": { + "Type": "AWS::Cognito::UserPoolClient", + "Properties": { + "ClientName": "mynoteccae4f3b_app_client", + "GenerateSecret": { + "Ref": "userpoolClientGenerateSecret" + }, + "RefreshTokenValidity": { + "Ref": "userpoolClientRefreshTokenValidity" + }, + "TokenValidityUnits": { + "RefreshToken": "days" + }, + "UserPoolId": { + "Ref": "UserPool" + } + }, + "DependsOn": [ + "UserPool" + ] + }, + "UserPoolClientRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + }, + "Action": "sts:AssumeRole" + } + ] + }, + "RoleName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "userpoolClientLambdaRole" + }, + { + "Fn::Join": [ + "", + [ + "upClientLambdaRoleccae4f3b", + { + "Fn::Select": [ + 3, + { + "Fn::Split": [ + "-", + { + "Ref": "AWS::StackName" + } + ] + } + ] + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + } + } + }, + "IdentityPool": { + "Type": "AWS::Cognito::IdentityPool", + "Properties": { + "AllowUnauthenticatedIdentities": { + "Ref": "allowUnauthenticatedIdentities" + }, + "CognitoIdentityProviders": [ + { + "ClientId": { + "Ref": "UserPoolClient" + }, + "ProviderName": { + "Fn::Sub": [ + "cognito-idp.${region}.amazonaws.com/${client}", + { + "region": { + "Ref": "AWS::Region" + }, + "client": { + "Ref": "UserPool" + } + } + ] + } + }, + { + "ClientId": { + "Ref": "UserPoolClientWeb" + }, + "ProviderName": { + "Fn::Sub": [ + "cognito-idp.${region}.amazonaws.com/${client}", + { + "region": { + "Ref": "AWS::Region" + }, + "client": { + "Ref": "UserPool" + } + } + ] + } + } + ], + "IdentityPoolName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "mynotesccae4f3b_identitypool_ccae4f3b", + { + "Fn::Join": [ + "", + [ + "mynotesccae4f3b_identitypool_ccae4f3b__", + { + "Ref": "env" + } + ] + ] + } + ] + } + } + }, + "IdentityPoolRoleMap": { + "Type": "AWS::Cognito::IdentityPoolRoleAttachment", + "Properties": { + "IdentityPoolId": { + "Ref": "IdentityPool" + }, + "Roles": { + "unauthenticated": { + "Ref": "unauthRoleArn" + }, + "authenticated": { + "Ref": "authRoleArn" + } + } + }, + "DependsOn": [ + "IdentityPool" + ] + } + }, + "Outputs": { + "IdentityPoolId": { + "Description": "Id for the identity pool", + "Value": { + "Ref": "IdentityPool" + } + }, + "IdentityPoolName": { + "Value": { + "Fn::GetAtt": [ + "IdentityPool", + "Name" + ] + } + }, + "UserPoolId": { + "Description": "Id for the user pool", + "Value": { + "Ref": "UserPool" + } + }, + "UserPoolArn": { + "Description": "Arn for the user pool", + "Value": { + "Fn::GetAtt": [ + "UserPool", + "Arn" + ] + } + }, + "UserPoolName": { + "Value": { + "Ref": "userPoolName" + } + }, + "AppClientIDWeb": { + "Description": "The user pool app client id for web", + "Value": { + "Ref": "UserPoolClientWeb" + } + }, + "AppClientID": { + "Description": "The user pool app client id", + "Value": { + "Ref": "UserPoolClient" + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/awscloudformation/build/root-cloudformation-stack.json b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/awscloudformation/build/root-cloudformation-stack.json new file mode 100644 index 0000000..1e3972c --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/awscloudformation/build/root-cloudformation-stack.json @@ -0,0 +1,437 @@ +{ + "Description": "Root Stack for AWS Amplify Console", + "AWSTemplateFormatVersion": "2010-09-09", + "Parameters": { + "DeploymentBucketName": { + "Type": "String", + "Default": "DeploymentBucket", + "Description": "Name of the common deployment bucket provided by the parent stack" + }, + "AuthRoleName": { + "Type": "String", + "Default": "AuthRoleName", + "Description": "Name of the common deployment bucket provided by the parent stack" + }, + "UnauthRoleName": { + "Type": "String", + "Default": "UnAuthRoleName", + "Description": "Name of the common deployment bucket provided by the parent stack" + } + }, + "Outputs": { + "Region": { + "Description": "CloudFormation provider root stack Region", + "Value": { + "Ref": "AWS::Region" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-Region" + } + } + }, + "StackName": { + "Description": "CloudFormation provider root stack ID", + "Value": { + "Ref": "AWS::StackName" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-StackName" + } + } + }, + "StackId": { + "Description": "CloudFormation provider root stack name", + "Value": { + "Ref": "AWS::StackId" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-StackId" + } + } + }, + "AuthRoleArn": { + "Value": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + } + }, + "UnauthRoleArn": { + "Value": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + } + }, + "DeploymentBucketName": { + "Description": "CloudFormation provider root stack deployment bucket name", + "Value": { + "Ref": "DeploymentBucketName" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-DeploymentBucketName" + } + } + }, + "AuthRoleName": { + "Value": { + "Ref": "AuthRole" + } + }, + "UnauthRoleName": { + "Value": { + "Ref": "UnauthRole" + } + } + }, + "Resources": { + "DeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "DeploymentBucketName" + }, + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "AuthRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "", + "Effect": "Deny", + "Principal": { + "Federated": "cognito-identity.amazonaws.com" + }, + "Action": "sts:AssumeRoleWithWebIdentity" + } + ] + }, + "RoleName": { + "Ref": "AuthRoleName" + } + } + }, + "UnauthRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "", + "Effect": "Deny", + "Principal": { + "Federated": "cognito-identity.amazonaws.com" + }, + "Action": "sts:AssumeRoleWithWebIdentity" + } + ] + }, + "RoleName": { + "Ref": "UnauthRoleName" + } + } + }, + "apimynotes": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/api/cloudformation-template.json", + "Parameters": { + "AppSyncApiName": "mynotes", + "DynamoDBBillingMode": "PAY_PER_REQUEST", + "DynamoDBEnableServerSideEncryption": false, + "S3DeploymentBucket": "amplify-mynotes-staging-b2b56-deployment", + "S3DeploymentRootKey": "amplify-appsync-files/c0e971ea1ba703ba5054d45b1d4a7a475f98dd0a", + "env": "staging" + } + } + }, + "authmynotesccae4f3b": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/auth/mynotesccae4f3b-cloudformation-template.json", + "Parameters": { + "identityPoolName": "mynotesccae4f3b_identitypool_ccae4f3b", + "allowUnauthenticatedIdentities": true, + "resourceNameTruncated": "mynoteccae4f3b", + "userPoolName": "mynotesccae4f3b_userpool_ccae4f3b", + "autoVerifiedAttributes": "email", + "mfaConfiguration": "OFF", + "mfaTypes": "SMS Text Message", + "smsAuthenticationMessage": "Your authentication code is {####}", + "smsVerificationMessage": "Your verification code is {####}", + "emailVerificationSubject": "Your verification code", + "emailVerificationMessage": "Your verification code is {####}", + "defaultPasswordPolicy": false, + "passwordPolicyMinLength": 8, + "passwordPolicyCharacters": "", + "requiredAttributes": "email", + "aliasAttributes": "", + "userpoolClientGenerateSecret": false, + "userpoolClientRefreshTokenValidity": 30, + "userpoolClientWriteAttributes": "email", + "userpoolClientReadAttributes": "email", + "userpoolClientLambdaRole": "mynoteccae4f3b_userpoolclient_lambda_role", + "userpoolClientSetAttributes": false, + "sharedId": "ccae4f3b", + "resourceName": "mynotesccae4f3b", + "authSelections": "identityPoolAndUserPool", + "useDefault": "default", + "userPoolGroupList": "", + "serviceName": "Cognito", + "usernameCaseSensitive": false, + "useEnabledMfas": true, + "authRoleArn": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + }, + "unauthRoleArn": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + }, + "breakCircularDependency": true, + "dependsOn": "", + "env": "staging" + } + } + }, + "functionS3Triggerdc42a5d7": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/function/S3Triggerdc42a5d7-cloudformation-template.json", + "Parameters": { + "deploymentBucketName": "amplify-mynotes-staging-b2b56-deployment", + "s3Key": "amplify-builds/S3Triggerdc42a5d7-6a475541666d35456861-build.zip", + "env": "staging" + } + } + }, + "UpdateRolesWithIDPFunction": { + "DependsOn": [ + "AuthRole", + "UnauthRole", + "authmynotesccae4f3b" + ], + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": { + "Fn::Join": [ + "\n", + [ + "const response = require('cfn-response');", + "const { IAMClient, GetRoleCommand, UpdateAssumeRolePolicyCommand } = require('@aws-sdk/client-iam');", + "exports.handler = function(event, context) {", + " // Don't return promise, response.send() marks context as done internally", + " const ignoredPromise = handleEvent(event, context)", + "};", + "async function handleEvent(event, context) {", + " try {", + " let authRoleName = event.ResourceProperties.authRoleName;", + " let unauthRoleName = event.ResourceProperties.unauthRoleName;", + " let idpId = event.ResourceProperties.idpId;", + " let authParamsJson = {", + " 'Version': '2012-10-17',", + " 'Statement': [{", + " 'Effect': 'Allow',", + " 'Principal': {'Federated': 'cognito-identity.amazonaws.com'},", + " 'Action': 'sts:AssumeRoleWithWebIdentity',", + " 'Condition': {", + " 'StringEquals': {'cognito-identity.amazonaws.com:aud': idpId},", + " 'ForAnyValue:StringLike': {'cognito-identity.amazonaws.com:amr': 'authenticated'}", + " }", + " }]", + " };", + " let unauthParamsJson = {", + " 'Version': '2012-10-17',", + " 'Statement': [{", + " 'Effect': 'Allow',", + " 'Principal': {'Federated': 'cognito-identity.amazonaws.com'},", + " 'Action': 'sts:AssumeRoleWithWebIdentity',", + " 'Condition': {", + " 'StringEquals': {'cognito-identity.amazonaws.com:aud': idpId},", + " 'ForAnyValue:StringLike': {'cognito-identity.amazonaws.com:amr': 'unauthenticated'}", + " }", + " }]", + " };", + " if (event.RequestType === 'Delete') {", + " try {", + " delete authParamsJson.Statement[0].Condition;", + " delete unauthParamsJson.Statement[0].Condition;", + " authParamsJson.Statement[0].Effect = 'Deny'", + " unauthParamsJson.Statement[0].Effect = 'Deny'", + " let authParams = {PolicyDocument: JSON.stringify(authParamsJson), RoleName: authRoleName};", + " let unauthParams = {PolicyDocument: JSON.stringify(unauthParamsJson), RoleName: unauthRoleName};", + " const iam = new IAMClient({region: event.ResourceProperties.region});", + " let res = await Promise.all([", + " iam.send(new GetRoleCommand({RoleName: authParams.RoleName})),", + " iam.send(new GetRoleCommand({RoleName: unauthParams.RoleName}))", + " ]);", + " res = await Promise.all([", + " iam.send(new UpdateAssumeRolePolicyCommand(authParams)),", + " iam.send(new UpdateAssumeRolePolicyCommand(unauthParams))", + " ]);", + " response.send(event, context, response.SUCCESS, {});", + " } catch (err) {", + " console.log(err.stack);", + " response.send(event, context, response.SUCCESS, {Error: err});", + " }", + " } else if (event.RequestType === 'Update' || event.RequestType === 'Create') {", + " const iam = new IAMClient({region: event.ResourceProperties.region});", + " let authParams = {PolicyDocument: JSON.stringify(authParamsJson), RoleName: authRoleName};", + " let unauthParams = {PolicyDocument: JSON.stringify(unauthParamsJson), RoleName: unauthRoleName};", + " const res = await Promise.all([", + " iam.send(new UpdateAssumeRolePolicyCommand(authParams)),", + " iam.send(new UpdateAssumeRolePolicyCommand(unauthParams))", + " ]);", + " response.send(event, context, response.SUCCESS, {});", + " }", + " } catch (err) {", + " console.log(err.stack);", + " response.send(event, context, response.FAILED, {Error: err});", + " }", + "};" + ] + ] + } + }, + "Handler": "index.handler", + "Runtime": "nodejs18.x", + "Timeout": 300, + "Role": { + "Fn::GetAtt": [ + "UpdateRolesWithIDPFunctionRole", + "Arn" + ] + } + } + }, + "UpdateRolesWithIDPFunctionOutputs": { + "Type": "Custom::LambdaCallout", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "UpdateRolesWithIDPFunction", + "Arn" + ] + }, + "region": { + "Ref": "AWS::Region" + }, + "idpId": { + "Fn::GetAtt": [ + "authmynotesccae4f3b", + "Outputs.IdentityPoolId" + ] + }, + "authRoleName": { + "Ref": "AuthRole" + }, + "unauthRoleName": { + "Ref": "UnauthRole" + } + } + }, + "UpdateRolesWithIDPFunctionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "RoleName": { + "Fn::Join": [ + "", + [ + { + "Ref": "AuthRole" + }, + "-idp" + ] + ] + }, + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": "UpdateRolesWithIDPFunctionPolicy", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": "arn:aws:logs:*:*:*" + }, + { + "Effect": "Allow", + "Action": [ + "iam:UpdateAssumeRolePolicy", + "iam:GetRole" + ], + "Resource": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + } + }, + { + "Effect": "Allow", + "Action": [ + "iam:UpdateAssumeRolePolicy", + "iam:GetRole" + ], + "Resource": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + } + } + ] + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/function/S3Trigger168e5d52/S3Trigger168e5d52-cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/function/S3Trigger168e5d52/S3Trigger168e5d52-cloudformation-template.json new file mode 100644 index 0000000..bada55f --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/function/S3Trigger168e5d52/S3Trigger168e5d52-cloudformation-template.json @@ -0,0 +1,193 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "{\"createdOn\":\"Mac\",\"createdBy\":\"Amplify\",\"createdWith\":\"12.12.4\",\"stackType\":\"function-Lambda\",\"metadata\":{}}", + "Parameters": { + "env": { + "Type": "String" + }, + "deploymentBucketName": { + "Type": "String" + }, + "s3Key": { + "Type": "String" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + }, + "Resources": { + "LambdaFunction": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "aws:asset:path": "./src", + "aws:asset:property": "Code" + }, + "Properties": { + "Handler": "index.handler", + "FunctionName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Trigger168e5d52", + { + "Fn::Join": [ + "", + [ + "S3Trigger168e5d52", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "Environment": { + "Variables": { + "ENV": { + "Ref": "env" + } + } + }, + "Role": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 25, + "Code": { + "S3Bucket": { + "Ref": "deploymentBucketName" + }, + "S3Key": { + "Ref": "s3Key" + } + } + } + }, + "LambdaExecutionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "RoleName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Trigger168e5d52LambdaRole168e5d52", + { + "Fn::Join": [ + "", + [ + "S3Trigger168e5d52LambdaRole168e5d52", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + } + } + }, + "lambdaexecutionpolicy": { + "DependsOn": [ + "LambdaExecutionRole" + ], + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyName": "lambda-execution-policy", + "Roles": [ + { + "Ref": "LambdaExecutionRole" + } + ], + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": { + "Fn::Sub": [ + "arn:aws:logs:${region}:${account}:log-group:/aws/lambda/${lambda}:log-stream:*", + { + "region": { + "Ref": "AWS::Region" + }, + "account": { + "Ref": "AWS::AccountId" + }, + "lambda": { + "Ref": "LambdaFunction" + } + } + ] + } + } + ] + } + } + } + }, + "Outputs": { + "Name": { + "Value": { + "Ref": "LambdaFunction" + } + }, + "Arn": { + "Value": { + "Fn::GetAtt": [ + "LambdaFunction", + "Arn" + ] + } + }, + "Region": { + "Value": { + "Ref": "AWS::Region" + } + }, + "LambdaExecutionRole": { + "Value": { + "Ref": "LambdaExecutionRole" + } + }, + "LambdaExecutionRoleArn": { + "Value": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json new file mode 100644 index 0000000..9972262 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json @@ -0,0 +1,193 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "{\"createdOn\":\"Mac\",\"createdBy\":\"Amplify\",\"createdWith\":\"12.12.4\",\"stackType\":\"function-Lambda\",\"metadata\":{}}", + "Parameters": { + "env": { + "Type": "String" + }, + "deploymentBucketName": { + "Type": "String" + }, + "s3Key": { + "Type": "String" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + }, + "Resources": { + "LambdaFunction": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "aws:asset:path": "./src", + "aws:asset:property": "Code" + }, + "Properties": { + "Handler": "index.handler", + "FunctionName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Triggerdc42a5d7", + { + "Fn::Join": [ + "", + [ + "S3Triggerdc42a5d7", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "Environment": { + "Variables": { + "ENV": { + "Ref": "env" + } + } + }, + "Role": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 25, + "Code": { + "S3Bucket": { + "Ref": "deploymentBucketName" + }, + "S3Key": { + "Ref": "s3Key" + } + } + } + }, + "LambdaExecutionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "RoleName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Triggerdc42a5d7LambdaRoledc42a5d7", + { + "Fn::Join": [ + "", + [ + "S3Triggerdc42a5d7LambdaRoledc42a5d7", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + } + } + }, + "lambdaexecutionpolicy": { + "DependsOn": [ + "LambdaExecutionRole" + ], + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyName": "lambda-execution-policy", + "Roles": [ + { + "Ref": "LambdaExecutionRole" + } + ], + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": { + "Fn::Sub": [ + "arn:aws:logs:${region}:${account}:log-group:/aws/lambda/${lambda}:log-stream:*", + { + "region": { + "Ref": "AWS::Region" + }, + "account": { + "Ref": "AWS::AccountId" + }, + "lambda": { + "Ref": "LambdaFunction" + } + } + ] + } + } + ] + } + } + } + }, + "Outputs": { + "Name": { + "Value": { + "Ref": "LambdaFunction" + } + }, + "Arn": { + "Value": { + "Fn::GetAtt": [ + "LambdaFunction", + "Arn" + ] + } + }, + "Region": { + "Value": { + "Ref": "AWS::Region" + } + }, + "LambdaExecutionRole": { + "Value": { + "Ref": "LambdaExecutionRole" + } + }, + "LambdaExecutionRoleArn": { + "Value": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/root-cloudformation-stack.json b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/root-cloudformation-stack.json new file mode 100644 index 0000000..1e3972c --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/root-cloudformation-stack.json @@ -0,0 +1,437 @@ +{ + "Description": "Root Stack for AWS Amplify Console", + "AWSTemplateFormatVersion": "2010-09-09", + "Parameters": { + "DeploymentBucketName": { + "Type": "String", + "Default": "DeploymentBucket", + "Description": "Name of the common deployment bucket provided by the parent stack" + }, + "AuthRoleName": { + "Type": "String", + "Default": "AuthRoleName", + "Description": "Name of the common deployment bucket provided by the parent stack" + }, + "UnauthRoleName": { + "Type": "String", + "Default": "UnAuthRoleName", + "Description": "Name of the common deployment bucket provided by the parent stack" + } + }, + "Outputs": { + "Region": { + "Description": "CloudFormation provider root stack Region", + "Value": { + "Ref": "AWS::Region" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-Region" + } + } + }, + "StackName": { + "Description": "CloudFormation provider root stack ID", + "Value": { + "Ref": "AWS::StackName" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-StackName" + } + } + }, + "StackId": { + "Description": "CloudFormation provider root stack name", + "Value": { + "Ref": "AWS::StackId" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-StackId" + } + } + }, + "AuthRoleArn": { + "Value": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + } + }, + "UnauthRoleArn": { + "Value": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + } + }, + "DeploymentBucketName": { + "Description": "CloudFormation provider root stack deployment bucket name", + "Value": { + "Ref": "DeploymentBucketName" + }, + "Export": { + "Name": { + "Fn::Sub": "${AWS::StackName}-DeploymentBucketName" + } + } + }, + "AuthRoleName": { + "Value": { + "Ref": "AuthRole" + } + }, + "UnauthRoleName": { + "Value": { + "Ref": "UnauthRole" + } + } + }, + "Resources": { + "DeploymentBucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Ref": "DeploymentBucketName" + }, + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "AuthRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "", + "Effect": "Deny", + "Principal": { + "Federated": "cognito-identity.amazonaws.com" + }, + "Action": "sts:AssumeRoleWithWebIdentity" + } + ] + }, + "RoleName": { + "Ref": "AuthRoleName" + } + } + }, + "UnauthRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "", + "Effect": "Deny", + "Principal": { + "Federated": "cognito-identity.amazonaws.com" + }, + "Action": "sts:AssumeRoleWithWebIdentity" + } + ] + }, + "RoleName": { + "Ref": "UnauthRoleName" + } + } + }, + "apimynotes": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/api/cloudformation-template.json", + "Parameters": { + "AppSyncApiName": "mynotes", + "DynamoDBBillingMode": "PAY_PER_REQUEST", + "DynamoDBEnableServerSideEncryption": false, + "S3DeploymentBucket": "amplify-mynotes-staging-b2b56-deployment", + "S3DeploymentRootKey": "amplify-appsync-files/c0e971ea1ba703ba5054d45b1d4a7a475f98dd0a", + "env": "staging" + } + } + }, + "authmynotesccae4f3b": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/auth/mynotesccae4f3b-cloudformation-template.json", + "Parameters": { + "identityPoolName": "mynotesccae4f3b_identitypool_ccae4f3b", + "allowUnauthenticatedIdentities": true, + "resourceNameTruncated": "mynoteccae4f3b", + "userPoolName": "mynotesccae4f3b_userpool_ccae4f3b", + "autoVerifiedAttributes": "email", + "mfaConfiguration": "OFF", + "mfaTypes": "SMS Text Message", + "smsAuthenticationMessage": "Your authentication code is {####}", + "smsVerificationMessage": "Your verification code is {####}", + "emailVerificationSubject": "Your verification code", + "emailVerificationMessage": "Your verification code is {####}", + "defaultPasswordPolicy": false, + "passwordPolicyMinLength": 8, + "passwordPolicyCharacters": "", + "requiredAttributes": "email", + "aliasAttributes": "", + "userpoolClientGenerateSecret": false, + "userpoolClientRefreshTokenValidity": 30, + "userpoolClientWriteAttributes": "email", + "userpoolClientReadAttributes": "email", + "userpoolClientLambdaRole": "mynoteccae4f3b_userpoolclient_lambda_role", + "userpoolClientSetAttributes": false, + "sharedId": "ccae4f3b", + "resourceName": "mynotesccae4f3b", + "authSelections": "identityPoolAndUserPool", + "useDefault": "default", + "userPoolGroupList": "", + "serviceName": "Cognito", + "usernameCaseSensitive": false, + "useEnabledMfas": true, + "authRoleArn": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + }, + "unauthRoleArn": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + }, + "breakCircularDependency": true, + "dependsOn": "", + "env": "staging" + } + } + }, + "functionS3Triggerdc42a5d7": { + "Type": "AWS::CloudFormation::Stack", + "Properties": { + "TemplateURL": "https://s3.amazonaws.com/amplify-mynotes-staging-b2b56-deployment/amplify-cfn-templates/function/S3Triggerdc42a5d7-cloudformation-template.json", + "Parameters": { + "deploymentBucketName": "amplify-mynotes-staging-b2b56-deployment", + "s3Key": "amplify-builds/S3Triggerdc42a5d7-6a475541666d35456861-build.zip", + "env": "staging" + } + } + }, + "UpdateRolesWithIDPFunction": { + "DependsOn": [ + "AuthRole", + "UnauthRole", + "authmynotesccae4f3b" + ], + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": { + "Fn::Join": [ + "\n", + [ + "const response = require('cfn-response');", + "const { IAMClient, GetRoleCommand, UpdateAssumeRolePolicyCommand } = require('@aws-sdk/client-iam');", + "exports.handler = function(event, context) {", + " // Don't return promise, response.send() marks context as done internally", + " const ignoredPromise = handleEvent(event, context)", + "};", + "async function handleEvent(event, context) {", + " try {", + " let authRoleName = event.ResourceProperties.authRoleName;", + " let unauthRoleName = event.ResourceProperties.unauthRoleName;", + " let idpId = event.ResourceProperties.idpId;", + " let authParamsJson = {", + " 'Version': '2012-10-17',", + " 'Statement': [{", + " 'Effect': 'Allow',", + " 'Principal': {'Federated': 'cognito-identity.amazonaws.com'},", + " 'Action': 'sts:AssumeRoleWithWebIdentity',", + " 'Condition': {", + " 'StringEquals': {'cognito-identity.amazonaws.com:aud': idpId},", + " 'ForAnyValue:StringLike': {'cognito-identity.amazonaws.com:amr': 'authenticated'}", + " }", + " }]", + " };", + " let unauthParamsJson = {", + " 'Version': '2012-10-17',", + " 'Statement': [{", + " 'Effect': 'Allow',", + " 'Principal': {'Federated': 'cognito-identity.amazonaws.com'},", + " 'Action': 'sts:AssumeRoleWithWebIdentity',", + " 'Condition': {", + " 'StringEquals': {'cognito-identity.amazonaws.com:aud': idpId},", + " 'ForAnyValue:StringLike': {'cognito-identity.amazonaws.com:amr': 'unauthenticated'}", + " }", + " }]", + " };", + " if (event.RequestType === 'Delete') {", + " try {", + " delete authParamsJson.Statement[0].Condition;", + " delete unauthParamsJson.Statement[0].Condition;", + " authParamsJson.Statement[0].Effect = 'Deny'", + " unauthParamsJson.Statement[0].Effect = 'Deny'", + " let authParams = {PolicyDocument: JSON.stringify(authParamsJson), RoleName: authRoleName};", + " let unauthParams = {PolicyDocument: JSON.stringify(unauthParamsJson), RoleName: unauthRoleName};", + " const iam = new IAMClient({region: event.ResourceProperties.region});", + " let res = await Promise.all([", + " iam.send(new GetRoleCommand({RoleName: authParams.RoleName})),", + " iam.send(new GetRoleCommand({RoleName: unauthParams.RoleName}))", + " ]);", + " res = await Promise.all([", + " iam.send(new UpdateAssumeRolePolicyCommand(authParams)),", + " iam.send(new UpdateAssumeRolePolicyCommand(unauthParams))", + " ]);", + " response.send(event, context, response.SUCCESS, {});", + " } catch (err) {", + " console.log(err.stack);", + " response.send(event, context, response.SUCCESS, {Error: err});", + " }", + " } else if (event.RequestType === 'Update' || event.RequestType === 'Create') {", + " const iam = new IAMClient({region: event.ResourceProperties.region});", + " let authParams = {PolicyDocument: JSON.stringify(authParamsJson), RoleName: authRoleName};", + " let unauthParams = {PolicyDocument: JSON.stringify(unauthParamsJson), RoleName: unauthRoleName};", + " const res = await Promise.all([", + " iam.send(new UpdateAssumeRolePolicyCommand(authParams)),", + " iam.send(new UpdateAssumeRolePolicyCommand(unauthParams))", + " ]);", + " response.send(event, context, response.SUCCESS, {});", + " }", + " } catch (err) {", + " console.log(err.stack);", + " response.send(event, context, response.FAILED, {Error: err});", + " }", + "};" + ] + ] + } + }, + "Handler": "index.handler", + "Runtime": "nodejs18.x", + "Timeout": 300, + "Role": { + "Fn::GetAtt": [ + "UpdateRolesWithIDPFunctionRole", + "Arn" + ] + } + } + }, + "UpdateRolesWithIDPFunctionOutputs": { + "Type": "Custom::LambdaCallout", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "UpdateRolesWithIDPFunction", + "Arn" + ] + }, + "region": { + "Ref": "AWS::Region" + }, + "idpId": { + "Fn::GetAtt": [ + "authmynotesccae4f3b", + "Outputs.IdentityPoolId" + ] + }, + "authRoleName": { + "Ref": "AuthRole" + }, + "unauthRoleName": { + "Ref": "UnauthRole" + } + } + }, + "UpdateRolesWithIDPFunctionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "RoleName": { + "Fn::Join": [ + "", + [ + { + "Ref": "AuthRole" + }, + "-idp" + ] + ] + }, + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + }, + "Policies": [ + { + "PolicyName": "UpdateRolesWithIDPFunctionPolicy", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": "arn:aws:logs:*:*:*" + }, + { + "Effect": "Allow", + "Action": [ + "iam:UpdateAssumeRolePolicy", + "iam:GetRole" + ], + "Resource": { + "Fn::GetAtt": [ + "AuthRole", + "Arn" + ] + } + }, + { + "Effect": "Allow", + "Action": [ + "iam:UpdateAssumeRolePolicy", + "iam:GetRole" + ], + "Resource": { + "Fn::GetAtt": [ + "UnauthRole", + "Arn" + ] + } + } + ] + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/storage/notesimage/build/cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/storage/notesimage/build/cloudformation-template.json new file mode 100644 index 0000000..e2beb9c --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/awscloudformation/build/storage/notesimage/build/cloudformation-template.json @@ -0,0 +1,750 @@ +{ + "Description": "{\"createdOn\":\"Mac\",\"createdBy\":\"Amplify\",\"createdWith\":\"12.12.4\",\"stackType\":\"storage-S3\",\"metadata\":{}}", + "AWSTemplateFormatVersion": "2010-09-09", + "Parameters": { + "env": { + "Type": "String" + }, + "bucketName": { + "Type": "String" + }, + "authRoleName": { + "Type": "String" + }, + "unauthRoleName": { + "Type": "String" + }, + "authPolicyName": { + "Type": "String" + }, + "unauthPolicyName": { + "Type": "String" + }, + "s3PublicPolicy": { + "Type": "String", + "Default": "NONE" + }, + "s3PrivatePolicy": { + "Type": "String", + "Default": "NONE" + }, + "s3ProtectedPolicy": { + "Type": "String", + "Default": "NONE" + }, + "s3UploadsPolicy": { + "Type": "String", + "Default": "NONE" + }, + "s3ReadPolicy": { + "Type": "String", + "Default": "NONE" + }, + "s3PermissionsAuthenticatedPublic": { + "Type": "String", + "Default": "DISALLOW" + }, + "s3PermissionsAuthenticatedProtected": { + "Type": "String", + "Default": "DISALLOW" + }, + "s3PermissionsAuthenticatedPrivate": { + "Type": "String", + "Default": "DISALLOW" + }, + "s3PermissionsAuthenticatedUploads": { + "Type": "String", + "Default": "DISALLOW" + }, + "s3PermissionsGuestPublic": { + "Type": "String", + "Default": "DISALLOW" + }, + "s3PermissionsGuestUploads": { + "Type": "String", + "Default": "DISALLOW" + }, + "AuthenticatedAllowList": { + "Type": "String", + "Default": "DISALLOW" + }, + "GuestAllowList": { + "Type": "String", + "Default": "DISALLOW" + }, + "selectedGuestPermissions": { + "Type": "CommaDelimitedList", + "Default": "NONE" + }, + "selectedAuthenticatedPermissions": { + "Type": "CommaDelimitedList", + "Default": "NONE" + }, + "functionS3Trigger168e5d52Arn": { + "Type": "String", + "Default": "functionS3Trigger168e5d52Arn" + }, + "functionS3Trigger168e5d52Name": { + "Type": "String", + "Default": "functionS3Trigger168e5d52Name" + }, + "functionS3Trigger168e5d52LambdaExecutionRole": { + "Type": "String", + "Default": "functionS3Trigger168e5d52LambdaExecutionRole" + }, + "triggerFunction": { + "Type": "String" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + }, + "CreateAuthPublic": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsAuthenticatedPublic" + }, + "DISALLOW" + ] + } + ] + }, + "CreateAuthProtected": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsAuthenticatedProtected" + }, + "DISALLOW" + ] + } + ] + }, + "CreateAuthPrivate": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsAuthenticatedPrivate" + }, + "DISALLOW" + ] + } + ] + }, + "CreateAuthUploads": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsAuthenticatedUploads" + }, + "DISALLOW" + ] + } + ] + }, + "CreateGuestPublic": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsGuestPublic" + }, + "DISALLOW" + ] + } + ] + }, + "CreateGuestUploads": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "s3PermissionsGuestUploads" + }, + "DISALLOW" + ] + } + ] + }, + "AuthReadAndList": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "AuthenticatedAllowList" + }, + "DISALLOW" + ] + } + ] + }, + "GuestReadAndList": { + "Fn::Not": [ + { + "Fn::Equals": [ + { + "Ref": "GuestAllowList" + }, + "DISALLOW" + ] + } + ] + } + }, + "Outputs": { + "BucketName": { + "Description": "Bucket name for the S3 bucket", + "Value": { + "Ref": "S3Bucket" + } + }, + "Region": { + "Value": { + "Ref": "AWS::Region" + } + } + }, + "Resources": { + "S3Bucket": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "bucketName" + }, + { + "Fn::Join": [ + "", + [ + { + "Ref": "bucketName" + }, + { + "Fn::Select": [ + 3, + { + "Fn::Split": [ + "-", + { + "Ref": "AWS::StackName" + } + ] + } + ] + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "CorsConfiguration": { + "CorsRules": [ + { + "AllowedHeaders": [ + "*" + ], + "AllowedMethods": [ + "GET", + "HEAD", + "PUT", + "POST", + "DELETE" + ], + "AllowedOrigins": [ + "*" + ], + "ExposedHeaders": [ + "x-amz-server-side-encryption", + "x-amz-request-id", + "x-amz-id-2", + "ETag" + ], + "Id": "S3CORSRuleId1", + "MaxAge": 3000 + } + ] + }, + "NotificationConfiguration": { + "LambdaConfigurations": [ + { + "Event": "s3:ObjectCreated:*", + "Function": { + "Ref": "functionS3Trigger168e5d52Arn" + } + }, + { + "Event": "s3:ObjectRemoved:*", + "Function": { + "Ref": "functionS3Trigger168e5d52Arn" + } + } + ] + }, + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + } + }, + "DependsOn": [ + "TriggerPermissions" + ], + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "TriggerPermissions": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Ref": "functionS3Trigger168e5d52Name" + }, + "Principal": "s3.amazonaws.com", + "SourceAccount": { + "Ref": "AWS::AccountId" + }, + "SourceArn": { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Fn::If": [ + "ShouldNotCreateEnvResources", + { + "Ref": "bucketName" + }, + { + "Fn::Join": [ + "", + [ + { + "Ref": "bucketName" + }, + { + "Fn::Select": [ + 3, + { + "Fn::Split": [ + "-", + { + "Ref": "AWS::StackName" + } + ] + } + ] + }, + "-", + { + "Ref": "env" + } + ] + ] + } + ] + } + ] + ] + } + } + }, + "S3AuthPublicPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": { + "Fn::Split": [ + ",", + { + "Ref": "s3PermissionsAuthenticatedPublic" + } + ] + }, + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/public/*" + ] + ] + } + ] + } + ] + }, + "PolicyName": { + "Ref": "s3PublicPolicy" + }, + "Roles": [ + { + "Ref": "authRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "CreateAuthPublic" + }, + "S3AuthProtectedPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": { + "Fn::Split": [ + ",", + { + "Ref": "s3PermissionsAuthenticatedProtected" + } + ] + }, + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/protected/${cognito-identity.amazonaws.com:sub}/*" + ] + ] + } + ] + } + ] + }, + "PolicyName": { + "Ref": "s3ProtectedPolicy" + }, + "Roles": [ + { + "Ref": "authRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "CreateAuthProtected" + }, + "S3AuthPrivatePolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": { + "Fn::Split": [ + ",", + { + "Ref": "s3PermissionsAuthenticatedPrivate" + } + ] + }, + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/private/${cognito-identity.amazonaws.com:sub}/*" + ] + ] + } + ] + } + ] + }, + "PolicyName": { + "Ref": "s3PrivatePolicy" + }, + "Roles": [ + { + "Ref": "authRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "CreateAuthPrivate" + }, + "S3AuthUploadPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": { + "Fn::Split": [ + ",", + { + "Ref": "s3PermissionsAuthenticatedUploads" + } + ] + }, + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/uploads/*" + ] + ] + } + ] + } + ] + }, + "PolicyName": { + "Ref": "s3UploadsPolicy" + }, + "Roles": [ + { + "Ref": "authRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "CreateAuthUploads" + }, + "S3AuthReadPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:GetObject", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/protected/*" + ] + ] + } + }, + { + "Action": "s3:ListBucket", + "Condition": { + "StringLike": { + "s3:prefix": [ + "public/", + "public/*", + "protected/", + "protected/*", + "private/${cognito-identity.amazonaws.com:sub}/", + "private/${cognito-identity.amazonaws.com:sub}/*" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + } + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": { + "Ref": "s3ReadPolicy" + }, + "Roles": [ + { + "Ref": "authRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "AuthReadAndList" + }, + "S3GuestReadPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:GetObject", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/protected/*" + ] + ] + } + }, + { + "Action": "s3:ListBucket", + "Condition": { + "StringLike": { + "s3:prefix": [ + "public/", + "public/*", + "protected/", + "protected/*" + ] + } + }, + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + } + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": { + "Ref": "s3ReadPolicy" + }, + "Roles": [ + { + "Ref": "unauthRoleName" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ], + "Condition": "GuestReadAndList" + }, + "S3TriggerBucketPolicy": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "s3:ListBucket" + ], + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + } + ] + ] + } + ] + }, + { + "Effect": "Allow", + "Action": [ + "s3:PutObject", + "s3:GetObject", + "s3:ListBucket", + "s3:DeleteObject" + ], + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:aws:s3:::", + { + "Ref": "S3Bucket" + }, + "/*" + ] + ] + } + ] + } + ] + }, + "PolicyName": "amplify-lambda-execution-policy-storage", + "Roles": [ + { + "Ref": "functionS3Trigger168e5d52LambdaExecutionRole" + } + ] + }, + "DependsOn": [ + "S3Bucket" + ] + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/backend-config.json b/New_APIs/Amplify-fullstack-API/amplify/backend/backend-config.json new file mode 100644 index 0000000..af6ea25 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/backend-config.json @@ -0,0 +1,72 @@ +{ + "api": { + "mynotes": { + "dependsOn": [], + "output": { + "authConfig": { + "additionalAuthenticationProviders": [], + "defaultAuthentication": { + "apiKeyConfig": { + "apiKeyExpirationDays": 7 + }, + "authenticationType": "API_KEY" + } + } + }, + "providerPlugin": "awscloudformation", + "service": "AppSync" + } + }, + "auth": { + "mynotesccae4f3b": { + "customAuth": false, + "dependsOn": [], + "frontendAuthConfig": { + "mfaConfiguration": "OFF", + "mfaTypes": [ + "SMS" + ], + "passwordProtectionSettings": { + "passwordPolicyCharacters": [], + "passwordPolicyMinLength": 8 + }, + "signupAttributes": [ + "EMAIL" + ], + "socialProviders": [], + "usernameAttributes": [], + "verificationMechanisms": [ + "EMAIL" + ] + }, + "providerPlugin": "awscloudformation", + "service": "Cognito" + } + }, + "function": { + "S3Triggerdc42a5d7": { + "build": true, + "providerPlugin": "awscloudformation", + "service": "Lambda" + } + }, + "parameters": { + "AMPLIFY_function_S3Triggerdc42a5d7_deploymentBucketName": { + "usedBy": [ + { + "category": "function", + "resourceName": "S3Triggerdc42a5d7" + } + ] + }, + "AMPLIFY_function_S3Triggerdc42a5d7_s3Key": { + "usedBy": [ + { + "category": "function", + "resourceName": "S3Triggerdc42a5d7" + } + ] + } + }, + "storage": {} +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json new file mode 100644 index 0000000..9972262 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/S3Triggerdc42a5d7-cloudformation-template.json @@ -0,0 +1,193 @@ +{ + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "{\"createdOn\":\"Mac\",\"createdBy\":\"Amplify\",\"createdWith\":\"12.12.4\",\"stackType\":\"function-Lambda\",\"metadata\":{}}", + "Parameters": { + "env": { + "Type": "String" + }, + "deploymentBucketName": { + "Type": "String" + }, + "s3Key": { + "Type": "String" + } + }, + "Conditions": { + "ShouldNotCreateEnvResources": { + "Fn::Equals": [ + { + "Ref": "env" + }, + "NONE" + ] + } + }, + "Resources": { + "LambdaFunction": { + "Type": "AWS::Lambda::Function", + "Metadata": { + "aws:asset:path": "./src", + "aws:asset:property": "Code" + }, + "Properties": { + "Handler": "index.handler", + "FunctionName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Triggerdc42a5d7", + { + "Fn::Join": [ + "", + [ + "S3Triggerdc42a5d7", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "Environment": { + "Variables": { + "ENV": { + "Ref": "env" + } + } + }, + "Role": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Timeout": 25, + "Code": { + "S3Bucket": { + "Ref": "deploymentBucketName" + }, + "S3Key": { + "Ref": "s3Key" + } + } + } + }, + "LambdaExecutionRole": { + "Type": "AWS::IAM::Role", + "Properties": { + "RoleName": { + "Fn::If": [ + "ShouldNotCreateEnvResources", + "S3Triggerdc42a5d7LambdaRoledc42a5d7", + { + "Fn::Join": [ + "", + [ + "S3Triggerdc42a5d7LambdaRoledc42a5d7", + "-", + { + "Ref": "env" + } + ] + ] + } + ] + }, + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": [ + "lambda.amazonaws.com" + ] + }, + "Action": [ + "sts:AssumeRole" + ] + } + ] + } + } + }, + "lambdaexecutionpolicy": { + "DependsOn": [ + "LambdaExecutionRole" + ], + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyName": "lambda-execution-policy", + "Roles": [ + { + "Ref": "LambdaExecutionRole" + } + ], + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": { + "Fn::Sub": [ + "arn:aws:logs:${region}:${account}:log-group:/aws/lambda/${lambda}:log-stream:*", + { + "region": { + "Ref": "AWS::Region" + }, + "account": { + "Ref": "AWS::AccountId" + }, + "lambda": { + "Ref": "LambdaFunction" + } + } + ] + } + } + ] + } + } + } + }, + "Outputs": { + "Name": { + "Value": { + "Ref": "LambdaFunction" + } + }, + "Arn": { + "Value": { + "Fn::GetAtt": [ + "LambdaFunction", + "Arn" + ] + } + }, + "Region": { + "Value": { + "Ref": "AWS::Region" + } + }, + "LambdaExecutionRole": { + "Value": { + "Ref": "LambdaExecutionRole" + } + }, + "LambdaExecutionRoleArn": { + "Value": { + "Fn::GetAtt": [ + "LambdaExecutionRole", + "Arn" + ] + } + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/amplify.state b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/amplify.state new file mode 100644 index 0000000..2ba0f4c --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/amplify.state @@ -0,0 +1,6 @@ +{ + "pluginId": "amplify-nodejs-function-runtime-provider", + "functionRuntime": "nodejs", + "defaultEditorFile": "src/index.js", + "useLegacyBuild": true +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/event.json b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/event.json new file mode 100644 index 0000000..fd2722e --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/event.json @@ -0,0 +1,5 @@ +{ + "key1": "value1", + "key2": "value2", + "key3": "value3" +} diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/index.js b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/index.js new file mode 100644 index 0000000..12e2a4e --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/index.js @@ -0,0 +1,6 @@ +exports.handler = async function (event) { + console.log('Received S3 event:', JSON.stringify(event, null, 2)); + const bucket = event.Records[0].s3.bucket.name; + const key = event.Records[0].s3.object.key; + console.log(`Bucket: ${bucket}`, `Key: ${key}`); +}; \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/package.json b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/package.json new file mode 100644 index 0000000..0fbf74b --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/package.json @@ -0,0 +1,7 @@ +{ + "name": "S3Triggerdc42a5d7", + "version": "2.0.0", + "description": "Lambda function generated by Amplify", + "main": "index.js", + "license": "Apache-2.0" +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/yarn.lock b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/yarn.lock new file mode 100644 index 0000000..fb57ccd --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/function/S3Triggerdc42a5d7/src/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/tags.json b/New_APIs/Amplify-fullstack-API/amplify/backend/tags.json new file mode 100644 index 0000000..b9321d7 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/tags.json @@ -0,0 +1,10 @@ +[ + { + "Key": "user:Stack", + "Value": "{project-env}" + }, + { + "Key": "user:Application", + "Value": "{project-name}" + } +] \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/backend/types/amplify-dependent-resources-ref.d.ts b/New_APIs/Amplify-fullstack-API/amplify/backend/types/amplify-dependent-resources-ref.d.ts new file mode 100644 index 0000000..1e999e9 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/backend/types/amplify-dependent-resources-ref.d.ts @@ -0,0 +1,29 @@ +export type AmplifyDependentResourcesAttributes = { + "api": { + "mynotes": { + "GraphQLAPIEndpointOutput": "string", + "GraphQLAPIIdOutput": "string", + "GraphQLAPIKeyOutput": "string" + } + }, + "auth": { + "mynotesccae4f3b": { + "AppClientID": "string", + "AppClientIDWeb": "string", + "IdentityPoolId": "string", + "IdentityPoolName": "string", + "UserPoolArn": "string", + "UserPoolId": "string", + "UserPoolName": "string" + } + }, + "function": { + "S3Triggerdc42a5d7": { + "Arn": "string", + "LambdaExecutionRole": "string", + "LambdaExecutionRoleArn": "string", + "Name": "string", + "Region": "string" + } + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/cli.json b/New_APIs/Amplify-fullstack-API/amplify/cli.json new file mode 100644 index 0000000..bd63c71 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/cli.json @@ -0,0 +1,64 @@ +{ + "features": { + "graphqltransformer": { + "addmissingownerfields": true, + "improvepluralization": false, + "validatetypenamereservedwords": true, + "useexperimentalpipelinedtransformer": true, + "enableiterativegsiupdates": true, + "secondarykeyasgsi": true, + "skipoverridemutationinputtypes": true, + "transformerversion": 2, + "suppressschemamigrationprompt": true, + "securityenhancementnotification": false, + "showfieldauthnotification": false, + "usesubusernamefordefaultidentityclaim": true, + "usefieldnameforprimarykeyconnectionfield": false, + "enableautoindexquerynames": true, + "respectprimarykeyattributesonconnectionfield": true, + "shoulddeepmergedirectiveconfigdefaults": false, + "populateownerfieldforstaticgroupauth": true, + "subscriptionsinheritprimaryauth": false + }, + "frontend-ios": { + "enablexcodeintegration": true + }, + "auth": { + "enablecaseinsensitivity": true, + "useinclusiveterminology": true, + "breakcirculardependency": true, + "forcealiasattributes": false, + "useenabledmfas": true + }, + "codegen": { + "useappsyncmodelgenplugin": true, + "usedocsgeneratorplugin": true, + "usetypesgeneratorplugin": true, + "cleangeneratedmodelsdirectory": true, + "retaincasestyle": true, + "addtimestampfields": true, + "handlelistnullabilitytransparently": true, + "emitauthprovider": true, + "generateindexrules": true, + "enabledartnullsafety": true, + "generatemodelsforlazyloadandcustomselectionset": false + }, + "appsync": { + "generategraphqlpermissions": true + }, + "latestregionsupport": { + "pinpoint": 1, + "translate": 1, + "transcribe": 1, + "rekognition": 1, + "textract": 1, + "comprehend": 1 + }, + "project": { + "overrides": true + } + }, + "debug": { + "shareProjectConfig": true + } +} \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/hooks/README.md b/New_APIs/Amplify-fullstack-API/amplify/hooks/README.md new file mode 100644 index 0000000..8fb601e --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/hooks/README.md @@ -0,0 +1,7 @@ +# Command Hooks + +Command hooks can be used to run custom scripts upon Amplify CLI lifecycle events like pre-push, post-add-function, etc. + +To get started, add your script files based on the expected naming convention in this directory. + +Learn more about the script file naming convention, hook parameters, third party dependencies, and advanced configurations at https://docs.amplify.aws/cli/usage/command-hooks diff --git a/New_APIs/Amplify-fullstack-API/amplify/hooks/post-push.sh.sample b/New_APIs/Amplify-fullstack-API/amplify/hooks/post-push.sh.sample new file mode 100644 index 0000000..20df3f3 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/hooks/post-push.sh.sample @@ -0,0 +1,24 @@ +# This is a sample hook script created by Amplify CLI. +# To start using this post-push hook please change the filename: +# post-push.sh.sample -> post-push.sh +# +# learn more: https://docs.amplify.aws/cli/usage/command-hooks + +if [ -z "$(which jq)" ]; then + echo "Please install jq to run the sample script." + exit 0 +fi + +parameters=`cat` +error=$(jq -r '.error // empty' <<< "$parameters") +data=$(jq -r '.data' <<< "$parameters") + +# +# Write code here: +# +if [ ! -z "$error" ]; then + echo "Amplify CLI emitted an error:" $(jq -r '.message' <<< "$error") + exit 0 +fi +echo "project root path:" $(pwd); +echo "Amplify CLI command:" $(jq -r '.amplify | .command' <<< "$data") \ No newline at end of file diff --git a/New_APIs/Amplify-fullstack-API/amplify/hooks/pre-push.js.sample b/New_APIs/Amplify-fullstack-API/amplify/hooks/pre-push.js.sample new file mode 100644 index 0000000..3ea7323 --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/hooks/pre-push.js.sample @@ -0,0 +1,27 @@ +/** + * This is a sample hook script created by Amplify CLI. + * To start using this pre-push hook please change the filename: + * pre-push.js.sample -> pre-push.js + * + * learn more: https://docs.amplify.aws/cli/usage/command-hooks + */ + +/** + * @param data { { amplify: { environment: { envName: string, projectPath: string, defaultEditor: string }, command: string, subCommand: string, argv: string[] } } } + * @param error { { message: string, stack: string } } + */ +const hookHandler = async (data, error) => { + // TODO write your hook handler here +}; + +const getParameters = async () => { + const fs = require("fs"); + return JSON.parse(fs.readFileSync(0, { encoding: "utf8" })); +}; + +getParameters() + .then((event) => hookHandler(event.data, event.error)) + .catch((err) => { + console.error(err); + process.exitCode = 1; + }); diff --git a/New_APIs/Amplify-fullstack-API/amplify/team-provider-info.json b/New_APIs/Amplify-fullstack-API/amplify/team-provider-info.json new file mode 100644 index 0000000..b82455c --- /dev/null +++ b/New_APIs/Amplify-fullstack-API/amplify/team-provider-info.json @@ -0,0 +1,29 @@ +{ + "staging": { + "awscloudformation": { + "AuthRoleName": "amplify-mynotes-staging-b2b56-authRole", + "UnauthRoleArn": "arn:aws:iam::339712714202:role/amplify-mynotes-staging-b2b56-unauthRole", + "AuthRoleArn": "arn:aws:iam::339712714202:role/amplify-mynotes-staging-b2b56-authRole", + "Region": "ap-southeast-2", + "DeploymentBucketName": "amplify-mynotes-staging-b2b56-deployment", + "UnauthRoleName": "amplify-mynotes-staging-b2b56-unauthRole", + "StackName": "amplify-mynotes-staging-b2b56", + "StackId": "arn:aws:cloudformation:ap-southeast-2:339712714202:stack/amplify-mynotes-staging-b2b56/5d40cab0-4b32-11ef-8fd8-06f396c97ee1", + "AmplifyAppId": "d2nrrgvsn5u7rq" + }, + "categories": { + "auth": { + "mynotesccae4f3b": {} + }, + "api": { + "mynotes": {} + }, + "function": { + "S3Triggerdc42a5d7": { + "deploymentBucketName": "amplify-mynotes-staging-b2b56-deployment", + "s3Key": "amplify-builds/S3Triggerdc42a5d7-6a475541666d35456861-build.zip" + } + } + } + } +} \ No newline at end of file