Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,663 changes: 3,663 additions & 0 deletions tests/aws/cdk_templates/serverlesspresso/ServerlesspressoStack.json

Large diffs are not rendered by default.

Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
openapi: "3.0.1"
info:
title: "ConfigServiceRESTAPI"
version: "2021-12-21T15:32:58Z"
paths:
/config:
get:
responses:
"200":
description: "200 response"
headers:
Access-Control-Allow-Origin:
schema:
type: "string"
Access-Control-Allow-Methods:
schema:
type: "string"
Access-Control-Allow-Headers:
schema:
type: "string"
content:
application/json:
schema:
$ref: "#/components/schemas/Empty"

x-amazon-apigateway-integration:
credentials:
Fn::GetAtt: [ConfigRESTApiRole, Arn]
httpMethod: "POST"
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:dynamodb:action/Scan
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Methods: "'GET,OPTIONS'"
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-Origin: "'*'"
responseTemplates:
application/json: "#set($Items = $input.path('$.Items'))\n$Items\n"
requestTemplates:
application/json: "{\n \"TableName\": \"serverlesspresso-config-table\"\
\n}"
passthroughBehavior: "when_no_templates"
type: "aws"
options:
responses:
"200":
description: "200 response"
headers:
Access-Control-Allow-Origin:
schema:
type: "string"
Access-Control-Allow-Methods:
schema:
type: "string"
Access-Control-Allow-Headers:
schema:
type: "string"
content: {}
x-amazon-apigateway-integration:
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Methods: "'GET,OPTIONS'"
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-Origin: "'*'"
responseTemplates:
application/json: "{}\n"
requestTemplates:
application/json: "{\n \"statusCode\" : 200\n}\n"
passthroughBehavior: "when_no_match"
type: "mock"
/admin-config:
get:
responses:
"200":
description: "200 response"
headers:
Access-Control-Allow-Origin:
schema:
type: "string"
Access-Control-Allow-Methods:
schema:
type: "string"
Access-Control-Allow-Headers:
schema:
type: "string"
content:
application/json:
schema:
$ref: "#/components/schemas/Empty"
security: [
{
"ServerlespressoAuth" : ["openid", "aws.cognito.signin.user.admin"]
}
]
x-amazon-apigateway-integration:
credentials:
Fn::GetAtt: [ConfigRESTApiRole, Arn]
httpMethod: "POST"
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:dynamodb:action/Scan
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Methods: "'GET,OPTIONS'"
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-Origin: "'*'"
responseTemplates:
application/json: "#set($Items = $input.path('$.Items'))\n$Items\n"
requestTemplates:
application/json: "{\n \"TableName\": \"serverlesspresso-config-table\"\
\n}"
passthroughBehavior: "when_no_templates"
type: "aws"
options:
responses:
"200":
description: "200 response"
headers:
Access-Control-Allow-Origin:
schema:
type: "string"
Access-Control-Allow-Methods:
schema:
type: "string"
Access-Control-Allow-Headers:
schema:
type: "string"
content: {}
x-amazon-apigateway-integration:
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Methods: "'GET,OPTIONS'"
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-Origin: "'*'"
responseTemplates:
application/json: "{}\n"
requestTemplates:
application/json: "{\n \"statusCode\" : 200\n}\n"
passthroughBehavior: "when_no_match"
type: "mock"
/store:
put:
responses:
"200":
description: "200 response"
headers:
Access-Control-Allow-Origin:
schema:
type: "string"
Access-Control-Allow-Methods:
schema:
type: "string"
Access-Control-Allow-Headers:
schema:
type: "string"
content:
application/json:
schema:
$ref: "#/components/schemas/Empty"
security: [
{
"ServerlespressoAuth" : ["openid", "aws.cognito.signin.user.admin"]
}
]
x-amazon-apigateway-integration:
credentials:
Fn::GetAtt: [ConfigRESTApiRole, Arn]
httpMethod: "POST"
uri: "arn:aws:apigateway:${AWS::Region}:dynamodb:action/UpdateItem"
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Methods: "'GET,OPTIONS'"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Access-Control-Allow-Methods should include 'PUT' instead of 'GET' for the store endpoint

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-Origin: "'*'"
requestTemplates:
application/json: "#set($state = $input.params('state'))\n\n#if( $state\
\ == 'open' )\n #set($stateBool = true)\n#else\n #set($stateBool = false)\n\
#end\n\n{\n \"TableName\": \"serverlesspresso-config-table\",\n \
\ \"Key\": {\n \"PK\": {\n \"S\":\"config\"\n }\n \
\ },\n \"UpdateExpression\": \"set storeOpen = :openState\",\n \
\ \"ExpressionAttributeValues\": {\n \":openState\": {\n \"BOOL\"\
: $stateBool\n }\n },\n \"ReturnValues\":\"ALL_NEW\"\n}"
passthroughBehavior: "when_no_templates"
type: "aws"
options:
responses:
"200":
description: "200 response"
headers:
Access-Control-Allow-Origin:
schema:
type: "string"
Access-Control-Allow-Methods:
schema:
type: "string"
Access-Control-Allow-Headers:
schema:
type: "string"
content: {}
x-amazon-apigateway-integration:
responses:
default:
statusCode: "200"
responseParameters:
method.response.header.Access-Control-Allow-Methods: "'PUT,OPTIONS'"
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-Origin: "'*'"
responseTemplates:
application/json: "{}\n"
requestTemplates:
application/json: "{\n \"statusCode\" : 200\n}\n"
passthroughBehavior: "when_no_match"
type: "mock"
components:
schemas:
Empty:
title: "Empty Schema"
type: "object"
securitySchemes:
ServerlespressoAuth:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "cognito_user_pools"
x-amazon-apigateway-authorizer:
providerARNs:
- Fn::GetAtt: [UserPool, Arn]
type: "cognito_user_pools"
Loading