Skip to content

Commit 2bb9d2f

Browse files
authored
2 parents 69a50f1 + 0230f26 commit 2bb9d2f

File tree

323 files changed

+5743
-2407
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

323 files changed

+5743
-2407
lines changed

.github/workflows/issue-label-assign.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ env:
8181
{"area":"@aws-cdk/aws-appintegrations","keywords":["(aws-appintegrations)","(appintegrations)"],"labels":["@aws-cdk/aws-appintegrations"],"assignees":["skinny85"]},
8282
{"area":"@aws-cdk/aws-applicationautoscaling","keywords":["aws-applicationautoscaling","application-autoscaling","scalabletarget"],"labels":["@aws-cdk/aws-applicationautoscaling"],"assignees":["comcalvi"]},
8383
{"area":"@aws-cdk/aws-applicationinsights","keywords":["aws-applicationinsights","application-insights"],"labels":["@aws-cdk/aws-applicationinsights"],"assignees":["corymhall"]},
84-
{"area":"@aws-cdk/aws-appmesh","keywords":["aws-appmesh","app-mesh","GatewayRoute","VirtualGateway","VirtualNode","VirtualRouter","VirtualService"],"labels":["@aws-cdk/aws-appmesh"],"assignees":["Seiya6329"]},
84+
{"area":"@aws-cdk/aws-appmesh","keywords":["aws-appmesh","app-mesh","GatewayRoute","VirtualGateway","VirtualNode","VirtualRouter","VirtualService"],"labels":["@aws-cdk/aws-appmesh"],"assignees":["ytsssun"]},
8585
{"area":"@aws-cdk/aws-appstream","keywords":["aws-appstream","app-stream"],"labels":["@aws-cdk/aws-appstream"],"assignees":["madeline-k"]},
8686
{"area":"@aws-cdk/aws-appsync","keywords":["aws-appsync","app-sync","appsyncfunction","graphqlapi","dynamodbdatasource","lambdadatasource","nonedatasource","rdsdatasource","resolver"],"labels":["@aws-cdk/aws-appsync"],"assignees":["otaviomacedo"]},
8787
{"area":"@aws-cdk/aws-athena","keywords":["aws-athena","athena","cfndatacatalog","cfnnamedquery","cfnworkgroup"],"labels":["@aws-cdk/aws-athena"],"assignees":["comcalvi"]},
@@ -273,5 +273,6 @@ env:
273273
{"area":"@aws-cdk/yaml-cfn","keywords":["(aws-yaml-cfn)","(yaml-cfn)"],"labels":["@aws-cdk/aws-yaml-cfn"],"assignees":["skinny85"]},
274274
{"area":"@aws-cdk/aws-apprunner","keywords":["apprunner","aws-apprunner"],"labels":["@aws-cdk/aws-apprunner"],"assignees":["corymhall"]},
275275
{"area":"@aws-cdk/aws-lightsail","keywords":["lightsail","aws-lightsail"],"labels":["@aws-cdk/aws-lightsail"],"assignees":["corymhall"]},
276-
{"area":"@aws-cdk/aws-aps","keywords":["aps","aws-aps","prometheus"],"labels":["@aws-cdk/aws-aps"],"assignees":["corymhall"]}
276+
{"area":"@aws-cdk/aws-aps","keywords":["aps","aws-aps","prometheus"],"labels":["@aws-cdk/aws-aps"],"assignees":["corymhall"]},
277+
{"area":"@aws-cdk/triggers","keywords":["trigger","aws-cdk/triggers","triggers"],"labels":["@aws-cdk/triggers"],"assignees":["otaviomacedo"]}
277278
]

.github/workflows/yarn-upgrade.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,4 @@ jobs:
115115
team-reviewers: aws-cdk-team
116116
# Github prevents further Github actions to be run if the default Github token is used.
117117
# Instead use a privileged token here, so further GH actions can be triggered on this PR.
118-
token: ${{ secrets.AUTOMATION_GITHUB_TOKEN }}
118+
token: ${{ secrets.PROJEN_GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22

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.
44

5+
## [1.149.0](https://github.com/aws/aws-cdk/compare/v1.148.0...v1.149.0) (2022-03-17)
6+
7+
8+
### Features
9+
10+
* **appsync:** add OpenSearch domain data source ([#16529](https://github.com/aws/aws-cdk/issues/16529)) ([922a9dc](https://github.com/aws/aws-cdk/commit/922a9dcf07174334ac67b9fcbacb01aafdfd9c6a)), closes [#16528](https://github.com/aws/aws-cdk/issues/16528)
11+
* **assertions:** Add the `hasNoXXX` methods. ([#19330](https://github.com/aws/aws-cdk/issues/19330)) ([6bdc9eb](https://github.com/aws/aws-cdk/commit/6bdc9eb52608329f1e66c420cb6c61aa942d17b0)), closes [#18874](https://github.com/aws/aws-cdk/issues/18874)
12+
* **aws-lambda-nodejs:** support additional esbuild configurations ([#17788](https://github.com/aws/aws-cdk/issues/17788)) ([ab313a4](https://github.com/aws/aws-cdk/commit/ab313a4abbec14a1886a7c87673dbc66354811ef))
13+
* **cfnspec:** cloudformation spec v60.0.0 ([#19347](https://github.com/aws/aws-cdk/issues/19347)) ([20da648](https://github.com/aws/aws-cdk/commit/20da648cebddd6feaf8a54d2bf40f3ba3bd30979))
14+
* **cli:** parallel asset publishing ([#19367](https://github.com/aws/aws-cdk/issues/19367)) ([c8cafef](https://github.com/aws/aws-cdk/commit/c8cafefc4cd98e7217973cd9eb0e92263a916b4f)), closes [#19193](https://github.com/aws/aws-cdk/issues/19193)
15+
* **ec2:** add support for x2idn and x2iedn instances ([#19334](https://github.com/aws/aws-cdk/issues/19334)) ([9699efc](https://github.com/aws/aws-cdk/commit/9699efc0c0b0e2b265daf824147be2827555cafa))
16+
* **elbv2:** add name validation for target group and load balancer names ([#19385](https://github.com/aws/aws-cdk/issues/19385)) ([97e0973](https://github.com/aws/aws-cdk/commit/97e09730cbb7c155e6697ace166348064d810449)), closes [/docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#cfn-elasticloadbalancingv2](https://github.com/aws//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html/issues/cfn-elasticloadbalancingv2) [/docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html#cfn-elasticloadbalancingv2](https://github.com/aws//docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-loadbalancer.html/issues/cfn-elasticloadbalancingv2)
17+
* **iotevents:** support SetVariable action ([#19305](https://github.com/aws/aws-cdk/issues/19305)) ([c222b12](https://github.com/aws/aws-cdk/commit/c222b122206e00dc9932639efd54d78a16ebf6d3))
18+
* **lambda:** dotnet6 runtime ([#19144](https://github.com/aws/aws-cdk/issues/19144)) ([bbed27d](https://github.com/aws/aws-cdk/commit/bbed27d95ab2724db937964d01aec5564a77e84f))
19+
* **synthetics:** add vpc configuration ([#18447](https://github.com/aws/aws-cdk/issues/18447)) ([c991e92](https://github.com/aws/aws-cdk/commit/c991e92453034330b68daa5b5721119e770b6109)), closes [#11865](https://github.com/aws/aws-cdk/issues/11865) [#9954](https://github.com/aws/aws-cdk/issues/9954)
20+
21+
22+
### Bug Fixes
23+
24+
* **cli:** failure to load malformed YAML is swallowed ([#19338](https://github.com/aws/aws-cdk/issues/19338)) ([1875c28](https://github.com/aws/aws-cdk/commit/1875c28865690d59c22939039a5d0e37039ab63c)), closes [#19335](https://github.com/aws/aws-cdk/issues/19335)
25+
* **lambda-event-sources:** increase batch size restriction ([#19317](https://github.com/aws/aws-cdk/issues/19317)) ([1bc5144](https://github.com/aws/aws-cdk/commit/1bc5144b05938829f90b89001ccda8fd4aefe343)), closes [#19285](https://github.com/aws/aws-cdk/issues/19285)
26+
* **lambda-nodejs:** cannot use esbuildArgs with older esbuild versions ([#19343](https://github.com/aws/aws-cdk/issues/19343)) ([59a4d81](https://github.com/aws/aws-cdk/commit/59a4d81cc712eedfd755232d157a2e492eb3d886))
27+
* **stepfunctions-tasks:** migrate from deprecated batch properties ([#19298](https://github.com/aws/aws-cdk/issues/19298)) ([75f5b3b](https://github.com/aws/aws-cdk/commit/75f5b3b69abf592b2c6d0ec6c19c374754e50f97)), closes [#18993](https://github.com/aws/aws-cdk/issues/18993)
28+
529
## [1.148.0](https://github.com/aws/aws-cdk/compare/v1.147.0...v1.148.0) (2022-03-09)
630

731

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ specific to the CDK.
8989

9090
### Build
9191

92-
The full build of the CDK takes a long time complete; 1-2 hours depending on the performance of the build machine.
92+
The full build of the CDK takes a long time to complete; 1-2 hours depending on the performance of the build machine.
9393
However, most first time contributions will require changing only one CDK module, sometimes two. A full build of the
9494
CDK is not required in these cases.
9595

@@ -481,7 +481,7 @@ grantAwesomePowerBeta1();
481481
```
482482

483483
Times goes by, we get feedback that this method will actually be much better
484-
if it accept a `Principal`. Since adding a required property is a breaking
484+
if it accepts a `Principal`. Since adding a required property is a breaking
485485
change, we will add `grantAwesomePowerBeta2()` and deprecate
486486
`grantAwesomePowerBeta1`:
487487

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"devDependencies": {
1818
"@yarnpkg/lockfile": "^1.1.0",
19-
"cdk-generate-synthetic-examples": "^0.1.6",
19+
"cdk-generate-synthetic-examples": "^0.1.8",
2020
"conventional-changelog-cli": "^2.2.2",
2121
"fs-extra": "^9.1.0",
2222
"graceful-fs": "^4.2.9",

packages/@aws-cdk/assertions/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,9 @@ Annotations.fromStack(stack).hasError(
550550

551551
Here are the available APIs for `Annotations`:
552552

553-
- `hasError()` and `findError()`
554-
- `hasWarning()` and `findWarning()`
555-
- `hasInfo()` and `findInfo()`
553+
- `hasError()`, `hasNoError()`, and `findError()`
554+
- `hasWarning()`, `hasNoWarning()`, and `findWarning()`
555+
- `hasInfo()`, `hasNoInfo()`, and `findInfo()`
556556

557557
The corresponding `findXxx()` API is complementary to the `hasXxx()` API, except instead
558558
of asserting its presence, it returns the set of matching messages.

packages/@aws-cdk/assertions/lib/annotations.ts

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Stack, Stage } from '@aws-cdk/core';
22
import { SynthesisMessage } from '@aws-cdk/cx-api';
33
import { Messages } from './private/message';
4-
import { findMessage, hasMessage } from './private/messages';
4+
import { findMessage, hasMessage, hasNoMessage } from './private/messages';
55

66
/**
77
* Suite of assertions that can be run on a CDK Stack.
@@ -35,6 +35,19 @@ export class Annotations {
3535
}
3636
}
3737

38+
/**
39+
* Assert that an error with the given message does not exist in the synthesized CDK `Stack`.
40+
*
41+
* @param constructPath the construct path to the error. Provide `'*'` to match all errors in the template.
42+
* @param message the error message as should be expected. This should be a string or Matcher object.
43+
*/
44+
public hasNoError(constructPath: string, message: any): void {
45+
const matchError = hasNoMessage(this._messages, constructPath, constructMessage('error', message));
46+
if (matchError) {
47+
throw new Error(matchError);
48+
}
49+
}
50+
3851
/**
3952
* Get the set of matching errors of a given construct path and message.
4053
*
@@ -58,6 +71,19 @@ export class Annotations {
5871
}
5972
}
6073

74+
/**
75+
* Assert that an warning with the given message does not exist in the synthesized CDK `Stack`.
76+
*
77+
* @param constructPath the construct path to the warning. Provide `'*'` to match all warnings in the template.
78+
* @param message the warning message as should be expected. This should be a string or Matcher object.
79+
*/
80+
public hasNoWarning(constructPath: string, message: any): void {
81+
const matchError = hasNoMessage(this._messages, constructPath, constructMessage('warning', message));
82+
if (matchError) {
83+
throw new Error(matchError);
84+
}
85+
}
86+
6187
/**
6288
* Get the set of matching warning of a given construct path and message.
6389
*
@@ -81,6 +107,19 @@ export class Annotations {
81107
}
82108
}
83109

110+
/**
111+
* Assert that an info with the given message does not exist in the synthesized CDK `Stack`.
112+
*
113+
* @param constructPath the construct path to the info. Provide `'*'` to match all info in the template.
114+
* @param message the info message as should be expected. This should be a string or Matcher object.
115+
*/
116+
public hasNoInfo(constructPath: string, message: any): void {
117+
const matchError = hasNoMessage(this._messages, constructPath, constructMessage('info', message));
118+
if (matchError) {
119+
throw new Error(matchError);
120+
}
121+
}
122+
84123
/**
85124
* Get the set of matching infos of a given construct path and message.
86125
*

packages/@aws-cdk/assertions/lib/private/messages.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { SynthesisMessage } from '@aws-cdk/cx-api';
22
import { Messages } from './message';
3-
import { formatFailure, matchSection } from './section';
3+
import { formatAllMatches, formatFailure, matchSection } from './section';
44

55
export function findMessage(messages: Messages, constructPath: string, props: any = {}): { [key: string]: { [key: string]: any } } {
66
const section: { [key: string]: SynthesisMessage } = messages;
@@ -32,6 +32,20 @@ export function hasMessage(messages: Messages, constructPath: string, props: any
3232
].join('\n');
3333
}
3434

35+
export function hasNoMessage(messages: Messages, constructPath: string, props: any): string | void {
36+
const section: { [key: string]: SynthesisMessage } = messages;
37+
const result = matchSection(filterPath(section, constructPath), props);
38+
39+
if (!result.match) {
40+
return;
41+
}
42+
43+
return [
44+
`Expected no matches, but stack has ${Object.keys(result.matches).length} messages as follows:`,
45+
formatAllMatches(result.matches),
46+
].join('\n');
47+
}
48+
3549
// We redact the stack trace by default because it is unnecessarily long and unintelligible.
3650
// If there is a use case for rendering the trace, we can add it later.
3751
function handleTrace(match: any, redact: boolean = true): void {

packages/@aws-cdk/assertions/lib/private/section.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ function eachEntryInSection(
4343
}
4444
}
4545

46+
export function formatAllMatches(matches: {[key: string]: any}): string {
47+
return [
48+
leftPad(JSON.stringify(matches, undefined, 2)),
49+
].join('\n');
50+
}
51+
4652
export function formatFailure(closestResult: MatchResult): string {
4753
return [
4854
'The closest result is:',

packages/@aws-cdk/assertions/test/annotations.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ describe('Messages', () => {
5050
});
5151
});
5252

53+
describe('hasNoError', () => {
54+
test('match', () => {
55+
annotations.hasNoError('/Default/Fred', Match.anyValue());
56+
});
57+
58+
test('no match', () => {
59+
expect(() => annotations.hasNoError('/Default/Foo', 'this is an error'))
60+
.toThrowError(/Expected no matches, but stack has 1 messages as follows:/);
61+
});
62+
});
63+
5364
describe('findError', () => {
5465
test('match', () => {
5566
const result = annotations.findError('*', Match.anyValue());
@@ -72,6 +83,17 @@ describe('Messages', () => {
7283
});
7384
});
7485

86+
describe('hasNoWarning', () => {
87+
test('match', () => {
88+
annotations.hasNoWarning('/Default/Foo', Match.anyValue());
89+
});
90+
91+
test('no match', () => {
92+
expect(() => annotations.hasNoWarning('/Default/Fred', 'this is a warning'))
93+
.toThrowError(/Expected no matches, but stack has 1 messages as follows:/);
94+
});
95+
});
96+
7597
describe('findWarning', () => {
7698
test('match', () => {
7799
const result = annotations.findWarning('*', Match.anyValue());
@@ -94,6 +116,17 @@ describe('Messages', () => {
94116
});
95117
});
96118

119+
describe('hasNoInfo', () => {
120+
test('match', () => {
121+
annotations.hasNoInfo('/Default/Qux', 'this info is incorrect');
122+
});
123+
124+
test('no match', () => {
125+
expect(() => annotations.hasNoInfo('/Default/Qux', 'this is an info'))
126+
.toThrowError(/Expected no matches, but stack has 1 messages as follows:/);
127+
});
128+
});
129+
97130
describe('findInfo', () => {
98131
test('match', () => {
99132
const result = annotations.findInfo('/Default/Qux', 'this is an info');

packages/@aws-cdk/aws-apigatewayv2-authorizers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"@aws-cdk/cdk-build-tools": "0.0.0",
8686
"@aws-cdk/cdk-integ-tools": "0.0.0",
8787
"@aws-cdk/pkglint": "0.0.0",
88-
"@types/aws-lambda": "^8.10.92",
88+
"@types/aws-lambda": "^8.10.93",
8989
"@types/jest": "^27.4.1"
9090
},
9191
"dependencies": {

packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ export class ScalableTarget extends Resource implements IScalableTarget {
148148
if (action.minCapacity === undefined && action.maxCapacity === undefined) {
149149
throw new Error(`You must supply at least one of minCapacity or maxCapacity, got ${JSON.stringify(action)}`);
150150
}
151+
152+
// add a warning on synth when minute is not defined in a cron schedule
153+
action.schedule._bind(this);
154+
151155
this.actions.push({
152156
scheduledActionName: id,
153157
schedule: action.schedule.expressionString,

packages/@aws-cdk/aws-applicationautoscaling/lib/schedule.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Duration } from '@aws-cdk/core';
1+
import { Annotations, Duration } from '@aws-cdk/core';
2+
import { Construct } from 'constructs';
23

34
/**
45
* Schedule for scheduled scaling actions
@@ -58,16 +59,29 @@ export abstract class Schedule {
5859
const day = fallback(options.day, options.weekDay !== undefined ? '?' : '*');
5960
const weekDay = fallback(options.weekDay, '?');
6061

61-
return new LiteralSchedule(`cron(${minute} ${hour} ${day} ${month} ${weekDay} ${year})`);
62+
return new class extends Schedule {
63+
public readonly expressionString: string = `cron(${minute} ${hour} ${day} ${month} ${weekDay} ${year})`;
64+
public _bind(scope: Construct) {
65+
if (!options.minute) {
66+
Annotations.of(scope).addWarning('cron: If you don\'t pass \'minute\', by default the event runs every minute. Pass \'minute: \'*\'\' if that\'s what you intend, or \'minute: 0\' to run once per hour instead.');
67+
}
68+
return new LiteralSchedule(this.expressionString);
69+
}
70+
};
6271
}
6372

6473
/**
6574
* Retrieve the expression for this schedule
6675
*/
6776
public abstract readonly expressionString: string;
6877

69-
protected constructor() {
70-
}
78+
protected constructor() {}
79+
80+
/**
81+
*
82+
* @internal
83+
*/
84+
public abstract _bind(scope: Construct): void;
7185
}
7286

7387
/**
@@ -126,6 +140,8 @@ class LiteralSchedule extends Schedule {
126140
constructor(public readonly expressionString: string) {
127141
super();
128142
}
143+
144+
public _bind() {}
129145
}
130146

131147
function fallback<T>(x: T | undefined, def: T): T {

packages/@aws-cdk/aws-applicationautoscaling/test/scalable-target.test.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Match, Template } from '@aws-cdk/assertions';
1+
import { Annotations, Match, Template } from '@aws-cdk/assertions';
22
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
33
import * as iam from '@aws-cdk/aws-iam';
44
import * as cdk from '@aws-cdk/core';
@@ -79,6 +79,53 @@ describe('scalable target', () => {
7979
});
8080
});
8181

82+
test('scheduled scaling shows warning when minute is not defined in cron', () => {
83+
// GIVEN
84+
const stack = new cdk.Stack();
85+
const target = createScalableTarget(stack);
86+
87+
// WHEN
88+
target.scaleOnSchedule('ScaleUp', {
89+
schedule: appscaling.Schedule.cron({
90+
hour: '8',
91+
day: '1',
92+
}),
93+
maxCapacity: 50,
94+
minCapacity: 1,
95+
});
96+
97+
// THEN
98+
expect(target.node.metadataEntry).toEqual([{
99+
type: 'aws:cdk:warning',
100+
data: 'cron: If you don\'t pass \'minute\', by default the event runs every minute. Pass \'minute: \'*\'\' if that\'s what you intend, or \'minute: 0\' to run once per hour instead.',
101+
trace: undefined,
102+
}]);
103+
Annotations.fromStack(stack).hasWarning('/Default/Target', "cron: If you don't pass 'minute', by default the event runs every minute. Pass 'minute: '*'' if that's what you intend, or 'minute: 0' to run once per hour instead.");
104+
105+
});
106+
107+
test('scheduled scaling shows no warning when minute is * in cron', () => {
108+
// GIVEN
109+
const stack = new cdk.Stack();
110+
const target = createScalableTarget(stack);
111+
112+
// WHEN
113+
target.scaleOnSchedule('ScaleUp', {
114+
schedule: appscaling.Schedule.cron({
115+
hour: '8',
116+
day: '1',
117+
minute: '*',
118+
}),
119+
maxCapacity: 50,
120+
minCapacity: 1,
121+
});
122+
123+
// THEN
124+
expect(target.node.metadataEntry).toEqual([]);
125+
const annotations = Annotations.fromStack(stack).findWarning('*', Match.anyValue());
126+
expect(annotations.length).toBe(0);
127+
});
128+
82129
test('step scaling on MathExpression', () => {
83130
// GIVEN
84131
const stack = new cdk.Stack();

0 commit comments

Comments
 (0)