diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/README.md b/packages/@aws-cdk/aws-mediapackagev2-alpha/README.md index 8396caf6794e5..ecc41a819125c 100644 --- a/packages/@aws-cdk/aws-mediapackagev2-alpha/README.md +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/README.md @@ -93,6 +93,25 @@ const channelGroup = ChannelGroup.fromChannelGroupAttributes(stack, 'ImportedCha }); ``` +You can also import from an ARN, which automatically extracts the name and region: + +```ts +declare const stack: Stack; +const channelGroup = ChannelGroup.fromChannelGroupArn(stack, 'ImportedChannelGroup', + 'arn:aws:mediapackagev2:us-west-2:123456789012:channelGroup/MyChannelGroup', +); +``` + +For cross-region imports, pass the `region` parameter to ensure the correct ARN is constructed: + +```ts +declare const stack: Stack; +const channelGroup = ChannelGroup.fromChannelGroupAttributes(stack, 'ImportedChannelGroup', { + channelGroupName: 'MyChannelGroup', + region: 'us-west-2', +}); +``` + ## Channel A channel is part of a channel group and represents the entry point for a content stream into MediaPackage. @@ -140,6 +159,17 @@ const channel = Channel.fromChannelAttributes(stack, 'ImportedChannel', { }); ``` +You can also import from an ARN: + +```ts +declare const stack: Stack; +const channel = Channel.fromChannelArn(stack, 'ImportedChannel', + 'arn:aws:mediapackagev2:us-west-2:123456789012:channelGroup/MyGroup/channel/MyChannel', +); +``` + +Imported channels expose a `region` property, which is parsed from the ARN or falls back to the importing stack's region. + ### Channel Resource Policy The following code creates a resource policy directly on the channel. This @@ -184,6 +214,15 @@ const originEndpoint = OriginEndpoint.fromOriginEndpointAttributes(stack, 'Impor }); ``` +You can also import from an ARN: + +```ts +declare const stack: Stack; +const originEndpoint = OriginEndpoint.fromOriginEndpointArn(stack, 'ImportedOriginEndpoint', + 'arn:aws:mediapackagev2:us-west-2:123456789012:channelGroup/MyGroup/channel/MyChannel/originEndpoint/MyEndpoint', +); +``` + The following code creates a resource policy on the origin endpoint. This will automatically create a policy on the first call: diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/channel.ts b/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/channel.ts index 2143e7087910e..77ee2b3070847 100644 --- a/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/channel.ts +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/channel.ts @@ -85,6 +85,11 @@ export interface IChannel extends IResource, IChannelRef { */ readonly channelGroup?: IChannelGroup; + /** + * The AWS region where this channel lives. + */ + readonly region: string; + /** * Grants IAM resource policy to the role used to write to MediaPackage V2 Channel. */ @@ -351,12 +356,52 @@ export interface ChannelAttributes { * @attribute */ readonly channelGroupName: string; + + /** + * The AWS region where the channel lives. + * + * Required for cross-region imports to construct the correct ARN. + * + * @default - the importing stack's region + */ + readonly region?: string; } /** * A new or imported Channel. */ abstract class ChannelBase extends Resource implements IChannel { + /** + * Creates a Channel construct that represents an external (imported) Channel from its ARN. + * + * The ARN is expected to be in the format: + * `arn::mediapackagev2:::channelGroup//channel/` + */ + public static fromChannelArn(scope: Construct, id: string, channelArn: string): IChannel { + if (Token.isUnresolved(channelArn)) { + throw new ValidationError( + lit`TokenArnNotSupported`, + 'Cannot parse a token ARN. Use Channel.fromChannelAttributes() with explicit channelName, channelGroupName, and region values instead.', + scope, + ); + } + const parsedArn = Stack.of(scope).splitArn(channelArn, ArnFormat.SLASH_RESOURCE_NAME); + // resourceName is "/channel/" + const [channelGroupName, , channelName] = parsedArn.resourceName?.split('/') ?? []; + if (!channelGroupName || !channelName) { + throw new ValidationError( + lit`InvalidChannelArn`, + `Could not parse channel ARN: ${channelArn}. Expected format: arn::mediapackagev2:::channelGroup//channel/`, + scope, + ); + } + return ChannelBase.fromChannelAttributes(scope, id, { + channelGroupName, + channelName, + region: parsedArn.region, + }); + } + /** * Creates a Channel construct that represents an external (imported) Channel. */ @@ -367,6 +412,7 @@ abstract class ChannelBase extends Resource implements IChannel { public readonly channelName = attrs.channelName; public readonly createdAt = undefined; public readonly modifiedAt = undefined; + public readonly region = attrs.region ?? Stack.of(this).region; protected autoCreatePolicy = false; public get ingestEndpointUrls(): string[] { @@ -381,6 +427,7 @@ abstract class ChannelBase extends Resource implements IChannel { resource: `channelGroup/${attrs.channelGroupName}/channel`, arnFormat: ArnFormat.SLASH_RESOURCE_NAME, resourceName: this.channelName, + region: this.region, }); } @@ -393,6 +440,7 @@ abstract class ChannelBase extends Resource implements IChannel { public abstract readonly createdAt?: string; public abstract readonly modifiedAt?: string; public abstract readonly ingestEndpointUrls: string[]; + public abstract readonly region: string; /** * A reference to this Channel resource @@ -568,6 +616,7 @@ export class Channel extends ChannelBase implements IChannel { public readonly channelName: string; public readonly channelArn: string; public readonly channelGroup?: IChannelGroup; + public readonly region: string; /** * The date and time the channel was created. @@ -634,6 +683,7 @@ export class Channel extends ChannelBase implements IChannel { this.channelArn = channel.attrArn; this.createdAt = channel.attrCreatedAt; this.modifiedAt = channel.attrModifiedAt; + this.region = Stack.of(this).region; this.ingestEndpointUrls = [Fn.select(0, channel.attrIngestEndpointUrls), Fn.select(1, channel.attrIngestEndpointUrls)]; channel.applyRemovalPolicy(props?.removalPolicy ?? RemovalPolicy.DESTROY); diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/endpoint.ts b/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/endpoint.ts index 9c1c1cc33ce22..5f7fd851bad2e 100644 --- a/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/endpoint.ts +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/endpoint.ts @@ -1880,6 +1880,15 @@ export interface OriginEndpointAttributes { * @attribute */ readonly originEndpointName: string; + + /** + * The AWS region where the origin endpoint lives. + * + * Required for cross-region imports to construct the correct ARN. + * + * @default - the importing stack's region + */ + readonly region?: string; } /** @@ -2537,6 +2546,38 @@ export class Segment { } abstract class OriginEndpointBase extends Resource implements IOriginEndpoint { + /** + * Creates an OriginEndpoint construct that represents an external (imported) Origin Endpoint from its ARN. + * + * The ARN is expected to be in the format: + * `arn::mediapackagev2:::channelGroup//channel//originEndpoint/` + */ + public static fromOriginEndpointArn(scope: Construct, id: string, originEndpointArn: string): IOriginEndpoint { + if (Token.isUnresolved(originEndpointArn)) { + throw new ValidationError( + lit`TokenArnNotSupported`, + 'Cannot parse a token ARN. Use OriginEndpoint.fromOriginEndpointAttributes() with explicit channelGroupName, channelName, originEndpointName, and region values instead.', + scope, + ); + } + const parsedArn = Stack.of(scope).splitArn(originEndpointArn, ArnFormat.SLASH_RESOURCE_NAME); + // resourceName is "/channel//originEndpoint/" + const [channelGroupName, , channelName, , originEndpointName] = parsedArn.resourceName?.split('/') ?? []; + if (!channelGroupName || !channelName || !originEndpointName) { + throw new ValidationError( + lit`InvalidOriginEndpointArn`, + `Could not parse origin endpoint ARN: ${originEndpointArn}. Expected format: arn::mediapackagev2:::channelGroup//channel//originEndpoint/`, + scope, + ); + } + return OriginEndpointBase.fromOriginEndpointAttributes(scope, id, { + channelGroupName, + channelName, + originEndpointName, + region: parsedArn.region, + }); + } + /** * Creates an OriginEndpoint construct that represents an external (imported) Origin Endpoint. */ @@ -2563,6 +2604,7 @@ abstract class OriginEndpointBase extends Resource implements IOriginEndpoint { resource: `channelGroup/${attrs.channelGroupName}/channel/${this.channelName}/originEndpoint`, arnFormat: ArnFormat.SLASH_RESOURCE_NAME, resourceName: this.originEndpointName, + region: attrs.region, }); } @@ -2887,6 +2929,23 @@ export class OriginEndpoint extends OriginEndpointBase implements IOriginEndpoin }); }); + // Validate manifest name uniqueness across all manifest types + const allManifestNames = [ + ...this.hlsManifests.map(m => m.manifestName), + ...this.llHlsManifests.map(m => m.manifestName), + ...this.dashManifests.map(m => m.manifestName), + ...this.mssManifests.map(m => m.manifestName), + ].filter(name => !Token.isUnresolved(name)); + + const duplicateNames = [...new Set(allManifestNames.filter((name, i) => allManifestNames.indexOf(name) !== i))]; + if (duplicateNames.length > 0) { + throw new ValidationError( + lit`DuplicateManifestName`, + `Duplicate manifest names: [${duplicateNames.join(', ')}]. Each manifest in an OriginEndpoint must have a unique manifestName.`, + this, + ); + } + // Validate manifest and container type compatibility if (this.mssManifests.length > 0 && containerType !== ContainerType.ISM) { throw new ValidationError(lit`MssRequiresIsm`, 'MSS manifests require ISM container type. Use Segment.ism() for MSS manifests.', this); diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/group.ts b/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/group.ts index 22b10b05517f4..3302545bc0d8c 100644 --- a/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/group.ts +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/group.ts @@ -162,12 +162,47 @@ export interface ChannelGroupAttributes { * @default - not available on imported channel groups */ readonly egressDomain?: string; + + /** + * The AWS region where the channel group lives. + * + * Required for cross-region imports to construct the correct ARN. + * + * @default - the importing stack's region + */ + readonly region?: string; } /** * A new or imported Channel Group. */ abstract class ChannelGroupBase extends Resource implements IChannelGroup { + /** + * Creates a Channel Group construct that represents an external (imported) Channel Group from its ARN. + */ + public static fromChannelGroupArn(scope: Construct, id: string, channelGroupArn: string): IChannelGroup { + if (Token.isUnresolved(channelGroupArn)) { + throw new ValidationError( + lit`TokenArnNotSupported`, + 'Cannot parse a token ARN. Use ChannelGroup.fromChannelGroupAttributes() with explicit channelGroupName and region values instead.', + scope, + ); + } + const parsedArn = Stack.of(scope).splitArn(channelGroupArn, ArnFormat.SLASH_RESOURCE_NAME); + const channelGroupName = parsedArn.resourceName; + if (!channelGroupName) { + throw new ValidationError( + lit`InvalidChannelGroupArn`, + `Could not parse channel group name from ARN: ${channelGroupArn}`, + scope, + ); + } + return ChannelGroupBase.fromChannelGroupAttributes(scope, id, { + channelGroupName, + region: parsedArn.region, + }); + } + /** * Creates a Channel Group construct that represents an external (imported) Channel Group. */ @@ -189,6 +224,7 @@ abstract class ChannelGroupBase extends Resource implements IChannelGroup { resource: 'channelGroup', arnFormat: ArnFormat.SLASH_RESOURCE_NAME, resourceName: attrs.channelGroupName, + region: attrs.region, }); public get egressDomain(): string { diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/channel.test.ts b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/channel.test.ts index df39256788e8f..f259d24e4e71a 100644 --- a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/channel.test.ts +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/channel.test.ts @@ -88,6 +88,37 @@ test('existing Channel can be imported', () => { expect(importedChannel.channelArn).toMatch(/^arn:.*:mediapackagev2:us-east-1:123456789012:channelGroup\/MyChannelGroup\/channel\/test$/); }); +test('imported Channel with cross-region override', () => { + const importedChannel = mediapackagev2.Channel.fromChannelAttributes(stack, 'ImportedChannel', { + channelName: 'test', + channelGroupName: 'MyChannelGroup', + region: 'eu-west-1', + }); + + expect(importedChannel.channelArn).toMatch(/^arn:.*:mediapackagev2:eu-west-1:123456789012:channelGroup\/MyChannelGroup\/channel\/test$/); +}); + +test('Channel can be imported from ARN', () => { + const importedChannel = mediapackagev2.Channel.fromChannelArn(stack, 'ImportedChannel', 'arn:aws:mediapackagev2:eu-west-1:123456789012:channelGroup/MyGroup/channel/MyChannel'); + + expect(importedChannel.channelGroupName).toBe('MyGroup'); + expect(importedChannel.channelName).toBe('MyChannel'); + expect(importedChannel.channelArn).toMatch(/mediapackagev2:eu-west-1:123456789012/); + expect(importedChannel.region).toBe('eu-west-1'); +}); + +test('Channel.fromChannelArn throws on invalid ARN', () => { + expect(() => { + mediapackagev2.Channel.fromChannelArn(stack, 'Bad', 'arn:aws:mediapackagev2:us-east-1:123456789012:channelGroup/MyGroup'); + }).toThrow(/Could not parse channel ARN/); +}); + +test('Channel.fromChannelArn throws on token ARN', () => { + expect(() => { + mediapackagev2.Channel.fromChannelArn(stack, 'TokenArn', Lazy.string({ produce: () => 'arn:aws:mediapackagev2:us-east-1:123456789012:channelGroup/G/channel/C' })); + }).toThrow(/Cannot parse a token ARN/); +}); + test('Channel has accessible ingest URLs - Tokens returned in Array', () => { const group = new mediapackagev2.ChannelGroup(stack, 'MyChannelGroup', { channelGroupName: 'test', @@ -361,3 +392,32 @@ test('imported channel has undefined for createdAt and modifiedAt, throws for in expect(imported.modifiedAt).toBeUndefined(); expect(() => imported.ingestEndpointUrls).toThrow(/ingestEndpointUrls.*is not available/); }); + +test('Channel exposes region from Stack', () => { + const group = new mediapackagev2.ChannelGroup(stack, 'MyChannelGroup'); + const channel = new mediapackagev2.Channel(stack, 'myChannel', { + channelGroup: group, + input: mediapackagev2.InputConfiguration.cmaf(), + }); + + expect(channel.region).toBe('us-east-1'); +}); + +test('imported channel region falls back to importing stack region', () => { + const imported = mediapackagev2.Channel.fromChannelAttributes(stack, 'ImportedChannel3', { + channelName: 'test', + channelGroupName: 'MyChannelGroup', + }); + + expect(imported.region).toBe('us-east-1'); +}); + +test('imported channel uses explicit region from attributes', () => { + const imported = mediapackagev2.Channel.fromChannelAttributes(stack, 'ImportedChannel4', { + channelName: 'test', + channelGroupName: 'MyChannelGroup', + region: 'eu-west-1', + }); + + expect(imported.region).toBe('eu-west-1'); +}); diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/group.test.ts b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/group.test.ts index 590a7b28a8ecd..162d36191eb70 100644 --- a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/group.test.ts +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/group.test.ts @@ -47,6 +47,28 @@ test('existing Channel Group can be imported', () => { expect(importedChannelGroup.channelGroupArn).toMatch(/^arn:.*:mediapackagev2:us-east-1:123456789012:channelGroup\/MyChannelGroup$/); }); +test('imported Channel Group with cross-region override', () => { + const importedChannelGroup = mediapackagev2.ChannelGroup.fromChannelGroupAttributes(stack, 'ImportedChannelGroup', { + channelGroupName: 'MyChannelGroup', + region: 'eu-west-1', + }); + + expect(importedChannelGroup.channelGroupArn).toMatch(/^arn:.*:mediapackagev2:eu-west-1:123456789012:channelGroup\/MyChannelGroup$/); +}); + +test('Channel Group can be imported from ARN', () => { + const imported = mediapackagev2.ChannelGroup.fromChannelGroupArn(stack, 'ImportedChannelGroup', 'arn:aws:mediapackagev2:eu-west-1:123456789012:channelGroup/MyGroup'); + + expect(imported.channelGroupName).toBe('MyGroup'); + expect(imported.channelGroupArn).toMatch(/mediapackagev2:eu-west-1:123456789012/); +}); + +test('ChannelGroup.fromChannelGroupArn throws on token ARN', () => { + expect(() => { + mediapackagev2.ChannelGroup.fromChannelGroupArn(stack, 'TokenArn', Lazy.string({ produce: () => 'arn:aws:mediapackagev2:us-east-1:123456789012:channelGroup/G' })); + }).toThrow(/Cannot parse a token ARN/); +}); + test('existing Channel Group can be imported and used by a Channel', () => { const importedChannelGroup = mediapackagev2.ChannelGroup.fromChannelGroupAttributes(stack, 'ImportedChannelGroup', { channelGroupName: 'MyChannelGroup', diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/aws-cdk-mediapackagev2-import-channel.assets.json b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/aws-cdk-mediapackagev2-import-channel.assets.json new file mode 100644 index 0000000000000..4aff0f26c346f --- /dev/null +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/aws-cdk-mediapackagev2-import-channel.assets.json @@ -0,0 +1,20 @@ +{ + "version": "53.0.0", + "files": { + "13198d5e6a239f7781503b9bacbc62325e26ae1a8a2e831323505a360eab4b1d": { + "displayName": "aws-cdk-mediapackagev2-import-channel Template", + "source": { + "path": "aws-cdk-mediapackagev2-import-channel.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region-0e95cc4c": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "13198d5e6a239f7781503b9bacbc62325e26ae1a8a2e831323505a360eab4b1d.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/aws-cdk-mediapackagev2-import-channel.metadata.json b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/aws-cdk-mediapackagev2-import-channel.metadata.json new file mode 100644 index 0000000000000..7b21daad1384e --- /dev/null +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/aws-cdk-mediapackagev2-import-channel.metadata.json @@ -0,0 +1,56 @@ +{ + "/aws-cdk-mediapackagev2-import-channel/Group": [ + { + "type": "aws:cdk:analytics:construct", + "data": "*" + } + ], + "/aws-cdk-mediapackagev2-import-channel/Channel": [ + { + "type": "aws:cdk:analytics:construct", + "data": "*" + } + ], + "/aws-cdk-mediapackagev2-import-channel/Endpoint": [ + { + "type": "aws:cdk:analytics:construct", + "data": "*" + } + ], + "/aws-cdk-mediapackagev2-import-channel/ImportedChannelRegion": [ + { + "type": "aws:cdk:logicalId", + "data": "ImportedChannelRegion" + } + ], + "/aws-cdk-mediapackagev2-import-channel/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-mediapackagev2-import-channel/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ], + "/aws-cdk-mediapackagev2-import-channel/Group/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "GroupC77FDACD" + } + ], + "/aws-cdk-mediapackagev2-import-channel/Channel/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Channel4048F119" + } + ], + "/aws-cdk-mediapackagev2-import-channel/Endpoint/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "EndpointEEF1FD8F" + } + ] +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/aws-cdk-mediapackagev2-import-channel.template.json b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/aws-cdk-mediapackagev2-import-channel.template.json new file mode 100644 index 0000000000000..69d55ecf156a0 --- /dev/null +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/aws-cdk-mediapackagev2-import-channel.template.json @@ -0,0 +1,92 @@ +{ + "Resources": { + "GroupC77FDACD": { + "Type": "AWS::MediaPackageV2::ChannelGroup", + "Properties": { + "ChannelGroupName": "import-test-group" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "Channel4048F119": { + "Type": "AWS::MediaPackageV2::Channel", + "Properties": { + "ChannelGroupName": "import-test-group", + "ChannelName": "import-test-channel", + "InputType": "CMAF" + }, + "DependsOn": [ + "GroupC77FDACD" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "EndpointEEF1FD8F": { + "Type": "AWS::MediaPackageV2::OriginEndpoint", + "Properties": { + "ChannelGroupName": "import-test-group", + "ChannelName": "import-test-channel", + "ContainerType": "CMAF", + "DashManifests": [ + { + "ManifestName": "dash-index" + } + ], + "HlsManifests": [ + { + "ManifestName": "hls-index" + } + ], + "OriginEndpointName": "import-test-endpoint", + "Segment": {} + }, + "DependsOn": [ + "Channel4048F119", + "GroupC77FDACD" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "Outputs": { + "ImportedChannelRegion": { + "Value": { + "Ref": "AWS::Region" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "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." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdk.out b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdk.out new file mode 100644 index 0000000000000..60aa68e157090 --- /dev/null +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"53.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.assets.json b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.assets.json new file mode 100644 index 0000000000000..b06d4be8b1b48 --- /dev/null +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.assets.json @@ -0,0 +1,20 @@ +{ + "version": "53.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "displayName": "cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E Template", + "source": { + "path": "cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region-d8d86b35": { + "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": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.metadata.json b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.metadata.json new file mode 100644 index 0000000000000..45d0f8e156b64 --- /dev/null +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.metadata.json @@ -0,0 +1,14 @@ +{ + "/cdk-integ-mediapackagev2-import-channel/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/cdk-integ-mediapackagev2-import-channel/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.template.json b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "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." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/integ.json b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/integ.json new file mode 100644 index 0000000000000..acf9ff1bec63f --- /dev/null +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/integ.json @@ -0,0 +1,13 @@ +{ + "version": "53.0.0", + "testCases": { + "cdk-integ-mediapackagev2-import-channel/DefaultTest": { + "stacks": [ + "aws-cdk-mediapackagev2-import-channel" + ], + "assertionStack": "cdk-integ-mediapackagev2-import-channel/DefaultTest/DeployAssert", + "assertionStackName": "cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E" + } + }, + "minimumCliVersion": "2.1108.0" +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/manifest.json b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/manifest.json new file mode 100644 index 0000000000000..b87556c56a292 --- /dev/null +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/manifest.json @@ -0,0 +1,594 @@ +{ + "version": "53.0.0", + "artifacts": { + "aws-cdk-mediapackagev2-import-channel.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-mediapackagev2-import-channel.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-mediapackagev2-import-channel": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-cdk-mediapackagev2-import-channel.template.json", + "terminationProtection": false, + "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}/13198d5e6a239f7781503b9bacbc62325e26ae1a8a2e831323505a360eab4b1d.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-mediapackagev2-import-channel.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-cdk-mediapackagev2-import-channel.assets" + ], + "additionalMetadataFile": "aws-cdk-mediapackagev2-import-channel.metadata.json", + "displayName": "aws-cdk-mediapackagev2-import-channel" + }, + "cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.template.json", + "terminationProtection": false, + "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}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.assets" + ], + "additionalMetadataFile": "cdkintegmediapackagev2importchannelDefaultTestDeployAssert0BBC657E.metadata.json", + "displayName": "cdk-integ-mediapackagev2-import-channel/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "aws-cdk-lib/feature-flag-report": { + "type": "cdk:feature-flag-report", + "properties": { + "module": "aws-cdk-lib", + "flags": { + "@aws-cdk/aws-signer:signingProfileNamePassedToCfn": { + "userValue": true, + "recommendedValue": true, + "explanation": "Pass signingProfileName to CfnSigningProfile" + }, + "@aws-cdk/core:newStyleStackSynthesis": { + "recommendedValue": true, + "explanation": "Switch to new stack synthesis method which enables CI/CD", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/core:stackRelativeExports": { + "recommendedValue": true, + "explanation": "Name exports based on the construct paths relative to the stack, rather than the global construct path", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-ecs-patterns:secGroupsDisablesImplicitOpenListener": { + "userValue": true, + "recommendedValue": true, + "explanation": "Disable implicit openListener when custom security groups are provided" + }, + "@aws-cdk/aws-rds:lowercaseDbIdentifier": { + "recommendedValue": true, + "explanation": "Force lowercasing of RDS Cluster names in CDK", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": { + "recommendedValue": true, + "explanation": "Allow adding/removing multiple UsagePlanKeys independently", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-lambda:recognizeVersionProps": { + "recommendedValue": true, + "explanation": "Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-lambda:recognizeLayerVersion": { + "userValue": true, + "recommendedValue": true, + "explanation": "Enable this feature flag to opt in to the updated logical id calculation for Lambda Version created using the `fn.currentVersion`." + }, + "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": { + "recommendedValue": true, + "explanation": "Enable this feature flag to have cloudfront distributions use the security policy TLSv1.2_2021 by default.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/core:checkSecretUsage": { + "userValue": true, + "recommendedValue": true, + "explanation": "Enable this flag to make it impossible to accidentally use SecretValues in unsafe locations" + }, + "@aws-cdk/core:target-partitions": { + "recommendedValue": [ + "aws", + "aws-cn" + ], + "explanation": "What regions to include in lookup tables of environment agnostic stacks" + }, + "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": { + "userValue": true, + "recommendedValue": true, + "explanation": "ECS extensions will automatically add an `awslogs` driver if no logging is specified" + }, + "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": { + "userValue": true, + "recommendedValue": true, + "explanation": "Enable this feature flag to have Launch Templates generated by the `InstanceRequireImdsv2Aspect` use unique names." + }, + "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": { + "userValue": true, + "recommendedValue": true, + "explanation": "ARN format used by ECS. In the new ARN format, the cluster name is part of the resource ID." + }, + "@aws-cdk/aws-iam:minimizePolicies": { + "userValue": true, + "recommendedValue": true, + "explanation": "Minimize IAM policies by combining Statements" + }, + "@aws-cdk/core:validateSnapshotRemovalPolicy": { + "userValue": true, + "recommendedValue": true, + "explanation": "Error on snapshot removal policies on resources that do not support it." + }, + "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": { + "userValue": true, + "recommendedValue": true, + "explanation": "Generate key aliases that include the stack name" + }, + "@aws-cdk/aws-s3:createDefaultLoggingPolicy": { + "userValue": true, + "recommendedValue": true, + "explanation": "Enable this feature flag to create an S3 bucket policy by default in cases where an AWS service would automatically create the Policy if one does not exist." + }, + "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": { + "userValue": true, + "recommendedValue": true, + "explanation": "Restrict KMS key policy for encrypted Queues a bit more" + }, + "@aws-cdk/aws-apigateway:disableCloudWatchRole": { + "userValue": true, + "recommendedValue": true, + "explanation": "Make default CloudWatch Role behavior safe for multiple API Gateways in one environment" + }, + "@aws-cdk/core:enablePartitionLiterals": { + "userValue": true, + "recommendedValue": true, + "explanation": "Make ARNs concrete if AWS partition is known" + }, + "@aws-cdk/aws-events:eventsTargetQueueSameAccount": { + "userValue": true, + "recommendedValue": true, + "explanation": "Event Rules may only push to encrypted SQS queues in the same account" + }, + "@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker": { + "userValue": true, + "recommendedValue": true, + "explanation": "Avoid setting the \"ECS\" deployment controller when adding a circuit breaker" + }, + "@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName": { + "userValue": true, + "recommendedValue": true, + "explanation": "Enable this feature to create default policy names for imported roles that depend on the stack the role is in." + }, + "@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy": { + "userValue": true, + "recommendedValue": true, + "explanation": "Use S3 Bucket Policy instead of ACLs for Server Access Logging" + }, + "@aws-cdk/aws-route53-patters:useCertificate": { + "userValue": true, + "recommendedValue": true, + "explanation": "Use the official `Certificate` resource instead of `DnsValidatedCertificate`" + }, + "@aws-cdk/customresources:installLatestAwsSdkDefault": { + "userValue": false, + "recommendedValue": false, + "explanation": "Whether to install the latest SDK by default in AwsCustomResource" + }, + "@aws-cdk/aws-rds:databaseProxyUniqueResourceName": { + "userValue": true, + "recommendedValue": true, + "explanation": "Use unique resource name for Database Proxy" + }, + "@aws-cdk/aws-codedeploy:removeAlarmsFromDeploymentGroup": { + "userValue": true, + "recommendedValue": true, + "explanation": "Remove CloudWatch alarms from deployment group" + }, + "@aws-cdk/aws-apigateway:authorizerChangeDeploymentLogicalId": { + "userValue": true, + "recommendedValue": true, + "explanation": "Include authorizer configuration in the calculation of the API deployment logical ID." + }, + "@aws-cdk/aws-ec2:launchTemplateDefaultUserData": { + "userValue": true, + "recommendedValue": true, + "explanation": "Define user data for a launch template by default when a machine image is provided." + }, + "@aws-cdk/aws-secretsmanager:useAttachedSecretResourcePolicyForSecretTargetAttachments": { + "userValue": true, + "recommendedValue": true, + "explanation": "SecretTargetAttachments uses the ResourcePolicy of the attached Secret." + }, + "@aws-cdk/aws-redshift:columnId": { + "userValue": true, + "recommendedValue": true, + "explanation": "Whether to use an ID to track Redshift column changes" + }, + "@aws-cdk/aws-stepfunctions-tasks:enableEmrServicePolicyV2": { + "userValue": true, + "recommendedValue": true, + "explanation": "Enable AmazonEMRServicePolicy_v2 managed policies" + }, + "@aws-cdk/aws-ec2:restrictDefaultSecurityGroup": { + "userValue": true, + "recommendedValue": true, + "explanation": "Restrict access to the VPC default security group" + }, + "@aws-cdk/aws-apigateway:requestValidatorUniqueId": { + "userValue": true, + "recommendedValue": true, + "explanation": "Generate a unique id for each RequestValidator added to a method" + }, + "@aws-cdk/aws-kms:aliasNameRef": { + "userValue": true, + "recommendedValue": true, + "explanation": "KMS Alias name and keyArn will have implicit reference to KMS Key" + }, + "@aws-cdk/aws-kms:applyImportedAliasPermissionsToPrincipal": { + "userValue": true, + "recommendedValue": true, + "explanation": "Enable grant methods on Aliases imported by name to use kms:ResourceAliases condition" + }, + "@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": { + "userValue": true, + "recommendedValue": true, + "explanation": "Generate a launch template when creating an AutoScalingGroup" + }, + "@aws-cdk/core:includePrefixInUniqueNameGeneration": { + "userValue": true, + "recommendedValue": true, + "explanation": "Include the stack prefix in the stack name generation process" + }, + "@aws-cdk/aws-efs:denyAnonymousAccess": { + "userValue": true, + "recommendedValue": true, + "explanation": "EFS denies anonymous clients accesses" + }, + "@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": { + "userValue": true, + "recommendedValue": true, + "explanation": "Enables support for Multi-AZ with Standby deployment for opensearch domains" + }, + "@aws-cdk/aws-lambda-nodejs:useLatestRuntimeVersion": { + "userValue": true, + "recommendedValue": true, + "explanation": "Enables aws-lambda-nodejs.Function to use the latest available NodeJs runtime as the default" + }, + "@aws-cdk/aws-efs:mountTargetOrderInsensitiveLogicalId": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, mount targets will have a stable logicalId that is linked to the associated subnet." + }, + "@aws-cdk/aws-rds:auroraClusterChangeScopeOfInstanceParameterGroupWithEachParameters": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, a scope of InstanceParameterGroup for AuroraClusterInstance with each parameters will change." + }, + "@aws-cdk/aws-appsync:useArnForSourceApiAssociationIdentifier": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, will always use the arn for identifiers for CfnSourceApiAssociation in the GraphqlApi construct rather than id." + }, + "@aws-cdk/aws-rds:preventRenderingDeprecatedCredentials": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, creating an RDS database cluster from a snapshot will only render credentials for snapshot credentials." + }, + "@aws-cdk/aws-codepipeline-actions:useNewDefaultBranchForCodeCommitSource": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, the CodeCommit source action is using the default branch name 'main'." + }, + "@aws-cdk/aws-cloudwatch-actions:changeLambdaPermissionLogicalIdForLambdaAction": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, the logical ID of a Lambda permission for a Lambda action includes an alarm ID." + }, + "@aws-cdk/aws-codepipeline:crossAccountKeysDefaultValueToFalse": { + "userValue": true, + "recommendedValue": true, + "explanation": "Enables Pipeline to set the default value for crossAccountKeys to false." + }, + "@aws-cdk/aws-codepipeline:defaultPipelineTypeToV2": { + "userValue": true, + "recommendedValue": true, + "explanation": "Enables Pipeline to set the default pipeline type to V2." + }, + "@aws-cdk/aws-kms:reduceCrossAccountRegionPolicyScope": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, IAM Policy created from KMS key grant will reduce the resource scope to this key only." + }, + "@aws-cdk/pipelines:reduceAssetRoleTrustScope": { + "recommendedValue": true, + "explanation": "Remove the root account principal from PipelineAssetsFileRole trust policy", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-eks:nodegroupNameAttribute": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, nodegroupName attribute of the provisioned EKS NodeGroup will not have the cluster name prefix." + }, + "@aws-cdk/aws-eks:useNativeOidcProvider": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, EKS V2 clusters will use the native OIDC provider resource AWS::IAM::OIDCProvider instead of creating the OIDCProvider with a custom resource (iam.OpenIDConnectProvider)." + }, + "@aws-cdk/aws-ec2:ebsDefaultGp3Volume": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, the default volume type of the EBS volume will be GP3" + }, + "@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, remove default deployment alarm settings" + }, + "@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": { + "userValue": false, + "recommendedValue": false, + "explanation": "When enabled, the custom resource used for `AwsCustomResource` will configure the `logApiResponseData` property as true by default" + }, + "@aws-cdk/aws-s3:keepNotificationInImportedBucket": { + "userValue": false, + "recommendedValue": false, + "explanation": "When enabled, Adding notifications to a bucket in the current stack will not remove notification from imported stack." + }, + "@aws-cdk/aws-stepfunctions-tasks:useNewS3UriParametersForBedrockInvokeModelTask": { + "recommendedValue": true, + "explanation": "When enabled, use new props for S3 URI field in task definition of state machine for bedrock invoke model.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/core:explicitStackTags": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, stack tags need to be assigned explicitly on a Stack." + }, + "@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, we will only grant the necessary permissions when users specify cloudwatch log group through logConfiguration" + }, + "@aws-cdk/aws-dynamodb:resourcePolicyPerReplica": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled will allow you to specify a resource policy per replica, and not copy the source table policy to all replicas" + }, + "@aws-cdk/aws-ec2:ec2SumTImeoutEnabled": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, initOptions.timeout and resourceSignalTimeout values will be summed together." + }, + "@aws-cdk/aws-appsync:appSyncGraphQLAPIScopeLambdaPermission": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, a Lambda authorizer Permission created when using GraphqlApi will be properly scoped with a SourceArn." + }, + "@aws-cdk/aws-rds:setCorrectValueForDatabaseInstanceReadReplicaInstanceResourceId": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, the value of property `instanceResourceId` in construct `DatabaseInstanceReadReplica` will be set to the correct value which is `DbiResourceId` instead of currently `DbInstanceArn`" + }, + "@aws-cdk/core:cfnIncludeRejectComplexResourceUpdateCreatePolicyIntrinsics": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, CFN templates added with `cfn-include` will error if the template contains Resource Update or Create policies with CFN Intrinsics that include non-primitive values." + }, + "@aws-cdk/aws-lambda-nodejs:sdkV3ExcludeSmithyPackages": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, both `@aws-sdk` and `@smithy` packages will be excluded from the Lambda Node.js 18.x runtime to prevent version mismatches in bundled applications." + }, + "@aws-cdk/aws-stepfunctions-tasks:fixRunEcsTaskPolicy": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, the resource of IAM Run Ecs policy generated by SFN EcsRunTask will reference the definition, instead of constructing ARN." + }, + "@aws-cdk/aws-ec2:bastionHostUseAmazonLinux2023ByDefault": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, the BastionHost construct will use the latest Amazon Linux 2023 AMI, instead of Amazon Linux 2." + }, + "@aws-cdk/core:aspectStabilization": { + "recommendedValue": true, + "explanation": "When enabled, a stabilization loop will be run when invoking Aspects during synthesis.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-route53-targets:userPoolDomainNameMethodWithoutCustomResource": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, use a new method for DNS Name of user pool domain target without creating a custom resource." + }, + "@aws-cdk/aws-elasticloadbalancingV2:albDualstackWithoutPublicIpv4SecurityGroupRulesDefault": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, the default security group ingress rules will allow IPv6 ingress from anywhere" + }, + "@aws-cdk/aws-iam:oidcRejectUnauthorizedConnections": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, the default behaviour of OIDC provider will reject unauthorized connections" + }, + "@aws-cdk/core:enableAdditionalMetadataCollection": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, CDK will expand the scope of usage data collected to better inform CDK development and improve communication for security concerns and emerging issues." + }, + "@aws-cdk/aws-lambda:createNewPoliciesWithAddToRolePolicy": { + "userValue": false, + "recommendedValue": false, + "explanation": "[Deprecated] When enabled, Lambda will create new inline policies with AddToRolePolicy instead of adding to the Default Policy Statement" + }, + "@aws-cdk/aws-s3:setUniqueReplicationRoleName": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, CDK will automatically generate a unique role name that is used for s3 object replication." + }, + "@aws-cdk/pipelines:reduceStageRoleTrustScope": { + "recommendedValue": true, + "explanation": "Remove the root account principal from Stage addActions trust policy", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-events:requireEventBusPolicySid": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, grantPutEventsTo() will use resource policies with Statement IDs for service principals." + }, + "@aws-cdk/core:aspectPrioritiesMutating": { + "userValue": true, + "recommendedValue": true, + "explanation": "When set to true, Aspects added by the construct library on your behalf will be given a priority of MUTATING." + }, + "@aws-cdk/aws-dynamodb:retainTableReplica": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, table replica will be default to the removal policy of source table unless specified otherwise." + }, + "@aws-cdk/cognito:logUserPoolClientSecretValue": { + "recommendedValue": false, + "explanation": "When disabled, the value of the user pool client secret will not be logged in the custom resource lambda function logs." + }, + "@aws-cdk/pipelines:reduceCrossAccountActionRoleTrustScope": { + "recommendedValue": true, + "explanation": "When enabled, scopes down the trust policy for the cross-account action role", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-stepfunctions:useDistributedMapResultWriterV2": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, the resultWriterV2 property of DistributedMap will be used insted of resultWriter" + }, + "@aws-cdk/s3-notifications:addS3TrustKeyPolicyForSnsSubscriptions": { + "userValue": true, + "recommendedValue": true, + "explanation": "Add an S3 trust policy to a KMS key resource policy for SNS subscriptions." + }, + "@aws-cdk/aws-ec2:requirePrivateSubnetsForEgressOnlyInternetGateway": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, the EgressOnlyGateway resource is only created if private subnets are defined in the dual-stack VPC." + }, + "@aws-cdk/aws-ec2-alpha:useResourceIdForVpcV2Migration": { + "recommendedValue": false, + "explanation": "When enabled, use resource IDs for VPC V2 migration" + }, + "@aws-cdk/aws-s3:publicAccessBlockedByDefault": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, setting any combination of options for BlockPublicAccess will automatically set true for any options not defined." + }, + "@aws-cdk/aws-lambda:useCdkManagedLogGroup": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, CDK creates and manages loggroup for the lambda function" + }, + "@aws-cdk/aws-elasticloadbalancingv2:networkLoadBalancerWithSecurityGroupByDefault": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, Network Load Balancer will be created with a security group by default." + }, + "@aws-cdk/aws-stepfunctions-tasks:httpInvokeDynamicJsonPathEndpoint": { + "recommendedValue": true, + "explanation": "When enabled, allows using a dynamic apiEndpoint with JSONPath format in HttpInvoke tasks.", + "unconfiguredBehavesLike": { + "v2": true + } + }, + "@aws-cdk/aws-ecs-patterns:uniqueTargetGroupId": { + "userValue": true, + "recommendedValue": true, + "explanation": "When enabled, ECS patterns will generate unique target group IDs to prevent conflicts during load balancer replacement" + }, + "@aws-cdk/aws-route53-patterns:useDistribution": { + "userValue": true, + "recommendedValue": true, + "explanation": "Use the `Distribution` resource instead of `CloudFrontWebDistribution`" + }, + "@aws-cdk/aws-cloudfront:defaultFunctionRuntimeV2_0": { + "recommendedValue": true, + "explanation": "Use cloudfront-js-2.0 as the default runtime for CloudFront Functions" + }, + "@aws-cdk/aws-elasticloadbalancingv2:usePostQuantumTlsPolicy": { + "recommendedValue": true, + "explanation": "When enabled, HTTPS/TLS listeners use post-quantum TLS policy by default" + }, + "@aws-cdk/core:automaticL1Traits": { + "recommendedValue": true, + "explanation": "Automatically use the default L1 traits for L1 constructs`", + "unconfiguredBehavesLike": { + "v2": true + } + } + } + } + } + }, + "minimumCliVersion": "2.1108.0" +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/tree.json b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/tree.json new file mode 100644 index 0000000000000..779dd8bc0fed8 --- /dev/null +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.js.snapshot/tree.json @@ -0,0 +1 @@ +{"version":"tree-0.1","tree":{"id":"App","path":"","constructInfo":{"fqn":"aws-cdk-lib.App","version":"0.0.0"},"children":{"aws-cdk-mediapackagev2-import-channel":{"id":"aws-cdk-mediapackagev2-import-channel","path":"aws-cdk-mediapackagev2-import-channel","constructInfo":{"fqn":"aws-cdk-lib.Stack","version":"0.0.0"},"children":{"Group":{"id":"Group","path":"aws-cdk-mediapackagev2-import-channel/Group","constructInfo":{"fqn":"@aws-cdk/aws-mediapackagev2-alpha.ChannelGroup","version":"0.0.0"},"children":{"Resource":{"id":"Resource","path":"aws-cdk-mediapackagev2-import-channel/Group/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_mediapackagev2.CfnChannelGroup","version":"0.0.0"},"attributes":{"aws:cdk:cloudformation:type":"AWS::MediaPackageV2::ChannelGroup","aws:cdk:cloudformation:props":{"channelGroupName":"import-test-group"}}}}},"Channel":{"id":"Channel","path":"aws-cdk-mediapackagev2-import-channel/Channel","constructInfo":{"fqn":"@aws-cdk/aws-mediapackagev2-alpha.Channel","version":"0.0.0"},"children":{"Resource":{"id":"Resource","path":"aws-cdk-mediapackagev2-import-channel/Channel/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_mediapackagev2.CfnChannel","version":"0.0.0"},"attributes":{"aws:cdk:cloudformation:type":"AWS::MediaPackageV2::Channel","aws:cdk:cloudformation:props":{"channelGroupName":"import-test-group","channelName":"import-test-channel","inputType":"CMAF"}}}}},"Endpoint":{"id":"Endpoint","path":"aws-cdk-mediapackagev2-import-channel/Endpoint","constructInfo":{"fqn":"@aws-cdk/aws-mediapackagev2-alpha.OriginEndpoint","version":"0.0.0"},"children":{"Resource":{"id":"Resource","path":"aws-cdk-mediapackagev2-import-channel/Endpoint/Resource","constructInfo":{"fqn":"aws-cdk-lib.aws_mediapackagev2.CfnOriginEndpoint","version":"0.0.0"},"attributes":{"aws:cdk:cloudformation:type":"AWS::MediaPackageV2::OriginEndpoint","aws:cdk:cloudformation:props":{"channelGroupName":"import-test-group","channelName":"import-test-channel","containerType":"CMAF","dashManifests":[{"manifestName":"dash-index"}],"hlsManifests":[{"manifestName":"hls-index"}],"originEndpointName":"import-test-endpoint","segment":{}}}}}},"ImportedChannel":{"id":"ImportedChannel","path":"aws-cdk-mediapackagev2-import-channel/ImportedChannel","constructInfo":{"fqn":"aws-cdk-lib.Resource","version":"0.0.0"}},"ImportedChannelRegion":{"id":"ImportedChannelRegion","path":"aws-cdk-mediapackagev2-import-channel/ImportedChannelRegion","constructInfo":{"fqn":"aws-cdk-lib.CfnOutput","version":"0.0.0"}},"BootstrapVersion":{"id":"BootstrapVersion","path":"aws-cdk-mediapackagev2-import-channel/BootstrapVersion","constructInfo":{"fqn":"aws-cdk-lib.CfnParameter","version":"0.0.0"}},"CheckBootstrapVersion":{"id":"CheckBootstrapVersion","path":"aws-cdk-mediapackagev2-import-channel/CheckBootstrapVersion","constructInfo":{"fqn":"aws-cdk-lib.CfnRule","version":"0.0.0"}}}},"cdk-integ-mediapackagev2-import-channel":{"id":"cdk-integ-mediapackagev2-import-channel","path":"cdk-integ-mediapackagev2-import-channel","constructInfo":{"fqn":"@aws-cdk/integ-tests-alpha.IntegTest","version":"0.0.0"},"children":{"DefaultTest":{"id":"DefaultTest","path":"cdk-integ-mediapackagev2-import-channel/DefaultTest","constructInfo":{"fqn":"@aws-cdk/integ-tests-alpha.IntegTestCase","version":"0.0.0"},"children":{"Default":{"id":"Default","path":"cdk-integ-mediapackagev2-import-channel/DefaultTest/Default","constructInfo":{"fqn":"constructs.Construct","version":"10.5.1"}},"DeployAssert":{"id":"DeployAssert","path":"cdk-integ-mediapackagev2-import-channel/DefaultTest/DeployAssert","constructInfo":{"fqn":"aws-cdk-lib.Stack","version":"0.0.0"},"children":{"BootstrapVersion":{"id":"BootstrapVersion","path":"cdk-integ-mediapackagev2-import-channel/DefaultTest/DeployAssert/BootstrapVersion","constructInfo":{"fqn":"aws-cdk-lib.CfnParameter","version":"0.0.0"}},"CheckBootstrapVersion":{"id":"CheckBootstrapVersion","path":"cdk-integ-mediapackagev2-import-channel/DefaultTest/DeployAssert/CheckBootstrapVersion","constructInfo":{"fqn":"aws-cdk-lib.CfnRule","version":"0.0.0"}}}}}}}},"Tree":{"id":"Tree","path":"Tree","constructInfo":{"fqn":"constructs.Construct","version":"10.5.1"}}}}} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.ts b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.ts new file mode 100644 index 0000000000000..54fd88f74aa07 --- /dev/null +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/integ.mediapackagev2-import-channel.ts @@ -0,0 +1,52 @@ +/** + * Integration test: Channel import and manifest name uniqueness validation. + * + * Creates a channel group, channel, and origin endpoint with multiple unique + * manifest types. Imports the channel via fromChannelAttributes with explicit + * region and verifies the region property is exposed. + */ +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as cdk from 'aws-cdk-lib'; +import * as mediapackagev2 from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-mediapackagev2-import-channel'); + +// Create resources +const group = new mediapackagev2.ChannelGroup(stack, 'Group', { + channelGroupName: 'import-test-group', +}); + +const channel = new mediapackagev2.Channel(stack, 'Channel', { + channelGroup: group, + channelName: 'import-test-channel', +}); + +// Endpoint with multiple unique manifest types (exercises manifest name validation) +new mediapackagev2.OriginEndpoint(stack, 'Endpoint', { + channel, + originEndpointName: 'import-test-endpoint', + segment: mediapackagev2.Segment.cmaf(), + manifests: [ + mediapackagev2.Manifest.hls({ manifestName: 'hls-index' }), + mediapackagev2.Manifest.dash({ manifestName: 'dash-index' }), + ], +}); + +// Import the channel via attributes with explicit region +const importedChannel = mediapackagev2.Channel.fromChannelAttributes(stack, 'ImportedChannel', { + channelGroupName: 'import-test-group', + channelName: 'import-test-channel', + region: stack.region, +}); + +// Verify the imported channel exposes region +new cdk.CfnOutput(stack, 'ImportedChannelRegion', { + value: importedChannel.region, +}); + +new IntegTest(app, 'cdk-integ-mediapackagev2-import-channel', { + testCases: [stack], +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/origin-endpoint.test.ts b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/origin-endpoint.test.ts index 1760c037d0880..6d20c47112f6f 100644 --- a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/origin-endpoint.test.ts +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/origin-endpoint.test.ts @@ -64,10 +64,10 @@ test('MediaPackagev2 Channel Configuration - no names', () => { segment: mediapackagev2.Segment.cmaf(), manifests: [ mediapackagev2.Manifest.lowLatencyHLS({ - manifestName: 'index', + manifestName: 'llhls-index', }), mediapackagev2.Manifest.hls({ - manifestName: 'index', + manifestName: 'hls-index', }), ], startoverWindow: Duration.seconds(100), @@ -76,8 +76,8 @@ test('MediaPackagev2 Channel Configuration - no names', () => { // THEN Template.fromStack(stack).hasResourceProperties('AWS::MediaPackageV2::OriginEndpoint', { OriginEndpointName: 'origin', - HlsManifests: [{ ManifestName: 'index' }], - LowLatencyHlsManifests: [{ ManifestName: 'index' }], + HlsManifests: [{ ManifestName: 'hls-index' }], + LowLatencyHlsManifests: [{ ManifestName: 'llhls-index' }], ContainerType: 'CMAF', StartoverWindowSeconds: 100, }); @@ -93,6 +93,38 @@ test('MediaPackagev2 Channel Configuration - no names imported', () => { expect(originEndpoint.originEndpointArn).toMatch(/^arn:.*:mediapackagev2:us-east-1:123456789012:channelGroup\/MyChannelGroup\/channel\/test\/originEndpoint\/endpoint$/); }); +test('imported OriginEndpoint with cross-region override', () => { + const originEndpoint = mediapackagev2.OriginEndpoint.fromOriginEndpointAttributes(stack, 'ImportedEndpoint', { + channelGroupName: 'MyChannelGroup', + channelName: 'test', + originEndpointName: 'endpoint', + region: 'eu-west-1', + }); + + expect(originEndpoint.originEndpointArn).toMatch(/^arn:.*:mediapackagev2:eu-west-1:123456789012:channelGroup\/MyChannelGroup\/channel\/test\/originEndpoint\/endpoint$/); +}); + +test('OriginEndpoint can be imported from ARN', () => { + const imported = mediapackagev2.OriginEndpoint.fromOriginEndpointArn(stack, 'ImportedEndpoint', 'arn:aws:mediapackagev2:eu-west-1:123456789012:channelGroup/MyGroup/channel/MyChannel/originEndpoint/MyEndpoint'); + + expect(imported.channelGroupName).toBe('MyGroup'); + expect(imported.channelName).toBe('MyChannel'); + expect(imported.originEndpointName).toBe('MyEndpoint'); + expect(imported.originEndpointArn).toMatch(/mediapackagev2:eu-west-1:123456789012/); +}); + +test('OriginEndpoint.fromOriginEndpointArn throws on invalid ARN', () => { + expect(() => { + mediapackagev2.OriginEndpoint.fromOriginEndpointArn(stack, 'Bad', 'arn:aws:mediapackagev2:us-east-1:123456789012:channelGroup/MyGroup/channel/MyChannel'); + }).toThrow(/Could not parse origin endpoint ARN/); +}); + +test('OriginEndpoint.fromOriginEndpointArn throws on token ARN', () => { + expect(() => { + mediapackagev2.OriginEndpoint.fromOriginEndpointArn(stack, 'TokenArn', Lazy.string({ produce: () => 'arn:aws:mediapackagev2:us-east-1:123456789012:channelGroup/G/channel/C/originEndpoint/E' })); + }).toThrow(/Cannot parse a token ARN/); +}); + test('MediaPackagev2 Channel Configuration - encryption configuration', () => { const channelGroup = new mediapackagev2.ChannelGroup(stack, 'MyChannelGroup'); const channel = new mediapackagev2.Channel(stack, 'mychannel', { diff --git a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/validation.test.ts b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/validation.test.ts index c62cabcf17b4d..7447a5c75aa44 100644 --- a/packages/@aws-cdk/aws-mediapackagev2-alpha/test/validation.test.ts +++ b/packages/@aws-cdk/aws-mediapackagev2-alpha/test/validation.test.ts @@ -367,4 +367,60 @@ describe('Manifest Validation', () => { }); }).toThrow(/Startover Window needs to be between 60-1209600 seconds/); }); + + test('throws on duplicate manifest names within same type', () => { + expect(() => { + new OriginEndpoint(stack, 'Endpoint', { + channel, + segment: Segment.cmaf(), + manifests: [ + Manifest.hls({ manifestName: 'index' }), + Manifest.hls({ manifestName: 'index' }), + ], + }); + }).toThrow(/Duplicate manifest names: \[index\]/); + }); + + test('throws on duplicate manifest names across different types', () => { + expect(() => { + new OriginEndpoint(stack, 'Endpoint', { + channel, + segment: Segment.cmaf(), + manifests: [ + Manifest.hls({ manifestName: 'index' }), + Manifest.dash({ manifestName: 'index' }), + ], + }); + }).toThrow(/Duplicate manifest names: \[index\]/); + }); + + test('reports all duplicate manifest names', () => { + expect(() => { + new OriginEndpoint(stack, 'Endpoint', { + channel, + segment: Segment.cmaf(), + manifests: [ + Manifest.hls({ manifestName: 'index' }), + Manifest.hls({ manifestName: 'index2' }), + Manifest.dash({ manifestName: 'index' }), + Manifest.dash({ manifestName: 'dash1' }), + Manifest.dash({ manifestName: 'dash1' }), + ], + }); + }).toThrow(/Duplicate manifest names: \[index, dash1\]/); + }); + + test('allows unique manifest names', () => { + expect(() => { + new OriginEndpoint(stack, 'Endpoint', { + channel, + segment: Segment.cmaf(), + manifests: [ + Manifest.hls({ manifestName: 'hls-index' }), + Manifest.lowLatencyHLS({ manifestName: 'llhls-index' }), + Manifest.dash({ manifestName: 'dash-index' }), + ], + }); + }).not.toThrow(); + }); });