aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 2.92 kB
JavaScript
var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.MetricAggregationType=exports.AdjustmentType=exports.StepScalingAction=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var constructs_1=()=>{var tmp=require("constructs");return constructs_1=()=>tmp,tmp},applicationautoscaling_generated_1=()=>{var tmp=require("./applicationautoscaling.generated");return applicationautoscaling_generated_1=()=>tmp,tmp},cdk=()=>{var tmp=require("../../core");return cdk=()=>tmp,tmp},errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_1=()=>tmp,tmp};class StepScalingAction extends constructs_1().Construct{constructor(scope,id,props){super(scope,id),this.adjustments=new Array;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_applicationautoscaling_StepScalingActionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,StepScalingAction),error}const resource=new(applicationautoscaling_generated_1()).CfnScalingPolicy(this,"Resource",{policyName:props.policyName||cdk().Names.uniqueId(this),policyType:"StepScaling",scalingTargetId:props.scalingTarget.scalableTargetId,stepScalingPolicyConfiguration:{adjustmentType:props.adjustmentType,cooldown:props.cooldown&&props.cooldown.toSeconds(),minAdjustmentMagnitude:props.minAdjustmentMagnitude,metricAggregationType:props.metricAggregationType,stepAdjustments:cdk().Lazy.any({produce:()=>this.adjustments})}});this.scalingPolicyArn=resource.ref}addAdjustment(adjustment){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_applicationautoscaling_AdjustmentTier(adjustment)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addAdjustment),error}if(adjustment.lowerBound===void 0&&adjustment.upperBound===void 0)throw new(errors_1()).ValidationError("At least one of lowerBound or upperBound is required",this);this.adjustments.push({metricIntervalLowerBound:adjustment.lowerBound,metricIntervalUpperBound:adjustment.upperBound,scalingAdjustment:adjustment.adjustment})}}exports.StepScalingAction=StepScalingAction,_a=JSII_RTTI_SYMBOL_1,StepScalingAction[_a]={fqn:"aws-cdk-lib.aws_applicationautoscaling.StepScalingAction",version:"2.202.0"};var AdjustmentType;(function(AdjustmentType2){AdjustmentType2.CHANGE_IN_CAPACITY="ChangeInCapacity",AdjustmentType2.PERCENT_CHANGE_IN_CAPACITY="PercentChangeInCapacity",AdjustmentType2.EXACT_CAPACITY="ExactCapacity"})(AdjustmentType||(exports.AdjustmentType=AdjustmentType={}));var MetricAggregationType;(function(MetricAggregationType2){MetricAggregationType2.AVERAGE="Average",MetricAggregationType2.MINIMUM="Minimum",MetricAggregationType2.MAXIMUM="Maximum"})(MetricAggregationType||(exports.MetricAggregationType=MetricAggregationType={}));
;