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

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,76 @@
import { Construct } from 'constructs';
import type { IScalableTargetRef, ScalableTargetReference } from './applicationautoscaling.generated';
import type { ScalingSchedule, ServiceNamespace } from './scalable-target';
import type { BasicStepScalingPolicyProps } from './step-scaling-policy';
import type { BasicTargetTrackingScalingPolicyProps } from './target-tracking-scaling-policy';
import type * as iam from '../../aws-iam';
import type { ResourceEnvironment } from '../../interfaces';
/**
* Properties for a ScalableTableAttribute
*/
export interface BaseScalableAttributeProps extends EnableScalingProps {
/**
* Service namespace of the scalable attribute
*/
readonly serviceNamespace: ServiceNamespace;
/**
* Resource ID of the attribute
*/
readonly resourceId: string;
/**
* Scalable dimension of the attribute
*/
readonly dimension: string;
/**
* Role to use for scaling
*/
readonly role: iam.IRole;
}
/**
* Represent an attribute for which autoscaling can be configured
*
* This class is basically a light wrapper around ScalableTarget, but with
* all methods protected instead of public so they can be selectively
* exposed and/or more specific versions of them can be exposed by derived
* classes for individual services support autoscaling.
*
* Typical use cases:
*
* - Hide away the PredefinedMetric enum for target tracking policies.
* - Don't expose all scaling methods (for example Dynamo tables don't support
* Step Scaling, so the Dynamo subclass won't expose this method).
*/
export declare abstract class BaseScalableAttribute extends Construct implements IScalableTargetRef {
protected readonly props: BaseScalableAttributeProps;
private target;
constructor(scope: Construct, id: string, props: BaseScalableAttributeProps);
get env(): ResourceEnvironment;
get scalableTargetRef(): ScalableTargetReference;
/**
* Scale out or in based on time
*/
protected doScaleOnSchedule(id: string, props: ScalingSchedule): void;
/**
* Scale out or in based on a metric value
*/
protected doScaleOnMetric(id: string, props: BasicStepScalingPolicyProps): void;
/**
* Scale out or in in order to keep a metric around a target value
*/
protected doScaleToTrackMetric(id: string, props: BasicTargetTrackingScalingPolicyProps): void;
}
/**
* Properties for enabling Application Auto Scaling
*/
export interface EnableScalingProps {
/**
* Minimum capacity to scale to
*
* @default 1
*/
readonly minCapacity?: number;
/**
* Maximum capacity to scale to
*/
readonly maxCapacity: number;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BaseScalableAttribute=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},scalable_target_1=()=>{var tmp=require("./scalable-target");return scalable_target_1=()=>tmp,tmp};class BaseScalableAttribute extends constructs_1().Construct{props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_applicationautoscaling.BaseScalableAttribute",version:"2.252.0"};target;constructor(scope,id,props){super(scope,id),this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_applicationautoscaling_BaseScalableAttributeProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,BaseScalableAttribute),error}this.target=new(scalable_target_1()).ScalableTarget(this,"Target",{serviceNamespace:this.props.serviceNamespace,scalableDimension:this.props.dimension,resourceId:this.props.resourceId,role:this.props.role,minCapacity:props.minCapacity??1,maxCapacity:props.maxCapacity})}get env(){return this.target.env}get scalableTargetRef(){return this.target.scalableTargetRef}doScaleOnSchedule(id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_applicationautoscaling_ScalingSchedule(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.doScaleOnSchedule),error}this.target.scaleOnSchedule(id,props)}doScaleOnMetric(id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_applicationautoscaling_BasicStepScalingPolicyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.doScaleOnMetric),error}this.target.scaleOnMetric(id,props)}doScaleToTrackMetric(id,props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_applicationautoscaling_BasicTargetTrackingScalingPolicyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.doScaleToTrackMetric),error}this.target.scaleToTrackMetric(id,props)}}exports.BaseScalableAttribute=BaseScalableAttribute;

View File

@@ -0,0 +1,7 @@
export * from './applicationautoscaling.generated';
export * from './base-scalable-attribute';
export * from './schedule';
export * from './scalable-target';
export * from './step-scaling-policy';
export * from './step-scaling-action';
export * from './target-tracking-scaling-policy';

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.CfnScalableTarget=void 0,Object.defineProperty(exports,_noFold="CfnScalableTarget",{enumerable:!0,configurable:!0,get:()=>{var value=require("./applicationautoscaling.generated").CfnScalableTarget;return Object.defineProperty(exports,_noFold="CfnScalableTarget",{enumerable:!0,configurable:!0,value}),value}}),exports.CfnScalingPolicy=void 0,Object.defineProperty(exports,_noFold="CfnScalingPolicy",{enumerable:!0,configurable:!0,get:()=>{var value=require("./applicationautoscaling.generated").CfnScalingPolicy;return Object.defineProperty(exports,_noFold="CfnScalingPolicy",{enumerable:!0,configurable:!0,value}),value}}),exports.BaseScalableAttribute=void 0,Object.defineProperty(exports,_noFold="BaseScalableAttribute",{enumerable:!0,configurable:!0,get:()=>{var value=require("./base-scalable-attribute").BaseScalableAttribute;return Object.defineProperty(exports,_noFold="BaseScalableAttribute",{enumerable:!0,configurable:!0,value}),value}}),exports.Schedule=void 0,Object.defineProperty(exports,_noFold="Schedule",{enumerable:!0,configurable:!0,get:()=>{var value=require("./schedule").Schedule;return Object.defineProperty(exports,_noFold="Schedule",{enumerable:!0,configurable:!0,value}),value}}),exports.ScalableTarget=void 0,Object.defineProperty(exports,_noFold="ScalableTarget",{enumerable:!0,configurable:!0,get:()=>{var value=require("./scalable-target").ScalableTarget;return Object.defineProperty(exports,_noFold="ScalableTarget",{enumerable:!0,configurable:!0,value}),value}}),exports.ServiceNamespace=void 0,Object.defineProperty(exports,_noFold="ServiceNamespace",{enumerable:!0,configurable:!0,get:()=>{var value=require("./scalable-target").ServiceNamespace;return Object.defineProperty(exports,_noFold="ServiceNamespace",{enumerable:!0,configurable:!0,value}),value}}),exports.StepScalingPolicy=void 0,Object.defineProperty(exports,_noFold="StepScalingPolicy",{enumerable:!0,configurable:!0,get:()=>{var value=require("./step-scaling-policy").StepScalingPolicy;return Object.defineProperty(exports,_noFold="StepScalingPolicy",{enumerable:!0,configurable:!0,value}),value}}),exports.StepScalingAction=void 0,Object.defineProperty(exports,_noFold="StepScalingAction",{enumerable:!0,configurable:!0,get:()=>{var value=require("./step-scaling-action").StepScalingAction;return Object.defineProperty(exports,_noFold="StepScalingAction",{enumerable:!0,configurable:!0,value}),value}}),exports.AdjustmentType=void 0,Object.defineProperty(exports,_noFold="AdjustmentType",{enumerable:!0,configurable:!0,get:()=>{var value=require("./step-scaling-action").AdjustmentType;return Object.defineProperty(exports,_noFold="AdjustmentType",{enumerable:!0,configurable:!0,value}),value}}),exports.MetricAggregationType=void 0,Object.defineProperty(exports,_noFold="MetricAggregationType",{enumerable:!0,configurable:!0,get:()=>{var value=require("./step-scaling-action").MetricAggregationType;return Object.defineProperty(exports,_noFold="MetricAggregationType",{enumerable:!0,configurable:!0,value}),value}}),exports.TargetTrackingScalingPolicy=void 0,Object.defineProperty(exports,_noFold="TargetTrackingScalingPolicy",{enumerable:!0,configurable:!0,get:()=>{var value=require("./target-tracking-scaling-policy").TargetTrackingScalingPolicy;return Object.defineProperty(exports,_noFold="TargetTrackingScalingPolicy",{enumerable:!0,configurable:!0,value}),value}}),exports.PredefinedMetric=void 0,Object.defineProperty(exports,_noFold="PredefinedMetric",{enumerable:!0,configurable:!0,get:()=>{var value=require("./target-tracking-scaling-policy").PredefinedMetric;return Object.defineProperty(exports,_noFold="PredefinedMetric",{enumerable:!0,configurable:!0,value}),value}});

View File

@@ -0,0 +1,248 @@
import type { Construct } from 'constructs';
import type { Schedule } from './schedule';
import type { BasicStepScalingPolicyProps } from './step-scaling-policy';
import { StepScalingPolicy } from './step-scaling-policy';
import type { BasicTargetTrackingScalingPolicyProps } from './target-tracking-scaling-policy';
import { TargetTrackingScalingPolicy } from './target-tracking-scaling-policy';
import * as iam from '../../aws-iam';
import type { IResource, TimeZone } from '../../core';
import { Resource } from '../../core';
import type { IScalableTargetRef, ScalableTargetReference } from '../../interfaces/generated/aws-applicationautoscaling-interfaces.generated';
export interface IScalableTarget extends IResource, IScalableTargetRef {
/**
* @attribute
*/
readonly scalableTargetId: string;
}
/**
* Properties for a scalable target
*/
export interface ScalableTargetProps {
/**
* The minimum value that Application Auto Scaling can use to scale a target during a scaling activity.
*/
readonly minCapacity: number;
/**
* The maximum value that Application Auto Scaling can use to scale a target during a scaling activity.
*/
readonly maxCapacity: number;
/**
* Role that allows Application Auto Scaling to modify your scalable target.
*
* @default A role is automatically created
*/
readonly role?: iam.IRole;
/**
* The resource identifier to associate with this scalable target.
*
* This string consists of the resource type and unique identifier.
*
* Example value: `service/ecsStack-MyECSCluster-AB12CDE3F4GH/ecsStack-MyECSService-AB12CDE3F4GH`
*
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html
*/
readonly resourceId: string;
/**
* The scalable dimension that's associated with the scalable target.
*
* Specify the service namespace, resource type, and scaling property.
*
* Example value: `ecs:service:DesiredCount`
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_ScalingPolicy.html
*/
readonly scalableDimension: string;
/**
* The namespace of the AWS service that provides the resource or
* custom-resource for a resource provided by your own application or
* service.
*
* For valid AWS service namespace values, see the RegisterScalableTarget
* action in the Application Auto Scaling API Reference.
*
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html
*/
readonly serviceNamespace: ServiceNamespace;
}
/**
* Attributes for importing a scalable target
*/
export interface ScalableTargetAttributes {
/**
* The scalable target ID
*/
readonly scalableTargetId: string;
/**
* The scalable dimension that's associated with the scalable target.
*/
readonly scalableDimension: string;
/**
* The namespace of the AWS service that provides the resource.
*/
readonly serviceNamespace: string;
}
/**
* Define a scalable target
*/
export declare class ScalableTarget extends Resource implements IScalableTarget {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Create a referenceable `IScalableTarget` object based on properties of a resource that already exists in your account
*/
static fromScalableTargetId(scope: Construct, id: string, scalableTargetId: string): IScalableTarget;
/**
* Create a referenceable `IScalableTarget` object based on properties of a resource that already exists in your account
*/
static fromScalableTargetAttributes(scope: Construct, id: string, attrs: ScalableTargetAttributes): IScalableTarget;
/**
* ID of the Scalable Target
*
* Example value: `service/ecsStack-MyECSCluster-AB12CDE3F4GH/ecsStack-MyECSService-AB12CDE3F4GH|ecs:service:DesiredCount|ecs`
*
* @attribute
*/
readonly scalableTargetId: string;
/**
* A reference to a ScalableTarget resource.
*/
get scalableTargetRef(): ScalableTargetReference;
/**
* The role used to give AutoScaling permissions to your resource
*/
readonly role: iam.IRole;
private readonly _scalableDimension;
private readonly _serviceNamespace;
private readonly actions;
constructor(scope: Construct, id: string, props: ScalableTargetProps);
/**
* Add a policy statement to the role's policy
*/
addToRolePolicy(statement: iam.PolicyStatement): void;
/**
* Scale out or in based on time
*/
scaleOnSchedule(id: string, action: ScalingSchedule): void;
/**
* Scale out or in, in response to a metric
*/
scaleOnMetric(id: string, props: BasicStepScalingPolicyProps): StepScalingPolicy;
/**
* Scale out or in in order to keep a metric around a target value
*/
scaleToTrackMetric(id: string, props: BasicTargetTrackingScalingPolicyProps): TargetTrackingScalingPolicy;
}
/**
* A scheduled scaling action
*/
export interface ScalingSchedule {
/**
* When to perform this action.
*/
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.
*
* During the scheduled time, if the current capacity is below the minimum
* capacity, Application Auto Scaling scales out to the minimum capacity.
*
* At least one of maxCapacity and minCapacity must be supplied.
*
* @default No new minimum capacity
*/
readonly minCapacity?: number;
/**
* The new maximum capacity.
*
* During the scheduled time, the current capacity is above the maximum
* capacity, Application Auto Scaling scales in to the maximum capacity.
*
* At least one of maxCapacity and minCapacity must be supplied.
*
* @default No new maximum capacity
*/
readonly maxCapacity?: number;
/**
* The time zone used when referring to the date and time of a scheduled action,
* when the scheduled action uses an at or cron expression.
*
* @default - UTC
*/
readonly timeZone?: TimeZone;
}
/**
* The service that supports Application AutoScaling
*/
export declare enum ServiceNamespace {
/**
* Elastic Container Service
*/
ECS = "ecs",
/**
* Elastic Map Reduce
*/
ELASTIC_MAP_REDUCE = "elasticmapreduce",
/**
* Elastic Compute Cloud
*/
EC2 = "ec2",
/**
* App Stream
*/
APPSTREAM = "appstream",
/**
* Dynamo DB
*/
DYNAMODB = "dynamodb",
/**
* Relational Database Service
*/
RDS = "rds",
/**
* SageMaker
*/
SAGEMAKER = "sagemaker",
/**
* Custom Resource
*/
CUSTOM_RESOURCE = "custom-resource",
/**
* Lambda
*/
LAMBDA = "lambda",
/**
* Comprehend
*/
COMPREHEND = "comprehend",
/**
* Kafka
*/
KAFKA = "kafka",
/**
* ElastiCache
*/
ELASTICACHE = "elasticache",
/**
* Neptune
*/
NEPTUNE = "neptune",
/**
* Cassandra
*/
CASSANDRA = "cassandra",
/**
* Workspaces
*/
WORKSPACES = "workspaces"
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,81 @@
import type { Construct } from 'constructs';
import type { Duration } from '../../core';
/**
* 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 Application AutoScaling will recognize
*/
static expression(expression: string): Schedule;
/**
* Construct a schedule from an interval and a time unit
*/
static rate(duration: Duration): Schedule;
/**
* Construct a Schedule from a moment in time
*/
static at(moment: Date): 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 https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions
*/
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 year to run this rule at
*
* @default - Every year
*/
readonly year?: 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},errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_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_applicationautoscaling.Schedule",version:"2.252.0"};static expression(expression){return new LiteralSchedule(expression)}static rate(duration){try{jsiiDeprecationWarnings().aws_cdk_lib_Duration(duration)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.rate),error}if(duration.isUnresolved()){if(!["minute","minutes","hour","hours","day","days"].includes(duration.unitLabel()))throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`AllowedUnitsSchedulingAre`,"Allowed units for scheduling are: 'minute', 'minutes', 'hour', 'hours', 'day' or 'days'");return new LiteralSchedule(`rate(${duration.formatTokenToNumber()})`)}if(duration.toSeconds()===0)throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`DurationCannot`,"Duration cannot be 0");let rate=maybeRate(duration.toDays({integral:!1}),"day");return rate===void 0&&(rate=maybeRate(duration.toHours({integral:!1}),"hour")),rate===void 0&&(rate=makeRate(duration.toMinutes({integral:!0}),"minute")),new LiteralSchedule(rate)}static at(moment){return new LiteralSchedule(`at(${formatISO(moment)})`)}static cron(options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_applicationautoscaling_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(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`CannotSupplyDayWeekDay`,"Cannot supply both 'day' and 'weekDay', use at most one");const minute=fallback(options.minute,"*"),hour=fallback(options.hour,"*"),month=fallback(options.month,"*"),year=fallback(options.year,"*"),day=fallback(options.day,options.weekDay!==void 0?"?":"*"),weekDay=fallback(options.weekDay,"?");return new class extends Schedule{expressionString=`cron(${minute} ${hour} ${day} ${month} ${weekDay} ${year})`;_bind(scope){return options.minute||core_1().Annotations.of(scope).addWarningV2("@aws-cdk/aws-applicationautoscaling:defaultRunEveryMinute","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}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());function pad(num){return num<10?"0"+num:num}}function maybeRate(interval,singular){if(!(interval===0||!Number.isInteger(interval)))return makeRate(interval,singular)}function makeRate(interval,singular){return interval===1?`rate(1 ${singular})`:`rate(${interval} ${singular}s)`}

View File

@@ -0,0 +1,145 @@
import { Construct } from 'constructs';
import * as cdk from '../../core';
import type { IScalableTargetRef } from '../../interfaces/generated/aws-applicationautoscaling-interfaces.generated';
/**
* Properties for a scaling policy
*/
export interface StepScalingActionProps {
/**
* The scalable target
*/
readonly scalingTarget: IScalableTargetRef;
/**
* A name for the scaling policy
*
* @default Automatically generated name
*/
readonly policyName?: string;
/**
* How the adjustment numbers are interpreted
*
* @default ChangeInCapacity
*/
readonly adjustmentType?: AdjustmentType;
/**
* Grace period after scaling activity.
*
* For scale out policies, multiple scale outs during the cooldown period are
* squashed so that only the biggest scale out happens.
*
* For scale in policies, subsequent scale ins during the cooldown period are
* ignored.
*
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html
* @default No cooldown period
*/
readonly cooldown?: cdk.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;
/**
* 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,132 @@
import { Construct } from 'constructs';
import { AdjustmentType, MetricAggregationType, StepScalingAction } from './step-scaling-action';
import * as cloudwatch from '../../aws-cloudwatch';
import * as cdk from '../../core';
import type { IScalableTargetRef } from '../../interfaces/generated/aws-applicationautoscaling-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.
*
* Subsequent scale outs during the cooldown period are squashed so that only
* the biggest scale out happens.
*
* Subsequent scale ins during the cooldown period are ignored.
*
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_StepScalingPolicyConfiguration.html
* @default No cooldown period
*/
readonly cooldown?: cdk.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`.
*
* @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 scaling target
*/
readonly scalingTarget: IScalableTargetRef;
}
/**
* Define a scaling 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 or equal 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,255 @@
import { Construct } from 'constructs';
import type * as cloudwatch from '../../aws-cloudwatch';
import * as cdk from '../../core';
import type { IScalableTargetRef } from '../../interfaces/generated/aws-applicationautoscaling-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
* in other services.
*/
export interface BaseTargetTrackingProps {
/**
* A name for the scaling policy
*
* @default - Automatically generated name.
*/
readonly policyName?: string;
/**
* 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 scalable resource. Otherwise, scale in is
* enabled and the target tracking policy can remove capacity from the
* scalable resource.
*
* @default false
*/
readonly disableScaleIn?: boolean;
/**
* Period after a scale in activity completes before another scale in activity can start.
*
* @default Duration.seconds(300) for the following scalable targets: ECS services,
* Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters,
* Amazon SageMaker endpoint variants, Custom resources. For all other scalable
* targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB
* global secondary indexes, Amazon Comprehend document classification endpoints,
* Lambda provisioned concurrency
*/
readonly scaleInCooldown?: cdk.Duration;
/**
* Period after a scale out activity completes before another scale out activity can start.
*
* @default Duration.seconds(300) for the following scalable targets: ECS services,
* Spot Fleet requests, EMR clusters, AppStream 2.0 fleets, Aurora DB clusters,
* Amazon SageMaker endpoint variants, Custom resources. For all other scalable
* targets, the default value is Duration.seconds(0): DynamoDB tables, DynamoDB
* global secondary indexes, Amazon Comprehend document classification endpoints,
* Lambda provisioned concurrency
*/
readonly scaleOutCooldown?: cdk.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 metrics.
*/
readonly predefinedMetric?: PredefinedMetric;
/**
* Identify the resource associated with the metric type.
*
* Only used for predefined metric ALBRequestCountPerTarget.
*
* Example value: `app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>`
*
* @default - No resource label.
*/
readonly resourceLabel?: string;
/**
* 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;
}
/**
* Properties for a concrete TargetTrackingPolicy
*
* Adds the scalingTarget.
*/
export interface TargetTrackingScalingPolicyProps extends BasicTargetTrackingScalingPolicyProps {
readonly scalingTarget: IScalableTargetRef;
}
export declare class TargetTrackingScalingPolicy extends Construct {
/**
* ARN of the scaling policy
*/
readonly scalingPolicyArn: string;
constructor(scope: Construct, id: string, props: TargetTrackingScalingPolicyProps);
}
/**
* One of the predefined autoscaling metrics
*/
export declare enum PredefinedMetric {
/**
* Average percentage of instances in an AppStream fleet that are being used.
*/
APPSTREAM_AVERAGE_CAPACITY_UTILIZATION = "AppStreamAverageCapacityUtilization",
/**
* Percentage of provisioned read capacity units utilized by a Keyspaces table.
*/
CASSANDRA_READ_CAPACITY_UTILIZATION = "CassandraReadCapacityUtilization",
/**
* Percentage of provisioned write capacity units utilized by a Keyspaces table.
*/
CASSANDRA_WRITE_CAPACITY_UTILIZATION = "CassandraWriteCapacityUtilization",
/**
* Percentage of provisioned inference units utilized by a Comprehend endpoint.
*/
COMPREHEND_INFERENCE_UTILIZATION = "ComprehendInferenceUtilization",
/**
* Average CPU Utilization of read replica instances in a Neptune DB cluster.
*/
NEPTURE_READER_AVERAGE_CPU_UTILIZATION = "NeptuneReaderAverageCPUUtilization",
/**
* Percentage of provisioned read capacity units consumed by a DynamoDB table.
*/
DYNAMODB_READ_CAPACITY_UTILIZATION = "DynamoDBReadCapacityUtilization",
/**
* Percentage of provisioned write capacity units consumed by a DynamoDB table.
*
* Suffix `dummy` is necessary due to jsii bug (https://github.com/aws/jsii/issues/2782).
* Duplicate values will be dropped, so this suffix is added as a workaround.
* The value will be replaced when this enum is used.
*
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
DYNAMODB_WRITE_CAPACITY_UTILIZATION = "DynamoDBWriteCapacityUtilization-dummy",
/**
* DYANMODB_WRITE_CAPACITY_UTILIZATION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
* @deprecated use `PredefinedMetric.DYNAMODB_WRITE_CAPACITY_UTILIZATION`
*/
DYANMODB_WRITE_CAPACITY_UTILIZATION = "DynamoDBWriteCapacityUtilization",
/**
* ALB_REQUEST_COUNT_PER_TARGET
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
ALB_REQUEST_COUNT_PER_TARGET = "ALBRequestCountPerTarget",
/**
* RDS_READER_AVERAGE_CPU_UTILIZATION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
RDS_READER_AVERAGE_CPU_UTILIZATION = "RDSReaderAverageCPUUtilization",
/**
* RDS_READER_AVERAGE_DATABASE_CONNECTIONS
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
RDS_READER_AVERAGE_DATABASE_CONNECTIONS = "RDSReaderAverageDatabaseConnections",
/**
* EC2_SPOT_FLEET_REQUEST_AVERAGE_CPU_UTILIZATION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
EC2_SPOT_FLEET_REQUEST_AVERAGE_CPU_UTILIZATION = "EC2SpotFleetRequestAverageCPUUtilization",
/**
* EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_IN
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_IN = "EC2SpotFleetRequestAverageNetworkIn",
/**
* EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_OUT
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
EC2_SPOT_FLEET_REQUEST_AVERAGE_NETWORK_OUT = "EC2SpotFleetRequestAverageNetworkOut",
/**
* SAGEMAKER_VARIANT_INVOCATIONS_PER_INSTANCE
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
SAGEMAKER_VARIANT_INVOCATIONS_PER_INSTANCE = "SageMakerVariantInvocationsPerInstance",
/**
* SAGEMAKER_VARIANT_PROVISIONED_CONCURRENCY_UTILIZATION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
SAGEMAKER_VARIANT_PROVISIONED_CONCURRENCY_UTILIZATION = "SageMakerVariantProvisionedConcurrencyUtilization",
/**
* SAGEMAKER_INFERENCE_COMPONENT_INVOCATIONS_PER_COPY
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
SAGEMAKER_INFERENCE_COMPONENT_INVOCATIONS_PER_COPY = "SageMakerInferenceComponentInvocationsPerCopy",
/**
* ECS_SERVICE_AVERAGE_CPU_UTILIZATION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
ECS_SERVICE_AVERAGE_CPU_UTILIZATION = "ECSServiceAverageCPUUtilization",
/**
* ECS_SERVICE_AVERAGE_MEMORY_UTILIZATION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
ECS_SERVICE_AVERAGE_MEMORY_UTILIZATION = "ECSServiceAverageMemoryUtilization",
/**
* LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION
* @see https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html#monitoring-metrics-concurrency
*/
LAMBDA_PROVISIONED_CONCURRENCY_UTILIZATION = "LambdaProvisionedConcurrencyUtilization",
/**
* KAFKA_BROKER_STORAGE_UTILIZATION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
KAFKA_BROKER_STORAGE_UTILIZATION = "KafkaBrokerStorageUtilization",
/**
* ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
ELASTICACHE_PRIMARY_ENGINE_CPU_UTILIZATION = "ElastiCachePrimaryEngineCPUUtilization",
/**
* ELASTICACHE_REPLICA_ENGINE_CPU_UTILIZATION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
ELASTICACHE_REPLICA_ENGINE_CPU_UTILIZATION = "ElastiCacheReplicaEngineCPUUtilization",
/**
* ELASTICACHE_DATABASE_MEMORY_USAGE_COUNTED_FOR_EVICT_PERCENTAGE
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
ELASTICACHE_DATABASE_MEMORY_USAGE_COUNTED_FOR_EVICT_PERCENTAGE = "ElastiCacheDatabaseMemoryUsageCountedForEvictPercentage",
/**
* ELASTICACHE_DATABASE_CAPACITY_USAGE_COUNTED_FOR_EVICT_PERCENTAGE
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
ELASTICACHE_DATABASE_CAPACITY_USAGE_COUNTED_FOR_EVICT_PERCENTAGE = "ElastiCacheDatabaseCapacityUsageCountedForEvictPercentage",
/**
* SAGEMAKER_INFERENCE_COMPONENT_CONCURRENT_REQUESTS_PER_COPY_HIGH_RESOLUTION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
SAGEMAKER_INFERENCE_COMPONENT_CONCURRENT_REQUESTS_PER_COPY_HIGH_RESOLUTION = "SageMakerInferenceComponentConcurrentRequestsPerCopyHighResolution",
/**
* SAGEMAKER_VARIANT_CONCURRENT_REQUESTS_PER_MODEL_HIGH_RESOLUTION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
SAGEMAKER_VARIANT_CONCURRENT_REQUESTS_PER_MODEL_HIGH_RESOLUTION = "SageMakerVariantConcurrentRequestsPerModelHighResolution",
/**
* WORKSPACES_AVERAGE_USER_SESSIONS_CAPACITY_UTILIZATION
* @see https://docs.aws.amazon.com/autoscaling/application/APIReference/API_PredefinedMetricSpecification.html
*/
WORKSPACES_AVERAGE_USER_SESSIONS_CAPACITY_UTILIZATION = "WorkSpacesAverageUserSessionsCapacityUtilization"
}

File diff suppressed because one or more lines are too long