"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.PlacementGroup=exports.PlacementGroupStrategy=exports.PlacementGroupSpreadLevel=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_generated_1=()=>{var tmp=require("./ec2.generated");return ec2_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},PlacementGroupSpreadLevel;(function(PlacementGroupSpreadLevel2){PlacementGroupSpreadLevel2.HOST="host",PlacementGroupSpreadLevel2.RACK="rack"})(PlacementGroupSpreadLevel||(exports.PlacementGroupSpreadLevel=PlacementGroupSpreadLevel={}));var PlacementGroupStrategy;(function(PlacementGroupStrategy2){PlacementGroupStrategy2.CLUSTER="cluster",PlacementGroupStrategy2.PARTITION="partition",PlacementGroupStrategy2.SPREAD="spread"})(PlacementGroupStrategy||(exports.PlacementGroupStrategy=PlacementGroupStrategy={}));class PlacementGroup extends core_1().Resource{static fromPlacementGroupName(scope,id,placementGroupName){class Import extends core_1().Resource{constructor(){super(...arguments),this.placementGroupName=placementGroupName}}return new Import(scope,id)}constructor(scope,id,props){super(scope,id,{physicalName:void 0});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_ec2_PlacementGroupProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,PlacementGroup),error}if(this.partitions=props?.partitions,this.spreadLevel=props?.spreadLevel,this.strategy=props?.strategy,this.partitions&&this.strategy){if(this.strategy!==PlacementGroupStrategy.PARTITION)throw new Error(`PlacementGroup '${id}' can only specify 'partitions' with the 'PARTITION' strategy`)}else this.partitions&&!this.strategy&&(this.strategy=PlacementGroupStrategy.PARTITION);if(this.spreadLevel&&(this.strategy||(this.strategy=PlacementGroupStrategy.SPREAD),this.strategy!==PlacementGroupStrategy.SPREAD))throw new Error(`PlacementGroup '${id}' can only specify 'spreadLevel' with the 'SPREAD' strategy`);const resource=new(ec2_generated_1()).CfnPlacementGroup(this,"Resource",{partitionCount:this.partitions,spreadLevel:this.spreadLevel,strategy:this.strategy});this.placementGroupName=this.getResourceArnAttribute(resource.attrGroupName,{service:"batch",resource:"compute-environment",resourceName:this.physicalName})}}exports.PlacementGroup=PlacementGroup,_a=JSII_RTTI_SYMBOL_1,PlacementGroup[_a]={fqn:"aws-cdk-lib.aws_ec2.PlacementGroup",version:"2.148.1"};
