Skip to content

Commit a8a15f0

Browse files
authored
Merge branch 'v2-main' into create-sym-links
2 parents 4c56394 + dcae3ee commit a8a15f0

28 files changed

Lines changed: 536 additions & 110 deletions

CHANGELOG.v2.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
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+
## [2.0.0-rc.18](https://github.com/aws/aws-cdk/compare/v2.0.0-rc.17...v2.0.0-rc.18) (2021-08-18)
6+
7+
8+
### Features
9+
10+
* **aws-apigateway:** import existing usage plan ([#15771](https://github.com/aws/aws-cdk/issues/15771)) ([97fc290](https://github.com/aws/aws-cdk/commit/97fc29032c05edb7914c48efee0124be0126a5c4)), closes [#12677](https://github.com/aws/aws-cdk/issues/12677)
11+
* **aws-elbv2:** ALB target group routing algorithms ([#15622](https://github.com/aws/aws-cdk/issues/15622)) ([6b32b2f](https://github.com/aws/aws-cdk/commit/6b32b2fb0c6ed2a21eb929e39930c6c9cf668dae)), closes [#15160](https://github.com/aws/aws-cdk/issues/15160)
12+
* **cfnspec:** cloudformation spec v39.9.0 ([#15987](https://github.com/aws/aws-cdk/issues/15987)) ([e0d6181](https://github.com/aws/aws-cdk/commit/e0d61810ab78f7cab1af53bce82c60790a814f71))
13+
* **cognito:** add support for token revocation in UserPoolClient ([#15317](https://github.com/aws/aws-cdk/issues/15317)) ([8cb0e97](https://github.com/aws/aws-cdk/commit/8cb0e97ea663e0447af77842e1a8efa8aee917eb)), closes [#15126](https://github.com/aws/aws-cdk/issues/15126)
14+
* **pipelines:** add `synthCodeBuildDefaults` ([#15627](https://github.com/aws/aws-cdk/issues/15627)) ([04b8d40](https://github.com/aws/aws-cdk/commit/04b8d400b2653aff4f48709e8b420c6adb996ef5))
15+
16+
17+
### Bug Fixes
18+
19+
* **core:** asset bundling fails for non-existent user ([#15313](https://github.com/aws/aws-cdk/issues/15313)) ([bf5882f](https://github.com/aws/aws-cdk/commit/bf5882f8def0676bbfaee7c2ff4fab6bf39df281)), closes [#15415](https://github.com/aws/aws-cdk/issues/15415) [#15415](https://github.com/aws/aws-cdk/issues/15415)
20+
* **ec2:** "clientVpnEndoint" => "clientVpnEndpoint" ([#14902](https://github.com/aws/aws-cdk/issues/14902)) ([c3b872a](https://github.com/aws/aws-cdk/commit/c3b872ad47ff3bdf2c841aa195b6fa6922c03769)), closes [#13810](https://github.com/aws/aws-cdk/issues/13810)
21+
* **pipelines:** repos with dashes cannot be used as additionalInputs ([#16017](https://github.com/aws/aws-cdk/issues/16017)) ([400a59d](https://github.com/aws/aws-cdk/commit/400a59d19ee63fbd9318da34760b4ed8c9ba99b9)), closes [#15753](https://github.com/aws/aws-cdk/issues/15753)
22+
523
## [2.0.0-rc.17](https://github.com/aws/aws-cdk/compare/v2.0.0-rc.16...v2.0.0-rc.17) (2021-08-11)
624

725

packages/@aws-cdk/assert-internal/lib/assertions/match-template.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,15 @@ class StackMatchesTemplateAssertion extends Assertion<StackInspector> {
7878
}
7979

8080
for (const change of Object.values(diff.parameters.changes)) {
81-
if (change.isAddition) { return false; }
81+
if (!change.isAddition) { return false; }
8282
}
8383

8484
for (const change of Object.values(diff.outputs.changes)) {
85-
if (change.isAddition || change.isUpdate) { return false; }
85+
if (!change.isAddition) { return false; }
8686
}
8787

8888
return true;
8989
}
90-
throw new Error(`Unsupported match style: ${this.matchStyle}`);
9190
}
9291

9392
public get description(): string {
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import * as fs from 'fs';
2+
import * as path from 'path';
3+
import * as cxschema from '@aws-cdk/cloud-assembly-schema';
4+
import * as cxapi from '@aws-cdk/cx-api';
5+
6+
export function mkStack(template: any): cxapi.CloudFormationStackArtifact {
7+
const assembly = new cxapi.CloudAssemblyBuilder();
8+
assembly.addArtifact('test', {
9+
type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK,
10+
environment: cxapi.EnvironmentUtils.format('123456789012', 'bermuda-triangle-1'),
11+
properties: {
12+
templateFile: 'template.json',
13+
},
14+
});
15+
16+
fs.writeFileSync(path.join(assembly.outdir, 'template.json'), JSON.stringify(template));
17+
return assembly.buildAssembly().getStackByName('test');
18+
}
19+
20+
export function mkResource(props: any): cxapi.CloudFormationStackArtifact {
21+
return mkStack({
22+
Resources: {
23+
SomeResource: {
24+
Type: 'Some::Resource',
25+
Properties: props,
26+
},
27+
},
28+
});
29+
}

packages/@aws-cdk/assert-internal/test/have-output.test.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { unlink, writeFileSync } from 'fs';
2-
import { join } from 'path';
3-
import * as cxschema from '@aws-cdk/cloud-assembly-schema';
1+
import { unlink } from 'fs';
42
import * as cxapi from '@aws-cdk/cx-api';
3+
import { mkStack } from './cloud-artifact';
54
import '../jest';
65

76
let templateFilePath: string;
@@ -180,23 +179,4 @@ afterEach(done => {
180179
} else {
181180
done();
182181
}
183-
});
184-
185-
function mkStack(template: any): cxapi.CloudFormationStackArtifact {
186-
const templateFileName = 'test-have-output-template.json';
187-
const stackName = 'test-have-output';
188-
const assembly = new cxapi.CloudAssemblyBuilder();
189-
190-
assembly.addArtifact(stackName, {
191-
type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK,
192-
environment: cxapi.EnvironmentUtils.format('123456789012', 'bermuda-triangle-1'),
193-
properties: {
194-
templateFile: templateFileName,
195-
},
196-
});
197-
198-
templateFilePath = join(assembly.outdir, templateFileName);
199-
writeFileSync(templateFilePath, JSON.stringify(template));
200-
201-
return assembly.buildAssembly().getStackByName(stackName);
202-
}
182+
});

packages/@aws-cdk/assert-internal/test/have-resource.test.ts

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import { writeFileSync } from 'fs';
2-
import { join } from 'path';
3-
import * as cxschema from '@aws-cdk/cloud-assembly-schema';
4-
import * as cxapi from '@aws-cdk/cx-api';
51
import { ABSENT, arrayWith, exactValue, expect as cdkExpect, haveResource, haveResourceLike, Capture, anything } from '../lib/index';
2+
import { mkResource, mkStack } from './cloud-artifact';
63

74
test('support resource with no properties', () => {
85
const synthStack = mkStack({
@@ -86,7 +83,7 @@ test('haveResource allows to opt in value extension', () => {
8683

8784
describe('property absence', () => {
8885
test('pass on absence', () => {
89-
const synthStack = mkSomeResource({
86+
const synthStack = mkResource({
9087
Prop: 'somevalue',
9188
});
9289

@@ -96,7 +93,7 @@ describe('property absence', () => {
9693
});
9794

9895
test('fail on presence', () => {
99-
const synthStack = mkSomeResource({
96+
const synthStack = mkResource({
10097
PropA: 3,
10198
});
10299

@@ -108,7 +105,7 @@ describe('property absence', () => {
108105
});
109106

110107
test('pass on deep absence', () => {
111-
const synthStack = mkSomeResource({
108+
const synthStack = mkResource({
112109
Deep: {
113110
Prop: 'somevalue',
114111
},
@@ -123,7 +120,7 @@ describe('property absence', () => {
123120
});
124121

125122
test('fail on deep presence', () => {
126-
const synthStack = mkSomeResource({
123+
const synthStack = mkResource({
127124
Deep: {
128125
Prop: 'somevalue',
129126
},
@@ -139,7 +136,7 @@ describe('property absence', () => {
139136
});
140137

141138
test('can use matcher to test for list element', () => {
142-
const synthStack = mkSomeResource({
139+
const synthStack = mkResource({
143140
List: [
144141
{ Prop: 'distraction' },
145142
{ Prop: 'goal' },
@@ -160,7 +157,7 @@ describe('property absence', () => {
160157
});
161158

162159
test('arrayContaining must match all elements in any order', () => {
163-
const synthStack = mkSomeResource({
160+
const synthStack = mkResource({
164161
List: ['a', 'b'],
165162
});
166163

@@ -178,7 +175,7 @@ describe('property absence', () => {
178175
});
179176

180177
test('exactValue escapes from deep fuzzy matching', () => {
181-
const synthStack = mkSomeResource({
178+
const synthStack = mkResource({
182179
Deep: {
183180
PropA: 'A',
184181
PropB: 'B',
@@ -216,7 +213,7 @@ describe('property absence', () => {
216213
* it.
217214
*/
218215
test('objectContainingDeep has deep effect through lists', () => {
219-
const synthStack = mkSomeResource({
216+
const synthStack = mkResource({
220217
List: [
221218
{
222219
PropA: 'A',
@@ -240,7 +237,7 @@ describe('property absence', () => {
240237
});
241238

242239
test('test capturing', () => {
243-
const synthStack = mkSomeResource({
240+
const synthStack = mkResource({
244241
Prop: 'somevalue',
245242
});
246243

@@ -252,28 +249,3 @@ describe('property absence', () => {
252249
expect(propValue.capturedValue).toEqual('somevalue');
253250
});
254251
});
255-
256-
function mkStack(template: any): cxapi.CloudFormationStackArtifact {
257-
const assembly = new cxapi.CloudAssemblyBuilder();
258-
assembly.addArtifact('test', {
259-
type: cxschema.ArtifactType.AWS_CLOUDFORMATION_STACK,
260-
environment: cxapi.EnvironmentUtils.format('123456789', 'us-west-2'),
261-
properties: {
262-
templateFile: 'template.json',
263-
},
264-
});
265-
266-
writeFileSync(join(assembly.outdir, 'template.json'), JSON.stringify(template));
267-
return assembly.buildAssembly().getStackByName('test');
268-
}
269-
270-
function mkSomeResource(props: any): cxapi.CloudFormationStackArtifact {
271-
return mkStack({
272-
Resources: {
273-
SomeResource: {
274-
Type: 'Some::Resource',
275-
Properties: props,
276-
},
277-
},
278-
});
279-
}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
import { MatchStyle } from '../lib';
2+
import { mkStack } from './cloud-artifact';
3+
import '../jest';
4+
5+
describe('matchTemplate', () => {
6+
describe('exact match', () => {
7+
test('match on resources', () => {
8+
const stack = mkStack({
9+
Resources: {
10+
FooResource: { Type: 'Foo::Bar' },
11+
},
12+
});
13+
14+
expect(stack).toMatchTemplate({
15+
Resources: {
16+
FooResource: { Type: 'Foo::Bar' },
17+
},
18+
}, MatchStyle.EXACT);
19+
20+
expect(stack).not.toMatchTemplate({
21+
Resources: {
22+
FooResource: { Type: 'Foo::Baz' },
23+
},
24+
}, MatchStyle.EXACT);
25+
});
26+
27+
test('match on parameters', () => {
28+
const stack = mkStack({
29+
Parameters: {
30+
FooParameter: { Type: 'String' },
31+
},
32+
});
33+
expect(stack).toMatchTemplate({
34+
Parameters: {
35+
FooParameter: { Type: 'String' },
36+
},
37+
}, MatchStyle.EXACT);
38+
39+
expect(stack).not.toMatchTemplate({
40+
Parameters: {
41+
BarParameter: { Type: 'String' },
42+
},
43+
}, MatchStyle.EXACT);
44+
});
45+
46+
test('match on outputs', () => {
47+
const stack = mkStack({
48+
Outputs: {
49+
FooOutput: { Value: 'Foo' },
50+
},
51+
});
52+
53+
expect(stack).toMatchTemplate({
54+
Outputs: {
55+
FooOutput: { Value: 'Foo' },
56+
},
57+
}, MatchStyle.EXACT);
58+
59+
expect(stack).not.toMatchTemplate({
60+
Outputs: {
61+
BarOutput: { Value: 'Bar' },
62+
},
63+
}, MatchStyle.EXACT);
64+
65+
expect(stack).not.toMatchTemplate({
66+
Outputs: {
67+
FooOutput: { Value: 'Bar' },
68+
},
69+
}, MatchStyle.EXACT);
70+
});
71+
});
72+
73+
describe('superset match', () => {
74+
test('match on resources', () => {
75+
const stack = mkStack({
76+
Resources: {
77+
FooResource: {
78+
Type: 'Foo::Bar',
79+
},
80+
BazResource: {
81+
Type: 'Foo::Baz',
82+
},
83+
},
84+
});
85+
expect(stack).toMatchTemplate({
86+
Resources: {
87+
FooResource: {
88+
Type: 'Foo::Bar',
89+
},
90+
},
91+
}, MatchStyle.SUPERSET);
92+
});
93+
94+
test('match on parameters', () => {
95+
const stack = mkStack({
96+
Parameters: {
97+
FooParameter: { Type: 'String' },
98+
BarParameter: { Type: 'String' },
99+
},
100+
});
101+
expect(stack).toMatchTemplate({
102+
Parameters: {
103+
FooParameter: { Type: 'String' },
104+
},
105+
}, MatchStyle.SUPERSET);
106+
107+
expect(stack).not.toMatchTemplate({
108+
Parameters: {
109+
FooParameter: { Type: 'String' },
110+
BarParameter: { Type: 'Number' },
111+
},
112+
}, MatchStyle.SUPERSET);
113+
});
114+
115+
test('match on outputs', () => {
116+
const stack = mkStack({
117+
Outputs: {
118+
FooOutput: { Value: 'Foo' },
119+
BarOutput: { Value: 'Bar' },
120+
},
121+
});
122+
123+
expect(stack).toMatchTemplate({
124+
Outputs: {
125+
FooOutput: { Value: 'Foo' },
126+
},
127+
}, MatchStyle.SUPERSET);
128+
129+
expect(stack).not.toMatchTemplate({
130+
Outputs: {
131+
FooOutput: { Value: 'Foo' },
132+
BarOutput: { Value: 'Baz' },
133+
},
134+
}, MatchStyle.SUPERSET);
135+
136+
expect(stack).not.toMatchTemplate({
137+
Outputs: {
138+
FooOutput: { Value: 'Bar' },
139+
BazOutput: { Value: 'Bar' },
140+
},
141+
}, MatchStyle.SUPERSET);
142+
});
143+
});
144+
});

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ plan.addApiStage({
212212
});
213213
```
214214

215+
Existing usage plans can be imported into a CDK app using its id.
216+
217+
```ts
218+
const importedUsagePlan = UsagePlan.fromUsagePlanId(stack, 'imported-usage-plan', '<usage-plan-key-id>');
219+
```
220+
215221
The name and value of the API Key can be specified at creation; if not
216222
provided, a name and value will be automatically generated by API Gateway.
217223

0 commit comments

Comments
 (0)