Skip to content

Commit

Permalink
Merge branch 'master' into fix/set-actual-physical-resource-id-on-is-…
Browse files Browse the repository at this point in the history
…complete
  • Loading branch information
mergify[bot] authored Feb 26, 2022
2 parents 7dc0f45 + 2ea9da1 commit 831f97f
Show file tree
Hide file tree
Showing 400 changed files with 13,458 additions and 1,088 deletions.
2 changes: 1 addition & 1 deletion .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pull_request_rules:
label:
add: [ contribution/core ]
conditions:
- author~=^(eladb|RomainMuller|garnaat|nija-at|skinny85|rix0rrr|NGL321|Jerry-AWS|MrArnoldPalmer|NetaNir|iliapolo|njlynch|ericzbeard|ccfife|fulghum|pkandasamy91|SoManyHs|uttarasridhar|otaviomacedo|BenChaimberg|madeline-k|BryanPan342|kaizen3031593|comcalvi|Chriscbr|corymhall|peterwoodworth|ryparker)$
- author~=^(eladb|RomainMuller|garnaat|nija-at|skinny85|rix0rrr|NGL321|Jerry-AWS|MrArnoldPalmer|NetaNir|iliapolo|njlynch|ericzbeard|ccfife|fulghum|pkandasamy91|SoManyHs|uttarasridhar|otaviomacedo|BenChaimberg|madeline-k|BryanPan342|kaizen3031593|comcalvi|Chriscbr|corymhall|peterwoodworth|ryparker|TheRealAmazonKendra)$
- -label~="contribution/core"
- name: automatic merge
actions:
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.146.0](https://github.com/aws/aws-cdk/compare/v1.145.0...v1.146.0) (2022-02-24)


### Features

* **apigatewayv2:** Import existing WebSocketApi from attributes ([#18958](https://github.com/aws/aws-cdk/issues/18958)) ([f203845](https://github.com/aws/aws-cdk/commit/f203845d26ae8333f467f1cb91ad965697087d85))
* **cli:** bundle dependencies ([#18667](https://github.com/aws/aws-cdk/issues/18667)) ([31d135f](https://github.com/aws/aws-cdk/commit/31d135fb51d3cd4e26fbdc132e03815a1416da75))
* **cli:** support for matching notices with arbitrary module names ([#19088](https://github.com/aws/aws-cdk/issues/19088)) ([a87dee7](https://github.com/aws/aws-cdk/commit/a87dee756057e554909207237b70f80af185b110))
* **cli:** support for notices ([#18936](https://github.com/aws/aws-cdk/issues/18936)) ([d37fbbb](https://github.com/aws/aws-cdk/commit/d37fbbbb31003d69da88b9340a6a9c9e1e927ac5))
* **cloudfront-origins:** extend max keepaliveTimeout of HttpOrigin to 180 ([#18837](https://github.com/aws/aws-cdk/issues/18837)) ([171fdcd](https://github.com/aws/aws-cdk/commit/171fdcdf595fcff5b2567b17e6fa73bf0d42e1bc)), closes [#18697](https://github.com/aws/aws-cdk/issues/18697)
* **eks:** Allow helm pull from OCI repositories ([#18547](https://github.com/aws/aws-cdk/issues/18547)) ([7e624d9](https://github.com/aws/aws-cdk/commit/7e624d994c94dbd584643c4cb6e9f8df53dabc18))
* **lambda:** add a fromFunctionName() method ([#19076](https://github.com/aws/aws-cdk/issues/19076)) ([5b92cc3](https://github.com/aws/aws-cdk/commit/5b92cc3a31eea29b40814498fca614eb1c7c8724)), closes [#18255](https://github.com/aws/aws-cdk/issues/18255) [#19031](https://github.com/aws/aws-cdk/issues/19031)
* **pipelines:** ECR source action ([#16385](https://github.com/aws/aws-cdk/issues/16385)) ([fc11ae2](https://github.com/aws/aws-cdk/commit/fc11ae2c4ec3bd9dfe3ff813aa831c744d8ac444)), closes [#16378](https://github.com/aws/aws-cdk/issues/16378)
* **pipelines:** step outputs ([#19024](https://github.com/aws/aws-cdk/issues/19024)) ([0dec2ee](https://github.com/aws/aws-cdk/commit/0dec2ee78a70832c3a697be26c67498460a587dd)), closes [#17189](https://github.com/aws/aws-cdk/issues/17189) [#18893](https://github.com/aws/aws-cdk/issues/18893) [#15943](https://github.com/aws/aws-cdk/issues/15943) [#16407](https://github.com/aws/aws-cdk/issues/16407)
* **rds:** make VPC optional for serverless Clusters ([#17413](https://github.com/aws/aws-cdk/issues/17413)) ([4f7818d](https://github.com/aws/aws-cdk/commit/4f7818dd76bd48ed652407f4852cc97ba57d7395)), closes [#17401](https://github.com/aws/aws-cdk/issues/17401)
* triggers ([#19011](https://github.com/aws/aws-cdk/issues/19011)) ([11d6c69](https://github.com/aws/aws-cdk/commit/11d6c69a8b1ee70cbea025d134be7702dd804444))


### Bug Fixes

* **cli:** hotswapping is slow for many resources deployed at once ([#19081](https://github.com/aws/aws-cdk/issues/19081)) ([040238e](https://github.com/aws/aws-cdk/commit/040238e9285945d1c48ef79474e527b871e7824c)), closes [#19021](https://github.com/aws/aws-cdk/issues/19021)
* **s3-notifications:** notifications allowed with imported kms keys ([#18989](https://github.com/aws/aws-cdk/issues/18989)) ([7441418](https://github.com/aws/aws-cdk/commit/7441418fbf9ffdf8d85a573e3c81c45c5648fe8a))
* API compatibility check fails in CI pipeline ([#19069](https://github.com/aws/aws-cdk/issues/19069)) ([6ec1005](https://github.com/aws/aws-cdk/commit/6ec1005c9cfa9723520885748d759b00be5cd2fa)), closes [#19070](https://github.com/aws/aws-cdk/issues/19070)
* **cloudfront:** trim autogenerated cache policy name ([#18953](https://github.com/aws/aws-cdk/issues/18953)) ([c7394c9](https://github.com/aws/aws-cdk/commit/c7394c96c42cb6a5af1e309bee2a5f11eb3ad35c)), closes [#18918](https://github.com/aws/aws-cdk/issues/18918)
* **elasticloadbalancingv2:** validate port/protocol are not provided for lambda targets ([#19043](https://github.com/aws/aws-cdk/issues/19043)) ([64d26cc](https://github.com/aws/aws-cdk/commit/64d26cc22b1fe456777c3367769ddbe860f26cf3)), closes [#12514](https://github.com/aws/aws-cdk/issues/12514)
* **route53:** fix cross account delegation deployment dependency ([#19047](https://github.com/aws/aws-cdk/issues/19047)) ([692a0d0](https://github.com/aws/aws-cdk/commit/692a0d06f2865503d1d88b0ba8af38ecceaec871)), closes [#19041](https://github.com/aws/aws-cdk/issues/19041)

## [1.145.0](https://github.com/aws/aws-cdk/compare/v1.144.0...v1.145.0) (2022-02-18)


Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"jsii-rosetta": "^1.54.0",
"lerna": "^4.0.0",
"patch-package": "^6.4.7",
"semver": "^6.3.0",
"standard-version": "^9.3.2",
"typescript": "~3.9.10"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^27.4.0",
"@types/jest": "^27.4.1",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/aws-autoscaling": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,8 @@
"dynamodb:BatchWriteItem",
"dynamodb:PutItem",
"dynamodb:UpdateItem",
"dynamodb:DeleteItem"
"dynamodb:DeleteItem",
"dynamodb:DescribeTable"
],
"Effect": "Allow",
"Resource": [
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/alexa-ask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.0"
"@types/jest": "^27.4.1"
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/app-delivery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.0",
"@types/jest": "^27.4.1",
"fast-check": "^2.22.0",
"jest": "^27.5.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert-internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"devDependencies": {
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.0",
"@types/jest": "^27.4.1",
"jest": "^27.5.1",
"ts-jest": "^27.1.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@aws-cdk/assert-internal": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.0",
"@types/jest": "^27.4.1",
"aws-cdk-migration": "0.0.0",
"constructs": "^3.3.69",
"jest": "^27.3.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assertions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^27.4.0",
"@types/jest": "^27.4.1",
"constructs": "^3.3.69",
"jest": "^27.5.1",
"ts-jest": "^27.1.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.0",
"@types/jest": "^27.4.1",
"@types/sinon": "^9.0.11",
"aws-cdk": "0.0.0",
"jest": "^27.5.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-accessanalyzer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.0"
"@types/jest": "^27.4.1"
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-acmpca/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.0"
"@types/jest": "^27.4.1"
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-amazonmq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.0"
"@types/jest": "^27.4.1"
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-amplify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.0",
"@types/jest": "^27.4.1",
"@types/yaml": "1.9.6",
"aws-sdk": "^2.848.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ export abstract class ResourceBase extends ResourceConstruct implements IResourc

const template = new Array<string>();

template.push('#set($origin = $input.params("Origin"))');
template.push('#if($origin == "") #set($origin = $input.params("origin")) #end');
template.push('#set($origin = $input.params().header.get("Origin"))');
template.push('#if($origin == "") #set($origin = $input.params().header.get("origin")) #end');

const condition = origins.map(o => `$origin.matches("${o}")`).join(' || ');

Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/usage-plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CfnUsagePlan, CfnUsagePlanKey } from './apigateway.generated';
import { Method } from './method';
import { IRestApi } from './restapi';
import { Stage } from './stage';
import { validateInteger } from './util';
import { validateDouble, validateInteger } from './util';

/**
* Container for defining throttling parameters to API stages or methods.
Expand Down Expand Up @@ -316,7 +316,7 @@ export class UsagePlan extends UsagePlanBase {
const burstLimit = props.burstLimit;
validateInteger(burstLimit, 'Throttle burst limit');
const rateLimit = props.rateLimit;
validateInteger(rateLimit, 'Throttle rate limit');
validateDouble(rateLimit, 'Throttle rate limit');

ret = {
burstLimit: burstLimit,
Expand Down
6 changes: 6 additions & 0 deletions packages/@aws-cdk/aws-apigateway/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export function validateInteger(property: number | undefined, messagePrefix: str
}
}

export function validateDouble(property: number | undefined, messagePrefix: string) {
if (property && isNaN(property) && isNaN(parseFloat(property.toString()))) {
throw new Error(`${messagePrefix} should be an double`);
}
}

export class JsonSchemaMapper {
/**
* Transforms naming of some properties to prefix with a $, where needed
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.0"
"@types/jest": "^27.4.1"
},
"dependencies": {
"@aws-cdk/aws-certificatemanager": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/test/cors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ describe('cors', () => {
'method.response.header.Access-Control-Allow-Methods': "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'",
},
ResponseTemplates: {
'application/json': '#set($origin = $input.params("Origin"))\n#if($origin == "") #set($origin = $input.params("origin")) #end\n#if($origin.matches("https://amazon.com") || $origin.matches("https://aws.amazon.com"))\n #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin)\n#end',
'application/json': '#set($origin = $input.params().header.get("Origin"))\n#if($origin == "") #set($origin = $input.params().header.get("origin")) #end\n#if($origin.matches("https://amazon.com") || $origin.matches("https://aws.amazon.com"))\n #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin)\n#end',
},
StatusCode: '204',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"corsapitest8682546E"
]
},
"corsapitestDeployment2BF1633A228079ea05e5799220dd4ca13512b92d": {
"corsapitestDeployment2BF1633A51392cbce1ac2785bd0e53063423e203": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"RestApiId": {
Expand All @@ -74,7 +74,7 @@
"Ref": "corsapitest8682546E"
},
"DeploymentId": {
"Ref": "corsapitestDeployment2BF1633A228079ea05e5799220dd4ca13512b92d"
"Ref": "corsapitestDeployment2BF1633A51392cbce1ac2785bd0e53063423e203"
},
"StageName": "prod"
},
Expand Down Expand Up @@ -472,7 +472,7 @@
"method.response.header.Access-Control-Allow-Methods": "'OPTIONS,GET,PUT,POST,DELETE,PATCH,HEAD'"
},
"ResponseTemplates": {
"application/json": "#set($origin = $input.params(\"Origin\"))\n#if($origin == \"\") #set($origin = $input.params(\"origin\")) #end\n#if($origin.matches(\"https://www.test-cors.org\"))\n #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin)\n#end"
"application/json": "#set($origin = $input.params().header.get(\"Origin\"))\n#if($origin == \"\") #set($origin = $input.params().header.get(\"origin\")) #end\n#if($origin.matches(\"https://www.test-cors.org\"))\n #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin)\n#end"
},
"StatusCode": "204"
}
Expand Down
55 changes: 53 additions & 2 deletions packages/@aws-cdk/aws-apigateway/test/usage-plan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ describe('usage plan', () => {
});
});

test('usage plan with throttling limits', () => {
test('usage plan with integer throttling limits', () => {
// GIVEN
const stack = new cdk.Stack();
const api = new apigateway.RestApi(stack, 'my-api', { cloudWatchRole: false, deploy: true, deployOptions: { stageName: 'test' } });
const method: apigateway.Method = api.root.addMethod('GET'); // Need at least one method on the api
const usagePlanName = 'Basic';
const usagePlanDescription = 'Basic Usage Plan with throttling limits';
const usagePlanDescription = 'Basic Usage Plan with integer throttling limits';

// WHEN
new apigateway.UsagePlan(stack, 'my-usage-plan', {
Expand Down Expand Up @@ -78,6 +78,57 @@ describe('usage plan', () => {
});
});

test('usage plan with integer and float throttling limits', () => {
// GIVEN
const stack = new cdk.Stack();
const api = new apigateway.RestApi(stack, 'my-api', { cloudWatchRole: false, deploy: true, deployOptions: { stageName: 'test' } });
const method: apigateway.Method = api.root.addMethod('GET'); // Need at least one method on the api
const usagePlanName = 'Basic';
const usagePlanDescription = 'Basic Usage Plan with integer and float throttling limits';

// WHEN
new apigateway.UsagePlan(stack, 'my-usage-plan', {
name: usagePlanName,
description: usagePlanDescription,
apiStages: [
{
stage: api.deploymentStage,
throttle: [
{
method,
throttle: {
burstLimit: 20,
rateLimit: 10.5,
},
},
],
},
],
});

// THEN
Template.fromStack(stack).hasResourceProperties(RESOURCE_TYPE, {
UsagePlanName: usagePlanName,
Description: usagePlanDescription,
ApiStages: [
{
ApiId: {
Ref: 'myapi4C7BF186',
},
Stage: {
Ref: 'myapiDeploymentStagetest4A4AB65E',
},
Throttle: {
'//GET': {
BurstLimit: 20,
RateLimit: 10.5,
},
},
},
],
});
});

test('usage plan with blocked methods', () => {
// GIVEN
const stack = new cdk.Stack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/aws-lambda": "^8.10.92",
"@types/jest": "^27.4.0"
"@types/jest": "^27.4.1"
},
"dependencies": {
"@aws-cdk/aws-apigatewayv2": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.4.0"
"@types/jest": "^27.4.1"
},
"dependencies": {
"@aws-cdk/aws-apigatewayv2": "0.0.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/@aws-cdk/aws-apigatewayv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,12 @@ webSocketApi.addRoute('sendmessage', {
});
```

To import an existing WebSocketApi:

```ts
const webSocketApi = apigwv2.WebSocketApi.fromWebSocketApiAttributes(this, 'mywsapi', { webSocketId: 'api-1234' });
```

### Manage Connections Permission

Grant permission to use API Gateway Management API of a WebSocket API by calling the `grantManageConnections` API.
Expand Down
36 changes: 36 additions & 0 deletions packages/@aws-cdk/aws-apigatewayv2/lib/websocket/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,47 @@ export interface WebSocketApiProps {
readonly defaultRouteOptions?: WebSocketRouteOptions;
}

/**
* Attributes for importing a WebSocketApi into the CDK
*/
export interface WebSocketApiAttributes {
/**
* The identifier of the WebSocketApi
*/
readonly webSocketId: string;

/**
* The endpoint URL of the WebSocketApi
* @default - throw san error if apiEndpoint is accessed.
*/
readonly apiEndpoint?: string;
}


/**
* Create a new API Gateway WebSocket API endpoint.
* @resource AWS::ApiGatewayV2::Api
*/
export class WebSocketApi extends ApiBase implements IWebSocketApi {
/**
* Import an existing WebSocket API into this CDK app.
*/
public static fromWebSocketApiAttributes(scope: Construct, id: string, attrs: WebSocketApiAttributes): IWebSocketApi {
class Import extends ApiBase {
public readonly apiId = attrs.webSocketId;
public readonly websocketApiId = attrs.webSocketId;
private readonly _apiEndpoint = attrs.apiEndpoint;

public get apiEndpoint(): string {
if (!this._apiEndpoint) {
throw new Error('apiEndpoint is not configured on the imported WebSocketApi.');
}
return this._apiEndpoint;
}
}
return new Import(scope, id);
}

public readonly apiId: string;
public readonly apiEndpoint: string;

Expand Down
Loading

0 comments on commit 831f97f

Please sign in to comment.