agent-claw: automated task changes

This commit is contained in:
daniel
2026-05-06 18:55:16 -05:00
parent 38905bb1e9
commit 732b00fb66
8494 changed files with 2018127 additions and 4 deletions

View File

@@ -0,0 +1 @@
export * from './require-imdsv2-aspect';

View File

@@ -0,0 +1 @@
"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&exports.__exportStar||function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});var _noFold;exports.AutoScalingGroupRequireImdsv2Aspect=void 0,Object.defineProperty(exports,_noFold="AutoScalingGroupRequireImdsv2Aspect",{enumerable:!0,configurable:!0,get:()=>{var value=require("./require-imdsv2-aspect").AutoScalingGroupRequireImdsv2Aspect;return Object.defineProperty(exports,_noFold="AutoScalingGroupRequireImdsv2Aspect",{enumerable:!0,configurable:!0,value}),value}});

View File

@@ -0,0 +1,16 @@
import type { IConstruct } from 'constructs';
import * as cdk from '../../../core';
/**
* Aspect that makes IMDSv2 required on instances deployed by AutoScalingGroups.
*/
export declare class AutoScalingGroupRequireImdsv2Aspect implements cdk.IAspect {
constructor();
visit(node: IConstruct): void;
/**
* Adds a warning annotation to a node.
*
* @param node The scope to add the warning to.
* @param message The warning message.
*/
protected warn(node: IConstruct, message: string): void;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AutoScalingGroupRequireImdsv2Aspect=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var cdk=()=>{var tmp=require("../../../core");return cdk=()=>tmp,tmp},cx_api_1=()=>{var tmp=require("../../../cx-api");return cx_api_1=()=>tmp,tmp},auto_scaling_group_1=()=>{var tmp=require("../auto-scaling-group");return auto_scaling_group_1=()=>tmp,tmp};class AutoScalingGroupRequireImdsv2Aspect{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_autoscaling.AutoScalingGroupRequireImdsv2Aspect",version:"2.252.0"};constructor(){}visit(node){if(node instanceof auto_scaling_group_1().AutoScalingGroup)if(cdk().FeatureFlags.of(node).isEnabled(cx_api_1().AUTOSCALING_GENERATE_LAUNCH_TEMPLATE)){const cfnLaunchTemplate=node.node.tryFindChild("LaunchTemplate").node.tryFindChild("Resource"),data=cfnLaunchTemplate.launchTemplateData;if(cdk().isResolvableObject(data)){this.warn(node,"CfnLaunchTemplate.LaunchTemplateData field is a CDK token.");return}const metadataOptions=data.metadataOptions;if(cdk().isResolvableObject(metadataOptions)){this.warn(node,"CfnLaunchTemplate.LaunchTemplateData.MetadataOptions field is a CDK token.");return}const newData={...data,metadataOptions:{...metadataOptions,httpTokens:"required"}};cfnLaunchTemplate.launchTemplateData=newData}else{const launchConfig=node.node.tryFindChild("LaunchConfig");if(cdk().isResolvableObject(launchConfig.metadataOptions)){this.warn(node,"CfnLaunchConfiguration.MetadataOptions field is a CDK token.");return}launchConfig.metadataOptions={...launchConfig.metadataOptions,httpTokens:"required"}}}warn(node,message){cdk().Annotations.of(node).addWarningV2(`@aws-cdk/aws-autoscaling:imdsv2${AutoScalingGroupRequireImdsv2Aspect.name}`,`${AutoScalingGroupRequireImdsv2Aspect.name} failed on node ${node.node.id}: ${message}`)}}exports.AutoScalingGroupRequireImdsv2Aspect=AutoScalingGroupRequireImdsv2Aspect;

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,48 @@
export interface MetricWithDims<D> {
readonly namespace: string;
readonly metricName: string;
readonly statistic: string;
readonly dimensionsMap: D;
}
export declare class AutoScalingMetrics {
static groupTotalInstancesAverage(this: void, dimensions: {
AutoScalingGroupName: string;
}): MetricWithDims<{
AutoScalingGroupName: string;
}>;
static groupDesiredCapacityAverage(this: void, dimensions: {
AutoScalingGroupName: string;
}): MetricWithDims<{
AutoScalingGroupName: string;
}>;
static groupMaxSizeAverage(this: void, dimensions: {
AutoScalingGroupName: string;
}): MetricWithDims<{
AutoScalingGroupName: string;
}>;
static groupMinSizeAverage(this: void, dimensions: {
AutoScalingGroupName: string;
}): MetricWithDims<{
AutoScalingGroupName: string;
}>;
static groupTerminatingInstancesAverage(this: void, dimensions: {
AutoScalingGroupName: string;
}): MetricWithDims<{
AutoScalingGroupName: string;
}>;
static groupPendingInstancesAverage(this: void, dimensions: {
AutoScalingGroupName: string;
}): MetricWithDims<{
AutoScalingGroupName: string;
}>;
static groupInServiceInstancesAverage(this: void, dimensions: {
AutoScalingGroupName: string;
}): MetricWithDims<{
AutoScalingGroupName: string;
}>;
static groupStandbyInstancesAverage(this: void, dimensions: {
AutoScalingGroupName: string;
}): MetricWithDims<{
AutoScalingGroupName: string;
}>;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AutoScalingMetrics=void 0;class AutoScalingMetrics{static groupTotalInstancesAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupTotalInstances",dimensionsMap:dimensions,statistic:"Average"}}static groupDesiredCapacityAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupDesiredCapacity",dimensionsMap:dimensions,statistic:"Average"}}static groupMaxSizeAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupMaxSize",dimensionsMap:dimensions,statistic:"Average"}}static groupMinSizeAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupMinSize",dimensionsMap:dimensions,statistic:"Average"}}static groupTerminatingInstancesAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupTerminatingInstances",dimensionsMap:dimensions,statistic:"Average"}}static groupPendingInstancesAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupPendingInstances",dimensionsMap:dimensions,statistic:"Average"}}static groupInServiceInstancesAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupInServiceInstances",dimensionsMap:dimensions,statistic:"Average"}}static groupStandbyInstancesAverage(dimensions){return{namespace:"AWS/AutoScaling",metricName:"GroupStandbyInstances",dimensionsMap:dimensions,statistic:"Average"}}}exports.AutoScalingMetrics=AutoScalingMetrics;

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
export * from './aspects';
export * from './auto-scaling-group';
export * from './schedule';
export * from './lifecycle-hook';
export * from './lifecycle-hook-target';
export * from './scheduled-action';
export * from './step-scaling-action';
export * from './step-scaling-policy';
export * from './target-tracking-scaling-policy';
export * from './termination-policy';
export * from './volume';
export * from './warm-pool';
export * from './autoscaling.generated';

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,43 @@
import type * as constructs from 'constructs';
import type { LifecycleHook } from './lifecycle-hook';
import type * as iam from '../../aws-iam';
/**
* Options needed to bind a target to a lifecycle hook.
* [disable-awslint:ref-via-interface] The lifecycle hook to attach to and an IRole to use
*/
export interface BindHookTargetOptions {
/**
* The lifecycle hook to attach to.
* [disable-awslint:ref-via-interface]
*/
readonly lifecycleHook: LifecycleHook;
/**
* The role to use when attaching to the lifecycle hook.
* [disable-awslint:ref-via-interface]
* @default: a role is not created unless the target arn is specified
*/
readonly role?: iam.IRole;
}
/**
* Result of binding a lifecycle hook to a target.
*/
export interface LifecycleHookTargetConfig {
/**
* The IRole that was used to bind the lifecycle hook to the target
*/
readonly createdRole: iam.IRole;
/**
* The targetArn that the lifecycle hook was bound to
*/
readonly notificationTargetArn: string;
}
/**
* Interface for autoscaling lifecycle hook targets
*/
export interface ILifecycleHookTarget {
/**
* Called when this object is used as the target of a lifecycle hook
* @param options [disable-awslint:ref-via-interface] The lifecycle hook to attach to and a role to use
*/
bind(scope: constructs.Construct, options: BindHookTargetOptions): LifecycleHookTargetConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});

View File

@@ -0,0 +1,114 @@
import type { Construct } from 'constructs';
import type { ILifecycleHookTarget } from './lifecycle-hook-target';
import type * as iam from '../../aws-iam';
import type { Duration, IResource } from '../../core';
import { Resource } from '../../core';
import type { IAutoScalingGroupRef, ILifecycleHookRef, LifecycleHookReference } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
/**
* Basic properties for a lifecycle hook
*/
export interface BasicLifecycleHookProps {
/**
* Name of the lifecycle hook
*
* @default - Automatically generated name.
*/
readonly lifecycleHookName?: string;
/**
* The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.
*
* @default Continue
*/
readonly defaultResult?: DefaultResult;
/**
* Maximum time between calls to RecordLifecycleActionHeartbeat for the hook
*
* If the lifecycle hook times out, perform the action in DefaultResult.
*
* @default - No heartbeat timeout.
*/
readonly heartbeatTimeout?: Duration;
/**
* The state of the Amazon EC2 instance to which you want to attach the lifecycle hook.
*/
readonly lifecycleTransition: LifecycleTransition;
/**
* Additional data to pass to the lifecycle hook target
*
* @default - No metadata.
*/
readonly notificationMetadata?: string;
/**
* The target of the lifecycle hook
*
* @default - No target.
*/
readonly notificationTarget?: ILifecycleHookTarget;
/**
* The role that allows publishing to the notification target
*
* @default - A role will be created if a target is provided. Otherwise, no role is created.
*/
readonly role?: iam.IRole;
}
/**
* Properties for a Lifecycle hook
*/
export interface LifecycleHookProps extends BasicLifecycleHookProps {
/**
* The AutoScalingGroup to add the lifecycle hook to
*/
readonly autoScalingGroup: IAutoScalingGroupRef;
}
/**
* A basic lifecycle hook object
*/
export interface ILifecycleHook extends ILifecycleHookRef, IResource {
/**
* The role for the lifecycle hook to execute
*
* @default - A default role is created if 'notificationTarget' is specified.
* Otherwise, no role is created.
*/
readonly role: iam.IRole;
}
/**
* Define a life cycle hook
*/
export declare class LifecycleHook extends Resource implements ILifecycleHook {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
private _role?;
private readonly _autoScalingGroupName;
/**
* The role that allows the ASG to publish to the notification target
*
* @default - A default role is created if 'notificationTarget' is specified.
* Otherwise, no role is created.
*/
get role(): iam.IRole;
/**
* The name of this lifecycle hook
* @attribute
*/
readonly lifecycleHookName: string;
get lifecycleHookRef(): LifecycleHookReference;
constructor(scope: Construct, id: string, props: LifecycleHookProps);
}
export declare enum DefaultResult {
CONTINUE = "CONTINUE",
ABANDON = "ABANDON"
}
/**
* What instance transition to attach the hook to
*/
export declare enum LifecycleTransition {
/**
* Execute the hook when an instance is about to be added
*/
INSTANCE_LAUNCHING = "autoscaling:EC2_INSTANCE_LAUNCHING",
/**
* Execute the hook when an instance is about to be terminated
*/
INSTANCE_TERMINATING = "autoscaling:EC2_INSTANCE_TERMINATING"
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,67 @@
import type { Construct } from 'constructs';
/**
* Schedule for scheduled scaling actions
*/
export declare abstract class Schedule {
/**
* Construct a schedule from a literal schedule expression
*
* @param expression The expression to use. Must be in a format that AutoScaling will recognize
* @see http://crontab.org/
*/
static expression(expression: string): Schedule;
/**
* Create a schedule from a set of cron fields
*/
static cron(options: CronOptions): Schedule;
/**
* Retrieve the expression for this schedule
*/
abstract readonly expressionString: string;
protected constructor();
/**
*
* @internal
*/
abstract _bind(scope: Construct): void;
}
/**
* Options to configure a cron expression
*
* All fields are strings so you can use complex expressions. Absence of
* a field implies '*' or '?', whichever one is appropriate.
*
* @see http://crontab.org/
*/
export interface CronOptions {
/**
* The minute to run this rule at
*
* @default - Every minute
*/
readonly minute?: string;
/**
* The hour to run this rule at
*
* @default - Every hour
*/
readonly hour?: string;
/**
* The day of the month to run this rule at
*
* @default - Every day of the month
*/
readonly day?: string;
/**
* The month to run this rule at
*
* @default - Every month
*/
readonly month?: string;
/**
* The day of the week to run this rule at
*
* @default - Any day of the week
*/
readonly weekDay?: string;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Schedule=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class Schedule{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_autoscaling.Schedule",version:"2.252.0"};static expression(expression){return new LiteralSchedule(expression)}static cron(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_CronOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.cron),error}if(options.weekDay!==void 0&&options.day!==void 0)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`CannotSupplyBothDayAndWeekDay`,"Cannot supply both 'day' and 'weekDay', use at most one");const minute=fallback(options.minute,"*"),hour=fallback(options.hour,"*"),month=fallback(options.month,"*"),day=fallback(options.day,"*"),weekDay=fallback(options.weekDay,"*");return new class extends Schedule{expressionString=`${minute} ${hour} ${day} ${month} ${weekDay}`;_bind(scope){return options.minute||core_1().Annotations.of(scope).addWarningV2("@aws-cdk/aws-autoscaling:scheduleDefaultRunsEveryMinute","cron: If you don't pass 'minute', by default the event runs every minute. Pass 'minute: '*'' if that's what you intend, or 'minute: 0' to run once per hour instead."),new LiteralSchedule(this.expressionString)}}}constructor(){}}exports.Schedule=Schedule;class LiteralSchedule extends Schedule{expressionString;constructor(expressionString){super(),this.expressionString=expressionString}_bind(){}}function fallback(x,def){return x===void 0?def:x}

View File

@@ -0,0 +1,93 @@
import type { Construct } from 'constructs';
import type { Schedule } from './schedule';
import { Resource } from '../../core';
import type { IAutoScalingGroupRef } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
/**
* Properties for a scheduled scaling action
*/
export interface BasicScheduledActionProps {
/**
* Specifies the time zone for a cron expression. If a time zone is not provided, UTC is used by default.
*
* Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as Etc/GMT+9 or Pacific/Tahiti).
*
* For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
*
* @default - UTC
*
*/
readonly timeZone?: string;
/**
* When to perform this action.
*
* Supports cron expressions.
*
* For more information about cron expressions, see https://en.wikipedia.org/wiki/Cron.
*/
readonly schedule: Schedule;
/**
* When this scheduled action becomes active.
*
* @default - The rule is activate immediately.
*/
readonly startTime?: Date;
/**
* When this scheduled action expires.
*
* @default - The rule never expires.
*/
readonly endTime?: Date;
/**
* The new minimum capacity.
*
* At the scheduled time, set the minimum capacity to the given capacity.
*
* At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.
*
* @default - No new minimum capacity.
*/
readonly minCapacity?: number;
/**
* The new maximum capacity.
*
* At the scheduled time, set the maximum capacity to the given capacity.
*
* At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.
*
* @default - No new maximum capacity.
*/
readonly maxCapacity?: number;
/**
* The new desired capacity.
*
* At the scheduled time, set the desired capacity to the given capacity.
*
* At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied.
*
* @default - No new desired capacity.
*/
readonly desiredCapacity?: number;
}
/**
* Properties for a scheduled action on an AutoScalingGroup
*/
export interface ScheduledActionProps extends BasicScheduledActionProps {
/**
* The AutoScalingGroup to apply the scheduled actions to
*/
readonly autoScalingGroup: IAutoScalingGroupRef;
}
/**
* Define a scheduled scaling action
*/
export declare class ScheduledAction extends Resource {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* The name of the scheduled action.
*
* @attribute
*/
readonly scheduledActionName: string;
constructor(scope: Construct, id: string, props: ScheduledActionProps);
}

View File

@@ -0,0 +1 @@
"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.ScheduledAction=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var autoscaling_generated_1=()=>{var tmp=require("./autoscaling.generated");return autoscaling_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},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},prop_injectable_1=()=>{var tmp=require("../../core/lib/prop-injectable");return prop_injectable_1=()=>tmp,tmp};let ScheduledAction=(()=>{let _classDecorators=[prop_injectable_1().propertyInjectable],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=core_1().Resource;var ScheduledAction2=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),ScheduledAction2=_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_autoscaling.ScheduledAction",version:"2.252.0"};static PROPERTY_INJECTION_ID="aws-cdk-lib.aws-autoscaling.ScheduledAction";scheduledActionName;constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_ScheduledActionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ScheduledAction2),error}if((0,metadata_resource_1().addConstructMetadata)(this,props),props.minCapacity===void 0&&props.maxCapacity===void 0&&props.desiredCapacity===void 0)throw new(core_1()).ValidationError((0,literal_string_1().lit)`LeastOneMinCapacityMax`,"At least one of minCapacity, maxCapacity, or desiredCapacity is required",this);props.schedule._bind(this);const resource=new(autoscaling_generated_1()).CfnScheduledAction(this,"Resource",{autoScalingGroupName:props.autoScalingGroup.autoScalingGroupRef.autoScalingGroupName,startTime:formatISO(props.startTime),endTime:formatISO(props.endTime),minSize:props.minCapacity,maxSize:props.maxCapacity,desiredCapacity:props.desiredCapacity,recurrence:props.schedule.expressionString,timeZone:props.timeZone});this.scheduledActionName=resource.attrScheduledActionName}static{__runInitializers(_classThis,_classExtraInitializers)}};return ScheduledAction2=_classThis})();exports.ScheduledAction=ScheduledAction;function formatISO(date){if(!date)return;return date.getUTCFullYear()+"-"+pad(date.getUTCMonth()+1)+"-"+pad(date.getUTCDate())+"T"+pad(date.getUTCHours())+":"+pad(date.getUTCMinutes())+":"+pad(date.getUTCSeconds())+"Z";function pad(num){return num<10?"0"+num:num}}

View File

@@ -0,0 +1,139 @@
import { Construct } from 'constructs';
import type { Duration } from '../../core';
import type { IAutoScalingGroupRef } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
/**
* Properties for a scaling policy
*/
export interface StepScalingActionProps {
/**
* The auto scaling group
*/
readonly autoScalingGroup: IAutoScalingGroupRef;
/**
* Period after a scaling completes before another scaling activity can start.
*
* @default The default cooldown configured on the AutoScalingGroup
* @deprecated cooldown is not valid with step scaling action
*/
readonly cooldown?: Duration;
/**
* Estimated time until a newly launched instance can send metrics to CloudWatch.
*
* @default Same as the cooldown
*/
readonly estimatedInstanceWarmup?: Duration;
/**
* How the adjustment numbers are interpreted
*
* @default ChangeInCapacity
*/
readonly adjustmentType?: AdjustmentType;
/**
* Minimum absolute number to adjust capacity with as result of percentage scaling.
*
* Only when using AdjustmentType = PercentChangeInCapacity, this number controls
* the minimum absolute effect size.
*
* @default No minimum scaling effect
*/
readonly minAdjustmentMagnitude?: number;
/**
* The aggregation type for the CloudWatch metrics.
*
* @default Average
*/
readonly metricAggregationType?: MetricAggregationType;
}
/**
* Define a step scaling action
*
* This kind of scaling policy adjusts the target capacity in configurable
* steps. The size of the step is configurable based on the metric's distance
* to its alarm threshold.
*
* This Action must be used as the target of a CloudWatch alarm to take effect.
*/
export declare class StepScalingAction extends Construct {
/**
* ARN of the scaling policy
*/
readonly scalingPolicyArn: string;
private readonly adjustments;
constructor(scope: Construct, id: string, props: StepScalingActionProps);
/**
* Add an adjustment interval to the ScalingAction
*/
addAdjustment(adjustment: AdjustmentTier): void;
}
/**
* How adjustment numbers are interpreted
*/
export declare enum AdjustmentType {
/**
* Add the adjustment number to the current capacity.
*
* A positive number increases capacity, a negative number decreases capacity.
*/
CHANGE_IN_CAPACITY = "ChangeInCapacity",
/**
* Add this percentage of the current capacity to itself.
*
* The number must be between -100 and 100; a positive number increases
* capacity and a negative number decreases it.
*/
PERCENT_CHANGE_IN_CAPACITY = "PercentChangeInCapacity",
/**
* Make the capacity equal to the exact number given.
*/
EXACT_CAPACITY = "ExactCapacity"
}
/**
* How the scaling metric is going to be aggregated
*/
export declare enum MetricAggregationType {
/**
* Average
*/
AVERAGE = "Average",
/**
* Minimum
*/
MINIMUM = "Minimum",
/**
* Maximum
*/
MAXIMUM = "Maximum"
}
/**
* An adjustment
*/
export interface AdjustmentTier {
/**
* What number to adjust the capacity with
*
* The number is interpreted as an added capacity, a new fixed capacity or an
* added percentage depending on the AdjustmentType value of the
* StepScalingPolicy.
*
* Can be positive or negative.
*/
readonly adjustment: number;
/**
* Lower bound where this scaling tier applies.
*
* The scaling tier applies if the difference between the metric
* value and its alarm threshold is higher than this value.
*
* @default -Infinity if this is the first tier, otherwise the upperBound of the previous tier
*/
readonly lowerBound?: number;
/**
* Upper bound where this scaling tier applies
*
* The scaling tier applies if the difference between the metric
* value and its alarm threshold is lower than this value.
*
* @default +Infinity
*/
readonly upperBound?: number;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,133 @@
import { Construct } from 'constructs';
import { AdjustmentType, MetricAggregationType, StepScalingAction } from './step-scaling-action';
import * as cloudwatch from '../../aws-cloudwatch';
import type { Duration } from '../../core';
import type { IAutoScalingGroupRef } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
export interface BasicStepScalingPolicyProps {
/**
* Metric to scale on.
*/
readonly metric: cloudwatch.IMetric;
/**
* The intervals for scaling.
*
* Maps a range of metric values to a particular scaling behavior.
*
* Must be between 2 and 40 steps.
*/
readonly scalingSteps: ScalingInterval[];
/**
* How the adjustment numbers inside 'intervals' are interpreted.
*
* @default ChangeInCapacity
*/
readonly adjustmentType?: AdjustmentType;
/**
* Grace period after scaling activity.
*
* @default Default cooldown period on your AutoScalingGroup
*/
readonly cooldown?: Duration;
/**
* Estimated time until a newly launched instance can send metrics to CloudWatch.
*
* @default Same as the cooldown
*/
readonly estimatedInstanceWarmup?: Duration;
/**
* Minimum absolute number to adjust capacity with as result of percentage scaling.
*
* Only when using AdjustmentType = PercentChangeInCapacity, this number controls
* the minimum absolute effect size.
*
* @default No minimum scaling effect
*/
readonly minAdjustmentMagnitude?: number;
/**
* How many evaluation periods of the metric to wait before triggering a scaling action
*
* Raising this value can be used to smooth out the metric, at the expense
* of slower response times.
*
* If `datapointsToAlarm` is not set, then all data points in the evaluation period
* must meet the criteria to trigger a scaling action.
*
* @default 1
*/
readonly evaluationPeriods?: number;
/**
* The number of data points out of the evaluation periods that must be breaching to
* trigger a scaling action
*
* Creates an "M out of N" alarm, where this property is the M and the value set for
* `evaluationPeriods` is the N value.
*
* Only has meaning if `evaluationPeriods != 1`. Must be less than or equal to
* `evaluationPeriods`.
*
* @default - Same as `evaluationPeriods`
*/
readonly datapointsToAlarm?: number;
/**
* Aggregation to apply to all data points over the evaluation periods
*
* Only has meaning if `evaluationPeriods != 1`.
*
* @default - The statistic from the metric if applicable (MIN, MAX, AVERAGE), otherwise AVERAGE.
*/
readonly metricAggregationType?: MetricAggregationType;
}
export interface StepScalingPolicyProps extends BasicStepScalingPolicyProps {
/**
* The auto scaling group
*/
readonly autoScalingGroup: IAutoScalingGroupRef;
}
/**
* Define a acaling strategy which scales depending on absolute values of some metric.
*
* You can specify the scaling behavior for various values of the metric.
*
* Implemented using one or more CloudWatch alarms and Step Scaling Policies.
*/
export declare class StepScalingPolicy extends Construct {
readonly lowerAlarm?: cloudwatch.Alarm;
readonly lowerAction?: StepScalingAction;
readonly upperAlarm?: cloudwatch.Alarm;
readonly upperAction?: StepScalingAction;
constructor(scope: Construct, id: string, props: StepScalingPolicyProps);
}
/**
* A range of metric values in which to apply a certain scaling operation
*/
export interface ScalingInterval {
/**
* The lower bound of the interval.
*
* The scaling adjustment will be applied if the metric is higher than this value.
*
* @default Threshold automatically derived from neighbouring intervals
*/
readonly lower?: number;
/**
* The upper bound of the interval.
*
* The scaling adjustment will be applied if the metric is lower than this value.
*
* @default Threshold automatically derived from neighbouring intervals
*/
readonly upper?: number;
/**
* The capacity adjustment to apply in this interval
*
* The number is interpreted differently based on AdjustmentType:
*
* - ChangeInCapacity: add the adjustment to the current capacity.
* The number can be positive or negative.
* - PercentChangeInCapacity: add or remove the given percentage of the current
* capacity to itself. The number can be in the range [-100..100].
* - ExactCapacity: set the capacity to this number. The number must
* be positive.
*/
readonly change: number;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,121 @@
import { Construct } from 'constructs';
import type * as cloudwatch from '../../aws-cloudwatch';
import type { Duration } from '../../core';
import type { IAutoScalingGroupRef } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
/**
* Base interface for target tracking props
*
* Contains the attributes that are common to target tracking policies,
* except the ones relating to the metric and to the scalable target.
*
* This interface is reused by more specific target tracking props objects.
*/
export interface BaseTargetTrackingProps {
/**
* Indicates whether scale in by the target tracking policy is disabled.
*
* If the value is true, scale in is disabled and the target tracking policy
* won't remove capacity from the autoscaling group. Otherwise, scale in is
* enabled and the target tracking policy can remove capacity from the
* group.
*
* @default false
*/
readonly disableScaleIn?: boolean;
/**
* Period after a scaling completes before another scaling activity can start.
*
* @default - The default cooldown configured on the AutoScalingGroup.
*/
readonly cooldown?: Duration;
/**
* Estimated time until a newly launched instance can send metrics to CloudWatch.
*
* @default - Same as the cooldown.
*/
readonly estimatedInstanceWarmup?: Duration;
}
/**
* Properties for a Target Tracking policy that include the metric but exclude the target
*/
export interface BasicTargetTrackingScalingPolicyProps extends BaseTargetTrackingProps {
/**
* The target value for the metric.
*/
readonly targetValue: number;
/**
* A predefined metric for application autoscaling
*
* The metric must track utilization. Scaling out will happen if the metric is higher than
* the target value, scaling in will happen in the metric is lower than the target value.
*
* Exactly one of customMetric or predefinedMetric must be specified.
*
* @default - No predefined metric.
*/
readonly predefinedMetric?: PredefinedMetric;
/**
* A custom metric for application autoscaling
*
* The metric must track utilization. Scaling out will happen if the metric is higher than
* the target value, scaling in will happen in the metric is lower than the target value.
*
* Exactly one of customMetric or predefinedMetric must be specified.
*
* @default - No custom metric.
*/
readonly customMetric?: cloudwatch.IMetric;
/**
* The resource label associated with the predefined metric
*
* Should be supplied if the predefined metric is ALBRequestCountPerTarget, and the
* format should be:
*
* app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>
*
* @default - No resource label.
*/
readonly resourceLabel?: string;
}
/**
* Properties for a concrete TargetTrackingPolicy
*
* Adds the scalingTarget.
*/
export interface TargetTrackingScalingPolicyProps extends BasicTargetTrackingScalingPolicyProps {
readonly autoScalingGroup: IAutoScalingGroupRef;
}
export declare class TargetTrackingScalingPolicy extends Construct {
/**
* ARN of the scaling policy
*/
readonly scalingPolicyArn: string;
/**
* The resource object
*/
private resource;
constructor(scope: Construct, id: string, props: TargetTrackingScalingPolicyProps);
}
/**
* One of the predefined autoscaling metrics
*/
export declare enum PredefinedMetric {
/**
* Average CPU utilization of the Auto Scaling group
*/
ASG_AVERAGE_CPU_UTILIZATION = "ASGAverageCPUUtilization",
/**
* Average number of bytes received on all network interfaces by the Auto Scaling group
*/
ASG_AVERAGE_NETWORK_IN = "ASGAverageNetworkIn",
/**
* Average number of bytes sent out on all network interfaces by the Auto Scaling group
*/
ASG_AVERAGE_NETWORK_OUT = "ASGAverageNetworkOut",
/**
* Number of requests completed per target in an Application Load Balancer target group
*
* Specify the ALB to look at in the `resourceLabel` field.
*/
ALB_REQUEST_COUNT_PER_TARGET = "ALBRequestCountPerTarget"
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PredefinedMetric=exports.TargetTrackingScalingPolicy=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},autoscaling_generated_1=()=>{var tmp=require("./autoscaling.generated");return autoscaling_generated_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class TargetTrackingScalingPolicy extends constructs_1().Construct{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_autoscaling.TargetTrackingScalingPolicy",version:"2.252.0"};scalingPolicyArn;resource;constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_TargetTrackingScalingPolicyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,TargetTrackingScalingPolicy),error}if(props.customMetric===void 0==(props.predefinedMetric===void 0))throw new(core_1()).ValidationError((0,literal_string_1().lit)`ExactlyOneCustomMetricPredefined`,"Exactly one of 'customMetric' or 'predefinedMetric' must be specified.",this);if(props.predefinedMetric===PredefinedMetric.ALB_REQUEST_COUNT_PER_TARGET&&!props.resourceLabel)throw new(core_1()).ValidationError((0,literal_string_1().lit)`TrackingRequestCountPerTarget`,"When tracking the ALBRequestCountPerTarget metric, the ALB identifier must be supplied in resourceLabel",this);if(props.customMetric&&!props.customMetric.toMetricConfig().metricStat)throw new(core_1()).ValidationError((0,literal_string_1().lit)`DirectMetricsSupportedTargetTracking`,"Only direct metrics are supported for Target Tracking. Use Step Scaling or supply a Metric object.",this);this.resource=new(autoscaling_generated_1()).CfnScalingPolicy(this,"Resource",{policyType:"TargetTrackingScaling",autoScalingGroupName:props.autoScalingGroup.autoScalingGroupRef.autoScalingGroupName,cooldown:props.cooldown&&props.cooldown.toSeconds().toString(),estimatedInstanceWarmup:props.estimatedInstanceWarmup&&props.estimatedInstanceWarmup.toSeconds(),targetTrackingConfiguration:{customizedMetricSpecification:renderCustomMetric(props.customMetric),disableScaleIn:props.disableScaleIn,predefinedMetricSpecification:props.predefinedMetric!==void 0?{predefinedMetricType:props.predefinedMetric,resourceLabel:props.resourceLabel}:void 0,targetValue:props.targetValue}}),this.scalingPolicyArn=this.resource.ref}}exports.TargetTrackingScalingPolicy=TargetTrackingScalingPolicy;function renderCustomMetric(metric){if(!metric)return;const c=metric.toMetricConfig().metricStat;return{dimensions:c.dimensions,metricName:c.metricName,namespace:c.namespace,statistic:c.statistic,unit:c.unitFilter}}var PredefinedMetric;(function(PredefinedMetric2){PredefinedMetric2.ASG_AVERAGE_CPU_UTILIZATION="ASGAverageCPUUtilization",PredefinedMetric2.ASG_AVERAGE_NETWORK_IN="ASGAverageNetworkIn",PredefinedMetric2.ASG_AVERAGE_NETWORK_OUT="ASGAverageNetworkOut",PredefinedMetric2.ALB_REQUEST_COUNT_PER_TARGET="ALBRequestCountPerTarget"})(PredefinedMetric||(exports.PredefinedMetric=PredefinedMetric={}));

View File

@@ -0,0 +1,45 @@
/**
* Specifies the termination criteria to apply before Amazon EC2 Auto Scaling
* chooses an instance for termination.
*/
export declare enum TerminationPolicy {
/**
* Terminate instances in the Auto Scaling group to align the remaining
* instances to the allocation strategy for the type of instance that is
* terminating (either a Spot Instance or an On-Demand Instance).
*/
ALLOCATION_STRATEGY = "AllocationStrategy",
/**
* Terminate instances that are closest to the next billing hour.
*/
CLOSEST_TO_NEXT_INSTANCE_HOUR = "ClosestToNextInstanceHour",
/**
* Terminate instances according to the default termination policy.
*/
DEFAULT = "Default",
/**
* Terminate the newest instance in the group.
*/
NEWEST_INSTANCE = "NewestInstance",
/**
* Terminate the oldest instance in the group.
*/
OLDEST_INSTANCE = "OldestInstance",
/**
* Terminate instances that have the oldest launch configuration.
*/
OLDEST_LAUNCH_CONFIGURATION = "OldestLaunchConfiguration",
/**
* Terminate instances that have the oldest launch template.
*/
OLDEST_LAUNCH_TEMPLATE = "OldestLaunchTemplate",
/**
* Terminate instances using custom termination policy with lambda. If this is
* specified, you must also supply a value of lambda arn in the terminationPolicyCustomLambdaFunctionArn property.
*
* If there are multiple termination policies specified, the custom termination policy with lambda
* must be specified first in the order.
* @see https://docs.aws.amazon.com/autoscaling/ec2/userguide/lambda-custom-termination-policy.html#lambda-custom-termination-policy-limitations
*/
CUSTOM_LAMBDA_FUNCTION = "CustomLambdaFunction"
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TerminationPolicy=void 0;var TerminationPolicy;(function(TerminationPolicy2){TerminationPolicy2.ALLOCATION_STRATEGY="AllocationStrategy",TerminationPolicy2.CLOSEST_TO_NEXT_INSTANCE_HOUR="ClosestToNextInstanceHour",TerminationPolicy2.DEFAULT="Default",TerminationPolicy2.NEWEST_INSTANCE="NewestInstance",TerminationPolicy2.OLDEST_INSTANCE="OldestInstance",TerminationPolicy2.OLDEST_LAUNCH_CONFIGURATION="OldestLaunchConfiguration",TerminationPolicy2.OLDEST_LAUNCH_TEMPLATE="OldestLaunchTemplate",TerminationPolicy2.CUSTOM_LAMBDA_FUNCTION="CustomLambdaFunction"})(TerminationPolicy||(exports.TerminationPolicy=TerminationPolicy={}));

View File

@@ -0,0 +1,165 @@
/**
* Block device
*/
export interface BlockDevice {
/**
* The device name exposed to the EC2 instance
*
* Supply a value like `/dev/sdh`, `xvdh`.
*
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
*/
readonly deviceName: string;
/**
* Defines the block device volume, to be either an Amazon EBS volume or an ephemeral instance store volume
*
* Supply a value like `BlockDeviceVolume.ebs(15)`, `BlockDeviceVolume.ephemeral(0)`.
*/
readonly volume: BlockDeviceVolume;
}
/**
* Base block device options for an EBS volume
*/
export interface EbsDeviceOptionsBase {
/**
* Indicates whether to delete the volume when the instance is terminated.
*
* @default - true for Amazon EC2 Auto Scaling, false otherwise (e.g. EBS)
*/
readonly deleteOnTermination?: boolean;
/**
* The number of I/O operations per second (IOPS) to provision for the volume.
*
* Must only be set for `volumeType`: `EbsDeviceVolumeType.IO1`
*
* The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS,
* you need at least 100 GiB storage on the volume.
*
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
*
* @default - none, required for `EbsDeviceVolumeType.IO1`
*/
readonly iops?: number;
/**
* The EBS volume type
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
*
* @default `EbsDeviceVolumeType.GP2`
*/
readonly volumeType?: EbsDeviceVolumeType;
/**
* The throughput that the volume supports, in MiB/s
* Takes a minimum of 125 and maximum of 2000.
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
* @default - 125 MiB/s. Only valid on gp3 volumes.
*/
readonly throughput?: number;
}
/**
* Block device options for an EBS volume
*/
export interface EbsDeviceOptions extends EbsDeviceOptionsBase {
/**
* Specifies whether the EBS volume is encrypted.
* Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption
*
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances
*
* @default false
*/
readonly encrypted?: boolean;
}
/**
* Block device options for an EBS volume created from a snapshot
*/
export interface EbsDeviceSnapshotOptions extends EbsDeviceOptionsBase {
/**
* The volume size, in Gibibytes (GiB)
*
* If you specify volumeSize, it must be equal or greater than the size of the snapshot.
*
* @default - The snapshot size
*/
readonly volumeSize?: number;
}
/**
* Properties of an EBS block device
*/
export interface EbsDeviceProps extends EbsDeviceSnapshotOptions {
/**
* The snapshot ID of the volume to use
*
* @default - No snapshot will be used
*/
readonly snapshotId?: string;
}
/**
* Describes a block device mapping for an EC2 instance or Auto Scaling group.
*/
export declare class BlockDeviceVolume {
readonly ebsDevice?: EbsDeviceProps | undefined;
readonly virtualName?: string | undefined;
/**
* @internal
*/
static _NO_DEVICE: BlockDeviceVolume;
/**
* Creates a new Elastic Block Storage device
*
* @param volumeSize The volume size, in Gibibytes (GiB)
* @param options additional device options
*/
static ebs(volumeSize: number, options?: EbsDeviceOptions): BlockDeviceVolume;
/**
* Creates a new Elastic Block Storage device from an existing snapshot
*
* @param snapshotId The snapshot ID of the volume to use
* @param options additional device options
*/
static ebsFromSnapshot(snapshotId: string, options?: EbsDeviceSnapshotOptions): BlockDeviceVolume;
/**
* Creates a virtual, ephemeral device.
* The name will be in the form ephemeral{volumeIndex}.
*
* @param volumeIndex the volume index. Must be equal or greater than 0
*/
static ephemeral(volumeIndex: number): BlockDeviceVolume;
/**
* Suppresses a volume mapping
*/
static noDevice(): BlockDeviceVolume;
/**
* @param ebsDevice EBS device info
* @param virtualName Virtual device name
*/
protected constructor(ebsDevice?: EbsDeviceProps | undefined, virtualName?: string | undefined);
}
/**
* Supported EBS volume types for blockDevices
*/
export declare enum EbsDeviceVolumeType {
/**
* Magnetic
*/
STANDARD = "standard",
/**
* Provisioned IOPS SSD - IO1
*/
IO1 = "io1",
/**
* General Purpose SSD - GP2
*/
GP2 = "gp2",
/**
* General Purpose SSD - GP3
*/
GP3 = "gp3",
/**
* Throughput Optimized HDD
*/
ST1 = "st1",
/**
* Cold HDD
*/
SC1 = "sc1"
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EbsDeviceVolumeType=exports.BlockDeviceVolume=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class BlockDeviceVolume{ebsDevice;virtualName;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_autoscaling.BlockDeviceVolume",version:"2.252.0"};static _NO_DEVICE=new BlockDeviceVolume;static ebs(volumeSize,options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_EbsDeviceOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.ebs),error}return new this({...options,volumeSize})}static ebsFromSnapshot(snapshotId,options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_EbsDeviceSnapshotOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.ebsFromSnapshot),error}return new this({...options,snapshotId})}static ephemeral(volumeIndex){if(volumeIndex<0)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`VolumeIndexMustBeNonNegative`,`volumeIndex must be a number starting from 0, got "${volumeIndex}"`);return new this(void 0,`ephemeral${volumeIndex}`)}static noDevice(){return this._NO_DEVICE}constructor(ebsDevice,virtualName){this.ebsDevice=ebsDevice,this.virtualName=virtualName;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_EbsDeviceProps(ebsDevice)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,BlockDeviceVolume),error}}}exports.BlockDeviceVolume=BlockDeviceVolume;var EbsDeviceVolumeType;(function(EbsDeviceVolumeType2){EbsDeviceVolumeType2.STANDARD="standard",EbsDeviceVolumeType2.IO1="io1",EbsDeviceVolumeType2.GP2="gp2",EbsDeviceVolumeType2.GP3="gp3",EbsDeviceVolumeType2.ST1="st1",EbsDeviceVolumeType2.SC1="sc1"})(EbsDeviceVolumeType||(exports.EbsDeviceVolumeType=EbsDeviceVolumeType={}));

View File

@@ -0,0 +1,76 @@
import type { Construct } from 'constructs';
import { Resource } from '../../core';
import type { IAutoScalingGroupRef } from '../../interfaces/generated/aws-autoscaling-interfaces.generated';
/**
* Options for a warm pool
*/
export interface WarmPoolOptions {
/**
* Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in.
*
* If the value is not specified, instances in the Auto Scaling group will be terminated
* when the group scales in.
*
* @default false
*/
readonly reuseOnScaleIn?: boolean;
/**
* The maximum number of instances that are allowed to be in the warm pool
* or in any state except Terminated for the Auto Scaling group.
*
* If the value is not specified, Amazon EC2 Auto Scaling launches and maintains
* the difference between the group's maximum capacity and its desired capacity.
*
* @default - max size of the Auto Scaling group
*/
readonly maxGroupPreparedCapacity?: number;
/**
* The minimum number of instances to maintain in the warm pool.
*
* @default 0
*/
readonly minSize?: number;
/**
* The instance state to transition to after the lifecycle actions are complete.
*
* @default PoolState.STOPPED
*/
readonly poolState?: PoolState;
}
/**
* Properties for a warm pool
*/
export interface WarmPoolProps extends WarmPoolOptions {
/**
* The Auto Scaling group to add the warm pool to.
*/
readonly autoScalingGroup: IAutoScalingGroupRef;
}
/**
* Define a warm pool
*/
export declare class WarmPool extends Resource {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
constructor(scope: Construct, id: string, props: WarmPoolProps);
}
/**
* The instance state in the warm pool
*/
export declare enum PoolState {
/**
* Hibernated
*
* To use this state, prerequisites must be in place.
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html
*/
HIBERNATED = "Hibernated",
/**
* Running
*/
RUNNING = "Running",
/**
* Stopped
*/
STOPPED = "Stopped"
}

View File

@@ -0,0 +1 @@
"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.PoolState=exports.WarmPool=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var autoscaling_generated_1=()=>{var tmp=require("./autoscaling.generated");return autoscaling_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},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp},prop_injectable_1=()=>{var tmp=require("../../core/lib/prop-injectable");return prop_injectable_1=()=>tmp,tmp};let WarmPool=(()=>{let _classDecorators=[prop_injectable_1().propertyInjectable],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=core_1().Resource;var WarmPool2=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),WarmPool2=_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_autoscaling.WarmPool",version:"2.252.0"};static PROPERTY_INJECTION_ID="aws-cdk-lib.aws-autoscaling.WarmPool";constructor(scope,id,props){super(scope,id,{physicalName:core_1().Lazy.string({produce:()=>core_1().Names.uniqueId(this)})});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_autoscaling_WarmPoolProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,WarmPool2),error}if((0,metadata_resource_1().addConstructMetadata)(this,props),props.maxGroupPreparedCapacity&&props.maxGroupPreparedCapacity<-1)throw new(core_1()).ValidationError((0,literal_string_1().lit)`MaxGroupPreparedCapacityParameter`,"'maxGroupPreparedCapacity' parameter should be greater than or equal to -1",this);if(props.minSize&&props.minSize<0)throw new(core_1()).ValidationError((0,literal_string_1().lit)`ShouldBeMinsizeParameterShould`,"'minSize' parameter should be greater than or equal to 0",this);new(autoscaling_generated_1()).CfnWarmPool(this,"Resource",{autoScalingGroupName:props.autoScalingGroup.autoScalingGroupRef.autoScalingGroupName,instanceReusePolicy:props.reuseOnScaleIn!==void 0?{reuseOnScaleIn:props.reuseOnScaleIn}:void 0,maxGroupPreparedCapacity:props.maxGroupPreparedCapacity,minSize:props.minSize,poolState:props.poolState})}static{__runInitializers(_classThis,_classExtraInitializers)}};return WarmPool2=_classThis})();exports.WarmPool=WarmPool;var PoolState;(function(PoolState2){PoolState2.HIBERNATED="Hibernated",PoolState2.RUNNING="Running",PoolState2.STOPPED="Stopped"})(PoolState||(exports.PoolState=PoolState={}));