aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 4.39 kB
JavaScript
var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.FargatePlatformVersion=exports.FargateService=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var cdk=()=>{var tmp=require("../../../core");return cdk=()=>tmp,tmp},base_service_1=()=>{var tmp=require("../base/base-service");return base_service_1=()=>tmp,tmp},from_service_attributes_1=()=>{var tmp=require("../base/from-service-attributes");return from_service_attributes_1=()=>tmp,tmp};class FargateService extends base_service_1().BaseService{static fromFargateServiceArn(scope,id,fargateServiceArn){class Import extends cdk().Resource{constructor(){super(...arguments),this.serviceArn=fargateServiceArn,this.serviceName=(0,from_service_attributes_1().extractServiceNameFromArn)(this,fargateServiceArn)}}return new Import(scope,id)}static fromFargateServiceAttributes(scope,id,attrs){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_FargateServiceAttributes(attrs)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromFargateServiceAttributes),error}return(0,from_service_attributes_1().fromServiceAttributes)(scope,id,attrs)}constructor(scope,id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_FargateServiceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,FargateService),error}if(!props.taskDefinition.isFargateCompatible)throw new Error("Supplied TaskDefinition is not configured for compatibility with Fargate");if(props.securityGroup!==void 0&&props.securityGroups!==void 0)throw new Error("Only one of SecurityGroup or SecurityGroups can be populated.");const unsupportedPlatformVersions=[FargatePlatformVersion.VERSION1_0,FargatePlatformVersion.VERSION1_1,FargatePlatformVersion.VERSION1_2,FargatePlatformVersion.VERSION1_3],isUnsupportedPlatformVersion=props.platformVersion&&unsupportedPlatformVersions.includes(props.platformVersion);if(props.taskDefinition.ephemeralStorageGiB&&isUnsupportedPlatformVersion)throw new Error(`The ephemeralStorageGiB feature requires platform version ${FargatePlatformVersion.VERSION1_4} or later, got ${props.platformVersion}.`);if(props.taskDefinition.pidMode&&isUnsupportedPlatformVersion)throw new Error(`The pidMode feature requires platform version ${FargatePlatformVersion.VERSION1_4} or later, got ${props.platformVersion}.`);super(scope,id,{...props,desiredCount:props.desiredCount,launchType:base_service_1().LaunchType.FARGATE,capacityProviderStrategies:props.capacityProviderStrategies,enableECSManagedTags:props.enableECSManagedTags},{cluster:props.cluster.clusterName,taskDefinition:props.deploymentController?.type===base_service_1().DeploymentControllerType.EXTERNAL?void 0:props.taskDefinition.taskDefinitionArn,platformVersion:props.platformVersion},props.taskDefinition);let securityGroups;props.securityGroup!==void 0?securityGroups=[props.securityGroup]:props.securityGroups!==void 0&&(securityGroups=props.securityGroups),(!props.deploymentController||props.deploymentController.type!==base_service_1().DeploymentControllerType.EXTERNAL)&&this.configureAwsVpcNetworkingWithSecurityGroups(props.cluster.vpc,props.assignPublicIp,props.vpcSubnets,securityGroups),this.node.addValidation({validate:()=>this.taskDefinition.referencesSecretJsonField&&isUnsupportedPlatformVersion?[`The task definition of this service uses at least one container that references a secret JSON field. This feature requires platform version ${FargatePlatformVersion.VERSION1_4} or later.`]:[]}),this.node.addValidation({validate:()=>this.taskDefinition.defaultContainer?[]:["A TaskDefinition must have at least one essential container"]})}}exports.FargateService=FargateService,_a=JSII_RTTI_SYMBOL_1,FargateService[_a]={fqn:"aws-cdk-lib.aws_ecs.FargateService",version:"2.160.0"};var FargatePlatformVersion;(function(FargatePlatformVersion2){FargatePlatformVersion2.LATEST="LATEST",FargatePlatformVersion2.VERSION1_4="1.4.0",FargatePlatformVersion2.VERSION1_3="1.3.0",FargatePlatformVersion2.VERSION1_2="1.2.0",FargatePlatformVersion2.VERSION1_1="1.1.0",FargatePlatformVersion2.VERSION1_0="1.0.0"})(FargatePlatformVersion||(exports.FargatePlatformVersion=FargatePlatformVersion={}));
;