Skip to content

Commit 886b28d

Browse files
authored
Merge branch 'main' into mergify/configuration-deprecated-update
2 parents 74b8b2c + 02cb5a4 commit 886b28d

File tree

5 files changed

+41
-18
lines changed

5 files changed

+41
-18
lines changed

packages/@aws-cdk/aws-msk-alpha/.eslintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,12 @@ baseConfig.parserOptions.project = __dirname + '/tsconfig.json';
44
baseConfig.rules['import/no-extraneous-dependencies'] = ['error', { devDependencies: true, peerDependencies: true } ];
55
baseConfig.rules['import/order'] = 'off';
66
baseConfig.rules['@aws-cdk/invalid-cfn-imports'] = 'off';
7+
baseConfig.rules['@cdklabs/no-throw-default-error'] = ['error'];
8+
baseConfig.overrides.push({
9+
files: ["./test/**"],
10+
rules: {
11+
"@cdklabs/no-throw-default-error": "off",
12+
},
13+
});
714

815
module.exports = baseConfig;

packages/@aws-cdk/aws-msk-alpha/lib/cluster.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export abstract class ClusterBase extends core.Resource implements ICluster {
4646
/** Manages connections for the cluster */
4747
public get connections(): ec2.Connections {
4848
if (!this._connections) {
49-
throw new Error('An imported Cluster cannot manage its security groups');
49+
throw new core.ValidationError('An imported Cluster cannot manage its security groups', this);
5050
}
5151
return this._connections;
5252
}
@@ -477,26 +477,24 @@ export class Cluster extends ClusterBase {
477477
});
478478

479479
if (subnetSelection.subnets.length < 2) {
480-
throw Error(`Cluster requires at least 2 subnets, got ${subnetSelection.subnets.length}`);
480+
throw new core.ValidationError(`Cluster requires at least 2 subnets, got ${subnetSelection.subnets.length}`, this);
481481
}
482482

483483
if (props.encryptionInTransit?.clientBroker === ClientBrokerEncryption.PLAINTEXT && props.clientAuthentication) {
484-
throw Error('To enable client authentication, you must enabled TLS-encrypted traffic between clients and brokers.');
484+
throw new core.ValidationError('To enable client authentication, you must enabled TLS-encrypted traffic between clients and brokers.', this);
485485
} else if (
486486
props.encryptionInTransit?.clientBroker ===
487487
ClientBrokerEncryption.TLS_PLAINTEXT &&
488488
(props.clientAuthentication?.saslProps?.scram ||
489489
props.clientAuthentication?.saslProps?.iam)
490490
) {
491-
throw Error(
492-
'To enable SASL/SCRAM or IAM authentication, you must only allow TLS-encrypted traffic between clients and brokers.',
493-
);
491+
throw new core.ValidationError('To enable SASL/SCRAM or IAM authentication, you must only allow TLS-encrypted traffic between clients and brokers.', this);
494492
}
495493

496494
const volumeSize = props.ebsStorageInfo?.volumeSize ?? 1000;
497495
// Minimum: 1 GiB, maximum: 16384 GiB
498496
if (volumeSize < 1 || volumeSize > 16384) {
499-
throw Error('EBS volume size should be in the range 1-16384');
497+
throw new core.ValidationError('EBS volume size should be in the range 1-16384', this);
500498
}
501499

502500
const instanceType = props.instanceType
@@ -507,12 +505,12 @@ export class Cluster extends ClusterBase {
507505

508506
if (props.storageMode && props.storageMode === StorageMode.TIERED) {
509507
if (!props.kafkaVersion.isTieredStorageCompatible()) {
510-
throw Error(`To deploy a tiered cluster you must select a compatible Kafka version, got ${props.kafkaVersion.version}`);
508+
throw new core.ValidationError(`To deploy a tiered cluster you must select a compatible Kafka version, got ${props.kafkaVersion.version}`, this);
511509
}
512510
if (instanceType === this.mskInstanceType(
513511
ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.SMALL),
514512
)) {
515-
throw Error('Tiered storage doesn\'t support broker type t3.small');
513+
throw new core.ValidationError('Tiered storage doesn\'t support broker type t3.small', this);
516514
}
517515
}
518516

@@ -883,9 +881,7 @@ export class Cluster extends ClusterBase {
883881
installLatestAwsSdk: false,
884882
});
885883
} else {
886-
throw Error(
887-
'Cannot create users if an authentication KMS key has not been created/provided.',
888-
);
884+
throw new core.ValidationError('Cannot create users if an authentication KMS key has not been created/provided.', this);
889885
}
890886
}
891887
}

packages/@aws-cdk/aws-msk-alpha/lib/serverless-cluster.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as ec2 from 'aws-cdk-lib/aws-ec2';
2-
import { Fn, Lazy, Names } from 'aws-cdk-lib';
2+
import { Fn, Lazy, Names, ValidationError } from 'aws-cdk-lib';
33
import * as constructs from 'constructs';
44
import { ClusterBase, ICluster } from '.';
55
import { CfnServerlessCluster } from 'aws-cdk-lib/aws-msk';
@@ -87,7 +87,7 @@ export class ServerlessCluster extends ClusterBase {
8787
addConstructMetadata(this, props);
8888

8989
if (props.vpcConfigs.length < 1 || props.vpcConfigs.length > 5) {
90-
throw Error(`\`vpcConfigs\` must contain between 1 and 5 configurations, got ${props.vpcConfigs.length} configurations.`);
90+
throw new ValidationError(`\`vpcConfigs\` must contain between 1 and 5 configurations, got ${props.vpcConfigs.length} configurations.`, this);
9191
}
9292

9393
const vpcConfigs = props.vpcConfigs.map((vpcConfig, index) => this._renderVpcConfig(vpcConfig, index));
@@ -127,16 +127,14 @@ export class ServerlessCluster extends ClusterBase {
127127
const subnetSelection = vpcConfig.vpc.selectSubnets(vpcConfig.vpcSubnets);
128128

129129
if (subnetSelection.subnets.length < 2) {
130-
throw Error(
131-
`Cluster requires at least 2 subnets, got ${subnetSelection.subnets.length} subnet.`,
132-
);
130+
throw new ValidationError(`Cluster requires at least 2 subnets, got ${subnetSelection.subnets.length} subnet.`, this);
133131
}
134132

135133
let securityGroups: ec2.ISecurityGroup[] = [];
136134

137135
if (vpcConfig.securityGroups) {
138136
if (vpcConfig.securityGroups.length < 1 || vpcConfig.securityGroups.length > 5) {
139-
throw Error(`\`securityGroups\` must contain between 1 and 5 elements, got ${vpcConfig.securityGroups.length} elements.`);
137+
throw new ValidationError(`\`securityGroups\` must contain between 1 and 5 elements, got ${vpcConfig.securityGroups.length} elements.`, this);
140138
}
141139
securityGroups = vpcConfig.securityGroups;
142140
} else {

packages/aws-cdk-lib/aws-rds/lib/cluster-engine.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,8 @@ export class AuroraPostgresEngineVersion {
10301030
public static readonly VER_13_17 = AuroraPostgresEngineVersion.of('13.17', '13', { s3Import: true, s3Export: true });
10311031
/** Version "13.18". */
10321032
public static readonly VER_13_18 = AuroraPostgresEngineVersion.of('13.18', '13', { s3Import: true, s3Export: true });
1033+
/** Version "13.20". */
1034+
public static readonly VER_13_20 = AuroraPostgresEngineVersion.of('13.20', '13', { s3Import: true, s3Export: true });
10331035
/** Version "14.3". */
10341036
public static readonly VER_14_3 = AuroraPostgresEngineVersion.of('14.3', '14', { s3Import: true, s3Export: true });
10351037
/** Version "14.4". */
@@ -1056,6 +1058,8 @@ export class AuroraPostgresEngineVersion {
10561058
public static readonly VER_14_14 = AuroraPostgresEngineVersion.of('14.14', '14', { s3Import: true, s3Export: true });
10571059
/** Version "14.15". */
10581060
public static readonly VER_14_15 = AuroraPostgresEngineVersion.of('14.15', '14', { s3Import: true, s3Export: true });
1061+
/** Version "14.17". */
1062+
public static readonly VER_14_17 = AuroraPostgresEngineVersion.of('14.17', '14', { s3Import: true, s3Export: true });
10591063
/** Version "15.2". */
10601064
public static readonly VER_15_2 = AuroraPostgresEngineVersion.of('15.2', '15', { s3Import: true, s3Export: true });
10611065
/** Version "15.3". */
@@ -1074,6 +1078,8 @@ export class AuroraPostgresEngineVersion {
10741078
public static readonly VER_15_9 = AuroraPostgresEngineVersion.of('15.9', '15', { s3Import: true, s3Export: true });
10751079
/** Version "15.10". */
10761080
public static readonly VER_15_10 = AuroraPostgresEngineVersion.of('15.10', '15', { s3Import: true, s3Export: true });
1081+
/** Version "15.12". */
1082+
public static readonly VER_15_12 = AuroraPostgresEngineVersion.of('15.12', '15', { s3Import: true, s3Export: true });
10771083
/**
10781084
* Version "16.0"
10791085
* @deprecated Version 16.0 is no longer supported by Amazon RDS.
@@ -1095,6 +1101,8 @@ export class AuroraPostgresEngineVersion {
10951101
public static readonly VER_16_6 = AuroraPostgresEngineVersion.of('16.6', '16', { s3Import: true, s3Export: true });
10961102
/** Version "16.6 limitless" */
10971103
public static readonly VER_16_6_LIMITLESS = AuroraPostgresEngineVersion.of('16.6-limitless', '16', { s3Import: true, s3Export: true });
1104+
/** Version "16.8". */
1105+
public static readonly VER_16_8 = AuroraPostgresEngineVersion.of('16.8', '16', { s3Import: true, s3Export: true });
10981106
/** Version "17.1". */
10991107
public static readonly VER_17_1 = AuroraPostgresEngineVersion.of('17.1', '17', { s3Import: true, s3Export: true });
11001108
/** Version "17.2". */

packages/aws-cdk-lib/aws-rds/test/cluster-engine.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ describe('cluster engine', () => {
5353
'aurora-postgresql9.6');
5454
expect(DatabaseClusterEngine.auroraPostgres({ version: AuroraPostgresEngineVersion.of('10.0', '10') }).parameterGroupFamily).toEqual(
5555
'aurora-postgresql10');
56+
expect(DatabaseClusterEngine.auroraPostgres({ version: AuroraPostgresEngineVersion.of('13.20', '13') }).parameterGroupFamily).toEqual(
57+
'aurora-postgresql13');
5658
expect(DatabaseClusterEngine.auroraPostgres({ version: AuroraPostgresEngineVersion.of('14.3', '14') }).parameterGroupFamily).toEqual(
5759
'aurora-postgresql14');
5860
expect(DatabaseClusterEngine.auroraPostgres({ version: AuroraPostgresEngineVersion.of('15.7', '15') }).parameterGroupFamily).toEqual(
@@ -70,16 +72,28 @@ describe('cluster engine', () => {
7072

7173
test('cluster parameter group correctly determined for AURORA_POSTGRESQL and given version', () => {
7274
// GIVEN
75+
const engine_VER_13_20 = DatabaseClusterEngine.auroraPostgres({
76+
version: AuroraPostgresEngineVersion.VER_13_20,
77+
});
7378
const engine_VER_14_3 = DatabaseClusterEngine.auroraPostgres({
7479
version: AuroraPostgresEngineVersion.VER_14_3,
7580
});
81+
const engine_VER_15_12 = DatabaseClusterEngine.auroraPostgres({
82+
version: AuroraPostgresEngineVersion.VER_15_12,
83+
});
7684
const engine_VER_16_3 = DatabaseClusterEngine.auroraPostgres({
7785
version: AuroraPostgresEngineVersion.VER_16_3,
7886
});
87+
const engine_VER_17_2 = DatabaseClusterEngine.auroraPostgres({
88+
version: AuroraPostgresEngineVersion.VER_17_2,
89+
});
7990

8091
// THEN
92+
expect(engine_VER_13_20.parameterGroupFamily).toEqual('aurora-postgresql13');
8193
expect(engine_VER_14_3.parameterGroupFamily).toEqual('aurora-postgresql14');
94+
expect(engine_VER_15_12.parameterGroupFamily).toEqual('aurora-postgresql15');
8295
expect(engine_VER_16_3.parameterGroupFamily).toEqual('aurora-postgresql16');
96+
expect(engine_VER_17_2.parameterGroupFamily).toEqual('aurora-postgresql17');
8397
});
8498

8599
testDeprecated('cluster parameter group correctly determined for AURORA and given version', () => {

0 commit comments

Comments
 (0)