Skip to content

Commit 8b3bf9c

Browse files
authored
2 parents 2c74f4c + 9b19e29 commit 8b3bf9c

File tree

111 files changed

+4991
-487
lines changed

Some content is hidden

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

111 files changed

+4991
-487
lines changed

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

Lines changed: 37 additions & 37 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,44 @@
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.79.0](https://github.com/aws/aws-cdk/compare/v1.78.0...v1.79.0) (2020-12-17)
6+
7+
8+
### ⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES
9+
10+
* **apigatewayv2:** `HttpApi.fromApiId()` has been replaced with
11+
`HttpApi.fromHttpApiAttributes()`.
12+
* **elasticsearch:** ES Domain LogGroup LogicalId will change, which will trigger new log group resources to be created
13+
14+
### Features
15+
16+
* **appmesh:** add timeout support to Routes ([#11973](https://github.com/aws/aws-cdk/issues/11973)) ([78c185d](https://github.com/aws/aws-cdk/commit/78c185d15e64e81ee86ee71cd6430cd80fdbb8fe))
17+
* **core:** expose custom resource provider's role ([#11923](https://github.com/aws/aws-cdk/issues/11923)) ([06f26d3](https://github.com/aws/aws-cdk/commit/06f26d390707b0e2a4e05e36405a4751c907a234)), closes [/github.com/aws/aws-cdk/pull/9751#issuecomment-723554595](https://github.com/aws//github.com/aws/aws-cdk/pull/9751/issues/issuecomment-723554595)
18+
* **ec2:** add r5b instance type to instance class ([#12027](https://github.com/aws/aws-cdk/issues/12027)) ([d276b02](https://github.com/aws/aws-cdk/commit/d276b020e61ee4455c7ed9f093436d1aab319e76)), closes [#12025](https://github.com/aws/aws-cdk/issues/12025)
19+
* **ecs-patterns:** Add DeploymentController option to Fargate services ([#10452](https://github.com/aws/aws-cdk/issues/10452)) ([2cd233a](https://github.com/aws/aws-cdk/commit/2cd233a94fc2f3cb06211157738e59e8c7ee85e5)), closes [aws/containers-roadmap#130](https://github.com/aws/containers-roadmap/issues/130) [#10971](https://github.com/aws/aws-cdk/issues/10971)
20+
* **eks:** attach cluster security group to self-managed nodes ([#12042](https://github.com/aws/aws-cdk/issues/12042)) ([1078bea](https://github.com/aws/aws-cdk/commit/1078bea4c90afaac76a5e81328a9d6ec44a79e9a))
21+
* **elasticsearch:** support audit logs ([#12106](https://github.com/aws/aws-cdk/issues/12106)) ([d10ea63](https://github.com/aws/aws-cdk/commit/d10ea631f8699385cadf61d6e0a067b68da37df6)), closes [#12105](https://github.com/aws/aws-cdk/issues/12105)
22+
* **ivs:** add IVS L2 Constructs ([#11454](https://github.com/aws/aws-cdk/issues/11454)) ([f813bff](https://github.com/aws/aws-cdk/commit/f813bff2da4792cfa7bfce6f572a7d2bb5c4759d))
23+
* **lambda:** encryption key for environment variables ([#11893](https://github.com/aws/aws-cdk/issues/11893)) ([ccbaf83](https://github.com/aws/aws-cdk/commit/ccbaf8399c3a9f3ff6e60758e0b713d82f37420b)), closes [#10837](https://github.com/aws/aws-cdk/issues/10837)
24+
* **lambda-nodejs:** expose more esbuild options ([#12063](https://github.com/aws/aws-cdk/issues/12063)) ([bab21b3](https://github.com/aws/aws-cdk/commit/bab21b377593b7475b047d05a54914344352c054)), closes [#12046](https://github.com/aws/aws-cdk/issues/12046)
25+
* **route53:** Vpc endpoint service private dns ([#10780](https://github.com/aws/aws-cdk/issues/10780)) ([8f6f9a8](https://github.com/aws/aws-cdk/commit/8f6f9a8678496e131a43ca4c76e561d50a0a0de8))
26+
* **s3-deployment:** support vpc in BucketDeploymentProps ([#12035](https://github.com/aws/aws-cdk/issues/12035)) ([6caf72f](https://github.com/aws/aws-cdk/commit/6caf72f67d6d3373186e57f32671369c2cc8b56e)), closes [#11734](https://github.com/aws/aws-cdk/issues/11734)
27+
* **stepfunctions-tasks:** add support for ModelClientConfig to SageMakerCreateTransformJob ([#11892](https://github.com/aws/aws-cdk/issues/11892)) ([bf05092](https://github.com/aws/aws-cdk/commit/bf050928c033328b259746c0a7f33038aadc4c17))
28+
29+
30+
### Bug Fixes
31+
32+
* **ec2:** 'encoded list token' error using Vpc imported from deploy-time lists ([#12040](https://github.com/aws/aws-cdk/issues/12040)) ([0690da9](https://github.com/aws/aws-cdk/commit/0690da925144c821a73bfab4ae8d678a8c074357))
33+
* **ec2:** fromInterfaceVpcEndpointAttributes: Security Groups should not be required ([#11857](https://github.com/aws/aws-cdk/issues/11857)) ([86ae5d6](https://github.com/aws/aws-cdk/commit/86ae5d6ec5291f7a8da37bbf021c31f88e66d283)), closes [#11050](https://github.com/aws/aws-cdk/issues/11050)
34+
* **eks:** failure to deploy cluster since aws-auth configmap exists ([#12068](https://github.com/aws/aws-cdk/issues/12068)) ([dc8a98a](https://github.com/aws/aws-cdk/commit/dc8a98a5436a7a2347fa9676d84f73a8cf00cd49)), closes [#12053](https://github.com/aws/aws-cdk/issues/12053)
35+
* **eks:** k8s resources accidentally deleted due to logical ID change ([#12053](https://github.com/aws/aws-cdk/issues/12053)) ([019852e](https://github.com/aws/aws-cdk/commit/019852e4834327d848c9fe8dc271f1d4d5117fb8)), closes [#10397](https://github.com/aws/aws-cdk/issues/10397) [#10397](https://github.com/aws/aws-cdk/issues/10397)
36+
* **elasticsearch:** Defining 2 domains with logging enabled in the same stack fails on construct id conflict ([#12055](https://github.com/aws/aws-cdk/issues/12055)) ([ec3ce19](https://github.com/aws/aws-cdk/commit/ec3ce19bc8203703cb1abcecdb2afc674c2013f6)), closes [#12017](https://github.com/aws/aws-cdk/issues/12017)
37+
* **elasticsearch:** log policies are overwritten when creating 2 domains which also results in a failure while destroying the stack ([#12056](https://github.com/aws/aws-cdk/issues/12056)) ([889d089](https://github.com/aws/aws-cdk/commit/889d0892bae10243e03900f0ae6db078fc7eb320)), closes [#12016](https://github.com/aws/aws-cdk/issues/12016)
38+
* **stepfunctions-tasks:** policies created for EMR tasks have ARNs that are not partition-aware ([#11553](https://github.com/aws/aws-cdk/issues/11553)) ([1cf6713](https://github.com/aws/aws-cdk/commit/1cf6713b778c789af7a420ad890910a9516473f0)), closes [#11503](https://github.com/aws/aws-cdk/issues/11503)
39+
40+
41+
* **apigatewayv2:** apiEndpoint is elevated to the IHttpApi interface ([#11988](https://github.com/aws/aws-cdk/issues/11988)) ([bc5b9b6](https://github.com/aws/aws-cdk/commit/bc5b9b659444bfbef9cfc3c8666fce7e6f45465a))
42+
543
## [1.78.0](https://github.com/aws/aws-cdk/compare/v1.77.0...v1.78.0) (2020-12-11)
644

745

CONTRIBUTING.md

Lines changed: 74 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,31 @@ Here are a few useful commands:
382382
evaluate only the rule specified [awslint README](./packages/awslint/README.md)
383383
for details on include/exclude rule patterns.
384384

385+
386+
#### jsii-rosetta
387+
388+
**jsii-rosetta** can be used to verify that all code examples included in documentation for a package (including those
389+
in `README.md`) successfully compile against the library they document. It is recommended to run it to ensure all
390+
examples are still accurate. Successfully building examples is also necessary to ensure the best possible translation to
391+
other supported languages (`C#`, `Java`, `Python`, ...).
392+
393+
> Note that examples may use libraries that are not part of the `dependencies` or `devDependencies` of the documented
394+
> package. For example `@aws-cdk/core` contains mainy examples that leverage libraries built *on top of it* (such as
395+
> `@aws-cdk/aws-sns`). Such libraries must be built (using `yarn build`) before **jsii-rosetta** can verify that
396+
> examples are correct.
397+
398+
To run **jsii-rosetta** in *strict* mode (so that it always fails when encountering examples that fail to compile), use
399+
the following command:
400+
401+
```console
402+
$ yarn rosetta:extract --strict
403+
```
404+
405+
For more information on how you can address examples that fail compiling due to missing fixtures (declarations that are
406+
necessary for the example to compile, but which would distract the reader away from what is being demonstrated), you
407+
might need to introduce [rosetta fixtures](https://github.com/aws/jsii/tree/main/packages/jsii-rosetta#fixtures). Refer
408+
to the [Examples](#examples) section.
409+
385410
### cfn2ts
386411

387412
This tool is used to generate our low-level CloudFormation resources
@@ -685,6 +710,8 @@ can be used in these cases.
685710

686711
### Examples
687712

713+
#### Fixture Files
714+
688715
Examples typed in fenced code blocks (looking like `'''ts`, but then with backticks
689716
instead of regular quotes) will be automatically extrated, compiled and translated
690717
to other languages when the bindings are generated.
@@ -694,7 +721,7 @@ a *fixture*, which looks like this:
694721

695722
```
696723
'''ts fixture=with-bucket
697-
bucket.addLifecycleTransition({ ... });
724+
bucket.addLifecycleTransition({ ...props });
698725
'''
699726
```
700727

@@ -717,8 +744,8 @@ contain three slashes to achieve the same effect:
717744
```
718745
/**
719746
* @example
720-
* /// fixture=with-bucket
721-
* bucket.addLifecycleTransition({ ... });
747+
* /// fixture=with-bucket
748+
* bucket.addLifecycleTransition({ ...props });
722749
*/
723750
```
724751

@@ -732,12 +759,52 @@ the current package.
732759
For a practical example of how making sample code compilable works, see the
733760
`aws-ec2` package.
734761

762+
#### Recommendations
763+
764+
In order to offer a consistent documentation style throughout the AWS CDK
765+
codebase, example code should follow the following recommendations (there may be
766+
cases where some of those do not apply - good judgement is to be applied):
767+
768+
- Types from the documented module should be **un-qualified**
769+
770+
```ts
771+
// An example in the @aws-cdk/core library, which defines Duration
772+
Duration.minutes(15);
773+
```
774+
775+
- Types from other modules should be **qualified**
776+
777+
```ts
778+
// An example in the @aws-cdk/core library, using something from @aws-cdk/aws-s3
779+
const bucket = new s3.Bucket(this, 'Bucket');
780+
// ...rest of the example...
781+
```
782+
783+
- Within `.ts-fixture` files, make use of `declare` statements instead of
784+
writing a compatible value (this will make your fixtures more durable):
785+
786+
```ts
787+
// An hypothetical 'rosetta/default.ts-fixture' file in `@aws-cdk/core`
788+
import * as kms from '@aws-cdk/aws-kms';
789+
import * as s3 from '@aws-cdk/aws-s3';
790+
import { StackProps } from '@aws-cdk/core';
791+
792+
declare const kmsKey: kms.IKey;
793+
declare const bucket: s3.Bucket;
794+
795+
declare const props: StackProps;
796+
```
797+
798+
> Those recommendations are not verified or enforced by automated tooling. Pull
799+
> request reviewers may however request that new sample code is edited to meet
800+
> those requirements as needed.
801+
802+
#### Checking a single package
803+
735804
Examples of all packages are extracted and compiled as part of the packaging
736805
step. If you are working on getting rid of example compilation errors of a
737-
single package, you can run `scripts/compile-samples` on the package by itself.
738-
739-
For now, non-compiling examples will not yet block the build, but at some point
740-
in the future they will.
806+
single package, you can run `yarn rosetta:extract --strict` in the package's
807+
directory (see the [**jsii-rosetta**](#jsii-rosetta) section).
741808

742809
### Feature Flags
743810

packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ export interface IHttpApi extends IResource {
1818
*/
1919
readonly httpApiId: string;
2020

21+
/**
22+
* The default endpoint for an API
23+
* @attribute
24+
*/
25+
readonly apiEndpoint: string;
26+
2127
/**
2228
* The default stage
2329
*/
@@ -184,6 +190,7 @@ export interface AddRoutesOptions extends BatchHttpRouteOptions {
184190
abstract class HttpApiBase extends Resource implements IHttpApi { // note that this is not exported
185191

186192
public abstract readonly httpApiId: string;
193+
public abstract readonly apiEndpoint: string;
187194
private vpcLinks: Record<string, VpcLink> = {};
188195

189196
public metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric {
@@ -233,6 +240,21 @@ abstract class HttpApiBase extends Resource implements IHttpApi { // note that t
233240
}
234241
}
235242

243+
/**
244+
* Attributes for importing an HttpApi into the CDK
245+
*/
246+
export interface HttpApiAttributes {
247+
/**
248+
* The identifier of the HttpApi
249+
*/
250+
readonly httpApiId: string;
251+
/**
252+
* The endpoint URL of the HttpApi
253+
* @default - throws an error if apiEndpoint is accessed.
254+
*/
255+
readonly apiEndpoint?: string;
256+
}
257+
236258
/**
237259
* Create a new API Gateway HTTP API endpoint.
238260
* @resource AWS::ApiGatewayV2::Api
@@ -241,9 +263,17 @@ export class HttpApi extends HttpApiBase {
241263
/**
242264
* Import an existing HTTP API into this CDK app.
243265
*/
244-
public static fromApiId(scope: Construct, id: string, httpApiId: string): IHttpApi {
266+
public static fromHttpApiAttributes(scope: Construct, id: string, attrs: HttpApiAttributes): IHttpApi {
245267
class Import extends HttpApiBase {
246-
public readonly httpApiId = httpApiId;
268+
public readonly httpApiId = attrs.httpApiId;
269+
private readonly _apiEndpoint = attrs.apiEndpoint;
270+
271+
public get apiEndpoint(): string {
272+
if (!this._apiEndpoint) {
273+
throw new Error('apiEndpoint is not configured on the imported HttpApi.');
274+
}
275+
return this._apiEndpoint;
276+
}
247277
}
248278
return new Import(scope, id);
249279
}
@@ -252,13 +282,7 @@ export class HttpApi extends HttpApiBase {
252282
* A human friendly name for this HTTP API. Note that this is different from `httpApiId`.
253283
*/
254284
public readonly httpApiName?: string;
255-
256285
public readonly httpApiId: string;
257-
258-
/**
259-
* The default endpoint for an API
260-
* @attribute
261-
*/
262286
public readonly apiEndpoint: string;
263287

264288
/**

packages/@aws-cdk/aws-apigatewayv2/test/http/api.test.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ describe('HttpApi', () => {
2929

3030
test('import', () => {
3131
const stack = new Stack();
32-
const api = new HttpApi(stack, 'api', { apiName: 'customName' });
33-
const imported = HttpApi.fromApiId(stack, 'imported', api.httpApiId );
34-
35-
expect(imported.httpApiId).toEqual(api.httpApiId);
32+
const imported = HttpApi.fromHttpApiAttributes(stack, 'imported', { httpApiId: 'http-1234', apiEndpoint: 'api-endpoint' });
3633

34+
expect(imported.httpApiId).toEqual('http-1234');
35+
expect(imported.apiEndpoint).toEqual('api-endpoint');
3736
});
3837

3938
test('unsetting createDefaultStage', () => {
@@ -188,7 +187,7 @@ describe('HttpApi', () => {
188187
// GIVEN
189188
const stack = new Stack();
190189
const apiId = 'importedId';
191-
const api = HttpApi.fromApiId(stack, 'test-api', apiId);
190+
const api = HttpApi.fromHttpApiAttributes(stack, 'test-api', { httpApiId: apiId });
192191
const metricName = '4xxError';
193192
const statistic = 'Sum';
194193

@@ -261,6 +260,13 @@ describe('HttpApi', () => {
261260

262261
expect(api.apiEndpoint).toBeDefined();
263262
});
263+
264+
test('apiEndpoint for imported', () => {
265+
const stack = new Stack();
266+
const api = HttpApi.fromHttpApiAttributes(stack, 'imported', { httpApiId: 'api-1234' });
267+
268+
expect(() => api.apiEndpoint).toThrow(/apiEndpoint is not configured/);
269+
});
264270
});
265271

266272
class DummyRouteIntegration implements IHttpRouteIntegration {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ The `tcp()`, `http()` and `http2()` methods provide the spec necessary to define
289289

290290
For HTTP based routes, the match field can be used to match on a route prefix.
291291
By default, an HTTP based route will match on `/`. All matches must start with a leading `/`.
292+
The timeout field can also be specified for `idle` and `perRequest` timeouts.
292293

293294
```ts
294295
router.addRoute('route-http', {
@@ -301,6 +302,10 @@ router.addRoute('route-http', {
301302
match: {
302303
serviceName: 'my-service.default.svc.cluster.local',
303304
},
305+
timeout: {
306+
idle : Duration.seconds(2),
307+
perRequest: Duration.seconds(1),
308+
},
304309
}),
305310
});
306311
```

0 commit comments

Comments
 (0)