Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
} else if (props && props.windowsVersion) {
if (this.hwType !== AmiHardwareType.STANDARD) {
throw new Error('Windows Server does not support special hardware type');
} else {
this.windowsVersion = props.windowsVersion;
}
} else { // generation not defined in props object
// always default to Amazon Linux v2 regardless of HW
this.generation = ec2.AmazonLinuxGeneration.AMAZON_LINUX_2;
}
// set the SSM parameter name
this.amiParameterName = "/aws/service/ecs/optimized-ami/"
+ (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX ? "amazon-linux/" : "")
+ (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 ? "amazon-linux-2/" : "")
+ (this.windowsVersion ? `windows_server/${this.windowsVersion}/english/full/` : "")
+ (this.hwType === AmiHardwareType.GPU ? "gpu/" : "")
+ (this.hwType === AmiHardwareType.ARM ? "arm64/" : "")
+ "recommended/image_id";
}
this.generation = props.generation;
}
} else if (props && props.windowsVersion) {
if (this.hwType !== AmiHardwareType.STANDARD) {
throw new Error('Windows Server does not support special hardware type');
} else {
this.windowsVersion = props.windowsVersion;
}
} else { // generation not defined in props object
// always default to Amazon Linux v2 regardless of HW
this.generation = ec2.AmazonLinuxGeneration.AMAZON_LINUX_2;
}
// set the SSM parameter name
this.amiParameterName = "/aws/service/ecs/optimized-ami/"
+ (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX ? "amazon-linux/" : "")
+ (this.generation === ec2.AmazonLinuxGeneration.AMAZON_LINUX_2 ? "amazon-linux-2/" : "")
+ (this.windowsVersion ? `windows_server/${this.windowsVersion}/english/full/` : "")
+ (this.hwType === AmiHardwareType.GPU ? "gpu/" : "")
+ (this.hwType === AmiHardwareType.ARM ? "arm64/" : "")
+ "recommended/image_id";
}