"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApplicationLoadBalancedFargateService=void 0;const jsiiDeprecationWarnings=require("../../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),aws_ecs_1=require("../../../aws-ecs"),core_1=require("../../../core"),cxapi=require("../../../cx-api"),application_load_balanced_service_base_1=require("../base/application-load-balanced-service-base");class ApplicationLoadBalancedFargateService extends application_load_balanced_service_base_1.ApplicationLoadBalancedServiceBase{constructor(scope,id,props={}){var _b,_c,_d;super(scope,id,props);try{jsiiDeprecationWarnings.aws_cdk_lib_aws_ecs_patterns_ApplicationLoadBalancedFargateServiceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.constructor),error}if(this.assignPublicIp=(_b=props.assignPublicIp)!==null&&_b!==void 0?_b:!1,props.taskDefinition&&props.taskImageOptions)throw new Error("You must specify either a taskDefinition or an image, not both.");if(props.taskDefinition)this.taskDefinition=props.taskDefinition;else if(props.taskImageOptions){const taskImageOptions=props.taskImageOptions;this.taskDefinition=new aws_ecs_1.FargateTaskDefinition(this,"TaskDef",{memoryLimitMiB:props.memoryLimitMiB,cpu:props.cpu,executionRole:taskImageOptions.executionRole,taskRole:taskImageOptions.taskRole,family:taskImageOptions.family});const enableLogging=(_c=taskImageOptions.enableLogging)!==null&&_c!==void 0?_c:!0,logDriver=taskImageOptions.logDriver!==void 0?taskImageOptions.logDriver:enableLogging?this.createAWSLogDriver(this.node.id):void 0,containerName=(_d=taskImageOptions.containerName)!==null&&_d!==void 0?_d:"web";this.taskDefinition.addContainer(containerName,{image:taskImageOptions.image,logging:logDriver,environment:taskImageOptions.environment,secrets:taskImageOptions.secrets,dockerLabels:taskImageOptions.dockerLabels}).addPortMappings({containerPort:taskImageOptions.containerPort||80})}else throw new Error("You must specify one of: taskDefinition or image");const desiredCount=core_1.FeatureFlags.of(this).isEnabled(cxapi.ECS_REMOVE_DEFAULT_DESIRED_COUNT)?this.internalDesiredCount:this.desiredCount;this.service=new aws_ecs_1.FargateService(this,"Service",{cluster:this.cluster,desiredCount,taskDefinition:this.taskDefinition,assignPublicIp:this.assignPublicIp,serviceName:props.serviceName,healthCheckGracePeriod:props.healthCheckGracePeriod,minHealthyPercent:props.minHealthyPercent,maxHealthyPercent:props.maxHealthyPercent,propagateTags:props.propagateTags,enableECSManagedTags:props.enableECSManagedTags,cloudMapOptions:props.cloudMapOptions,platformVersion:props.platformVersion,deploymentController:props.deploymentController,circuitBreaker:props.circuitBreaker,securityGroups:props.securityGroups,vpcSubnets:props.taskSubnets}),this.addServiceAsTarget(this.service)}}exports.ApplicationLoadBalancedFargateService=ApplicationLoadBalancedFargateService,_a=JSII_RTTI_SYMBOL_1,ApplicationLoadBalancedFargateService[_a]={fqn:"aws-cdk-lib.aws_ecs_patterns.ApplicationLoadBalancedFargateService",version:"2.21.0"};
//# sourceMappingURL=application-load-balanced-fargate-service.js.map
