Skip to content

Commit

Permalink
Merge branch 'master' into fix/fromResourceAttr
Browse files Browse the repository at this point in the history
  • Loading branch information
skinny85 authored Nov 6, 2020
2 parents be6be66 + 52da8cb commit c28dacd
Show file tree
Hide file tree
Showing 54 changed files with 1,848 additions and 949 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ What is the unexpected behavior you were seeing? If you got an error, paste it h

### Environment

- **CLI Version :**
- **CDK CLI Version :**
- **Framework Version:**
- **Node.js Version:** <!-- Version of Node.js (run the command `node -v`) -->
- **OS :**
Expand Down
43 changes: 42 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,55 @@

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.72.0](https://github.com/aws/aws-cdk/compare/v1.71.0...v1.72.0) (2020-11-06)


### ⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES

* **rds:** Serverless cluster `enableHttpEndpoint` renamed to `enableDataApi`
* **stepfunctions-tasks:** type of `outputLocation` in the experimental Athena `StartQueryExecution` has been changed to `s3.Location` from `string`

### Features

* **apigatewayv2:** http api - endpoint url ([#11092](https://github.com/aws/aws-cdk/issues/11092)) ([c200413](https://github.com/aws/aws-cdk/commit/c20041356940c5569c00e82f9e6bee794002929b)), closes [#10651](https://github.com/aws/aws-cdk/issues/10651)
* **apigatewayv2:** vpc link and private integrations ([#11198](https://github.com/aws/aws-cdk/issues/11198)) ([e87a6a3](https://github.com/aws/aws-cdk/commit/e87a6a333c06d157f6d9074e05f251505525d0d5)), closes [#10531](https://github.com/aws/aws-cdk/issues/10531) [#10119](https://github.com/aws/aws-cdk/issues/10119) [aws/jsii#1947](https://github.com/aws/jsii/issues/1947)
* **appmesh:** add Virtual Gateways and Gateway Routes ([#10879](https://github.com/aws/aws-cdk/issues/10879)) ([79200e7](https://github.com/aws/aws-cdk/commit/79200e75b2468ccdee46154d049f3ceb30bb51e1))
* **appsync:** add RDS datasource ([#9258](https://github.com/aws/aws-cdk/issues/9258)) ([23d0943](https://github.com/aws/aws-cdk/commit/23d0943216df76bea395b319deb21282e4c57a7c)), closes [#9152](https://github.com/aws/aws-cdk/issues/9152)
* **appsync:** support custom cloudWatchLogsRoleArn for GraphqlApi ([#10357](https://github.com/aws/aws-cdk/issues/10357)) ([bed89a5](https://github.com/aws/aws-cdk/commit/bed89a5d0aabe7d9a25ad7fac74a38f03b92e4c9)), closes [#9441](https://github.com/aws/aws-cdk/issues/9441)
* **ec2:** Add Lambda interface endpoint ([#11260](https://github.com/aws/aws-cdk/issues/11260)) ([9d0c935](https://github.com/aws/aws-cdk/commit/9d0c935fc62f325105598473e39b47b247437146)), closes [#11259](https://github.com/aws/aws-cdk/issues/11259)
* intro "Names.uniqueId()" instead of the deprecated "node.uniqueId" ([#11166](https://github.com/aws/aws-cdk/issues/11166)) ([5e433b1](https://github.com/aws/aws-cdk/commit/5e433b1d52470c3ecf5a460f79e4b8103542c35c)), closes [aws/constructs#314](https://github.com/aws/constructs/issues/314)
* **ecs-patterns:** add option to create cname instead of alias record ([#10812](https://github.com/aws/aws-cdk/issues/10812)) ([89a5055](https://github.com/aws/aws-cdk/commit/89a505524ae3fe1c726d6988df07da6167493480))
* **ecs-service-extensions:** create an `Environment` from attributes ([#10932](https://github.com/aws/aws-cdk/issues/10932)) ([d395b5e](https://github.com/aws/aws-cdk/commit/d395b5e618fc423c46c65b9be40d0c1423e2b578)), closes [#10931](https://github.com/aws/aws-cdk/issues/10931)
* **rds:** add grant method for Data API ([#10748](https://github.com/aws/aws-cdk/issues/10748)) ([884539b](https://github.com/aws/aws-cdk/commit/884539b231245c893c456b2c619fe661cd39960f)), closes [#10744](https://github.com/aws/aws-cdk/issues/10744)


### Bug Fixes

* **apigateway:** changes to gateway response does not trigger auto deployment ([#11068](https://github.com/aws/aws-cdk/issues/11068)) ([0c8264a](https://github.com/aws/aws-cdk/commit/0c8264adf782d1adbfe8d538186a71093d9c8834)), closes [#10963](https://github.com/aws/aws-cdk/issues/10963)
* **cfnspec:** incorrect Route 53 health check configuration properties in CloudFormation specification ([#11280](https://github.com/aws/aws-cdk/issues/11280)) ([f3c8b50](https://github.com/aws/aws-cdk/commit/f3c8b5034eb7ad1ccd9eecb4a929c8f11a2336d0)), closes [#issuecomment-717435271](https://github.com/aws/aws-cdk/issues/11096#issuecomment-717435271) [#11096](https://github.com/aws/aws-cdk/issues/11096)
* **cli:** `--no-previous-parameters` incorrectly skips updates ([#11288](https://github.com/aws/aws-cdk/issues/11288)) ([1bfc649](https://github.com/aws/aws-cdk/commit/1bfc64948b6ac63f93f030c5a2064b3ac4376289))
* **core:** many nested stacks make NodeJS run out of memory ([#11250](https://github.com/aws/aws-cdk/issues/11250)) ([c124886](https://github.com/aws/aws-cdk/commit/c124886fbcabea166f34250cad84f7526e05b1bf))
* **core:** multiple library copies lead to 'Assets must be defined within Stage or App' error ([#11113](https://github.com/aws/aws-cdk/issues/11113)) ([fcfed39](https://github.com/aws/aws-cdk/commit/fcfed39e3524eef66d3638896bf4ca86697f1718)), closes [#10314](https://github.com/aws/aws-cdk/issues/10314)
* **core:** support docker engine v20.10.0-beta1 ([#11124](https://github.com/aws/aws-cdk/issues/11124)) ([87887a3](https://github.com/aws/aws-cdk/commit/87887a3faf24f5fde608135429585c6521637764))
* **dynamodb:** Misconfigured metrics causing empty graphs ([#11283](https://github.com/aws/aws-cdk/issues/11283)) ([9968669](https://github.com/aws/aws-cdk/commit/9968669e4f4602a03de67e12bc5636a4f4bb1fd7))
* **ecs:** redirect config should honor openListener flag ([#11115](https://github.com/aws/aws-cdk/issues/11115)) ([ed6e7ed](https://github.com/aws/aws-cdk/commit/ed6e7ed9ebee7dc8932c35885698fc72e2052085))
* **event-targets:** circular dependency when the lambda target is in a different stack ([#11217](https://github.com/aws/aws-cdk/issues/11217)) ([e21f249](https://github.com/aws/aws-cdk/commit/e21f249f7b9c78ed5948d63e7650ee7b8d5b3f8b)), closes [#10942](https://github.com/aws/aws-cdk/issues/10942)
* **pipelines:** asset stage can't support more than 50 assets ([#11284](https://github.com/aws/aws-cdk/issues/11284)) ([5db8e80](https://github.com/aws/aws-cdk/commit/5db8e8018d2b8304025b7e61178c7a747c778a78)), closes [#9353](https://github.com/aws/aws-cdk/issues/9353)
* **secretsmanager:** can't export secret name from Secret ([#11202](https://github.com/aws/aws-cdk/issues/11202)) ([5dcdecb](https://github.com/aws/aws-cdk/commit/5dcdecb2c5d6ce19517af66090cfacabed88025b)), closes [#10914](https://github.com/aws/aws-cdk/issues/10914)
* **secretsmanager:** Secret.fromSecretName doesn't work with ECS ([#11042](https://github.com/aws/aws-cdk/issues/11042)) ([fe1ce73](https://github.com/aws/aws-cdk/commit/fe1ce73ec59fc3ad9d8b138ba2122303e77c0531)), closes [#10309](https://github.com/aws/aws-cdk/issues/10309) [#10519](https://github.com/aws/aws-cdk/issues/10519)
* **stepfunctions:** stack overflow when referenced json path finding encounters a circular object graph ([#11225](https://github.com/aws/aws-cdk/issues/11225)) ([f14d823](https://github.com/aws/aws-cdk/commit/f14d823279e4dbb6ac90ab21d219257b22b81278)), closes [#9319](https://github.com/aws/aws-cdk/issues/9319)
* **stepfunctions-tasks:** Athena* APIs have incorrect supported integration patterns ([#11188](https://github.com/aws/aws-cdk/issues/11188)) ([0f66833](https://github.com/aws/aws-cdk/commit/0f6683394fa6f96d6839b2c107f3dab8045509b4)), closes [#11045](https://github.com/aws/aws-cdk/issues/11045) [#11246](https://github.com/aws/aws-cdk/issues/11246)
* **stepfunctions-tasks:** incorrect S3 permissions for AthenaStartQueryExecution ([#11203](https://github.com/aws/aws-cdk/issues/11203)) ([b35c423](https://github.com/aws/aws-cdk/commit/b35c423644fbd8f20705c16c0809a9fb93e6d6f3))
* explicitly set the 'ImagePullPrincipalType' of image ([#11264](https://github.com/aws/aws-cdk/issues/11264)) ([29aa223](https://github.com/aws/aws-cdk/commit/29aa223f05b5f012b42b662e7a9fcc8fe82167a7)), closes [#10569](https://github.com/aws/aws-cdk/issues/10569)

## [1.71.0](https://github.com/aws/aws-cdk/compare/v1.70.0...v1.71.0) (2020-10-29)


### ⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES

* **synthetics:** `runtime` is now a required property.

### ⚠ BREAKING CHANGES
### ⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES

* **core:** Creation stack traces for `Lazy` values are no longer
captured by default. The `CDK_DEBUG=true` environment variable must be
Expand Down
2 changes: 1 addition & 1 deletion bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
set -euo pipefail
scriptdir=$(cd $(dirname $0) && pwd)
cd ${scriptdir}
yarn
yarn --frozen-lockfile
${scriptdir}/scripts/bump.js ${1:-minor}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Container } from './container';
import { ServiceExtension, ServiceBuild } from './extension-interfaces';

// The version of the App Mesh envoy sidecar to add to the task.
const APP_MESH_ENVOY_SIDECAR_VERSION = 'v1.15.0.0-prod';
const APP_MESH_ENVOY_SIDECAR_VERSION = 'v1.15.1.0-prod';

/**
* The settings for the App Mesh extension.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@
{
"Ref": "AWS::URLSuffix"
},
"/aws-appmesh-envoy:v1.15.0.0-prod"
"/aws-appmesh-envoy:v1.15.1.0-prod"
]
]
},
Expand Down Expand Up @@ -1596,7 +1596,7 @@
{
"Ref": "AWS::URLSuffix"
},
"/aws-appmesh-envoy:v1.15.0.0-prod"
"/aws-appmesh-envoy:v1.15.1.0-prod"
]
]
},
Expand Down Expand Up @@ -2584,7 +2584,7 @@
{
"Ref": "AWS::URLSuffix"
},
"/aws-appmesh-envoy:v1.15.0.0-prod"
"/aws-appmesh-envoy:v1.15.1.0-prod"
]
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@
{
"Ref": "AWS::URLSuffix"
},
"/aws-appmesh-envoy:v1.15.0.0-prod"
"/aws-appmesh-envoy:v1.15.1.0-prod"
]
]
},
Expand Down Expand Up @@ -1710,7 +1710,7 @@
{
"Ref": "AWS::URLSuffix"
},
"/aws-appmesh-envoy:v1.15.0.0-prod"
"/aws-appmesh-envoy:v1.15.1.0-prod"
]
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export = {
{
Ref: 'AWS::URLSuffix',
},
'/aws-appmesh-envoy:v1.15.0.0-prod',
'/aws-appmesh-envoy:v1.15.1.0-prod',
],
],
},
Expand Down
9 changes: 4 additions & 5 deletions packages/@aws-cdk/aws-apigateway/lib/api-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IResource as IResourceBase, Resource, Stack } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CfnApiKey } from './apigateway.generated';
import { ResourceOptions } from './resource';
import { RestApi } from './restapi';
import { IRestApi } from './restapi';
import { QuotaSettings, ThrottleSettings, UsagePlan, UsagePlanPerApiStage } from './usage-plan';

/**
Expand Down Expand Up @@ -47,11 +47,10 @@ export interface ApiKeyOptions extends ResourceOptions {
*/
export interface ApiKeyProps extends ApiKeyOptions {
/**
* [disable-awslint:ref-via-interface]
* A list of resources this api key is associated with.
* @default none
*/
readonly resources?: RestApi[];
readonly resources?: IRestApi[];

/**
* An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.
Expand Down Expand Up @@ -183,12 +182,12 @@ export class ApiKey extends ApiKeyBase {
});
}

private renderStageKeys(resources: RestApi[] | undefined): CfnApiKey.StageKeyProperty[] | undefined {
private renderStageKeys(resources: IRestApi[] | undefined): CfnApiKey.StageKeyProperty[] | undefined {
if (!resources) {
return undefined;
}

return resources.map((resource: RestApi) => {
return resources.map((resource: IRestApi) => {
const restApi = resource;
const restApiId = restApi.restApiId;
const stageName = restApi.deploymentStage!.stageName.toString();
Expand Down
6 changes: 6 additions & 0 deletions packages/@aws-cdk/aws-apigateway/lib/json-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ export interface JsonSchema {
readonly title?: string;
readonly description?: string;
readonly 'enum'?: any[];
/**
* The default value if you use an enum.
*
* @default - not set
*/
readonly default?: any;
readonly format?: string;
readonly definitions?: { [name: string]: JsonSchema };

Expand Down
20 changes: 10 additions & 10 deletions packages/@aws-cdk/aws-apigateway/lib/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,16 @@ export abstract class RestApiBase extends Resource implements IRestApi {
});
}

/**
* Add an ApiKey
*/
public addApiKey(id: string, options?: ApiKeyOptions): IApiKey {
return new ApiKey(this, id, {
resources: [this],
...options,
});
}

/**
* Returns the given named metric for this API
*/
Expand Down Expand Up @@ -706,16 +716,6 @@ export class RestApi extends RestApiBase {
return this.urlForPath();
}

/**
* Add an ApiKey
*/
public addApiKey(id: string, options?: ApiKeyOptions): IApiKey {
return new ApiKey(this, id, {
resources: [this],
...options,
});
}

/**
* Adds a new model.
*/
Expand Down
28 changes: 28 additions & 0 deletions packages/@aws-cdk/aws-apigateway/test/restapi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,34 @@ describe('restapi', () => {
},
});
});

test('addApiKey is supported', () => {
// GIVEN
const stack = new Stack();
const api = new apigw.SpecRestApi(stack, 'myapi', {
apiDefinition: apigw.ApiDefinition.fromInline({ foo: 'bar' }),
});
api.root.addMethod('OPTIONS');

// WHEN
api.addApiKey('myapikey', {
apiKeyName: 'myApiKey1',
value: '01234567890ABCDEFabcdef',
});

// THEN
expect(stack).toHaveResource('AWS::ApiGateway::ApiKey', {
Enabled: true,
Name: 'myApiKey1',
StageKeys: [
{
RestApiId: { Ref: 'myapi162F20B8' },
StageName: { Ref: 'myapiDeploymentStageprod329F21FF' },
},
],
Value: '01234567890ABCDEFabcdef',
});
});
});

describe('Metrics', () => {
Expand Down
16 changes: 16 additions & 0 deletions packages/@aws-cdk/aws-apigateway/test/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,21 @@ describe('util', () => {
required: ['ref'],
});
});

test('"default" for enum', () => {
const schema: JsonSchema = {
type: JsonSchemaType.STRING,
enum: ['green', 'blue', 'red'],
default: 'blue',
};

const actual = JsonSchemaMapper.toCfnJsonSchema(schema);
expect(actual).toEqual({
$schema: 'http://json-schema.org/draft-04/schema#',
type: 'string',
enum: ['green', 'blue', 'red'],
default: 'blue',
});
});
});
});
16 changes: 15 additions & 1 deletion packages/@aws-cdk/aws-cloudwatch/lib/alarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,18 @@ export class Alarm extends AlarmBase {
};
},
withExpression(expr, conf) {

const hasSubmetrics = mathExprHasSubmetrics(expr);

if (hasSubmetrics) {
assertSubmetricsCount(expr);
}

return {
expression: expr.expression,
id: entry.id || uniqueMetricId(),
label: conf.renderingProperties?.label,
period: mathExprHasSubmetrics(expr) ? undefined : expr.period,
period: hasSubmetrics ? undefined : expr.period,
returnData: entry.tag ? undefined : false, // Tag stores "primary" attribute, default is "true"
};
},
Expand Down Expand Up @@ -344,4 +351,11 @@ function mathExprHasSubmetrics(expr: MetricExpressionConfig) {
return Object.keys(expr.usingMetrics).length > 0;
}

function assertSubmetricsCount(expr: MetricExpressionConfig) {
if (Object.keys(expr.usingMetrics).length > 10) {
// https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-on-metric-math-expressions
throw new Error('Alarms on math expressions cannot contain more than 10 individual metrics');
};
}

type Writeable<T> = { -readonly [P in keyof T]: T[P] };
34 changes: 33 additions & 1 deletion packages/@aws-cdk/aws-cloudwatch/test/test.alarm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,46 @@ import { ABSENT, expect, haveResource } from '@aws-cdk/assert';
import { Duration, Stack } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { Test } from 'nodeunit';
import { Alarm, IAlarm, IAlarmAction, Metric } from '../lib';
import { Alarm, IAlarm, IAlarmAction, Metric, MathExpression, IMetric } from '../lib';

const testMetric = new Metric({
namespace: 'CDK/Test',
metricName: 'Metric',
});

export = {

'alarm does not accept a math expression with more than 10 metrics'(test: Test) {

const stack = new Stack();

const usingMetrics: Record<string, IMetric> = {};

for (const i of [...Array(15).keys()]) {
const metricName = `metric${i}`;
usingMetrics[metricName] = new Metric({
namespace: 'CDK/Test',
metricName: metricName,
});
}

const math = new MathExpression({
expression: 'a',
usingMetrics,
});

test.throws(() => {

new Alarm(stack, 'Alarm', {
metric: math,
threshold: 1000,
evaluationPeriods: 3,
});

}, /Alarms on math expressions cannot contain more than 10 individual metrics/);

test.done();
},
'can make simple alarm'(test: Test) {
// GIVEN
const stack = new Stack();
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codepipeline-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@aws-cdk/aws-cloudtrail": "0.0.0",
"@types/lodash": "^4.14.164",
"@types/lodash": "^4.14.165",
"@types/nodeunit": "^0.0.31",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-cognito/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export * from './user-pool';
export * from './user-pool-attr';
export * from './user-pool-client';
export * from './user-pool-domain';
export * from './user-pool-idp';
export * from './user-pool-idp';
export * from './user-pool-idps';
Loading

0 comments on commit c28dacd

Please sign in to comment.