-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: move the normalized open api version to feature flag normalized_…
…open_api_version (#3555)
- Loading branch information
Showing
10 changed files
with
1,866 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
166 changes: 166 additions & 0 deletions
166
tests/translator/input/feature_toggle_api_open_api_version_override.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
Transform: | ||
- AWS::Serverless-2016-10-31 | ||
Resources: | ||
ApiGatewayCognitoExecutionRole4F7CB5C8: | ||
Type: AWS::IAM::Role | ||
Properties: | ||
AssumeRolePolicyDocument: | ||
Statement: | ||
- Action: sts:AssumeRole | ||
Effect: Allow | ||
Principal: | ||
Service: apigateway.amazonaws.com | ||
Version: '2012-10-17' | ||
Policies: | ||
- PolicyDocument: | ||
Statement: | ||
- Action: lambda:Invoke* | ||
Effect: Allow | ||
Resource: | ||
Fn::GetAtt: | ||
- LambdaFunction7804BD21 | ||
- Arn | ||
Version: '2012-10-17' | ||
PolicyName: apigInvokeLambda | ||
LambdaFunctionServiceRoleD6E423C9: | ||
Type: AWS::IAM::Role | ||
Properties: | ||
AssumeRolePolicyDocument: | ||
Statement: | ||
- Action: sts:AssumeRole | ||
Effect: Allow | ||
Principal: | ||
Service: lambda.amazonaws.com | ||
Version: '2012-10-17' | ||
ManagedPolicyArns: | ||
- Fn::Join: | ||
- '' | ||
- - 'arn:' | ||
- Ref: AWS::Partition | ||
- :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole | ||
LambdaFunctionServiceRoleDefaultPolicyF01A7EDC: | ||
Type: AWS::IAM::Policy | ||
Properties: | ||
PolicyDocument: | ||
Statement: | ||
- Action: sns:Publish | ||
Effect: Allow | ||
Resource: '*' | ||
Version: '2012-10-17' | ||
PolicyName: LambdaFunctionServiceRoleDefaultPolicyF01A7EDC | ||
Roles: | ||
- Ref: LambdaFunctionServiceRoleD6E423C9 | ||
LambdaFunction7804BD21: | ||
Type: AWS::Lambda::Function | ||
Properties: | ||
Code: | ||
ZipFile: | | ||
exports.handler = async (event, context, callback) => { | ||
const auth = event.queryStringParameters.authorization | ||
const policyDocument = { | ||
Version: '2012-10-17', | ||
Statement: [{ | ||
Action: 'execute-api:Invoke', | ||
Effect: auth && auth.toLowerCase() === 'allow' ? 'Allow' : 'Deny', | ||
Resource: event.methodArn | ||
}] | ||
} | ||
return { | ||
principalId: 'user', | ||
context: {}, | ||
policyDocument | ||
} | ||
} | ||
Role: | ||
Fn::GetAtt: | ||
- LambdaFunctionServiceRoleD6E423C9 | ||
- Arn | ||
Handler: index.handler | ||
Runtime: nodejs16.x | ||
MyCognitoUserPool: | ||
Type: AWS::Cognito::UserPool | ||
Properties: | ||
UserPoolName: MyCognitoUserPool | ||
ApiGatewayCognitoService15108F0B: | ||
Type: AWS::Serverless::Api | ||
Properties: | ||
StageName: prod | ||
Auth: | ||
AddDefaultAuthorizerToCorsPreflight: false | ||
Authorizers: | ||
CognitoAuthorizer: | ||
UserPoolArn: | ||
Fn::GetAtt: MyCognitoUserPool.Arn | ||
DefaultAuthorizer: CognitoAuthorizer | ||
DefinitionBody: | ||
openapi: 3.0.2 | ||
info: | ||
title: RxtHofApprovalServiceLambdaCognito | ||
version: '2018-05-10' | ||
paths: | ||
/reviews: | ||
post: | ||
operationId: CreateReview | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/CreateReviewRequestContent' | ||
required: true | ||
responses: | ||
'200': | ||
description: CreateReview 200 response | ||
headers: | ||
Access-Control-Allow-Origin: | ||
schema: | ||
type: string | ||
Access-Control-Expose-Headers: | ||
schema: | ||
type: string | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/CreateReviewResponseContent' | ||
x-amazon-apigateway-integration: | ||
type: aws_proxy | ||
httpMethod: POST | ||
uri: | ||
Fn::Sub: arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunction7804BD21.Arn}/invocations | ||
credentials: | ||
Fn::Sub: ${ApiGatewayCognitoExecutionRole4F7CB5C8.Arn} | ||
responses: | ||
default: | ||
statusCode: '200' | ||
responseParameters: | ||
method.response.header.Access-Control-Allow-Origin: "'*'" | ||
method.response.header.Access-Control-Expose-Headers: "'Content-Length,Content-Type,X-Amzn-Errortype,X-Amzn-Requestid'" | ||
components: | ||
schemas: | ||
CreateReviewRequestContent: | ||
type: object | ||
properties: | ||
reviewId: | ||
type: string | ||
CreateReviewResponseContent: | ||
type: object | ||
properties: | ||
reviewId: | ||
type: string | ||
securitySchemes: | ||
aws.auth.sigv4: | ||
type: apiKey | ||
description: AWS Signature Version 4 authentication | ||
name: Authorization | ||
in: header | ||
x-amazon-apigateway-authtype: awsSigv4 | ||
security: | ||
- aws.auth.sigv4: [] | ||
x-amazon-apigateway-gateway-responses: | ||
DEFAULT_5XX: | ||
responseTemplates: | ||
application/json: '{"message":$context.error.messageString}' | ||
responseParameters: | ||
gatewayresponse.header.Access-Control-Allow-Origin: "'*'" | ||
OpenApiVersion: '2.0' | ||
TracingEnabled: true |
Oops, something went wrong.