aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 2.53 kB
JavaScript
;var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.BaseDeploymentConfig=exports.ComputePlatform=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),core_1=require("../../core"),codedeploy_generated_1=require("./codedeploy.generated"),utils_1=require("./private/utils");var ComputePlatform;(function(ComputePlatform2){ComputePlatform2.SERVER="Server",ComputePlatform2.LAMBDA="Lambda",ComputePlatform2.ECS="ECS"})(ComputePlatform=exports.ComputePlatform||(exports.ComputePlatform={}));class BaseDeploymentConfig extends core_1.Resource{constructor(scope,id,props){super(scope,id,{physicalName:props?.deploymentConfigName});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_codedeploy_BaseDeploymentConfigProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,BaseDeploymentConfig),error}if(props?.trafficRouting&&(props?.computePlatform===void 0||props?.computePlatform===ComputePlatform.SERVER))throw new Error("Traffic routing config must not be specified for a Server-base deployment configuration");if(props?.minimumHealthyHosts&&props?.computePlatform&&props?.computePlatform!==ComputePlatform.SERVER)throw new Error("Minimum healthy hosts config must only be specified for a Server-base deployment configuration");const resource=new codedeploy_generated_1.CfnDeploymentConfig(this,"Resource",{deploymentConfigName:this.physicalName,computePlatform:props?.computePlatform,trafficRoutingConfig:props?.trafficRouting?.bind(this),minimumHealthyHosts:props?.minimumHealthyHosts?._json});this.deploymentConfigName=this.getResourceNameAttribute(resource.ref),this.deploymentConfigArn=this.getResourceArnAttribute(utils_1.arnForDeploymentConfig(resource.ref),{service:"codedeploy",resource:"deploymentconfig",resourceName:this.physicalName,arnFormat:core_1.ArnFormat.COLON_RESOURCE_NAME}),this.node.addValidation({validate:()=>utils_1.validateName("Deployment config",this.physicalName)})}static fromDeploymentConfigName(scope,id,deploymentConfigName){const arn=core_1.Stack.of(scope).formatArn({service:"codedeploy",resource:"deploymentconfig",resourceName:deploymentConfigName,arnFormat:core_1.ArnFormat.COLON_RESOURCE_NAME});return{deploymentConfigName,deploymentConfigArn:arn}}}exports.BaseDeploymentConfig=BaseDeploymentConfig,_a=JSII_RTTI_SYMBOL_1,BaseDeploymentConfig[_a]={fqn:"aws-cdk-lib.aws_codedeploy.BaseDeploymentConfig",version:"2.70.0"};function ignore(_x){}