Skip to content

Commit

Permalink
Merge branch 'main' into mrgrain/feat/21169-integ-test-test-regex
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 10, 2022
2 parents 2cb9bd4 + 0a55e91 commit daba17f
Show file tree
Hide file tree
Showing 398 changed files with 19,175 additions and 3,832 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"devDependencies": {
"@types/prettier": "2.6.0",
"@yarnpkg/lockfile": "^1.1.0",
"cdk-generate-synthetic-examples": "^0.1.43",
"cdk-generate-synthetic-examples": "^0.1.57",
"conventional-changelog-cli": "^2.2.2",
"fs-extra": "^9.1.0",
"graceful-fs": "^4.2.10",
"jest-junit": "^13.2.0",
"jsii-diff": "1.69.0",
"jsii-pacmak": "1.69.0",
"jsii-reflect": "1.69.0",
"jsii-rosetta": "1.69.0",
"jsii-diff": "1.71.0",
"jsii-pacmak": "1.71.0",
"jsii-reflect": "1.71.0",
"jsii-rosetta": "1.71.0",
"lerna": "^4.0.0",
"patch-package": "^6.5.0",
"semver": "^6.3.0",
Expand Down
20 changes: 20 additions & 0 deletions packages/@aws-cdk/aws-apprunner/lib/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ export class Runtime {
*/
public static readonly CORRETTO_11 = Runtime.of('CORRETTO_11')

/**
* .NET 6
*/
public static readonly DOTNET_6 = Runtime.of('DOTNET_6')

/**
* Go 1.18
*/
public static readonly GO_1 = Runtime.of('GO_1')

/**
* NodeJS 12
*/
Expand All @@ -118,11 +128,21 @@ export class Runtime {
*/
public static readonly NODEJS_16 = Runtime.of('NODEJS_16')

/**
* PHP 8.1
*/
public static readonly PHP_81 = Runtime.of('PHP_81')

/**
* Python 3
*/
public static readonly PYTHON_3 = Runtime.of('PYTHON_3')

/**
* Ruby 3.1
*/
public static readonly RUBY_31 = Runtime.of('RUBY_31')

/**
* Other runtimes
*
Expand Down
5 changes: 3 additions & 2 deletions packages/@aws-cdk/aws-cloudfront/lib/distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,9 @@ export class Distribution extends Resource implements IDistribution {
} else {
const originIndex = this.boundOrigins.length + 1;
const scope = new Construct(this, `Origin${originIndex}`);
const originId = Names.uniqueId(scope).slice(-ORIGIN_ID_MAX_LENGTH);
const originBindConfig = origin.bind(scope, { originId });
const generatedId = Names.uniqueId(scope).slice(-ORIGIN_ID_MAX_LENGTH);
const originBindConfig = origin.bind(scope, { originId: generatedId });
const originId = originBindConfig.originProperty?.id ?? generatedId;
const duplicateId = this.boundOrigins.find(boundOrigin => boundOrigin.originProperty?.id === originBindConfig.originProperty?.id);
if (duplicateId) {
throw new Error(`Origin with id ${duplicateId.originProperty?.id} already exists. OriginIds must be unique within a distribution`);
Expand Down
54 changes: 54 additions & 0 deletions packages/@aws-cdk/aws-cloudfront/test/distribution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,60 @@ describe('origin IDs', () => {
});
});

describe('custom origin ids', () => {
test('test that originId param is respected', () => {
const origin = defaultOrigin(undefined, 'custom-origin-id');

const distribution = new Distribution(stack, 'Http1Distribution', {
defaultBehavior: { origin },
additionalBehaviors: {
secondUsage: {
origin,
},
},
});
distribution.addBehavior(
'thirdUsage',
origin,
);

Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', {
DistributionConfig: {
DefaultCacheBehavior: {
CachePolicyId: '658327ea-f89d-4fab-a63d-7e88639e58f6',
Compress: true,
TargetOriginId: 'custom-origin-id',
ViewerProtocolPolicy: 'allow-all',
},
CacheBehaviors: [{
CachePolicyId: '658327ea-f89d-4fab-a63d-7e88639e58f6',
Compress: true,
PathPattern: 'secondUsage',
TargetOriginId: 'custom-origin-id',
ViewerProtocolPolicy: 'allow-all',
},
{
CachePolicyId: '658327ea-f89d-4fab-a63d-7e88639e58f6',
Compress: true,
PathPattern: 'thirdUsage',
TargetOriginId: 'custom-origin-id',
ViewerProtocolPolicy: 'allow-all',
}],
Enabled: true,
HttpVersion: 'http2',
IPV6Enabled: true,
Origins: [{
DomainName: 'www.example.com',
Id: 'custom-origin-id',
CustomOriginConfig: {
OriginProtocolPolicy: 'https-only',
},
}],
},
});
});
});

describe('supported HTTP versions', () => {
test('setting HTTP/1.1 renders HttpVersion correctly', () => {
new Distribution(stack, 'Http1Distribution', {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "21.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
"path": "DistributionOriginIdDefaultTestDeployAssert16FC3109.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"21.0.0"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "21.0.0",
"files": {
"413425a9c32869faf78d5031f15a0e8f5eed244599a8c576f6f4c025d23505e6": {
"source": {
"path": "integ-distribution-origin-id.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "413425a9c32869faf78d5031f15a0e8f5eed244599a8c576f6f4c025d23505e6.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
}
},
"dockerImages": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"Resources": {
"TestDistribution94EC811C": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"CacheBehaviors": [
{
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"PathPattern": "/second",
"TargetOriginId": "my-custom-origin-id",
"ViewerProtocolPolicy": "allow-all"
},
{
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"PathPattern": "/third",
"TargetOriginId": "my-custom-origin-id",
"ViewerProtocolPolicy": "allow-all"
}
],
"DefaultCacheBehavior": {
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"TargetOriginId": "my-custom-origin-id",
"ViewerProtocolPolicy": "allow-all"
},
"Enabled": true,
"HttpVersion": "http2",
"IPV6Enabled": true,
"Origins": [
{
"CustomOriginConfig": {
"OriginProtocolPolicy": "https-only"
},
"DomainName": "www.example.com",
"Id": "my-custom-origin-id"
}
]
}
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "21.0.0",
"testCases": {
"DistributionOriginId/DefaultTest": {
"stacks": [
"integ-distribution-origin-id"
],
"assertionStack": "DistributionOriginId/DefaultTest/DeployAssert",
"assertionStackName": "DistributionOriginIdDefaultTestDeployAssert16FC3109"
}
}
}
Loading

0 comments on commit daba17f

Please sign in to comment.