diff --git a/.serverless/cloudformation-template-create-stack.json b/.serverless/cloudformation-template-create-stack.json deleted file mode 100644 index 969844a..0000000 --- a/.serverless/cloudformation-template-create-stack.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "AWSTemplateFormatVersion": "2010-09-09", - "Description": "The AWS CloudFormation template for this Serverless application", - "Resources": { - "ServerlessDeploymentBucket": { - "Type": "AWS::S3::Bucket" - }, - "IamRoleLambdaExecution": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] - }, - "Action": [ - "sts:AssumeRole" - ] - } - ] - }, - "Path": "/" - } - }, - "IamPolicyLambdaExecution": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyName": "dev-serverless-crud-lambda", - "PolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Resource": "arn:aws:logs:us-east-1:*:*" - }, - { - "Effect": "Allow", - "Action": [ - "dynamodb:DescribeTable", - "dynamodb:Query", - "dynamodb:Scan", - "dynamodb:GetItem", - "dynamodb:PutItem", - "dynamodb:UpdateItem", - "dynamodb:DeleteItem" - ], - "Resource": "arn:aws:dynamodb:us-east-1:*:*" - } - ] - }, - "Roles": [ - { - "Ref": "IamRoleLambdaExecution" - } - ] - } - }, - "TodosDynamoDbTable": { - "Type": "AWS::DynamoDB::Table", - "DeletionPolicy": "Retain", - "Properties": { - "AttributeDefinitions": [ - { - "AttributeName": "id", - "AttributeType": "S" - } - ], - "KeySchema": [ - { - "AttributeName": "id", - "KeyType": "HASH" - } - ], - "ProvisionedThroughput": { - "ReadCapacityUnits": 1, - "WriteCapacityUnits": 1 - }, - "TableName": "todos" - } - } - }, - "Outputs": { - "ServerlessDeploymentBucketName": { - "Value": { - "Ref": "ServerlessDeploymentBucket" - } - } - } -} \ No newline at end of file diff --git a/.serverless/cloudformation-template-update-stack.json b/.serverless/cloudformation-template-update-stack.json deleted file mode 100644 index dfeb475..0000000 --- a/.serverless/cloudformation-template-update-stack.json +++ /dev/null @@ -1,1051 +0,0 @@ -{ - "AWSTemplateFormatVersion": "2010-09-09", - "Description": "The AWS CloudFormation template for this Serverless application", - "Resources": { - "ServerlessDeploymentBucket": { - "Type": "AWS::S3::Bucket" - }, - "IamRoleLambdaExecution": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] - }, - "Action": [ - "sts:AssumeRole" - ] - } - ] - }, - "Path": "/" - } - }, - "IamPolicyLambdaExecution": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyName": "dev-serverless-crud-lambda", - "PolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Resource": "arn:aws:logs:us-east-1:*:*" - }, - { - "Effect": "Allow", - "Action": [ - "dynamodb:DescribeTable", - "dynamodb:Query", - "dynamodb:Scan", - "dynamodb:GetItem", - "dynamodb:PutItem", - "dynamodb:UpdateItem", - "dynamodb:DeleteItem" - ], - "Resource": "arn:aws:dynamodb:us-east-1:*:*" - } - ] - }, - "Roles": [ - { - "Ref": "IamRoleLambdaExecution" - } - ] - } - }, - "TodosDynamoDbTable": { - "Type": "AWS::DynamoDB::Table", - "DeletionPolicy": "Retain", - "Properties": { - "AttributeDefinitions": [ - { - "AttributeName": "id", - "AttributeType": "S" - } - ], - "KeySchema": [ - { - "AttributeName": "id", - "KeyType": "HASH" - } - ], - "ProvisionedThroughput": { - "ReadCapacityUnits": 1, - "WriteCapacityUnits": 1 - }, - "TableName": "todos" - } - }, - "CreateLambdaFunction": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/serverless-crud/dev/1476332749588-2016-10-13T04:25:49.588Z/serverless-crud.zip" - }, - "FunctionName": "serverless-crud-dev-create", - "Handler": "handler.create", - "MemorySize": 1024, - "Role": { - "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" - ] - }, - "Runtime": "nodejs4.3", - "Timeout": 6 - } - }, - "ReadAllLambdaFunction": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/serverless-crud/dev/1476332749588-2016-10-13T04:25:49.588Z/serverless-crud.zip" - }, - "FunctionName": "serverless-crud-dev-readAll", - "Handler": "handler.readAll", - "MemorySize": 1024, - "Role": { - "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" - ] - }, - "Runtime": "nodejs4.3", - "Timeout": 6 - } - }, - "ReadOneLambdaFunction": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/serverless-crud/dev/1476332749588-2016-10-13T04:25:49.588Z/serverless-crud.zip" - }, - "FunctionName": "serverless-crud-dev-readOne", - "Handler": "handler.readOne", - "MemorySize": 1024, - "Role": { - "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" - ] - }, - "Runtime": "nodejs4.3", - "Timeout": 6 - } - }, - "UpdateLambdaFunction": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/serverless-crud/dev/1476332749588-2016-10-13T04:25:49.588Z/serverless-crud.zip" - }, - "FunctionName": "serverless-crud-dev-update", - "Handler": "handler.update", - "MemorySize": 1024, - "Role": { - "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" - ] - }, - "Runtime": "nodejs4.3", - "Timeout": 6 - } - }, - "DeleteLambdaFunction": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Ref": "ServerlessDeploymentBucket" - }, - "S3Key": "serverless/serverless-crud/dev/1476332749588-2016-10-13T04:25:49.588Z/serverless-crud.zip" - }, - "FunctionName": "serverless-crud-dev-delete", - "Handler": "handler.delete", - "MemorySize": 1024, - "Role": { - "Fn::GetAtt": [ - "IamRoleLambdaExecution", - "Arn" - ] - }, - "Runtime": "nodejs4.3", - "Timeout": 6 - } - }, - "ApiGatewayRestApi": { - "Type": "AWS::ApiGateway::RestApi", - "Properties": { - "Name": "dev-serverless-crud" - } - }, - "ApiGatewayResourceTodos": { - "Type": "AWS::ApiGateway::Resource", - "Properties": { - "ParentId": { - "Fn::GetAtt": [ - "ApiGatewayRestApi", - "RootResourceId" - ] - }, - "PathPart": "todos", - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayResourceTodosIdVar": { - "Type": "AWS::ApiGateway::Resource", - "Properties": { - "ParentId": { - "Ref": "ApiGatewayResourceTodos" - }, - "PathPart": "{id}", - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayMethodTodosPost": { - "Type": "AWS::ApiGateway::Method", - "Properties": { - "AuthorizationType": "NONE", - "HttpMethod": "POST", - "MethodResponses": [ - { - "ResponseModels": {}, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "method.response.header.Access-Control-Allow-Origin" - }, - "StatusCode": 200 - }, - { - "StatusCode": 400 - }, - { - "StatusCode": 401 - }, - { - "StatusCode": 403 - }, - { - "StatusCode": 404 - }, - { - "StatusCode": 422 - }, - { - "StatusCode": 500 - }, - { - "StatusCode": 502 - }, - { - "StatusCode": 504 - } - ], - "RequestParameters": {}, - "Integration": { - "IntegrationHttpMethod": "POST", - "Type": "AWS_PROXY", - "Uri": { - "Fn::Join": [ - "", - [ - "arn:aws:apigateway:", - { - "Ref": "AWS::Region" - }, - ":lambda:path/2015-03-31/functions/", - { - "Fn::GetAtt": [ - "CreateLambdaFunction", - "Arn" - ] - }, - "/invocations" - ] - ] - }, - "RequestTemplates": { - "application/json": "\n #define( $loop )\n {\n #foreach($key in $map.keySet())\n \"$util.escapeJavaScript($key)\":\n \"$util.escapeJavaScript($map.get($key))\"\n #if( $foreach.hasNext ) , #end\n #end\n }\n #end\n\n {\n \"body\": $input.json(\"$\"),\n \"method\": \"$context.httpMethod\",\n \"principalId\": \"$context.authorizer.principalId\",\n \"stage\": \"$context.stage\",\n\n #set( $map = $input.params().header )\n \"headers\": $loop,\n\n #set( $map = $input.params().querystring )\n \"query\": $loop,\n\n #set( $map = $input.params().path )\n \"path\": $loop,\n\n #set( $map = $context.identity )\n \"identity\": $loop,\n\n #set( $map = $stageVariables )\n \"stageVariables\": $loop\n }\n ", - "application/x-www-form-urlencoded": "\n #define( $body )\n {\n #foreach( $token in $input.path('$').split('&') )\n #set( $keyVal = $token.split('=') )\n #set( $keyValSize = $keyVal.size() )\n #if( $keyValSize >= 1 )\n #set( $key = $util.escapeJavaScript($util.urlDecode($keyVal[0])) )\n #if( $keyValSize >= 2 )\n #set( $val = $util.escapeJavaScript($util.urlDecode($keyVal[1])) )\n #else\n #set( $val = '' )\n #end\n \"$key\": \"$val\"#if($foreach.hasNext),#end\n #end\n #end\n }\n #end\n\n #define( $loop )\n {\n #foreach($key in $map.keySet())\n \"$util.escapeJavaScript($key)\":\n \"$util.escapeJavaScript($map.get($key))\"\n #if( $foreach.hasNext ) , #end\n #end\n }\n #end\n\n {\n \"body\": $body,\n \"method\": \"$context.httpMethod\",\n \"principalId\": \"$context.authorizer.principalId\",\n \"stage\": \"$context.stage\",\n\n #set( $map = $input.params().header )\n \"headers\": $loop,\n\n #set( $map = $input.params().querystring )\n \"query\": $loop,\n\n #set( $map = $input.params().path )\n \"path\": $loop,\n\n #set( $map = $context.identity )\n \"identity\": $loop,\n\n #set( $map = $stageVariables )\n \"stageVariables\": $loop\n }\n " - }, - "PassthroughBehavior": "NEVER", - "IntegrationResponses": [ - { - "StatusCode": 200, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "'*'" - }, - "ResponseTemplates": {} - }, - { - "StatusCode": 400, - "SelectionPattern": ".*\\[400\\].*" - }, - { - "StatusCode": 401, - "SelectionPattern": ".*\\[401\\].*" - }, - { - "StatusCode": 403, - "SelectionPattern": ".*\\[403\\].*" - }, - { - "StatusCode": 404, - "SelectionPattern": ".*\\[404\\].*" - }, - { - "StatusCode": 422, - "SelectionPattern": ".*\\[422\\].*" - }, - { - "StatusCode": 500, - "SelectionPattern": ".*(Process\\s?exited\\s?before\\s?completing\\s?request|Task\\s?timed\\s?out\\s?|\\[500\\]).*" - }, - { - "StatusCode": 502, - "SelectionPattern": ".*\\[502\\].*" - }, - { - "StatusCode": 504, - "SelectionPattern": ".*\\[504\\].*" - } - ] - }, - "ResourceId": { - "Ref": "ApiGatewayResourceTodos" - }, - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayMethodTodosGet": { - "Type": "AWS::ApiGateway::Method", - "Properties": { - "AuthorizationType": "NONE", - "HttpMethod": "GET", - "MethodResponses": [ - { - "ResponseModels": {}, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "method.response.header.Access-Control-Allow-Origin" - }, - "StatusCode": 200 - }, - { - "StatusCode": 400 - }, - { - "StatusCode": 401 - }, - { - "StatusCode": 403 - }, - { - "StatusCode": 404 - }, - { - "StatusCode": 422 - }, - { - "StatusCode": 500 - }, - { - "StatusCode": 502 - }, - { - "StatusCode": 504 - } - ], - "RequestParameters": {}, - "Integration": { - "IntegrationHttpMethod": "POST", - "Type": "AWS_PROXY", - "Uri": { - "Fn::Join": [ - "", - [ - "arn:aws:apigateway:", - { - "Ref": "AWS::Region" - }, - ":lambda:path/2015-03-31/functions/", - { - "Fn::GetAtt": [ - "ReadAllLambdaFunction", - "Arn" - ] - }, - "/invocations" - ] - ] - }, - "RequestTemplates": { - "application/json": "\n #define( $loop )\n {\n #foreach($key in $map.keySet())\n \"$util.escapeJavaScript($key)\":\n \"$util.escapeJavaScript($map.get($key))\"\n #if( $foreach.hasNext ) , #end\n #end\n }\n #end\n\n {\n \"body\": $input.json(\"$\"),\n \"method\": \"$context.httpMethod\",\n \"principalId\": \"$context.authorizer.principalId\",\n \"stage\": \"$context.stage\",\n\n #set( $map = $input.params().header )\n \"headers\": $loop,\n\n #set( $map = $input.params().querystring )\n \"query\": $loop,\n\n #set( $map = $input.params().path )\n \"path\": $loop,\n\n #set( $map = $context.identity )\n \"identity\": $loop,\n\n #set( $map = $stageVariables )\n \"stageVariables\": $loop\n }\n ", - "application/x-www-form-urlencoded": "\n #define( $body )\n {\n #foreach( $token in $input.path('$').split('&') )\n #set( $keyVal = $token.split('=') )\n #set( $keyValSize = $keyVal.size() )\n #if( $keyValSize >= 1 )\n #set( $key = $util.escapeJavaScript($util.urlDecode($keyVal[0])) )\n #if( $keyValSize >= 2 )\n #set( $val = $util.escapeJavaScript($util.urlDecode($keyVal[1])) )\n #else\n #set( $val = '' )\n #end\n \"$key\": \"$val\"#if($foreach.hasNext),#end\n #end\n #end\n }\n #end\n\n #define( $loop )\n {\n #foreach($key in $map.keySet())\n \"$util.escapeJavaScript($key)\":\n \"$util.escapeJavaScript($map.get($key))\"\n #if( $foreach.hasNext ) , #end\n #end\n }\n #end\n\n {\n \"body\": $body,\n \"method\": \"$context.httpMethod\",\n \"principalId\": \"$context.authorizer.principalId\",\n \"stage\": \"$context.stage\",\n\n #set( $map = $input.params().header )\n \"headers\": $loop,\n\n #set( $map = $input.params().querystring )\n \"query\": $loop,\n\n #set( $map = $input.params().path )\n \"path\": $loop,\n\n #set( $map = $context.identity )\n \"identity\": $loop,\n\n #set( $map = $stageVariables )\n \"stageVariables\": $loop\n }\n " - }, - "PassthroughBehavior": "NEVER", - "IntegrationResponses": [ - { - "StatusCode": 200, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "'*'" - }, - "ResponseTemplates": {} - }, - { - "StatusCode": 400, - "SelectionPattern": ".*\\[400\\].*" - }, - { - "StatusCode": 401, - "SelectionPattern": ".*\\[401\\].*" - }, - { - "StatusCode": 403, - "SelectionPattern": ".*\\[403\\].*" - }, - { - "StatusCode": 404, - "SelectionPattern": ".*\\[404\\].*" - }, - { - "StatusCode": 422, - "SelectionPattern": ".*\\[422\\].*" - }, - { - "StatusCode": 500, - "SelectionPattern": ".*(Process\\s?exited\\s?before\\s?completing\\s?request|Task\\s?timed\\s?out\\s?|\\[500\\]).*" - }, - { - "StatusCode": 502, - "SelectionPattern": ".*\\[502\\].*" - }, - { - "StatusCode": 504, - "SelectionPattern": ".*\\[504\\].*" - } - ] - }, - "ResourceId": { - "Ref": "ApiGatewayResourceTodos" - }, - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayMethodTodosIdVarGet": { - "Type": "AWS::ApiGateway::Method", - "Properties": { - "AuthorizationType": "NONE", - "HttpMethod": "GET", - "MethodResponses": [ - { - "ResponseModels": {}, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "method.response.header.Access-Control-Allow-Origin" - }, - "StatusCode": 200 - }, - { - "StatusCode": 400 - }, - { - "StatusCode": 401 - }, - { - "StatusCode": 403 - }, - { - "StatusCode": 404 - }, - { - "StatusCode": 422 - }, - { - "StatusCode": 500 - }, - { - "StatusCode": 502 - }, - { - "StatusCode": 504 - } - ], - "RequestParameters": {}, - "Integration": { - "IntegrationHttpMethod": "POST", - "Type": "AWS_PROXY", - "Uri": { - "Fn::Join": [ - "", - [ - "arn:aws:apigateway:", - { - "Ref": "AWS::Region" - }, - ":lambda:path/2015-03-31/functions/", - { - "Fn::GetAtt": [ - "ReadOneLambdaFunction", - "Arn" - ] - }, - "/invocations" - ] - ] - }, - "RequestTemplates": { - "application/json": "\n #define( $loop )\n {\n #foreach($key in $map.keySet())\n \"$util.escapeJavaScript($key)\":\n \"$util.escapeJavaScript($map.get($key))\"\n #if( $foreach.hasNext ) , #end\n #end\n }\n #end\n\n {\n \"body\": $input.json(\"$\"),\n \"method\": \"$context.httpMethod\",\n \"principalId\": \"$context.authorizer.principalId\",\n \"stage\": \"$context.stage\",\n\n #set( $map = $input.params().header )\n \"headers\": $loop,\n\n #set( $map = $input.params().querystring )\n \"query\": $loop,\n\n #set( $map = $input.params().path )\n \"path\": $loop,\n\n #set( $map = $context.identity )\n \"identity\": $loop,\n\n #set( $map = $stageVariables )\n \"stageVariables\": $loop\n }\n ", - "application/x-www-form-urlencoded": "\n #define( $body )\n {\n #foreach( $token in $input.path('$').split('&') )\n #set( $keyVal = $token.split('=') )\n #set( $keyValSize = $keyVal.size() )\n #if( $keyValSize >= 1 )\n #set( $key = $util.escapeJavaScript($util.urlDecode($keyVal[0])) )\n #if( $keyValSize >= 2 )\n #set( $val = $util.escapeJavaScript($util.urlDecode($keyVal[1])) )\n #else\n #set( $val = '' )\n #end\n \"$key\": \"$val\"#if($foreach.hasNext),#end\n #end\n #end\n }\n #end\n\n #define( $loop )\n {\n #foreach($key in $map.keySet())\n \"$util.escapeJavaScript($key)\":\n \"$util.escapeJavaScript($map.get($key))\"\n #if( $foreach.hasNext ) , #end\n #end\n }\n #end\n\n {\n \"body\": $body,\n \"method\": \"$context.httpMethod\",\n \"principalId\": \"$context.authorizer.principalId\",\n \"stage\": \"$context.stage\",\n\n #set( $map = $input.params().header )\n \"headers\": $loop,\n\n #set( $map = $input.params().querystring )\n \"query\": $loop,\n\n #set( $map = $input.params().path )\n \"path\": $loop,\n\n #set( $map = $context.identity )\n \"identity\": $loop,\n\n #set( $map = $stageVariables )\n \"stageVariables\": $loop\n }\n " - }, - "PassthroughBehavior": "NEVER", - "IntegrationResponses": [ - { - "StatusCode": 200, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "'*'" - }, - "ResponseTemplates": {} - }, - { - "StatusCode": 400, - "SelectionPattern": ".*\\[400\\].*" - }, - { - "StatusCode": 401, - "SelectionPattern": ".*\\[401\\].*" - }, - { - "StatusCode": 403, - "SelectionPattern": ".*\\[403\\].*" - }, - { - "StatusCode": 404, - "SelectionPattern": ".*\\[404\\].*" - }, - { - "StatusCode": 422, - "SelectionPattern": ".*\\[422\\].*" - }, - { - "StatusCode": 500, - "SelectionPattern": ".*(Process\\s?exited\\s?before\\s?completing\\s?request|Task\\s?timed\\s?out\\s?|\\[500\\]).*" - }, - { - "StatusCode": 502, - "SelectionPattern": ".*\\[502\\].*" - }, - { - "StatusCode": 504, - "SelectionPattern": ".*\\[504\\].*" - } - ] - }, - "ResourceId": { - "Ref": "ApiGatewayResourceTodosIdVar" - }, - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayMethodTodosIdVarPut": { - "Type": "AWS::ApiGateway::Method", - "Properties": { - "AuthorizationType": "NONE", - "HttpMethod": "PUT", - "MethodResponses": [ - { - "ResponseModels": {}, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "method.response.header.Access-Control-Allow-Origin" - }, - "StatusCode": 200 - }, - { - "StatusCode": 400 - }, - { - "StatusCode": 401 - }, - { - "StatusCode": 403 - }, - { - "StatusCode": 404 - }, - { - "StatusCode": 422 - }, - { - "StatusCode": 500 - }, - { - "StatusCode": 502 - }, - { - "StatusCode": 504 - } - ], - "RequestParameters": {}, - "Integration": { - "IntegrationHttpMethod": "POST", - "Type": "AWS_PROXY", - "Uri": { - "Fn::Join": [ - "", - [ - "arn:aws:apigateway:", - { - "Ref": "AWS::Region" - }, - ":lambda:path/2015-03-31/functions/", - { - "Fn::GetAtt": [ - "UpdateLambdaFunction", - "Arn" - ] - }, - "/invocations" - ] - ] - }, - "RequestTemplates": { - "application/json": "\n #define( $loop )\n {\n #foreach($key in $map.keySet())\n \"$util.escapeJavaScript($key)\":\n \"$util.escapeJavaScript($map.get($key))\"\n #if( $foreach.hasNext ) , #end\n #end\n }\n #end\n\n {\n \"body\": $input.json(\"$\"),\n \"method\": \"$context.httpMethod\",\n \"principalId\": \"$context.authorizer.principalId\",\n \"stage\": \"$context.stage\",\n\n #set( $map = $input.params().header )\n \"headers\": $loop,\n\n #set( $map = $input.params().querystring )\n \"query\": $loop,\n\n #set( $map = $input.params().path )\n \"path\": $loop,\n\n #set( $map = $context.identity )\n \"identity\": $loop,\n\n #set( $map = $stageVariables )\n \"stageVariables\": $loop\n }\n ", - "application/x-www-form-urlencoded": "\n #define( $body )\n {\n #foreach( $token in $input.path('$').split('&') )\n #set( $keyVal = $token.split('=') )\n #set( $keyValSize = $keyVal.size() )\n #if( $keyValSize >= 1 )\n #set( $key = $util.escapeJavaScript($util.urlDecode($keyVal[0])) )\n #if( $keyValSize >= 2 )\n #set( $val = $util.escapeJavaScript($util.urlDecode($keyVal[1])) )\n #else\n #set( $val = '' )\n #end\n \"$key\": \"$val\"#if($foreach.hasNext),#end\n #end\n #end\n }\n #end\n\n #define( $loop )\n {\n #foreach($key in $map.keySet())\n \"$util.escapeJavaScript($key)\":\n \"$util.escapeJavaScript($map.get($key))\"\n #if( $foreach.hasNext ) , #end\n #end\n }\n #end\n\n {\n \"body\": $body,\n \"method\": \"$context.httpMethod\",\n \"principalId\": \"$context.authorizer.principalId\",\n \"stage\": \"$context.stage\",\n\n #set( $map = $input.params().header )\n \"headers\": $loop,\n\n #set( $map = $input.params().querystring )\n \"query\": $loop,\n\n #set( $map = $input.params().path )\n \"path\": $loop,\n\n #set( $map = $context.identity )\n \"identity\": $loop,\n\n #set( $map = $stageVariables )\n \"stageVariables\": $loop\n }\n " - }, - "PassthroughBehavior": "NEVER", - "IntegrationResponses": [ - { - "StatusCode": 200, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "'*'" - }, - "ResponseTemplates": {} - }, - { - "StatusCode": 400, - "SelectionPattern": ".*\\[400\\].*" - }, - { - "StatusCode": 401, - "SelectionPattern": ".*\\[401\\].*" - }, - { - "StatusCode": 403, - "SelectionPattern": ".*\\[403\\].*" - }, - { - "StatusCode": 404, - "SelectionPattern": ".*\\[404\\].*" - }, - { - "StatusCode": 422, - "SelectionPattern": ".*\\[422\\].*" - }, - { - "StatusCode": 500, - "SelectionPattern": ".*(Process\\s?exited\\s?before\\s?completing\\s?request|Task\\s?timed\\s?out\\s?|\\[500\\]).*" - }, - { - "StatusCode": 502, - "SelectionPattern": ".*\\[502\\].*" - }, - { - "StatusCode": 504, - "SelectionPattern": ".*\\[504\\].*" - } - ] - }, - "ResourceId": { - "Ref": "ApiGatewayResourceTodosIdVar" - }, - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayMethodTodosIdVarDelete": { - "Type": "AWS::ApiGateway::Method", - "Properties": { - "AuthorizationType": "NONE", - "HttpMethod": "DELETE", - "MethodResponses": [ - { - "ResponseModels": {}, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "method.response.header.Access-Control-Allow-Origin" - }, - "StatusCode": 200 - }, - { - "StatusCode": 400 - }, - { - "StatusCode": 401 - }, - { - "StatusCode": 403 - }, - { - "StatusCode": 404 - }, - { - "StatusCode": 422 - }, - { - "StatusCode": 500 - }, - { - "StatusCode": 502 - }, - { - "StatusCode": 504 - } - ], - "RequestParameters": {}, - "Integration": { - "IntegrationHttpMethod": "POST", - "Type": "AWS_PROXY", - "Uri": { - "Fn::Join": [ - "", - [ - "arn:aws:apigateway:", - { - "Ref": "AWS::Region" - }, - ":lambda:path/2015-03-31/functions/", - { - "Fn::GetAtt": [ - "DeleteLambdaFunction", - "Arn" - ] - }, - "/invocations" - ] - ] - }, - "RequestTemplates": { - "application/json": "\n #define( $loop )\n {\n #foreach($key in $map.keySet())\n \"$util.escapeJavaScript($key)\":\n \"$util.escapeJavaScript($map.get($key))\"\n #if( $foreach.hasNext ) , #end\n #end\n }\n #end\n\n {\n \"body\": $input.json(\"$\"),\n \"method\": \"$context.httpMethod\",\n \"principalId\": \"$context.authorizer.principalId\",\n \"stage\": \"$context.stage\",\n\n #set( $map = $input.params().header )\n \"headers\": $loop,\n\n #set( $map = $input.params().querystring )\n \"query\": $loop,\n\n #set( $map = $input.params().path )\n \"path\": $loop,\n\n #set( $map = $context.identity )\n \"identity\": $loop,\n\n #set( $map = $stageVariables )\n \"stageVariables\": $loop\n }\n ", - "application/x-www-form-urlencoded": "\n #define( $body )\n {\n #foreach( $token in $input.path('$').split('&') )\n #set( $keyVal = $token.split('=') )\n #set( $keyValSize = $keyVal.size() )\n #if( $keyValSize >= 1 )\n #set( $key = $util.escapeJavaScript($util.urlDecode($keyVal[0])) )\n #if( $keyValSize >= 2 )\n #set( $val = $util.escapeJavaScript($util.urlDecode($keyVal[1])) )\n #else\n #set( $val = '' )\n #end\n \"$key\": \"$val\"#if($foreach.hasNext),#end\n #end\n #end\n }\n #end\n\n #define( $loop )\n {\n #foreach($key in $map.keySet())\n \"$util.escapeJavaScript($key)\":\n \"$util.escapeJavaScript($map.get($key))\"\n #if( $foreach.hasNext ) , #end\n #end\n }\n #end\n\n {\n \"body\": $body,\n \"method\": \"$context.httpMethod\",\n \"principalId\": \"$context.authorizer.principalId\",\n \"stage\": \"$context.stage\",\n\n #set( $map = $input.params().header )\n \"headers\": $loop,\n\n #set( $map = $input.params().querystring )\n \"query\": $loop,\n\n #set( $map = $input.params().path )\n \"path\": $loop,\n\n #set( $map = $context.identity )\n \"identity\": $loop,\n\n #set( $map = $stageVariables )\n \"stageVariables\": $loop\n }\n " - }, - "PassthroughBehavior": "NEVER", - "IntegrationResponses": [ - { - "StatusCode": 200, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "'*'" - }, - "ResponseTemplates": {} - }, - { - "StatusCode": 400, - "SelectionPattern": ".*\\[400\\].*" - }, - { - "StatusCode": 401, - "SelectionPattern": ".*\\[401\\].*" - }, - { - "StatusCode": 403, - "SelectionPattern": ".*\\[403\\].*" - }, - { - "StatusCode": 404, - "SelectionPattern": ".*\\[404\\].*" - }, - { - "StatusCode": 422, - "SelectionPattern": ".*\\[422\\].*" - }, - { - "StatusCode": 500, - "SelectionPattern": ".*(Process\\s?exited\\s?before\\s?completing\\s?request|Task\\s?timed\\s?out\\s?|\\[500\\]).*" - }, - { - "StatusCode": 502, - "SelectionPattern": ".*\\[502\\].*" - }, - { - "StatusCode": 504, - "SelectionPattern": ".*\\[504\\].*" - } - ] - }, - "ResourceId": { - "Ref": "ApiGatewayResourceTodosIdVar" - }, - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayMethodTodosOptions": { - "Type": "AWS::ApiGateway::Method", - "Properties": { - "AuthorizationType": "NONE", - "HttpMethod": "OPTIONS", - "MethodResponses": [ - { - "ResponseModels": {}, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": true, - "method.response.header.Access-Control-Allow-Headers": true, - "method.response.header.Access-Control-Allow-Methods": true - }, - "StatusCode": "200" - } - ], - "RequestParameters": {}, - "Integration": { - "Type": "MOCK", - "RequestTemplates": { - "application/json": "{statusCode:200}" - }, - "IntegrationResponses": [ - { - "StatusCode": "200", - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "'*'", - "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'", - "method.response.header.Access-Control-Allow-Methods": "'OPTIONS,GET,POST'" - }, - "ResponseTemplates": { - "application/json": "" - } - } - ] - }, - "ResourceId": { - "Ref": "ApiGatewayResourceTodos" - }, - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayMethodTodosIdVarOptions": { - "Type": "AWS::ApiGateway::Method", - "Properties": { - "AuthorizationType": "NONE", - "HttpMethod": "OPTIONS", - "MethodResponses": [ - { - "ResponseModels": {}, - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": true, - "method.response.header.Access-Control-Allow-Headers": true, - "method.response.header.Access-Control-Allow-Methods": true - }, - "StatusCode": "200" - } - ], - "RequestParameters": {}, - "Integration": { - "Type": "MOCK", - "RequestTemplates": { - "application/json": "{statusCode:200}" - }, - "IntegrationResponses": [ - { - "StatusCode": "200", - "ResponseParameters": { - "method.response.header.Access-Control-Allow-Origin": "'*'", - "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'", - "method.response.header.Access-Control-Allow-Methods": "'OPTIONS,DELETE,PUT,GET'" - }, - "ResponseTemplates": { - "application/json": "" - } - } - ] - }, - "ResourceId": { - "Ref": "ApiGatewayResourceTodosIdVar" - }, - "RestApiId": { - "Ref": "ApiGatewayRestApi" - } - } - }, - "ApiGatewayDeployment1476332749599": { - "Type": "AWS::ApiGateway::Deployment", - "Properties": { - "RestApiId": { - "Ref": "ApiGatewayRestApi" - }, - "StageName": "dev" - }, - "DependsOn": [ - "ApiGatewayMethodTodosPost", - "ApiGatewayMethodTodosGet", - "ApiGatewayMethodTodosIdVarGet", - "ApiGatewayMethodTodosIdVarPut", - "ApiGatewayMethodTodosIdVarDelete" - ] - }, - "CreateLambdaPermissionApiGateway": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "FunctionName": { - "Fn::GetAtt": [ - "CreateLambdaFunction", - "Arn" - ] - }, - "Action": "lambda:InvokeFunction", - "Principal": "apigateway.amazonaws.com" - } - }, - "ReadAllLambdaPermissionApiGateway": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "FunctionName": { - "Fn::GetAtt": [ - "ReadAllLambdaFunction", - "Arn" - ] - }, - "Action": "lambda:InvokeFunction", - "Principal": "apigateway.amazonaws.com" - } - }, - "ReadOneLambdaPermissionApiGateway": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "FunctionName": { - "Fn::GetAtt": [ - "ReadOneLambdaFunction", - "Arn" - ] - }, - "Action": "lambda:InvokeFunction", - "Principal": "apigateway.amazonaws.com" - } - }, - "UpdateLambdaPermissionApiGateway": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "FunctionName": { - "Fn::GetAtt": [ - "UpdateLambdaFunction", - "Arn" - ] - }, - "Action": "lambda:InvokeFunction", - "Principal": "apigateway.amazonaws.com" - } - }, - "DeleteLambdaPermissionApiGateway": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "FunctionName": { - "Fn::GetAtt": [ - "DeleteLambdaFunction", - "Arn" - ] - }, - "Action": "lambda:InvokeFunction", - "Principal": "apigateway.amazonaws.com" - } - } - }, - "Outputs": { - "ServerlessDeploymentBucketName": { - "Value": { - "Ref": "ServerlessDeploymentBucket" - } - }, - "CreateLambdaFunctionArn": { - "Description": "Lambda function info", - "Value": { - "Fn::GetAtt": [ - "CreateLambdaFunction", - "Arn" - ] - } - }, - "ReadAllLambdaFunctionArn": { - "Description": "Lambda function info", - "Value": { - "Fn::GetAtt": [ - "ReadAllLambdaFunction", - "Arn" - ] - } - }, - "ReadOneLambdaFunctionArn": { - "Description": "Lambda function info", - "Value": { - "Fn::GetAtt": [ - "ReadOneLambdaFunction", - "Arn" - ] - } - }, - "UpdateLambdaFunctionArn": { - "Description": "Lambda function info", - "Value": { - "Fn::GetAtt": [ - "UpdateLambdaFunction", - "Arn" - ] - } - }, - "DeleteLambdaFunctionArn": { - "Description": "Lambda function info", - "Value": { - "Fn::GetAtt": [ - "DeleteLambdaFunction", - "Arn" - ] - } - }, - "ServiceEndpoint": { - "Description": "URL of the service endpoint", - "Value": { - "Fn::Join": [ - "", - [ - "https://", - { - "Ref": "ApiGatewayRestApi" - }, - ".execute-api.us-east-1.amazonaws.com/dev" - ] - ] - } - } - } -} \ No newline at end of file diff --git a/.serverless/serverless-crud.zip b/.serverless/serverless-crud.zip deleted file mode 100644 index 937d6e3..0000000 Binary files a/.serverless/serverless-crud.zip and /dev/null differ