UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 8.79 kB
"use strict";var __esDecorate=exports&&exports.__esDecorate||function(ctor,descriptorIn,decorators,contextIn,initializers,extraInitializers){function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Function expected");return f}for(var kind=contextIn.kind,key=kind==="getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor?contextIn.static?ctor:ctor.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor(target,contextIn.name):{}),_,done=!1,i=decorators.length-1;i>=0;i--){var context={};for(var p in contextIn)context[p]=p==="access"?{}:contextIn[p];for(var p in contextIn.access)context.access[p]=contextIn.access[p];context.addInitializer=function(f){if(done)throw new TypeError("Cannot add initializers after decoration has completed");extraInitializers.push(accept(f||null))};var result=(0,decorators[i])(kind==="accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key],context);if(kind==="accessor"){if(result===void 0)continue;if(result===null||typeof result!="object")throw new TypeError("Object expected");(_=accept(result.get))&&(descriptor.get=_),(_=accept(result.set))&&(descriptor.set=_),(_=accept(result.init))&&initializers.unshift(_)}else(_=accept(result))&&(kind==="field"?initializers.unshift(_):descriptor[key]=_)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0},__runInitializers=exports&&exports.__runInitializers||function(thisArg,initializers,value){for(var useValue=arguments.length>2,i=0;i<initializers.length;i++)value=useValue?initializers[i].call(thisArg,value):initializers[i].call(thisArg);return useValue?value:void 0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.RolloutStrategy=exports.DeploymentStrategyId=exports.GrowthType=exports.DeploymentStrategy=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var appconfig_generated_1=()=>{var tmp=require("./appconfig.generated");return appconfig_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},metadata_resource_1=()=>{var tmp=require("../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp},prop_injectable_1=()=>{var tmp=require("../../core/lib/prop-injectable");return prop_injectable_1=()=>tmp,tmp};let DeploymentStrategy=(()=>{let _classDecorators=[prop_injectable_1().propertyInjectable],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=core_1().Resource;var DeploymentStrategy2=class extends _classSuper{static{_classThis=this}static{const _metadata=typeof Symbol=="function"&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;__esDecorate(null,_classDescriptor={value:_classThis},_classDecorators,{kind:"class",name:_classThis.name,metadata:_metadata},null,_classExtraInitializers),DeploymentStrategy2=_classThis=_classDescriptor.value,_metadata&&Object.defineProperty(_classThis,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appconfig.DeploymentStrategy",version:"2.233.0"};static PROPERTY_INJECTION_ID="aws-cdk-lib.aws-appconfig.DeploymentStrategy";get deploymentStrategyRef(){return{deploymentStrategyId:this.deploymentStrategyId}}static fromDeploymentStrategyArn(scope,id,deploymentStrategyArn){const deploymentStrategyId=core_1().Stack.of(scope).splitArn(deploymentStrategyArn,core_1().ArnFormat.SLASH_RESOURCE_NAME).resourceName;if(!deploymentStrategyId)throw new(core_1()).ValidationError("Missing required deployment strategy id from deployment strategy ARN",scope);class Import extends core_1().Resource{deploymentStrategyId=deploymentStrategyId;deploymentStrategyArn=deploymentStrategyArn;get deploymentStrategyRef(){return{deploymentStrategyId:this.deploymentStrategyId}}}return new Import(scope,id,{environmentFromArn:deploymentStrategyArn})}static fromDeploymentStrategyId(scope,id,deploymentStrategyId){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appconfig_DeploymentStrategyId(deploymentStrategyId)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromDeploymentStrategyId),error}const deploymentStrategyArn=core_1().Stack.of(scope).formatArn({service:"appconfig",resource:"deploymentstrategy",resourceName:deploymentStrategyId.id});class Import extends core_1().Resource{deploymentStrategyId=deploymentStrategyId.id;deploymentStrategyArn=deploymentStrategyArn;get deploymentStrategyRef(){return{deploymentStrategyId:this.deploymentStrategyId}}}return new Import(scope,id,{environmentFromArn:deploymentStrategyArn})}name;deploymentDurationInMinutes;growthFactor;description;finalBakeTimeInMinutes;growthType;deploymentStrategyId;deploymentStrategyArn;_cfnDeploymentStrategy;constructor(scope,id,props){super(scope,id,{physicalName:props.deploymentStrategyName});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appconfig_DeploymentStrategyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,DeploymentStrategy2),error}(0,metadata_resource_1().addConstructMetadata)(this,props),this.deploymentDurationInMinutes=props.rolloutStrategy.deploymentDuration.toMinutes(),this.growthFactor=props.rolloutStrategy.growthFactor,this.description=props.description,this.finalBakeTimeInMinutes=props.rolloutStrategy.finalBakeTime?.toMinutes(),this.growthType=props.rolloutStrategy.growthType,this.name=props.deploymentStrategyName||core_1().Names.uniqueResourceName(this,{maxLength:64,separator:"-"});const resource=new(appconfig_generated_1()).CfnDeploymentStrategy(this,"Resource",{name:this.name,deploymentDurationInMinutes:this.deploymentDurationInMinutes,growthFactor:this.growthFactor,replicateTo:"NONE",description:this.description,finalBakeTimeInMinutes:this.finalBakeTimeInMinutes,growthType:this.growthType});this._cfnDeploymentStrategy=resource,this.deploymentStrategyId=this._cfnDeploymentStrategy.ref,this.deploymentStrategyArn=this.stack.formatArn({service:"appconfig",resource:"deploymentstrategy",resourceName:this.deploymentStrategyId})}static{__runInitializers(_classThis,_classExtraInitializers)}};return DeploymentStrategy2=_classThis})();exports.DeploymentStrategy=DeploymentStrategy;var GrowthType;(function(GrowthType2){GrowthType2.LINEAR="LINEAR",GrowthType2.EXPONENTIAL="EXPONENTIAL"})(GrowthType||(exports.GrowthType=GrowthType={}));class DeploymentStrategyId{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appconfig.DeploymentStrategyId",version:"2.233.0"};static CANARY_10_PERCENT_20_MINUTES=DeploymentStrategyId.fromString("AppConfig.Canary10Percent20Minutes");static LINEAR_50_PERCENT_EVERY_30_SECONDS=DeploymentStrategyId.fromString("AppConfig.Linear50PercentEvery30Seconds");static LINEAR_20_PERCENT_EVERY_6_MINUTES=DeploymentStrategyId.fromString("AppConfig.Linear20PercentEvery6Minutes");static ALL_AT_ONCE=DeploymentStrategyId.fromString("AppConfig.AllAtOnce");static fromString(deploymentStrategyId){return{id:deploymentStrategyId}}}exports.DeploymentStrategyId=DeploymentStrategyId;class RolloutStrategy{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appconfig.RolloutStrategy",version:"2.233.0"};static CANARY_10_PERCENT_20_MINUTES=RolloutStrategy.exponential({growthFactor:10,deploymentDuration:core_1().Duration.minutes(20),finalBakeTime:core_1().Duration.minutes(10)});static LINEAR_50_PERCENT_EVERY_30_SECONDS=RolloutStrategy.linear({growthFactor:50,deploymentDuration:core_1().Duration.minutes(1),finalBakeTime:core_1().Duration.minutes(1)});static LINEAR_20_PERCENT_EVERY_6_MINUTES=RolloutStrategy.linear({growthFactor:20,deploymentDuration:core_1().Duration.minutes(30),finalBakeTime:core_1().Duration.minutes(30)});static ALL_AT_ONCE=RolloutStrategy.linear({growthFactor:100,deploymentDuration:core_1().Duration.minutes(0),finalBakeTime:core_1().Duration.minutes(10)});static linear(props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appconfig_RolloutStrategyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.linear),error}return{growthFactor:props.growthFactor,deploymentDuration:props.deploymentDuration,growthType:GrowthType.LINEAR,finalBakeTime:props.finalBakeTime}}static exponential(props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_appconfig_RolloutStrategyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.exponential),error}return{growthFactor:props.growthFactor,deploymentDuration:props.deploymentDuration,growthType:GrowthType.EXPONENTIAL,finalBakeTime:props.finalBakeTime}}}exports.RolloutStrategy=RolloutStrategy;