Skip to content

Commit

Permalink
fix: union enum
Browse files Browse the repository at this point in the history
  • Loading branch information
nmussy committed Apr 5, 2024
1 parent 6954aa4 commit 195a484
Show file tree
Hide file tree
Showing 6 changed files with 716 additions and 1,406 deletions.
694 changes: 0 additions & 694 deletions allowed-breaking-changes.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import * as ec2 from 'aws-cdk-lib/aws-ec2';
import { EC2_RESTRICT_DEFAULT_SECURITY_GROUP } from 'aws-cdk-lib/cx-api';
import { Construct } from 'constructs';

type Version = ec2.WindowsVersion | ec2.WindowsSpecificVersion;

const env = {
account: process.env.CDK_INTEG_ACCOUNT ?? process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_INTEG_REGION ?? process.env.CDK_DEFAULT_REGION,
Expand Down Expand Up @@ -37,19 +35,19 @@ export class InstanceTestCase extends Stack {

const app = new App();

const instanceVersions: Version[] = [
ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_BASE,
const instanceVersions: ec2.WindowsVersion[] = [
ec2.WindowsLatestVersion.WINDOWS_SERVER_2016_ENGLISH_CORE_BASE,
ec2.WindowsSpecificVersion.WINDOWS_SERVER_2022_ENGLISH_FULL_BASE_2024_02_14,
];

// Ideally, all the versions would be tested, but just the integration snapshot verification takes forever
// const imageVersions: Version[] = ([Object.values(ec2.WindowsVersion), Object.values(ec2.WindowsSpecificVersion)].flat());

const imageVersions: Version[] = [
ec2.WindowsVersion.WINDOWS_SERVER_2022_JAPANESE_FULL_SQL_2017_WEB,
ec2.WindowsVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_BASE,
ec2.WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE,
ec2.WindowsVersion.WINDOWS_SERVER_2022_ENGLISH_CORE_ECS_OPTIMIZED,
const imageVersions: ec2.WindowsVersion[] = [
ec2.WindowsLatestVersion.WINDOWS_SERVER_2022_JAPANESE_FULL_SQL_2017_WEB,
ec2.WindowsLatestVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_BASE,
ec2.WindowsLatestVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE,
ec2.WindowsLatestVersion.WINDOWS_SERVER_2022_ENGLISH_CORE_ECS_OPTIMIZED,

ec2.WindowsSpecificVersion.WINDOWS_SERVER_2022_JAPANESE_FULL_SQL_2017_WEB_2023_12_13,
ec2.WindowsSpecificVersion.WINDOWS_SERVER_2016_ENGLISH_FULL_BASE_2023_11_15,
Expand All @@ -75,9 +73,9 @@ new IntegTest(app, 'windows-machine-image-integ-test', {
enableLookups: true,
});

function getMachineImage (version: Version) {
return Object.values(ec2.WindowsVersion).includes(version as ec2.WindowsVersion) ?
ec2.MachineImage.latestWindows(version as ec2.WindowsVersion) :
function getMachineImage (version: ec2.WindowsVersion) {
return Object.values(ec2.WindowsLatestVersion).includes(version as ec2.WindowsLatestVersion) ?
ec2.MachineImage.latestWindows(version as ec2.WindowsLatestVersion) :
ec2.MachineImage.specificWindows(version as ec2.WindowsSpecificVersion);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as cxschema from '../../../cloud-assembly-schema';
import { ContextProvider, CfnMapping, Aws, Stack, Token } from '../../../core';
import * as cxapi from '../../../cx-api';
import { UserData } from '../user-data';
import { WindowsSpecificVersion, WindowsVersion } from '../windows-versions';
import { WindowsLatestVersion, WindowsSpecificVersion, WindowsVersion } from '../windows-versions';

/**
* Factory functions for standard Amazon Machine Image objects.
Expand All @@ -26,7 +26,7 @@ export abstract class MachineImage {
* If you want to use a specific datestamped version of the image,
* use the {@link MachineImage.specificWindows} method instead.
*/
public static latestWindows(version: WindowsVersion, props?: WindowsImageProps): IMachineImage {
public static latestWindows(version: WindowsLatestVersion, props?: WindowsImageProps): IMachineImage {
return new WindowsImage(version, props);
}

Expand Down
Loading

0 comments on commit 195a484

Please sign in to comment.