aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 2.14 kB
JavaScript
var _a,_b;Object.defineProperty(exports,"__esModule",{value:!0}),exports.PlacementConstraint=exports.PlacementStrategy=exports.BinPackResource=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var ec2_service_1=()=>{var tmp=require("./ec2/ec2-service");return ec2_service_1=()=>tmp,tmp},BinPackResource;(function(BinPackResource2){BinPackResource2.CPU="CPU",BinPackResource2.MEMORY="MEMORY"})(BinPackResource||(exports.BinPackResource=BinPackResource={}));class PlacementStrategy{static spreadAcrossInstances(){return new PlacementStrategy([{type:"spread",field:ec2_service_1().BuiltInAttributes.INSTANCE_ID}])}static spreadAcross(...fields){if(fields.length===0)throw new Error("spreadAcross: give at least one field to spread by");return new PlacementStrategy(fields.map(field=>({type:"spread",field})))}static packedByCpu(){return PlacementStrategy.packedBy(BinPackResource.CPU)}static packedByMemory(){return PlacementStrategy.packedBy(BinPackResource.MEMORY)}static packedBy(resource){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ecs_BinPackResource(resource)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.packedBy),error}return new PlacementStrategy([{type:"binpack",field:resource}])}static randomly(){return new PlacementStrategy([{type:"random"}])}constructor(json){this.json=json}toJson(){return this.json}}exports.PlacementStrategy=PlacementStrategy,_a=JSII_RTTI_SYMBOL_1,PlacementStrategy[_a]={fqn:"aws-cdk-lib.aws_ecs.PlacementStrategy",version:"2.185.0"};class PlacementConstraint{static distinctInstances(){return new PlacementConstraint([{type:"distinctInstance"}])}static memberOf(...expressions){return new PlacementConstraint(expressions.map(expression=>({type:"memberOf",expression})))}constructor(json){this.json=json}toJson(){return this.json}}exports.PlacementConstraint=PlacementConstraint,_b=JSII_RTTI_SYMBOL_1,PlacementConstraint[_b]={fqn:"aws-cdk-lib.aws_ecs.PlacementConstraint",version:"2.185.0"};
;