Skip to content

Commit 2d40d77

Browse files
authored
2 parents b24095d + 2ac68d4 commit 2d40d77

File tree

1,042 files changed

+71868
-7949
lines changed

Some content is hidden

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

1,042 files changed

+71868
-7949
lines changed

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

+219-219
Large diffs are not rendered by default.

CHANGELOG.v2.alpha.md

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
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.60.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.59.0-alpha.0...v2.60.0-alpha.0) (2023-01-11)
6+
7+
8+
### Features
9+
10+
* **gamelift:** add MatchmakingConfiguration L2 Construct for GameLift ([#23326](https://github.com/aws/aws-cdk/issues/23326)) ([9b2573b](https://github.com/aws/aws-cdk/commit/9b2573b32e8535d3db21f07647f099c9e01eb292))
11+
* **integ-runner:** support `--language` presets for JavaScript, TypeScript, Python and Go ([#22058](https://github.com/aws/aws-cdk/issues/22058)) ([22673b2](https://github.com/aws/aws-cdk/commit/22673b2ea40c13b6c10a2c7c628ce5cc534f5840)), closes [#21169](https://github.com/aws/aws-cdk/issues/21169)
12+
513
## [2.59.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.58.1-alpha.0...v2.59.0-alpha.0) (2023-01-03)
614

715
## [2.58.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.58.0-alpha.0...v2.58.1-alpha.0) (2022-12-30)

CHANGELOG.v2.md

+24
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+
## [2.60.0](https://github.com/aws/aws-cdk/compare/v2.59.0...v2.60.0) (2023-01-11)
6+
7+
8+
### Features
9+
10+
* **appsync:** js resolver support ([#23551](https://github.com/aws/aws-cdk/issues/23551)) ([2318384](https://github.com/aws/aws-cdk/commit/231838409cc1409c137ff27086e853ce2b0fbf1c)), closes [#22921](https://github.com/aws/aws-cdk/issues/22921)
11+
* **appsync:** stabilize appsync module 🎆🎆 🎆 ([#23633](https://github.com/aws/aws-cdk/issues/23633)) ([e5b0230](https://github.com/aws/aws-cdk/commit/e5b023089e168c50eda83a11db0e697b96caf7e9)), closes [#6836](https://github.com/aws/aws-cdk/issues/6836)
12+
* **cfnspec:** cloudformation spec v106.0.0 ([#23586](https://github.com/aws/aws-cdk/issues/23586)) ([f178c98](https://github.com/aws/aws-cdk/commit/f178c98d4473d8bb8d46d80c076fa520d03c623b))
13+
* **cloudfront:** remove headers and server timing ([#23558](https://github.com/aws/aws-cdk/issues/23558)) ([44a4812](https://github.com/aws/aws-cdk/commit/44a4812778d87af27809e5a733c6e5ea6b65004b))
14+
* **cognito:** use secretsmanager secrets for clientSecretValue ([#22885](https://github.com/aws/aws-cdk/issues/22885)) ([4baea78](https://github.com/aws/aws-cdk/commit/4baea78f415566dea499f4ce49fc24d4dc7c4ef7))
15+
* **ec2:** subnet ipv4 cidr blocks on imported vpc ([#23317](https://github.com/aws/aws-cdk/issues/23317)) ([e0885db](https://github.com/aws/aws-cdk/commit/e0885db29c8b45cfe9da1df8b55af2bf78892a04))
16+
* **ecr-assets:** Support docker outputs flag ([#23304](https://github.com/aws/aws-cdk/issues/23304)) ([61e5495](https://github.com/aws/aws-cdk/commit/61e5495105e06aba4c027fb33ae031da09a3ff33)), closes [#20566](https://github.com/aws/aws-cdk/issues/20566)
17+
* **pipelines:** Expose stack output namespaces in custom `pipelines.Step`s ([#23110](https://github.com/aws/aws-cdk/issues/23110)) ([14f6811](https://github.com/aws/aws-cdk/commit/14f6811b89a0ae374863a3b2bdd36997ce67883e)), closes [/github.com/aws/aws-cdk/issues/23000#issuecomment-1324379670](https://github.com/aws//github.com/aws/aws-cdk/issues/23000/issues/issuecomment-1324379670)
18+
19+
20+
### Bug Fixes
21+
22+
* **acm:** domainName length constraint failure due to Tokens ([#23567](https://github.com/aws/aws-cdk/issues/23567)) ([2d7e3c0](https://github.com/aws/aws-cdk/commit/2d7e3c0e9edfb8f3e30dc0c1efaeb03fde19db7c)), closes [#23565](https://github.com/aws/aws-cdk/issues/23565)
23+
* **aws-custom-resource:** switch off `installLatestAwsSdk` by default ([#23591](https://github.com/aws/aws-cdk/issues/23591)) ([c9b2548](https://github.com/aws/aws-cdk/commit/c9b2548126f01fd918009df0a42f0ab4c5e69cc3)), closes [#23113](https://github.com/aws/aws-cdk/issues/23113)
24+
* **bootstrap:** KMS keys cannot be tagged ([#21975](https://github.com/aws/aws-cdk/issues/21975)) ([0e552db](https://github.com/aws/aws-cdk/commit/0e552dbb63a97cd6a7a65cae80ae863609237e61)), closes [#21281](https://github.com/aws/aws-cdk/issues/21281)
25+
* **events:** cross stack rules require concrete environment ([#23549](https://github.com/aws/aws-cdk/issues/23549)) ([22d3341](https://github.com/aws/aws-cdk/commit/22d3341c2239b046473ded3fcbc85b5cbc4a37a1)), closes [#18405](https://github.com/aws/aws-cdk/issues/18405)
26+
* **iam:** create stack based default policies for roles ([#23100](https://github.com/aws/aws-cdk/issues/23100)) ([dea4216](https://github.com/aws/aws-cdk/commit/dea4216a3f2e6727a6bc49d632c03b3f0a416947))
27+
* **lambda:** automatic `currentVersion` conflicts with explicit `Version` resource ([#23636](https://github.com/aws/aws-cdk/issues/23636)) ([de68652](https://github.com/aws/aws-cdk/commit/de6865229ee824c01431ae27509dbcd3e1a83763)), closes [#23225](https://github.com/aws/aws-cdk/issues/23225)
28+
529
## [2.59.0](https://github.com/aws/aws-cdk/compare/v2.58.1...v2.59.0) (2023-01-03)
630

731

allowed-breaking-changes.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,8 @@ incompatible-argument:@aws-cdk/aws-route53-targets.InterfaceVpcEndpointTarget.<i
149149
changed-type:@aws-cdk/cx-api.AssetManifestArtifact.requiresBootstrapStackVersion
150150

151151
# removed mistyped ec2 instance class
152-
removed:aws-cdk-lib.aws_ec2.InstanceClass.COMPUTE6_GRAVITON2_HIGH_NETWORK_BANDWITH
152+
removed:aws-cdk-lib.aws_ec2.InstanceClass.COMPUTE6_GRAVITON2_HIGH_NETWORK_BANDWITH
153+
154+
# added new required property StackOutputsMap
155+
strengthened:@aws-cdk/pipelines.ProduceActionOptions
156+
strengthened:aws-cdk-lib.pipelines.ProduceActionOptions

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"devDependencies": {
1919
"@types/prettier": "2.6.0",
2020
"@yarnpkg/lockfile": "^1.1.0",
21-
"cdk-generate-synthetic-examples": "^0.1.92",
21+
"cdk-generate-synthetic-examples": "^0.1.112",
2222
"conventional-changelog-cli": "^2.2.2",
2323
"fs-extra": "^9.1.0",
2424
"graceful-fs": "^4.2.10",
@@ -28,7 +28,7 @@
2828
"jsii-reflect": "1.72.0",
2929
"jsii-rosetta": "1.72.0",
3030
"lerna": "^4.0.0",
31-
"patch-package": "^6.5.0",
31+
"patch-package": "^6.5.1",
3232
"semver": "^6.3.0",
3333
"standard-version": "^9.5.0",
3434
"typescript": "~3.9.10"

packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ export interface LambdaAuthorizerProps {
2020
/**
2121
* The handler for the authorizer lambda function.
2222
*
23-
* The handler must follow a very specific protocol on the input it receives and the output it needs to produce.
24-
* API Gateway has documented the handler's input specification
25-
* {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-input.html | here} and output specification
26-
* {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html | here}.
23+
* The handler must follow a very specific protocol on the input it receives
24+
* and the output it needs to produce. API Gateway has documented the
25+
* handler's [input specification](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-input.html)
26+
* and [output specification](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html).
2727
*/
2828
readonly handler: lambda.IFunction;
2929

packages/@aws-cdk/aws-apigateway/lib/lambda-api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface LambdaRestApiProps extends RestApiProps {
1717
/**
1818
* Specific Lambda integration options.
1919
*
20-
* @default see defaults defined in {@link LambdaIntegrationOptions}.
20+
* @default see defaults defined in `LambdaIntegrationOptions`.
2121
*/
2222
readonly integrationOptions?: LambdaIntegrationOptions;
2323

packages/@aws-cdk/aws-apigateway/lib/method.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export interface MethodOptions {
2525
* Method authorization.
2626
* If the value is set of `Custom`, an `authorizer` must also be specified.
2727
*
28-
* If you're using one of the authorizers that are available via the {@link Authorizer} class, such as {@link Authorizer#token()},
28+
* If you're using one of the authorizers that are available via the `Authorizer` class, such as `Authorizer#token()`,
2929
* it is recommended that this option not be specified. The authorizer will take care of setting the correct authorization type.
30-
* However, specifying an authorization type using this property that conflicts with what is expected by the {@link Authorizer}
30+
* However, specifying an authorization type using this property that conflicts with what is expected by the `Authorizer`
3131
* will result in an error.
3232
*
3333
* @default - open access unless `authorizer` is specified

packages/@aws-cdk/aws-apigateway/lib/restapi.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ export abstract class RestApiBase extends Resource implements IRestApi {
616616
/**
617617
* Represents a REST API in Amazon API Gateway, created with an OpenAPI specification.
618618
*
619-
* Some properties normally accessible on @see {@link RestApi} - such as the description -
619+
* Some properties normally accessible on @see `RestApi` - such as the description -
620620
* must be declared in the specification. All Resources and Methods need to be defined as
621621
* part of the OpenAPI specification file, and cannot be added via the CDK.
622622
*

packages/@aws-cdk/aws-appmesh/lib/http-route-path-match.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Construct } from 'constructs';
22
import { CfnGatewayRoute, CfnRoute } from './appmesh.generated';
33

44
/**
5-
* The type returned from the `bind()` method in {@link HttpRoutePathMatch}.
5+
* The type returned from the `bind()` method in `HttpRoutePathMatch`.
66
*/
77
export interface HttpRoutePathMatchConfig {
88
/**
@@ -94,7 +94,7 @@ class HttpRouteWholePathMatch extends HttpRoutePathMatch {
9494
}
9595

9696
/**
97-
* The type returned from the `bind()` method in {@link HttpGatewayRoutePathMatch}.
97+
* The type returned from the `bind()` method in `HttpGatewayRoutePathMatch`.
9898
*/
9999
export interface HttpGatewayRoutePathMatchConfig {
100100
/**

packages/@aws-cdk/aws-appmesh/lib/tls-certificate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Construct } from 'constructs';
33
import { CfnVirtualNode } from './appmesh.generated';
44

55
/**
6-
* A wrapper for the tls config returned by {@link TlsCertificate.bind}
6+
* A wrapper for the tls config returned by `TlsCertificate.bind`
77
*/
88
export interface TlsCertificateConfig {
99
/**

packages/@aws-cdk/aws-appsync/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ junit.xml
2323
!**/*.snapshot/**/asset.*/*.d.ts
2424

2525
!**/*.snapshot/**/asset.*/**
26+
!test/integ-assets/**/*.js

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

+37-7
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@
99
>
1010
> [CFN Resources]: https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib
1111
12-
![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)
13-
14-
> The APIs of higher level constructs in this module are experimental and under active development.
15-
> They are subject to non-backward compatible changes or removal in any future version. These are
16-
> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be
17-
> announced in the release notes. This means that while you may use them, you may need to update
18-
> your source code when upgrading to a newer version of this package.
12+
![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)
1913

2014
---
2115

@@ -550,4 +544,40 @@ const pipelineResolver = new appsync.Resolver(this, 'pipeline', {
550544
});
551545
```
552546

547+
### JS Functions and Resolvers
548+
549+
JS Functions and resolvers are also supported. You can use a `.js` file within your CDK project, or specify your function code inline.
550+
551+
```ts
552+
declare const api: appsync.GraphqlApi;
553+
554+
const myJsFunction = new appsync.AppsyncFunction(this, 'function', {
555+
name: 'my_js_function',
556+
api,
557+
dataSource: api.addNoneDataSource('none'),
558+
code: appsync.Code.fromAsset('directory/function_code.js'),
559+
runtime: appsync.FunctionRuntime.JS_1_0_0,
560+
});
561+
562+
new appsync.Resolver(this, 'PipelineResolver', {
563+
api,
564+
typeName: 'typeName',
565+
fieldName: 'fieldName',
566+
code: appsync.Code.fromInline(`
567+
// The before step
568+
export function request(...args) {
569+
console.log(args);
570+
return {}
571+
}
572+
573+
// The after step
574+
export function response(ctx) {
575+
return ctx.prev.result
576+
}
577+
`),
578+
runtime: appsync.FunctionRuntime.JS_1_0_0,
579+
pipelineConfig: [myJsFunction],
580+
});
581+
```
582+
553583
Learn more about Pipeline Resolvers and AppSync Functions [here](https://docs.aws.amazon.com/appsync/latest/devguide/pipeline-resolvers.html).

packages/@aws-cdk/aws-appsync/lib/appsync-function.ts

+28
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { Resource, IResource, Lazy, Fn } from '@aws-cdk/core';
22
import { Construct } from 'constructs';
33
import { CfnFunctionConfiguration } from './appsync.generated';
4+
import { Code } from './code';
45
import { BaseDataSource } from './data-source';
56
import { IGraphqlApi } from './graphqlapi-base';
67
import { MappingTemplate } from './mapping-template';
8+
import { FunctionRuntime } from './runtime';
79

810
/**
911
* the base properties for AppSync Functions
@@ -31,6 +33,18 @@ export interface BaseAppsyncFunctionProps {
3133
* @default - no response mapping template
3234
*/
3335
readonly responseMappingTemplate?: MappingTemplate;
36+
/**
37+
* The functions runtime
38+
*
39+
* @default - no function runtime, VTL mapping templates used
40+
*/
41+
readonly runtime?: FunctionRuntime;
42+
/**
43+
* The function code
44+
*
45+
* @default - no code is used
46+
*/
47+
readonly code?: Code;
3448
}
3549

3650
/**
@@ -128,11 +142,25 @@ export class AppsyncFunction extends Resource implements IAppsyncFunction {
128142

129143
public constructor(scope: Construct, id: string, props: AppsyncFunctionProps) {
130144
super(scope, id);
145+
146+
// If runtime is specified, code must also be
147+
if (props.runtime && !props.code) {
148+
throw new Error('Code is required when specifying a runtime');
149+
}
150+
151+
if (props.code && (props.requestMappingTemplate || props.responseMappingTemplate)) {
152+
throw new Error('Mapping templates cannot be used alongside code');
153+
}
154+
155+
const code = props.code?.bind(this);
131156
this.function = new CfnFunctionConfiguration(this, 'Resource', {
132157
name: props.name,
133158
description: props.description,
134159
apiId: props.api.apiId,
135160
dataSourceName: props.dataSource.name,
161+
runtime: props.runtime?.toProperties(),
162+
codeS3Location: code?.s3Location,
163+
code: code?.inlineCode,
136164
functionVersion: '2018-05-29',
137165
requestMappingTemplate: props.requestMappingTemplate?.renderTemplate(),
138166
responseMappingTemplate: props.responseMappingTemplate?.renderTemplate(),
+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import * as s3_assets from '@aws-cdk/aws-s3-assets';
2+
import * as cdk from '@aws-cdk/core';
3+
import { Construct } from 'constructs';
4+
5+
/**
6+
* Result of binding `Code` into a `Function`.
7+
*/
8+
export interface CodeConfig {
9+
/**
10+
* The location of the code in S3 (mutually exclusive with `inlineCode`.
11+
* @default - code is not an s3 location
12+
*/
13+
readonly s3Location?: string;
14+
15+
/**
16+
* Inline code (mutually exclusive with `s3Location`).
17+
* @default - code is not inline code
18+
*/
19+
readonly inlineCode?: string;
20+
}
21+
22+
/**
23+
* Represents source code for an AppSync Function or Resolver.
24+
*/
25+
export abstract class Code {
26+
/**
27+
* Loads the function code from a local disk path.
28+
*
29+
* @param path The path to the source code file.
30+
*/
31+
public static fromAsset(path: string, options?: s3_assets.AssetOptions): AssetCode {
32+
return new AssetCode(path, options);
33+
}
34+
35+
/**
36+
* Inline code for AppSync function
37+
* @returns `InlineCode` with inline code.
38+
* @param code The actual handler code (limited to 4KiB)
39+
*/
40+
public static fromInline(code: string): InlineCode {
41+
return new InlineCode(code);
42+
}
43+
44+
/**
45+
* Bind source code to an AppSync Function or resolver.
46+
*/
47+
public abstract bind(scope: Construct): CodeConfig;
48+
}
49+
50+
/**
51+
* Represents a local file with source code used for an AppSync Function or Resolver.
52+
*/
53+
export class AssetCode extends Code {
54+
private asset?: s3_assets.Asset;
55+
56+
/**
57+
* @param path The path to the asset file.
58+
*/
59+
constructor(public readonly path: string, private readonly options: s3_assets.AssetOptions = { }) {
60+
super();
61+
}
62+
63+
public bind(scope: Construct): CodeConfig {
64+
// If the same AssetCode is used multiple times, retain only the first instantiation.
65+
if (!this.asset) {
66+
this.asset = new s3_assets.Asset(scope, 'Code', {
67+
path: this.path,
68+
...this.options,
69+
});
70+
} else if (cdk.Stack.of(this.asset) !== cdk.Stack.of(scope)) {
71+
throw new Error(`Asset is already associated with another stack '${cdk.Stack.of(this.asset).stackName}'. ` +
72+
'Create a new Code instance for every stack.');
73+
}
74+
75+
return {
76+
s3Location: this.asset.s3ObjectUrl,
77+
};
78+
}
79+
}
80+
81+
/**
82+
* AppSync function code from an inline string.
83+
*/
84+
export class InlineCode extends Code {
85+
constructor(private code: string) {
86+
super();
87+
88+
if (code.length === 0) {
89+
throw new Error('AppSync Inline code cannot be empty');
90+
}
91+
}
92+
93+
public bind(_scope: Construct): CodeConfig {
94+
return {
95+
inlineCode: this.code,
96+
};
97+
}
98+
}

packages/@aws-cdk/aws-appsync/lib/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ export * from './resolver';
1010
export * from './schema';
1111
export * from './graphqlapi';
1212
export * from './graphqlapi-base';
13+
export * from './code';
14+
export * from './runtime';

0 commit comments

Comments
 (0)