Skip to content

Commit

Permalink
Merge branch 'main' into AWS242-27547
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Mar 2, 2023
2 parents e28b4bb + 0ebbf58 commit d0b14fa
Show file tree
Hide file tree
Showing 388 changed files with 8,611 additions and 2,613 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The following tools need to be installed on your system prior to installing the
- [Node.js >= 14.15.0](https://nodejs.org/download/release/latest-v14.x/)
- We recommend using a version in [Active LTS](https://nodejs.org/en/about/releases/)
- [Yarn >= 1.19.1, < 2](https://yarnpkg.com/lang/en/docs/install)
- [.NET Core SDK >= 3.1.x](https://www.microsoft.com/net/download)
- [.NET SDK >= 6.0.x](https://www.microsoft.com/net/download)
- [Python >= 3.6.5, < 4.0](https://www.python.org/downloads/release/python-365/)
- [Docker >= 19.03](https://docs.docker.com/get-docker/)
- the Docker daemon must also be running
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The CDK is available in the following languages:
- We recommend using a version in [Active LTS](https://nodejs.org/en/about/releases/)
* Python ([Python ≥ 3.6](https://www.python.org/downloads/))
* Java ([Java ≥ 8](https://www.oracle.com/technetwork/java/javase/downloads/index.html) and [Maven ≥ 3.5.4](https://maven.apache.org/download.cgi))
* .NET ([.NET Core ≥ 3.1](https://dotnet.microsoft.com/download))
* .NET ([.NET ≥ 6.0](https://dotnet.microsoft.com/download))
* Go ([Go ≥ 1.16.4](https://golang.org/))

Third-party Language Deprecation: language version is only supported until its EOL (End Of Life) shared by the vendor or community and is subject to change with prior notice.
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
"@types/node": "18.11.19",
"@types/prettier": "2.6.0",
"@yarnpkg/lockfile": "^1.1.0",
"cdk-generate-synthetic-examples": "^0.1.155",
"cdk-generate-synthetic-examples": "^0.1.167",
"conventional-changelog-cli": "^2.2.2",
"fs-extra": "^9.1.0",
"graceful-fs": "^4.2.10",
"jest-junit": "^13.2.0",
"jsii-diff": "1.75.0",
"jsii-pacmak": "1.75.0",
"jsii-reflect": "1.75.0",
"jsii-rosetta": "1.75.0",
"jsii-diff": "1.76.0",
"jsii-pacmak": "1.76.0",
"jsii-reflect": "1.76.0",
"jsii-rosetta": "v4.9-next",
"lerna": "^4.0.0",
"patch-package": "^6.5.1",
"semver": "^6.3.0",
Expand Down
13 changes: 11 additions & 2 deletions packages/@aws-cdk-testing/cli-integ/bin/stage-distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ async function main() {
type: 'boolean',
requiresArg: false,
})
.option('regression', {
description: 'Enable access to previous versions of the staged packages (this is expensive for CodeArtifact so we only do it when necessary)',
type: 'boolean',
requiresArg: false,
default: false,
})
.command('publish <DIRECTORY>', 'Publish a given directory', cmd => cmd
.positional('DIRECTORY', {
descripton: 'Directory distribution',
Expand Down Expand Up @@ -190,6 +196,7 @@ async function publish(repo: TestRepository, usageDir: UsageDir, args: {
python?: boolean;
java?: boolean;
dotnet?: boolean;
regression?: boolean;
}) {
const directory = `${args.DIRECTORY}`;
const login = await repo.loginInformation();
Expand Down Expand Up @@ -221,8 +228,10 @@ async function publish(repo: TestRepository, usageDir: UsageDir, args: {
await uploadDotnetPackages(glob.sync(path.join(directory, 'dotnet', '**', '*.nupkg')), usageDir);
});

console.log('🛍 Configuring packages for upstream versions');
await repo.markAllUpstreamAllow();
if (args.regression) {
console.log('🛍 Configuring packages for upstream versions');
await repo.markAllUpstreamAllow();
}
}

function whichRepos(args: {
Expand Down
5 changes: 3 additions & 2 deletions packages/@aws-cdk-testing/cli-integ/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"@octokit/rest": "^18.12.0",
"aws-sdk": "^2.1317.0",
"aws-sdk": "^2.1325.0",
"axios": "^0.27.2",
"fs-extra": "^9.1.0",
"glob": "^7.2.3",
Expand All @@ -50,7 +50,8 @@
"p-queue": "^6.6.2",
"semver": "^7.3.8",
"ts-mock-imports": "^1.3.8",
"yargs": "^17.7.0"
"yaml": "1.10.2",
"yargs": "^17.7.1"
},
"repository": {
"url": "https://github.com/aws/aws-cdk.git",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from 'fs';
import * as path from 'path';
import * as yaml from 'yaml';
import { integTest, randomString, withoutBootstrap } from '../../lib';

jest.setTimeout(2 * 60 * 60_000); // Includes the time to acquire locks, worst-case single-threaded runtime
Expand Down Expand Up @@ -196,6 +197,41 @@ integTest('can dump the template, modify and use it to deploy a custom bootstrap
});
}));

integTest('a customized template vendor will not overwrite the default template', withoutBootstrap(async (fixture) => {
// Initial bootstrap
const toolkitStackName = fixture.bootstrapStackName;
await fixture.cdkBootstrapModern({
toolkitStackName,
cfnExecutionPolicy: 'arn:aws:iam::aws:policy/AdministratorAccess',
});

// Customize template
const templateStr = await fixture.cdkBootstrapModern({
// toolkitStackName doesn't matter for this particular invocation
toolkitStackName,
showTemplate: true,
cliOptions: {
captureStderr: false,
},
});

const template = yaml.parse(templateStr, { schema: 'core' });
template.Parameters.BootstrapVariant.Default = 'CustomizedVendor';
const filename = path.join(fixture.integTestDir, `${fixture.qualifier}-template.yaml`);
fs.writeFileSync(filename, yaml.stringify(template, { schema: 'yaml-1.1' }), { encoding: 'utf-8' });

// Rebootstrap. For some reason, this doesn't cause a failure, it's a successful no-op.
const output = await fixture.cdkBootstrapModern({
toolkitStackName,
template: filename,
cfnExecutionPolicy: 'arn:aws:iam::aws:policy/AdministratorAccess',
cliOptions: {
captureStderr: true,
},
});
expect(output).toContain('Not overwriting it with a template containing');
}));

integTest('can use the default permissions boundary to bootstrap', withoutBootstrap(async (fixture) => {
let template = await fixture.cdkBootstrapModern({
// toolkitStackName doesn't matter for this particular invocation
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-amplify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.5.2",
"aws-sdk": "^2.1317.0",
"aws-sdk": "^2.1325.0",
"jsii": "v4.9-next"
},
"dependencies": {
Expand Down
34 changes: 32 additions & 2 deletions packages/@aws-cdk/aws-apigateway/lib/restapi.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
import { IVpcEndpoint } from '@aws-cdk/aws-ec2';
import * as iam from '@aws-cdk/aws-iam';
import { ArnFormat, CfnOutput, IResource as IResourceBase, Resource, Stack, Token, FeatureFlags, RemovalPolicy } from '@aws-cdk/core';
import { ArnFormat, CfnOutput, IResource as IResourceBase, Resource, Stack, Token, FeatureFlags, RemovalPolicy, Size } from '@aws-cdk/core';
import { APIGATEWAY_DISABLE_CLOUDWATCH_ROLE } from '@aws-cdk/cx-api';
import { Construct } from 'constructs';
import { ApiDefinition } from './api-definition';
Expand Down Expand Up @@ -225,9 +225,22 @@ export interface RestApiProps extends RestApiOptions {
* payload size.
*
* @default - Compression is disabled.
* @deprecated - superseded by `minCompressionSize`
*/
readonly minimumCompressionSize?: number;

/**
* A Size(in bytes, kibibytes, mebibytes etc) that is used to enable compression (with non-negative
* between 0 and 10485760 (10M) bytes, inclusive) or disable compression
* (when undefined) on an API. When compression is enabled, compression or
* decompression is not applied on the payload if the payload size is
* smaller than this value. Setting it to zero allows compression for any
* payload size.
*
* @default - Compression is disabled.
*/
readonly minCompressionSize?: Size;

/**
* The ID of the API Gateway RestApi resource that you want to clone.
*
Expand Down Expand Up @@ -261,6 +274,18 @@ export interface SpecRestApiProps extends RestApiBaseProps {
* @see https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html
*/
readonly apiDefinition: ApiDefinition;

/**
* A Size(in bytes, kibibytes, mebibytes etc) that is used to enable compression (with non-negative
* between 0 and 10485760 (10M) bytes, inclusive) or disable compression
* (when undefined) on an API. When compression is enabled, compression or
* decompression is not applied on the payload if the payload size is
* smaller than this value. Setting it to zero allows compression for any
* payload size.
*
* @default - Compression is disabled.
*/
readonly minCompressionSize?: Size;
}

/**
Expand Down Expand Up @@ -648,6 +673,7 @@ export class SpecRestApi extends RestApiBase {
name: this.restApiName,
policy: props.policy,
failOnWarnings: props.failOnWarnings,
minimumCompressionSize: props.minCompressionSize?.toBytes(),
body: apiDefConfig.inlineDefinition ?? undefined,
bodyS3Location: apiDefConfig.inlineDefinition ? undefined : apiDefConfig.s3Location,
endpointConfiguration: this._configureEndpoints(props),
Expand Down Expand Up @@ -758,12 +784,16 @@ export class RestApi extends RestApiBase {
constructor(scope: Construct, id: string, props: RestApiProps = { }) {
super(scope, id, props);

if (props.minCompressionSize !== undefined && props.minimumCompressionSize !== undefined) {
throw new Error('both properties minCompressionSize and minimumCompressionSize cannot be set at once.');
}

const resource = new CfnRestApi(this, 'Resource', {
name: this.physicalName,
description: props.description,
policy: props.policy,
failOnWarnings: props.failOnWarnings,
minimumCompressionSize: props.minimumCompressionSize,
minimumCompressionSize: props.minCompressionSize?.toBytes() ?? props.minimumCompressionSize,
binaryMediaTypes: props.binaryMediaTypes,
endpointConfiguration: this._configureEndpoints(props),
apiKeySourceType: props.apiKeySourceType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "21.0.0",
"version": "30.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"21.0.0"}
{"version":"30.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "21.0.0",
"version": "30.0.0",
"testCases": {
"apigateway-restapi/DefaultTest": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{
"version": "21.0.0",
"version": "30.0.0",
"artifacts": {
"Tree": {
"type": "cdk:tree",
"properties": {
"file": "tree.json"
}
},
"test-apigateway-restapi.assets": {
"type": "cdk:asset-manifest",
"properties": {
Expand All @@ -23,7 +17,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/527feb6f65d1f41404abb6acfb6504a918e1d7489665b74acb9fa0ca23f34049.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/94f416193221135915e06201345d08e3db001c8bbf22b073f16ec02d3b8fba4b.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down Expand Up @@ -60,7 +54,7 @@
"/test-apigateway-restapi/my-api/Deployment/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "myapiDeployment92F2CB4996088bac04ec19d9db88f146f3d88bca"
"data": "myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb"
}
],
"/test-apigateway-restapi/my-api/DeploymentStage.beta/Resource": [
Expand Down Expand Up @@ -204,7 +198,7 @@
"/test-apigateway-restapi/TestDeployment/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "TestDeploymentD77B56866f3141cef1e8fea8ab3b3b8bc90df36d"
"data": "TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1"
}
],
"/test-apigateway-restapi/TestStage/Resource": [
Expand All @@ -231,28 +225,19 @@
"data": "CheckBootstrapVersion"
}
],
"myapiDeployment92F2CB4963d40685c54c6f8da21d80a83f16d3d5": [
"myapiDeployment92F2CB4996088bac04ec19d9db88f146f3d88bca": [
{
"type": "aws:cdk:logicalId",
"data": "myapiDeployment92F2CB4963d40685c54c6f8da21d80a83f16d3d5",
"data": "myapiDeployment92F2CB4996088bac04ec19d9db88f146f3d88bca",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
}
],
"myapiv1appliances507FEFF4": [
"TestDeploymentD77B56866f3141cef1e8fea8ab3b3b8bc90df36d": [
{
"type": "aws:cdk:logicalId",
"data": "myapiv1appliances507FEFF4",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
}
],
"myapiv1appliancesGET8FE872EC": [
{
"type": "aws:cdk:logicalId",
"data": "myapiv1appliancesGET8FE872EC",
"data": "TestDeploymentD77B56866f3141cef1e8fea8ab3b3b8bc90df36d",
"trace": [
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
]
Expand Down Expand Up @@ -307,6 +292,12 @@
]
},
"displayName": "apigateway-restapi/DefaultTest/DeployAssert"
},
"Tree": {
"type": "cdk:tree",
"properties": {
"file": "tree.json"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "21.0.0",
"version": "30.0.0",
"files": {
"527feb6f65d1f41404abb6acfb6504a918e1d7489665b74acb9fa0ca23f34049": {
"94f416193221135915e06201345d08e3db001c8bbf22b073f16ec02d3b8fba4b": {
"source": {
"path": "test-apigateway-restapi.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "527feb6f65d1f41404abb6acfb6504a918e1d7489665b74acb9fa0ca23f34049.json",
"objectKey": "94f416193221135915e06201345d08e3db001c8bbf22b073f16ec02d3b8fba4b.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"myapi4C7BF186": {
"Type": "AWS::ApiGateway::RestApi",
"Properties": {
"MinimumCompressionSize": 1024,
"Name": "my-api"
}
},
Expand Down Expand Up @@ -55,7 +56,7 @@
"UpdateReplacePolicy": "Retain",
"DeletionPolicy": "Retain"
},
"myapiDeployment92F2CB4996088bac04ec19d9db88f146f3d88bca": {
"myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"RestApiId": {
Expand Down Expand Up @@ -87,7 +88,7 @@
"CacheClusterEnabled": true,
"CacheClusterSize": "0.5",
"DeploymentId": {
"Ref": "myapiDeployment92F2CB4996088bac04ec19d9db88f146f3d88bca"
"Ref": "myapiDeployment92F2CB496a6dee9579dae89ab3a0b094b4d193eb"
},
"Description": "beta stage",
"MethodSettings": [
Expand Down Expand Up @@ -672,7 +673,7 @@
"MyHandlerServiceRoleFFA06653"
]
},
"TestDeploymentD77B56866f3141cef1e8fea8ab3b3b8bc90df36d": {
"TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1": {
"Type": "AWS::ApiGateway::Deployment",
"Properties": {
"RestApiId": {
Expand All @@ -695,7 +696,7 @@
"Ref": "myapi4C7BF186"
},
"DeploymentId": {
"Ref": "TestDeploymentD77B56866f3141cef1e8fea8ab3b3b8bc90df36d"
"Ref": "TestDeploymentD77B56860a9c34c1bc306bfbc7d318827eacd1e1"
},
"StageName": "prod"
},
Expand Down
Loading

0 comments on commit d0b14fa

Please sign in to comment.