-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
295 changed files
with
8,704 additions
and
965 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: github-merit-badger | ||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
|
||
jobs: | ||
call-action: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- uses: kaizencc/github-merit-badger@main | ||
id: merit-badger | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
badges: '[beginning-contributor,repeat-contributor,valued-contributor,admired-contributor,star-contributor,distinguished-contributor]' | ||
thresholds: '[0,3,6,13,25,50]' | ||
badge-type: 'achievement' | ||
ignore-usernames: '[RomainMuller,rix0rrr,Jerry-AWS,MrArnoldPalmer,iliapolo,otaviomacedo,madeline-k,kaizencc,comcalvi,corymhall,peterwoodworth,ryparker,TheRealAmazonKendra,vinayak-kukreja,Naumel,mrgrain,aws-cdk-automation,dependabot,mergify]' |
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
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
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
92 changes: 92 additions & 0 deletions
92
packages/@aws-cdk/aws-apigateway/test/integ.spec-restapi.ts
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,92 @@ | ||
import * as path from 'path'; | ||
import * as lambda from '@aws-cdk/aws-lambda'; | ||
import * as cdk from '@aws-cdk/core'; | ||
import { IntegTest } from '@aws-cdk/integ-tests'; | ||
import * as apigateway from '../lib'; | ||
|
||
class Test extends cdk.Stack { | ||
constructor(scope: cdk.App, id: string) { | ||
super(scope, id); | ||
|
||
const api = new apigateway.SpecRestApi(this, 'my-api', { | ||
apiDefinition: apigateway.ApiDefinition.fromAsset(path.join(__dirname, 'sample-definition.yaml')), | ||
disableExecuteApiEndpoint: true, | ||
retainDeployments: true, | ||
cloudWatchRole: true, | ||
deployOptions: { | ||
cacheClusterEnabled: true, | ||
stageName: 'beta', | ||
description: 'beta stage', | ||
loggingLevel: apigateway.MethodLoggingLevel.INFO, | ||
dataTraceEnabled: true, | ||
methodOptions: { | ||
'/api/appliances/GET': { | ||
cachingEnabled: true, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
const handler = new lambda.Function(this, 'MyHandler', { | ||
runtime: lambda.Runtime.NODEJS_14_X, | ||
code: lambda.Code.fromInline(`exports.handler = ${handlerCode}`), | ||
handler: 'index.handler', | ||
}); | ||
|
||
const v1 = api.root.addResource('v1'); | ||
|
||
const integration = new apigateway.LambdaIntegration(handler); | ||
|
||
const toys = v1.addResource('toys'); | ||
const getToysMethod: apigateway.Method = toys.addMethod('GET', integration, { apiKeyRequired: true }); | ||
toys.addMethod('POST'); | ||
toys.addMethod('PUT'); | ||
|
||
const appliances = v1.addResource('appliances'); | ||
appliances.addMethod('GET'); | ||
|
||
const books = v1.addResource('books'); | ||
books.addMethod('GET', integration); | ||
books.addMethod('POST', integration); | ||
|
||
function handlerCode(event: any, _: any, callback: any) { | ||
return callback(undefined, { | ||
isBase64Encoded: false, | ||
statusCode: 200, | ||
headers: { 'content-type': 'application/json' }, | ||
body: JSON.stringify(event), | ||
}); | ||
} | ||
|
||
const key = api.addApiKey('ApiKey'); | ||
const plan = api.addUsagePlan('UsagePlan', { | ||
name: 'Basic', | ||
apiKey: key, | ||
description: 'Free tier monthly usage plan', | ||
throttle: { rateLimit: 5 }, | ||
quota: { | ||
limit: 10000, | ||
period: apigateway.Period.MONTH, | ||
}, | ||
}); | ||
plan.addApiStage({ | ||
stage: api.deploymentStage, | ||
throttle: [ | ||
{ | ||
method: getToysMethod, | ||
throttle: { | ||
rateLimit: 10, | ||
burstLimit: 2, | ||
}, | ||
}, | ||
], | ||
}); | ||
} | ||
} | ||
|
||
const app = new cdk.App(); | ||
|
||
const testCase = new Test(app, 'test-apigateway-spec-restapi'); | ||
new IntegTest(app, 'apigateway-spec-restapi', { | ||
testCases: [testCase], | ||
}); |
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
19 changes: 19 additions & 0 deletions
19
...c-restapi.integ.snapshot/apigatewayspecrestapiDefaultTestDeployAssertD16AA485.assets.json
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,19 @@ | ||
{ | ||
"version": "21.0.0", | ||
"files": { | ||
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { | ||
"source": { | ||
"path": "apigatewayspecrestapiDefaultTestDeployAssertD16AA485.template.json", | ||
"packaging": "file" | ||
}, | ||
"destinations": { | ||
"current_account-current_region": { | ||
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", | ||
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" | ||
} | ||
} | ||
} | ||
}, | ||
"dockerImages": {} | ||
} |
36 changes: 36 additions & 0 deletions
36
...restapi.integ.snapshot/apigatewayspecrestapiDefaultTestDeployAssertD16AA485.template.json
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,36 @@ | ||
{ | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...nteg.snapshot/asset.68497ac876de4e963fc8f7b5f1b28844c18ecc95e3f7c6e9e0bf250e03c037fb.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,30 @@ | ||
openapi: "3.0.2" | ||
info: | ||
version: 1.0.0 | ||
title: Test API for CDK | ||
paths: | ||
/pets: | ||
get: | ||
summary: Test Method | ||
operationId: testMethod | ||
responses: | ||
"200": | ||
description: A paged array of pets | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Empty" | ||
x-amazon-apigateway-integration: | ||
responses: | ||
default: | ||
statusCode: "200" | ||
requestTemplates: | ||
application/json: "{\"statusCode\": 200}" | ||
passthroughBehavior: when_no_match | ||
type: mock | ||
|
||
components: | ||
schemas: | ||
Empty: | ||
title: Empty Schema | ||
type: object |
1 change: 1 addition & 0 deletions
1
packages/@aws-cdk/aws-apigateway/test/spec-restapi.integ.snapshot/cdk.out
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 @@ | ||
{"version":"21.0.0"} |
12 changes: 12 additions & 0 deletions
12
packages/@aws-cdk/aws-apigateway/test/spec-restapi.integ.snapshot/integ.json
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,12 @@ | ||
{ | ||
"version": "21.0.0", | ||
"testCases": { | ||
"apigateway-spec-restapi/DefaultTest": { | ||
"stacks": [ | ||
"test-apigateway-spec-restapi" | ||
], | ||
"assertionStack": "apigateway-spec-restapi/DefaultTest/DeployAssert", | ||
"assertionStackName": "apigatewayspecrestapiDefaultTestDeployAssertD16AA485" | ||
} | ||
} | ||
} |
Oops, something went wrong.