Skip to content

Commit 5541378

Browse files
authored
Merge branch 'main' into corymhall/apigateway/cors-default-method-options
2 parents d9a1dd1 + 239215f commit 5541378

852 files changed

Lines changed: 22221 additions & 3838 deletions

File tree

Some content is hidden

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

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,5 +282,7 @@ env:
282282
{"area":"@aws-cdk/yaml-cfn","keywords":["aws-yaml-cfn","yaml-cfn"],"labels":["@aws-cdk/aws-yaml-cfn"],"assignees":["kaizencc"]},
283283
{"area":"@aws-cdk/aws-lightsail","keywords":["lightsail","aws-lightsail"],"labels":["@aws-cdk/aws-lightsail"],"assignees":["corymhall"]},
284284
{"area":"@aws-cdk/aws-aps","keywords":["aps","aws-aps","prometheus"],"labels":["@aws-cdk/aws-aps"],"assignees":["corymhall"]},
285-
{"area":"@aws-cdk/triggers","keywords":["trigger","triggers"],"labels":["@aws-cdk/triggers"],"assignees":["otaviomacedo"]}
285+
{"area":"@aws-cdk/triggers","keywords":["trigger","triggers"],"labels":["@aws-cdk/triggers"],"assignees":["otaviomacedo"]},
286+
{"area":"@aws-cdk/integ-tests","keywords":["integ-tests", "integ"],"labels":["@aws-cdk/integ-tests"],"assignees":["corymhall"]},
287+
{"area":"@aws-cdk/integ-runner","keywords":["integ-runner"],"labels":["@aws-cdk/integ-runner"],"assignees":["corymhall"]}
286288
]

CHANGELOG.v2.alpha.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
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.45.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.44.0-alpha.0...v2.45.0-alpha.0) (2022-10-06)
6+
7+
8+
### Features
9+
10+
* **gamelift:** add Build L2 constructs for GameLift ([#22313](https://github.com/aws/aws-cdk/issues/22313)) ([983d26e](https://github.com/aws/aws-cdk/commit/983d26e4e7cbb40fe1148ec635efe8093d850835))
11+
* **gamelift:** add Script L2 Construct for GameLift ([#22343](https://github.com/aws/aws-cdk/issues/22343)) ([da181ba](https://github.com/aws/aws-cdk/commit/da181bac2a7fee2cad8915006d4501074fcb04d4))
12+
* **neptune:** enable cloudwatch logs exports ([#22004](https://github.com/aws/aws-cdk/issues/22004)) ([2b2bb01](https://github.com/aws/aws-cdk/commit/2b2bb01dbe00c79e7f5a0513a2e1f76f6cdcbc11)), closes [#20248](https://github.com/aws/aws-cdk/issues/20248) [#15888](https://github.com/aws/aws-cdk/issues/15888)
13+
* **servicecatalogappregistry:** application-associator L2 Construct ([#22024](https://github.com/aws/aws-cdk/issues/22024)) ([a2b7a46](https://github.com/aws/aws-cdk/commit/a2b7a4624638a458bfb6e8e09c67a77e48e1d167))
14+
515
## [2.44.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.43.1-alpha.0...v2.44.0-alpha.0) (2022-09-28)
616

717

CHANGELOG.v2.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,38 @@
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.45.0](https://github.com/aws/aws-cdk/compare/v2.44.0...v2.45.0) (2022-10-06)
6+
7+
8+
### Features
9+
10+
* add `addMetadata()` method to `Stack` ([#22337](https://github.com/aws/aws-cdk/issues/22337)) ([61b2ab7](https://github.com/aws/aws-cdk/commit/61b2ab79f2a044dcceba7fec1a01629873aa4517))
11+
* **apigateway:** add accessLogField static method ([#22322](https://github.com/aws/aws-cdk/issues/22322)) ([3ce8e47](https://github.com/aws/aws-cdk/commit/3ce8e47159c5f108c2f20d10714117762ad99ffd)), closes [#21650](https://github.com/aws/aws-cdk/issues/21650)
12+
* **apigateway:** create BasePathMapping without stage ([#21488](https://github.com/aws/aws-cdk/issues/21488)) ([9bb213c](https://github.com/aws/aws-cdk/commit/9bb213c326ec79aca71bb646decd799f8c4954cd)), closes [#15806](https://github.com/aws/aws-cdk/issues/15806)
13+
* **aws-cloudwatch:** composite alarm actions suppression ([#22330](https://github.com/aws/aws-cdk/issues/22330)) ([19c945e](https://github.com/aws/aws-cdk/commit/19c945e280baa0c074e4d278c5b418042d595fa6))
14+
* **cfn-include:** allow cyclical dependencies ([#22126](https://github.com/aws/aws-cdk/issues/22126)) ([2c8195a](https://github.com/aws/aws-cdk/commit/2c8195a0ee0b2832ade598259a4bae5e3ea25eaa))
15+
* **cfnspec:** cloudformation spec v91.0.0 ([#22305](https://github.com/aws/aws-cdk/issues/22305)) ([0358d51](https://github.com/aws/aws-cdk/commit/0358d51954b3ae32c6d7bdb490d498ab743770ec))
16+
* **codedeploy:** CodeDeploy deployment config constructs for Lambda and ECS ([#22159](https://github.com/aws/aws-cdk/issues/22159)) ([6840d8e](https://github.com/aws/aws-cdk/commit/6840d8e43381793bd7a51191bddaffc4cb6641d6))
17+
* **codepipeline-actions:** add elastic beanstalk deploy action ([#22135](https://github.com/aws/aws-cdk/issues/22135)) ([d8acc8a](https://github.com/aws/aws-cdk/commit/d8acc8aa07867be1b1b3cad05b67dab2d7bc3252)), closes [#2516](https://github.com/aws/aws-cdk/issues/2516)
18+
* **core:** allow overriding the stage name ([#22223](https://github.com/aws/aws-cdk/issues/22223)) ([3d227e5](https://github.com/aws/aws-cdk/commit/3d227e5e8a7452af85470e6e617dd785dcfb6fbe)), closes [40aws-cdk/core/lib/stage.ts#L139](https://github.com/40aws-cdk/core/lib/stage.ts/issues/L139) [40aws-cdk/core/lib/stack.ts#L1139-L1143](https://github.com/40aws-cdk/core/lib/stack.ts/issues/L1139-L1143) [40aws-cdk/core/lib/stack.ts#L106-L111](https://github.com/40aws-cdk/core/lib/stack.ts/issues/L106-L111)
19+
* **core:** make `StackSynthesizer` easier to subclass ([#22308](https://github.com/aws/aws-cdk/issues/22308)) ([8b2b381](https://github.com/aws/aws-cdk/commit/8b2b38187b709a4e9a37a4de043a84267a9ec937))
20+
* **sqs:** add SQS managed server side encryption ([#21591](https://github.com/aws/aws-cdk/issues/21591)) ([fa137eb](https://github.com/aws/aws-cdk/commit/fa137eb9f57a0956dae512e41b7a400b401d5642)), closes [#17770](https://github.com/aws/aws-cdk/issues/17770)
21+
22+
23+
### Bug Fixes
24+
25+
* **certificatemanager:** unable to set removal policy on DnsValidatedCertificate ([#22122](https://github.com/aws/aws-cdk/issues/22122)) ([bae6554](https://github.com/aws/aws-cdk/commit/bae655419c2f0805c4fa3ea7ef20704539bbb44c)), closes [#22040](https://github.com/aws/aws-cdk/issues/22040) [#22040](https://github.com/aws/aws-cdk/issues/22040) [#20649](https://github.com/aws/aws-cdk/issues/20649) [#14519](https://github.com/aws/aws-cdk/issues/14519)
26+
* **cli:** large context causes E2BIG error during synthesis on Linux ([#21373](https://github.com/aws/aws-cdk/issues/21373)) ([7040168](https://github.com/aws/aws-cdk/commit/7040168f21f81421b78c44955b39cfca21c6c22d)), closes [#21230](https://github.com/aws/aws-cdk/issues/21230) [#19261](https://github.com/aws/aws-cdk/issues/19261)
27+
* **core:** addPropertyOverride doesn't work for all intrinsics ([#22294](https://github.com/aws/aws-cdk/issues/22294)) ([e2deca0](https://github.com/aws/aws-cdk/commit/e2deca0f1981f09c9d32c11c8359400191a7d753)), closes [#20608](https://github.com/aws/aws-cdk/issues/20608) [#19971](https://github.com/aws/aws-cdk/issues/19971)
28+
* **ec2:** cannot allow all ipv6 traffic ([#22279](https://github.com/aws/aws-cdk/issues/22279)) ([f7bbc94](https://github.com/aws/aws-cdk/commit/f7bbc943f00f3e0ceeb0ed03ec03bb36af5b3cb9)), closes [#7094](https://github.com/aws/aws-cdk/issues/7094)
29+
* **init:** freshly generated go project doesn't build ([#22310](https://github.com/aws/aws-cdk/issues/22310)) ([c6a4e71](https://github.com/aws/aws-cdk/commit/c6a4e71067299b0e0ad65f31e9eec15a4e80ebdb))
30+
* **region-info:** SSM service principals are incorrect in opt-in regions ([#22327](https://github.com/aws/aws-cdk/issues/22327)) ([b7f0889](https://github.com/aws/aws-cdk/commit/b7f08895c884c9e4e8b672e62f6c7515fa65b3a8))
31+
* **s3:** Bucket Key cannot be used with KMS_MANAGED key ([#22331](https://github.com/aws/aws-cdk/issues/22331)) ([63d3c54](https://github.com/aws/aws-cdk/commit/63d3c541e571dffe3efab83e69fa9718eef14411))
32+
* **sns:** race condition exists between sqs queue policy and sns subscription ([#21797](https://github.com/aws/aws-cdk/issues/21797)) ([cf43b03](https://github.com/aws/aws-cdk/commit/cf43b03c0c6231f93ca1db0b24df7c623d55dd2b))
33+
* **sqs:** SSE-SQS is enabled by default and can't be disabled ([#22321](https://github.com/aws/aws-cdk/issues/22321)) ([43547d3](https://github.com/aws/aws-cdk/commit/43547d3544a02f76c287abfc26570a02cfae65c6)), closes [#22137](https://github.com/aws/aws-cdk/issues/22137)
34+
* **step-functions:** arn is not valid across partitions ([#22314](https://github.com/aws/aws-cdk/issues/22314)) ([6e16ffe](https://github.com/aws/aws-cdk/commit/6e16ffe8e49f6a5d4ba076ba3d66f564daded96b))
35+
* **stepfunctions-tasks:** emrcontainers has incorrect validation of entry point arguments ([#22242](https://github.com/aws/aws-cdk/issues/22242)) ([a006b9a](https://github.com/aws/aws-cdk/commit/a006b9a9ec7f743ce276f98bfbdac12a8ee13872)), closes [#22061](https://github.com/aws/aws-cdk/issues/22061)
36+
537
## [2.44.0](https://github.com/aws/aws-cdk/compare/v2.43.1...v2.44.0) (2022-09-28)
638

739

docs/DESIGN_GUIDELINES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ new lambda.Function(this, 'MyFunction', {
671671
code: lambda.Code.bucket(myBucket, 'bundle.zip'), // or
672672
code: lambda.Code.inline('code')
673673
// etc
674-
}
674+
})
675675
```
676676

677677
### Attributes

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
"devDependencies": {
1919
"@types/prettier": "2.6.0",
2020
"@yarnpkg/lockfile": "^1.1.0",
21-
"cdk-generate-synthetic-examples": "^0.1.17",
21+
"cdk-generate-synthetic-examples": "^0.1.23",
2222
"conventional-changelog-cli": "^2.2.2",
2323
"fs-extra": "^9.1.0",
2424
"graceful-fs": "^4.2.10",
2525
"jest-junit": "^13.2.0",
26-
"jsii-diff": "^1.68.0",
27-
"jsii-pacmak": "^1.68.0",
28-
"jsii-reflect": "^1.68.0",
29-
"jsii-rosetta": "^1.68.0",
26+
"jsii-diff": "^1.69.0",
27+
"jsii-pacmak": "^1.69.0",
28+
"jsii-reflect": "^1.69.0",
29+
"jsii-rosetta": "^1.69.0",
3030
"lerna": "^4.0.0",
3131
"patch-package": "^6.4.7",
3232
"semver": "^6.3.0",

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,22 @@ declare const lambdaFn: lambda.Function;
389389
importedKey.grantRead(lambdaFn);
390390
```
391391

392+
### Adding an API Key to an imported RestApi
393+
394+
API Keys are added to ApiGateway Stages, not to the API itself. When you import a RestApi
395+
it does not have any information on the Stages that may be associated with it. Since adding an API
396+
Key requires a stage, you should instead add the Api Key to the imported Stage.
397+
398+
```ts
399+
declare const restApi: apigateway.IRestApi;
400+
const importedStage = apigateway.Stage.fromStageAttributes(this, 'imported-stage', {
401+
stageName: 'myStageName',
402+
restApi,
403+
});
404+
405+
importedStage.addApiKey('MyApiKey');
406+
```
407+
392408
### ⚠️ Multiple API Keys
393409

394410
It is possible to specify multiple API keys for a given Usage Plan, by calling `usagePlan.addApiKey()`.
@@ -426,7 +442,7 @@ declare const api: apigateway.RestApi;
426442

427443
const key = new apigateway.RateLimitedApiKey(this, 'rate-limited-api-key', {
428444
customerId: 'hello-customer',
429-
resources: [api],
445+
stages: [api.deploymentStage],
430446
quota: {
431447
limit: 10000,
432448
period: apigateway.Period.MONTH

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

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Construct } from 'constructs';
44
import { CfnApiKey } from './apigateway.generated';
55
import { ResourceOptions } from './resource';
66
import { IRestApi } from './restapi';
7+
import { IStage } from './stage';
78
import { QuotaSettings, ThrottleSettings, UsagePlan, UsagePlanPerApiStage } from './usage-plan';
89

910
/**
@@ -56,9 +57,17 @@ export interface ApiKeyProps extends ApiKeyOptions {
5657
/**
5758
* A list of resources this api key is associated with.
5859
* @default none
60+
* @deprecated - use `stages` instead
5961
*/
6062
readonly resources?: IRestApi[];
6163

64+
/**
65+
* A list of Stages this api key is associated with.
66+
*
67+
* @default - the api key is not associated with any stages
68+
*/
69+
readonly stages?: IStage[];
70+
6271
/**
6372
* An AWS Marketplace customer identifier to use when integrating with the AWS SaaS Marketplace.
6473
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-apikey.html#cfn-apigateway-apikey-customerid
@@ -168,7 +177,7 @@ export class ApiKey extends ApiKeyBase {
168177
enabled: props.enabled ?? true,
169178
generateDistinctId: props.generateDistinctId,
170179
name: this.physicalName,
171-
stageKeys: this.renderStageKeys(props.resources),
180+
stageKeys: this.renderStageKeys(props.resources, props.stages),
172181
value: props.value,
173182
});
174183

@@ -182,17 +191,29 @@ export class ApiKey extends ApiKeyBase {
182191
});
183192
}
184193

185-
private renderStageKeys(resources: IRestApi[] | undefined): CfnApiKey.StageKeyProperty[] | undefined {
186-
if (!resources) {
194+
private renderStageKeys(resources?: IRestApi[], stages?: IStage[]): CfnApiKey.StageKeyProperty[] | undefined {
195+
if (!resources && !stages) {
187196
return undefined;
188197
}
189198

190-
return resources.map((resource: IRestApi) => {
191-
const restApi = resource;
192-
const restApiId = restApi.restApiId;
193-
const stageName = restApi.deploymentStage!.stageName.toString();
194-
return { restApiId, stageName };
195-
});
199+
if (resources && stages) {
200+
throw new Error('Only one of "resources" or "stages" should be provided');
201+
}
202+
203+
return resources
204+
? resources.map((resource: IRestApi) => {
205+
const restApi = resource;
206+
if (!restApi.deploymentStage) {
207+
throw new Error('Cannot add an ApiKey to a RestApi that does not contain a "deploymentStage".\n'+
208+
'Either set the RestApi.deploymentStage or create an ApiKey from a Stage');
209+
}
210+
const restApiId = restApi.restApiId;
211+
const stageName = restApi.deploymentStage!.stageName.toString();
212+
return { restApiId, stageName };
213+
})
214+
: stages ? stages.map((stage => {
215+
return { restApiId: stage.restApi.restApiId, stageName: stage.stageName };
216+
})) : undefined;
196217
}
197218
}
198219

@@ -258,4 +279,4 @@ const writePermissions = [
258279
'apigateway:PUT',
259280
'apigateway:PATCH',
260281
'apigateway:DELETE',
261-
];
282+
];

packages/@aws-cdk/aws-apigateway/lib/domain-name.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface DomainNameOptions {
3939
/**
4040
* The Transport Layer Security (TLS) version + cipher suite for this domain name.
4141
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html
42-
* @default SecurityPolicy.TLS_1_0
42+
* @default SecurityPolicy.TLS_1_2
4343
*/
4444
readonly securityPolicy?: SecurityPolicy;
4545

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,11 @@ export abstract class RestApiBase extends Resource implements IRestApi {
403403
}
404404

405405
/**
406-
* Add an ApiKey
406+
* Add an ApiKey to the deploymentStage
407407
*/
408408
public addApiKey(id: string, options?: ApiKeyOptions): IApiKey {
409409
return new ApiKey(this, id, {
410-
resources: [this],
410+
stages: [this.deploymentStage],
411411
...options,
412412
});
413413
}

0 commit comments

Comments
 (0)