diff --git a/packages/@aws-cdk/aws-ec2-alpha/lib/subnet-v2.ts b/packages/@aws-cdk/aws-ec2-alpha/lib/subnet-v2.ts index ad144439ce2c3..0cd0210aff93a 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/lib/subnet-v2.ts +++ b/packages/@aws-cdk/aws-ec2-alpha/lib/subnet-v2.ts @@ -408,12 +408,13 @@ export interface SubnetV2Attributes { } -const subnetTypeMap = { +type DeprecatedSubnetType = 'Deprecated_Isolated' | 'Deprecated_Private'; +const subnetTypeMap: { [key in SubnetType | DeprecatedSubnetType]: (vpc: IVpcV2, subnet: SubnetV2) => void } = { [SubnetType.PRIVATE_ISOLATED]: (vpc: IVpcV2, subnet: SubnetV2) => vpc.isolatedSubnets.push(subnet), [SubnetType.PUBLIC]: (vpc: IVpcV2, subnet: SubnetV2) => vpc.publicSubnets.push(subnet), [SubnetType.PRIVATE_WITH_EGRESS]: (vpc: IVpcV2, subnet: SubnetV2) => vpc.privateSubnets.push(subnet), - [SubnetType.ISOLATED]: (vpc: IVpcV2, subnet: SubnetV2) => vpc.isolatedSubnets.push(subnet), - [SubnetType.PRIVATE]: (vpc: IVpcV2, subnet: SubnetV2) => vpc.privateSubnets.push(subnet), + ['Deprecated_Isolated']: (vpc: IVpcV2, subnet: SubnetV2) => vpc.isolatedSubnets.push(subnet), + ['Deprecated_Private']: (vpc: IVpcV2, subnet: SubnetV2) => vpc.privateSubnets.push(subnet), [SubnetType.PRIVATE_WITH_NAT]: (vpc: IVpcV2, subnet: SubnetV2) => vpc.privateSubnets.push(subnet), }; diff --git a/packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2-base.ts b/packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2-base.ts index 32b2bceec2720..eee807bdbe968 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2-base.ts +++ b/packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2-base.ts @@ -636,17 +636,18 @@ export abstract class VpcV2Base extends Resource implements IVpcV2 { return subnets; } - private selectSubnetObjectsByType(subnetType: SubnetType) { - const allSubnets = { + private selectSubnetObjectsByType(subnetType: SubnetType): ISubnet[] { + type DeprecatedSubnetType = 'Deprecated_Isolated' | 'Deprecated_Private'; + const allSubnets: { [key in SubnetType | DeprecatedSubnetType]?: ISubnet[] } = { [SubnetType.PRIVATE_ISOLATED]: this.isolatedSubnets, - [SubnetType.ISOLATED]: this.isolatedSubnets, + ['Deprecated_Isolated']: this.isolatedSubnets, [SubnetType.PRIVATE_WITH_NAT]: this.privateSubnets, [SubnetType.PRIVATE_WITH_EGRESS]: this.privateSubnets, - [SubnetType.PRIVATE]: this.privateSubnets, + ['Deprecated_Private']: this.privateSubnets, [SubnetType.PUBLIC]: this.publicSubnets, }; - const subnets = allSubnets[subnetType]; + const subnets = allSubnets[subnetType]!; // Force merge conflict here with https://github.com/aws/aws-cdk/pull/4089 // see ImportedVpc @@ -668,13 +669,13 @@ export abstract class VpcV2Base extends Resource implements IVpcV2 { private reifySelectionDefaults(placement: SubnetSelection): SubnetSelection { // TODO: throw error as new VpcV2 cannot support subnetName or subnetGroupName anymore - if (placement.subnetName !== undefined) { + if ('subnetName' in placement && placement.subnetName !== undefined) { if (placement.subnetGroupName !== undefined) { throw new Error('Please use only \'subnetGroupName\' (\'subnetName\' is deprecated and has the same behavior)'); } else { Annotations.of(this).addWarningV2('@aws-cdk/aws-ec2:subnetNameDeprecated', 'Usage of \'subnetName\' in SubnetSelection is deprecated, use \'subnetGroupName\' instead'); } - placement = { ...placement, subnetGroupName: placement.subnetName }; + placement = { ...placement, subnetGroupName: placement.subnetName as string }; } const exclusiveSelections: Array = ['subnets', 'subnetType', 'subnetGroupName']; diff --git a/packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2.ts b/packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2.ts index ea493343f8802..4b0571891a367 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2.ts +++ b/packages/@aws-cdk/aws-ec2-alpha/lib/vpc-v2.ts @@ -329,11 +329,11 @@ export class VpcV2 extends VpcV2Base { if (props.subnets) { for (const subnet of props.subnets) { if (subnet.subnetType === SubnetType.PRIVATE_WITH_EGRESS || subnet.subnetType === SubnetType.PRIVATE_WITH_NAT || - subnet.subnetType === SubnetType.PRIVATE) { + subnet.subnetType as string === 'Deprecated_Private') { this.privateSubnets.push(SubnetV2.fromSubnetV2Attributes(scope, subnet.subnetName?? 'ImportedPrivateSubnet', subnet)); } else if (subnet.subnetType === SubnetType.PUBLIC) { this.publicSubnets.push(SubnetV2.fromSubnetV2Attributes(scope, subnet.subnetName?? 'ImportedPublicSubnet', subnet)); - } else if (subnet.subnetType === SubnetType.ISOLATED || subnet.subnetType === SubnetType.PRIVATE_ISOLATED) { + } else if (subnet.subnetType as string === 'Deprecated_Isolated' || subnet.subnetType === SubnetType.PRIVATE_ISOLATED) { this.isolatedSubnets.push(SubnetV2.fromSubnetV2Attributes(scope, subnet.subnetName?? 'ImportedIsolatedSubnet', subnet)); } } diff --git a/packages/@aws-cdk/aws-iot-actions-alpha/test/cloudwatch/integ.cloudwatch-set-alarm-state-action.ts b/packages/@aws-cdk/aws-iot-actions-alpha/test/cloudwatch/integ.cloudwatch-set-alarm-state-action.ts index 195171ef8aa1f..5af4e98c3a367 100644 --- a/packages/@aws-cdk/aws-iot-actions-alpha/test/cloudwatch/integ.cloudwatch-set-alarm-state-action.ts +++ b/packages/@aws-cdk/aws-iot-actions-alpha/test/cloudwatch/integ.cloudwatch-set-alarm-state-action.ts @@ -12,7 +12,7 @@ class TestStack extends cdk.Stack { const metric = new cloudwatch.Metric({ namespace: 'MyNamespace', metricName: 'MyMetric', - dimensions: { MyDimension: 'MyDimensionValue' }, + dimensionsMap: { MyDimension: 'MyDimensionValue' }, }); const alarm = new cloudwatch.Alarm(this, 'MyAlarm', { metric: metric, diff --git a/packages/@aws-cdk/aws-iot-alpha/lib/logging.ts b/packages/@aws-cdk/aws-iot-alpha/lib/logging.ts index 5df5afff1276c..6f6aa34c2c87a 100644 --- a/packages/@aws-cdk/aws-iot-alpha/lib/logging.ts +++ b/packages/@aws-cdk/aws-iot-alpha/lib/logging.ts @@ -1,4 +1,4 @@ -import { Resource, Stack, IResource } from 'aws-cdk-lib/core'; +import { Resource, Stack, IResource, ArnFormat } from 'aws-cdk-lib/core'; import { Construct } from 'constructs'; import * as iot from 'aws-cdk-lib/aws-iot'; import * as iam from 'aws-cdk-lib/aws-iam'; @@ -119,7 +119,7 @@ export class Logging extends Resource implements ILogging { Stack.of(this).formatArn({ service: 'logs', resource: 'log-group', - sep: ':', + arnFormat: ArnFormat.COLON_RESOURCE_NAME, resourceName: 'AWSIotLogsV2:*', }), ], diff --git a/packages/@aws-cdk/aws-lambda-go-alpha/test/bundling.test.ts b/packages/@aws-cdk/aws-lambda-go-alpha/test/bundling.test.ts index f9a8559add078..b8f2f7a85ff13 100644 --- a/packages/@aws-cdk/aws-lambda-go-alpha/test/bundling.test.ts +++ b/packages/@aws-cdk/aws-lambda-go-alpha/test/bundling.test.ts @@ -191,7 +191,7 @@ test('Local bundling', () => { expect(bundler.local).toBeDefined(); - const tryBundle = bundler.local?.tryBundle('/outdir', { image: Runtime.GO_1_X.bundlingDockerImage }); + const tryBundle = bundler.local?.tryBundle('/outdir', { image: Runtime.GO_1_X.bundlingImage }); expect(tryBundle).toBe(true); expect(spawnSyncMock).toHaveBeenCalledWith( @@ -217,7 +217,7 @@ test('Incorrect go version', () => { architecture: Architecture.X86_64, }); - const tryBundle = bundler.local?.tryBundle('/outdir', { image: Runtime.GO_1_X.bundlingDockerImage }); + const tryBundle = bundler.local?.tryBundle('/outdir', { image: Runtime.GO_1_X.bundlingImage }); expect(tryBundle).toBe(false); }); diff --git a/packages/@aws-cdk/aws-lambda-python-alpha/test/function.test.ts b/packages/@aws-cdk/aws-lambda-python-alpha/test/function.test.ts index 3277030ca9e3e..cb4f1db8c3bcd 100644 --- a/packages/@aws-cdk/aws-lambda-python-alpha/test/function.test.ts +++ b/packages/@aws-cdk/aws-lambda-python-alpha/test/function.test.ts @@ -24,16 +24,15 @@ jest.mock('../lib/bundling', () => { throw new Error('unexpected asset hash type'); })(); - return { - isInline: false, - bind: () => ({ + return new class extends lambda.Code { + public readonly isInline: boolean = false; + public bind = () => ({ s3Location: { bucketName: 'mock-bucket-name', objectKey: mockObjectKey, }, - }), - bindToResource: () => { return; }, - }; + }); + }(); }), hasDependencies: jest.fn().mockReturnValue(false), }, diff --git a/packages/@aws-cdk/aws-sagemaker-alpha/lib/endpoint.ts b/packages/@aws-cdk/aws-sagemaker-alpha/lib/endpoint.ts index 2fcb1d79651a3..91dda7736b180 100644 --- a/packages/@aws-cdk/aws-sagemaker-alpha/lib/endpoint.ts +++ b/packages/@aws-cdk/aws-sagemaker-alpha/lib/endpoint.ts @@ -148,7 +148,7 @@ class EndpointInstanceProductionVariant implements IEndpointInstanceProductionVa return new cloudwatch.Metric({ namespace, metricName, - dimensions: { + dimensionsMap: { EndpointName: this.endpoint.endpointName, VariantName: this.variantName, }, diff --git a/packages/@aws-cdk/aws-sagemaker-alpha/lib/model.ts b/packages/@aws-cdk/aws-sagemaker-alpha/lib/model.ts index 28f88d4934b1d..2a07b2faf2197 100644 --- a/packages/@aws-cdk/aws-sagemaker-alpha/lib/model.ts +++ b/packages/@aws-cdk/aws-sagemaker-alpha/lib/model.ts @@ -103,7 +103,7 @@ abstract class ModelBase extends cdk.Resource implements IModel { return; } - this.role.addToPolicy(statement); + this.role.addToPrincipalPolicy(statement); } }