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,13 @@
{
"targets": {
"java": {
"package": "software.amazon.awscdk.services.codedeploy"
},
"dotnet": {
"namespace": "Amazon.CDK.AWS.CodeDeploy"
},
"python": {
"module": "aws_cdk.aws_codedeploy"
}
}
}

784
cdk/node_modules/aws-cdk-lib/aws-codedeploy/README.md generated vendored Normal file
View File

@@ -0,0 +1,784 @@
# AWS CodeDeploy Construct Library
## Table of Contents
- [Introduction](#introduction)
- Deploying to Amazon EC2 and on-premise instances
- [EC2/on-premise Applications](#ec2on-premise-applications)
- [EC2/on-premise Deployment Groups](#ec2on-premise-deployment-groups)
- [EC2/on-premise Deployment Configurations](#ec2on-premise-deployment-configurations)
- Deploying to AWS Lambda functions
- [Lambda Applications](#lambda-applications)
- [Lambda Deployment Groups](#lambda-deployment-groups)
- [Lambda Deployment Configurations](#lambda-deployment-configurations)
- Deploying to Amazon ECS services
- [ECS Applications](#ecs-applications)
- [ECS Deployment Groups](#ecs-deployment-groups)
- [ECS Deployment Configurations](#ecs-deployment-configurations)
- [ECS Deployments](#ecs-deployments)
## Introduction
AWS CodeDeploy is a deployment service that automates application deployments to
Amazon EC2 instances, on-premises instances, serverless Lambda functions, or
Amazon ECS services.
The CDK currently supports Amazon EC2, on-premise, AWS Lambda, and Amazon ECS applications.
## EC2/on-premise Applications
To create a new CodeDeploy Application that deploys to EC2/on-premise instances:
```ts
const application = new codedeploy.ServerApplication(this, 'CodeDeployApplication', {
applicationName: 'MyApplication', // optional property
});
```
To import an already existing Application:
```ts
const application = codedeploy.ServerApplication.fromServerApplicationName(
this,
'ExistingCodeDeployApplication',
'MyExistingApplication',
);
```
## EC2/on-premise Deployment Groups
To create a new CodeDeploy Deployment Group that deploys to EC2/on-premise instances:
```ts
import * as autoscaling from 'aws-cdk-lib/aws-autoscaling';
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
declare const application: codedeploy.ServerApplication;
declare const asg: autoscaling.AutoScalingGroup;
declare const alarm: cloudwatch.Alarm;
const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'CodeDeployDeploymentGroup', {
application,
deploymentGroupName: 'MyDeploymentGroup',
autoScalingGroups: [asg],
// adds User Data that installs the CodeDeploy agent on your auto-scaling groups hosts
// default: true
installAgent: true,
// adds EC2 instances matching tags
ec2InstanceTags: new codedeploy.InstanceTagSet(
{
// any instance with tags satisfying
// key1=v1 or key1=v2 or key2 (any value) or value v3 (any key)
// will match this group
'key1': ['v1', 'v2'],
'key2': [],
'': ['v3'],
},
),
// adds on-premise instances matching tags
onPremiseInstanceTags: new codedeploy.InstanceTagSet(
// only instances with tags (key1=v1 or key1=v2) AND key2=v3 will match this set
{
'key1': ['v1', 'v2'],
},
{
'key2': ['v3'],
},
),
// CloudWatch alarms
alarms: [alarm],
// whether to ignore failure to fetch the status of alarms from CloudWatch
// default: false
ignorePollAlarmsFailure: false,
// whether to skip the step of checking CloudWatch alarms during the deployment process
// default: false
ignoreAlarmConfiguration: false,
// auto-rollback configuration
autoRollback: {
failedDeployment: true, // default: true
stoppedDeployment: true, // default: false
deploymentInAlarm: true, // default: true if you provided any alarms, false otherwise
},
// whether the deployment group was configured to have CodeDeploy install a termination hook into an Auto Scaling group
// default: false
terminationHook: true,
});
```
All properties are optional - if you don't provide an Application,
one will be automatically created.
To import an already existing Deployment Group:
```ts
declare const application: codedeploy.ServerApplication;
const deploymentGroup = codedeploy.ServerDeploymentGroup.fromServerDeploymentGroupAttributes(
this,
'ExistingCodeDeployDeploymentGroup', {
application,
deploymentGroupName: 'MyExistingDeploymentGroup',
},
);
```
### Load balancers
You can [specify a load balancer](https://docs.aws.amazon.com/codedeploy/latest/userguide/integrations-aws-elastic-load-balancing.html)
with the `loadBalancer` property when creating a Deployment Group.
`LoadBalancer` is an abstract class with static factory methods that allow you to create instances of it from various sources.
With Classic Elastic Load Balancer, you provide it directly:
```ts
import * as elb from 'aws-cdk-lib/aws-elasticloadbalancing';
declare const lb: elb.LoadBalancer;
lb.addListener({
externalPort: 80,
});
const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'DeploymentGroup', {
loadBalancer: codedeploy.LoadBalancer.classic(lb),
});
```
With Application Load Balancer or Network Load Balancer,
you provide a Target Group as the load balancer:
```ts
declare const alb: elbv2.ApplicationLoadBalancer;
const listener = alb.addListener('Listener', { port: 80 });
const targetGroup = listener.addTargets('Fleet', { port: 80 });
const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'DeploymentGroup', {
loadBalancer: codedeploy.LoadBalancer.application(targetGroup),
});
```
The `loadBalancer` property has been deprecated. To provide multiple Elastic Load Balancers as target groups use the `loadBalancers` parameter:
```ts
import * as elb from 'aws-cdk-lib/aws-elasticloadbalancing';
import * as elb2 from 'aws-cdk-lib/aws-elasticloadbalancingv2';
declare const clb: elb.LoadBalancer;
declare const alb: elb2.ApplicationLoadBalancer;
declare const nlb: elb2.NetworkLoadBalancer;
const albListener = alb.addListener('ALBListener', { port: 80 });
const albTargetGroup = albListener.addTargets('ALBFleet', { port: 80 });
const nlbListener = nlb.addListener('NLBListener', { port: 80 });
const nlbTargetGroup = nlbListener.addTargets('NLBFleet', { port: 80 });
const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'DeploymentGroup', {
loadBalancers: [
codedeploy.LoadBalancer.classic(clb),
codedeploy.LoadBalancer.application(albTargetGroup),
codedeploy.LoadBalancer.network(nlbTargetGroup),
]
});
```
## EC2/on-premise Deployment Configurations
You can also pass a Deployment Configuration when creating the Deployment Group:
```ts
const deploymentGroup = new codedeploy.ServerDeploymentGroup(this, 'CodeDeployDeploymentGroup', {
deploymentConfig: codedeploy.ServerDeploymentConfig.ALL_AT_ONCE,
});
```
The default Deployment Configuration is `ServerDeploymentConfig.ONE_AT_A_TIME`.
You can also create a custom Deployment Configuration:
```ts
const deploymentConfig = new codedeploy.ServerDeploymentConfig(this, 'DeploymentConfiguration', {
deploymentConfigName: 'MyDeploymentConfiguration', // optional property
// one of these is required, but both cannot be specified at the same time
minimumHealthyHosts: codedeploy.MinimumHealthyHosts.count(2),
// minimumHealthyHosts: codedeploy.MinimumHealthyHosts.percentage(75),
});
```
Or import an existing one:
```ts
const deploymentConfig = codedeploy.ServerDeploymentConfig.fromServerDeploymentConfigName(
this,
'ExistingDeploymentConfiguration',
'MyExistingDeploymentConfiguration',
);
```
### Zonal Configuration
CodeDeploy can deploy your application to one Availability Zone at a time, within an AWS Region by configuring [zonal configuration](https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations-create.html#zonal-config).
To create a new deployment configuration with zonal configuration:
```ts
const deploymentConfig = new codedeploy.ServerDeploymentConfig(this, 'DeploymentConfiguration', {
minimumHealthyHosts: codedeploy.MinimumHealthyHosts.count(2),
zonalConfig: {
monitorDuration: Duration.minutes(30),
firstZoneMonitorDuration: Duration.minutes(60),
minimumHealthyHostsPerZone: codedeploy.MinimumHealthyHostsPerZone.count(1),
},
});
```
**Note**: Zonal configuration is only configurable for EC2/on-premise deployments.
## Lambda Applications
To create a new CodeDeploy Application that deploys to a Lambda function:
```ts
const application = new codedeploy.LambdaApplication(this, 'CodeDeployApplication', {
applicationName: 'MyApplication', // optional property
});
```
To import an already existing Application:
```ts
const application = codedeploy.LambdaApplication.fromLambdaApplicationName(
this,
'ExistingCodeDeployApplication',
'MyExistingApplication',
);
```
## Lambda Deployment Groups
To enable traffic shifting deployments for Lambda functions, CodeDeploy uses Lambda Aliases, which can balance incoming traffic between two different versions of your function.
Before deployment, the alias sends 100% of invokes to the version used in production.
When you publish a new version of the function to your stack, CodeDeploy will send a small percentage of traffic to the new version, monitor, and validate before shifting 100% of traffic to the new version.
To create a new CodeDeploy Deployment Group that deploys to a Lambda function:
```ts
declare const myApplication: codedeploy.LambdaApplication;
declare const func: lambda.Function;
const version = func.currentVersion;
const version1Alias = new lambda.Alias(this, 'alias', {
aliasName: 'prod',
version,
});
const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', {
application: myApplication, // optional property: one will be created for you if not provided
alias: version1Alias,
deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE,
});
```
In order to deploy a new version of this function:
1. Reference the version with the latest changes `const version = func.currentVersion`.
2. Re-deploy the stack (this will trigger a deployment).
3. Monitor the CodeDeploy deployment as traffic shifts between the versions.
### Lambda Deployment Rollbacks and Alarms
CodeDeploy will roll back if the deployment fails. You can optionally trigger a rollback when one or more alarms are in a failed state:
```ts
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
declare const alias: lambda.Alias;
const alarm = new cloudwatch.Alarm(this, 'Errors', {
comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD,
threshold: 1,
evaluationPeriods: 1,
metric: alias.metricErrors(),
});
const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', {
alias,
deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE,
alarms: [
// pass some alarms when constructing the deployment group
alarm,
],
});
// or add alarms to an existing group
declare const blueGreenAlias: lambda.Alias;
deploymentGroup.addAlarm(new cloudwatch.Alarm(this, 'BlueGreenErrors', {
comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD,
threshold: 1,
evaluationPeriods: 1,
metric: blueGreenAlias.metricErrors(),
}));
```
### Pre and Post Hooks
CodeDeploy allows you to run an arbitrary Lambda function before traffic shifting actually starts (PreTraffic Hook) and after it completes (PostTraffic Hook).
With either hook, you have the opportunity to run logic that determines whether the deployment must succeed or fail.
For example, with PreTraffic hook you could run integration tests against the newly created Lambda version (but not serving traffic). With PostTraffic hook, you could run end-to-end validation checks.
```ts
declare const warmUpUserCache: lambda.Function;
declare const endToEndValidation: lambda.Function;
declare const alias: lambda.Alias;
// pass a hook whe creating the deployment group
const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', {
alias: alias,
deploymentConfig: codedeploy.LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE,
preHook: warmUpUserCache,
});
// or configure one on an existing deployment group
deploymentGroup.addPostHook(endToEndValidation);
```
### Import an existing Lambda Deployment Group
To import an already existing Deployment Group:
```ts
declare const application: codedeploy.LambdaApplication;
const deploymentGroup = codedeploy.LambdaDeploymentGroup.fromLambdaDeploymentGroupAttributes(this, 'ExistingCodeDeployDeploymentGroup', {
application,
deploymentGroupName: 'MyExistingDeploymentGroup',
});
```
## Lambda Deployment Configurations
CodeDeploy for Lambda comes with predefined configurations for traffic shifting.
The predefined configurations are available as LambdaDeploymentConfig constants.
```ts
const config = codedeploy.LambdaDeploymentConfig.CANARY_10PERCENT_30MINUTES;
declare const application: codedeploy.LambdaApplication;
declare const alias: lambda.Alias;
const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', {
application,
alias,
deploymentConfig: config,
});
```
If you want to specify your own strategy,
you can do so with the LambdaDeploymentConfig construct,
letting you specify precisely how fast a new function version is deployed.
```ts
const config = new codedeploy.LambdaDeploymentConfig(this, 'CustomConfig', {
trafficRouting: new codedeploy.TimeBasedCanaryTrafficRouting({
interval: Duration.minutes(15),
percentage: 5,
}),
});
declare const application: codedeploy.LambdaApplication;
declare const alias: lambda.Alias;
const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', {
application,
alias,
deploymentConfig: config,
});
```
You can specify a custom name for your deployment config, but if you do you will not be able to update the interval/percentage through CDK.
```ts
const config = new codedeploy.LambdaDeploymentConfig(this, 'CustomConfig', {
trafficRouting: new codedeploy.TimeBasedCanaryTrafficRouting({
interval: Duration.minutes(15),
percentage: 5,
}),
deploymentConfigName: 'MyDeploymentConfig',
});
```
To import an already existing Deployment Config:
```ts
const deploymentConfig = codedeploy.LambdaDeploymentConfig.fromLambdaDeploymentConfigName(
this,
'ExistingDeploymentConfiguration',
'MyExistingDeploymentConfiguration',
);
```
## ECS Applications
To create a new CodeDeploy Application that deploys an ECS service:
```ts
const application = new codedeploy.EcsApplication(this, 'CodeDeployApplication', {
applicationName: 'MyApplication', // optional property
});
```
To import an already existing Application:
```ts
const application = codedeploy.EcsApplication.fromEcsApplicationName(
this,
'ExistingCodeDeployApplication',
'MyExistingApplication',
);
```
## ECS Deployment Groups
CodeDeploy can be used to deploy to load-balanced ECS services.
CodeDeploy performs ECS blue-green deployments by managing ECS task sets and load balancer
target groups. During a blue-green deployment, one task set and target group runs the
original version of your ECS task definition ('blue') and another task set and target group
runs the new version of your ECS task definition ('green').
CodeDeploy orchestrates traffic shifting during ECS blue-green deployments by using
a load balancer listener to balance incoming traffic between the 'blue' and 'green' task sets/target groups
running two different versions of your ECS task definition.
Before deployment, the load balancer listener sends 100% of requests to the 'blue' target group.
When you publish a new version of the task definition and start a CodeDeploy deployment,
CodeDeploy can send a small percentage of traffic to the new 'green' task set behind the 'green' target group,
monitor, and validate before shifting 100% of traffic to the new version.
To create a new CodeDeploy Deployment Group that deploys to an ECS service:
```ts
declare const myApplication: codedeploy.EcsApplication;
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.FargateTaskDefinition;
declare const blueTargetGroup: elbv2.ITargetGroup;
declare const greenTargetGroup: elbv2.ITargetGroup;
declare const listener: elbv2.IApplicationListener;
const service = new ecs.FargateService(this, 'Service', {
cluster,
taskDefinition,
deploymentController: {
type: ecs.DeploymentControllerType.CODE_DEPLOY,
},
});
new codedeploy.EcsDeploymentGroup(this, 'BlueGreenDG', {
service,
blueGreenDeploymentConfig: {
blueTargetGroup,
greenTargetGroup,
listener,
},
deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES,
});
```
In order to deploy a new task definition version to the ECS service,
deploy the changes directly through CodeDeploy using the CodeDeploy APIs or console.
When the `CODE_DEPLOY` deployment controller is used, the ECS service cannot be
deployed with a new task definition version through CloudFormation.
For more information on the behavior of CodeDeploy blue-green deployments for ECS, see
[What happens during an Amazon ECS deployment](https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-steps-ecs.html#deployment-steps-what-happens)
in the CodeDeploy user guide.
Note: If you wish to deploy updates to your ECS service through CDK and CloudFormation instead of directly through CodeDeploy,
using the [`CfnCodeDeployBlueGreenHook`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnCodeDeployBlueGreenHook.html)
construct is the recommended approach instead of using the `EcsDeploymentGroup` construct. For a comparison
of ECS blue-green deployments through CodeDeploy (using `EcsDeploymentGroup`) and through CloudFormation (using `CfnCodeDeployBlueGreenHook`),
see [Create an Amazon ECS blue/green deployment through AWS CloudFormation](https://docs.aws.amazon.com/codedeploy/latest/userguide/deployments-create-ecs-cfn.html#differences-ecs-bg-cfn)
in the CloudFormation user guide.
### ECS Deployment Rollbacks and Alarms
CodeDeploy will automatically roll back if a deployment fails.
You can optionally trigger an automatic rollback when one or more alarms are in a failed state during a deployment, or if the deployment stops.
In this example, CodeDeploy will monitor and roll back on alarms set for the
number of unhealthy ECS tasks in each of the blue and green target groups,
as well as alarms set for the number HTTP 5xx responses seen in each of the blue
and green target groups.
```ts
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
declare const service: ecs.FargateService;
declare const blueTargetGroup: elbv2.ApplicationTargetGroup;
declare const greenTargetGroup: elbv2.ApplicationTargetGroup;
declare const listener: elbv2.IApplicationListener;
// Alarm on the number of unhealthy ECS tasks in each target group
const blueUnhealthyHosts = new cloudwatch.Alarm(this, 'BlueUnhealthyHosts', {
alarmName: Stack.of(this).stackName + '-Unhealthy-Hosts-Blue',
metric: blueTargetGroup.metricUnhealthyHostCount(),
threshold: 1,
evaluationPeriods: 2,
});
const greenUnhealthyHosts = new cloudwatch.Alarm(this, 'GreenUnhealthyHosts', {
alarmName: Stack.of(this).stackName + '-Unhealthy-Hosts-Green',
metric: greenTargetGroup.metricUnhealthyHostCount(),
threshold: 1,
evaluationPeriods: 2,
});
// Alarm on the number of HTTP 5xx responses returned by each target group
const blueApiFailure = new cloudwatch.Alarm(this, 'Blue5xx', {
alarmName: Stack.of(this).stackName + '-Http-5xx-Blue',
metric: blueTargetGroup.metricHttpCodeTarget(
elbv2.HttpCodeTarget.TARGET_5XX_COUNT,
{ period: Duration.minutes(1) },
),
threshold: 1,
evaluationPeriods: 1,
});
const greenApiFailure = new cloudwatch.Alarm(this, 'Green5xx', {
alarmName: Stack.of(this).stackName + '-Http-5xx-Green',
metric: greenTargetGroup.metricHttpCodeTarget(
elbv2.HttpCodeTarget.TARGET_5XX_COUNT,
{ period: Duration.minutes(1) },
),
threshold: 1,
evaluationPeriods: 1,
});
new codedeploy.EcsDeploymentGroup(this, 'BlueGreenDG', {
// CodeDeploy will monitor these alarms during a deployment and automatically roll back
alarms: [blueUnhealthyHosts, greenUnhealthyHosts, blueApiFailure, greenApiFailure],
autoRollback: {
// CodeDeploy will automatically roll back if a deployment is stopped
stoppedDeployment: true,
},
service,
blueGreenDeploymentConfig: {
blueTargetGroup,
greenTargetGroup,
listener,
},
deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES,
});
```
### Deployment validation and manual deployment approval
CodeDeploy blue-green deployments provide an opportunity to validate the new task definition version running on
the 'green' ECS task set prior to shifting any production traffic to the new version. A second 'test' listener
serving traffic on a different port be added to the load balancer. For example, the test listener can serve
test traffic on port 9001 while the main listener serves production traffic on port 443.
During a blue-green deployment, CodeDeploy can then shift 100% of test traffic over to the 'green'
task set/target group prior to shifting any production traffic during the deployment.
```ts
declare const myApplication: codedeploy.EcsApplication;
declare const service: ecs.FargateService;
declare const blueTargetGroup: elbv2.ITargetGroup;
declare const greenTargetGroup: elbv2.ITargetGroup;
declare const listener: elbv2.IApplicationListener;
declare const testListener: elbv2.IApplicationListener;
new codedeploy.EcsDeploymentGroup(this, 'BlueGreenDG', {
service,
blueGreenDeploymentConfig: {
blueTargetGroup,
greenTargetGroup,
listener,
testListener,
},
deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES,
});
```
Automated validation steps can run during the CodeDeploy deployment after shifting test traffic and before
shifting production traffic. CodeDeploy supports registering Lambda functions as lifecycle hooks for
an ECS deployment. These Lambda functions can run automated validation steps against the test traffic
port, for example in response to the `AfterAllowTestTraffic` lifecycle hook. For more information about
how to specify the Lambda functions to run for each CodeDeploy lifecycle hook in an ECS deployment, see the
[AppSpec 'hooks' for an Amazon ECS deployment](https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#appspec-hooks-ecs)
section in the CodeDeploy user guide.
After provisioning the 'green' ECS task set and re-routing test traffic during a blue-green deployment,
CodeDeploy can wait for approval before continuing the deployment and re-routing production traffic.
During this approval wait time, you can complete additional validation steps prior to exposing the new
'green' task set to production traffic, such as manual testing through the test listener port or
running automated integration test suites.
To approve the deployment, validation steps use the CodeDeploy
[ContinueDeployment API(https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_ContinueDeployment.html).
If the ContinueDeployment API is not called within the approval wait time period, CodeDeploy will stop the
deployment and can automatically roll back the deployment.
```ts
declare const service: ecs.FargateService;
declare const blueTargetGroup: elbv2.ITargetGroup;
declare const greenTargetGroup: elbv2.ITargetGroup;
declare const listener: elbv2.IApplicationListener;
declare const testListener: elbv2.IApplicationListener;
new codedeploy.EcsDeploymentGroup(this, 'BlueGreenDG', {
autoRollback: {
// CodeDeploy will automatically roll back if the 8-hour approval period times out and the deployment stops
stoppedDeployment: true,
},
service,
blueGreenDeploymentConfig: {
// The deployment will wait for approval for up to 8 hours before stopping the deployment
deploymentApprovalWaitTime: Duration.hours(8),
blueTargetGroup,
greenTargetGroup,
listener,
testListener,
},
deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES,
});
```
### Deployment bake time
You can specify how long CodeDeploy waits before it terminates the original 'blue' ECS task set when a blue-green deployment
is complete in order to let the deployment "bake" a while. During this bake time, CodeDeploy will continue to monitor any
CloudWatch alarms specified for the deployment group and will automatically roll back if those alarms go into a failed state.
```ts
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';
declare const service: ecs.FargateService;
declare const blueTargetGroup: elbv2.ITargetGroup;
declare const greenTargetGroup: elbv2.ITargetGroup;
declare const listener: elbv2.IApplicationListener;
declare const blueUnhealthyHosts: cloudwatch.Alarm;
declare const greenUnhealthyHosts: cloudwatch.Alarm;
declare const blueApiFailure: cloudwatch.Alarm;
declare const greenApiFailure: cloudwatch.Alarm;
new codedeploy.EcsDeploymentGroup(this, 'BlueGreenDG', {
service,
blueGreenDeploymentConfig: {
blueTargetGroup,
greenTargetGroup,
listener,
// CodeDeploy will wait for 30 minutes after completing the blue-green deployment before it terminates the blue tasks
terminationWaitTime: Duration.minutes(30),
},
// CodeDeploy will continue to monitor these alarms during the 30-minute bake time and will automatically
// roll back if they go into a failed state at any point during the deployment.
alarms: [blueUnhealthyHosts, greenUnhealthyHosts, blueApiFailure, greenApiFailure],
deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES,
});
```
### Import an existing ECS Deployment Group
To import an already existing Deployment Group:
```ts
declare const application: codedeploy.EcsApplication;
const deploymentGroup = codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes(this, 'ExistingCodeDeployDeploymentGroup', {
application,
deploymentGroupName: 'MyExistingDeploymentGroup',
});
```
## ECS Deployment Configurations
CodeDeploy for ECS comes with predefined configurations for traffic shifting.
The predefined configurations are available as LambdaDeploymentConfig constants.
```ts
const config = codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES;
```
If you want to specify your own strategy,
you can do so with the EcsDeploymentConfig construct,
letting you specify precisely how fast an ECS service is deployed.
```ts
new codedeploy.EcsDeploymentConfig(this, 'CustomConfig', {
trafficRouting: new codedeploy.TimeBasedCanaryTrafficRouting({
interval: Duration.minutes(15),
percentage: 5,
}),
});
```
You can specify a custom name for your deployment config, but if you do you will not be able to update the interval/percentage through CDK.
```ts
const config = new codedeploy.EcsDeploymentConfig(this, 'CustomConfig', {
trafficRouting: new codedeploy.TimeBasedCanaryTrafficRouting({
interval: Duration.minutes(15),
percentage: 5,
}),
deploymentConfigName: 'MyDeploymentConfig',
});
```
Or import an existing one:
```ts
const deploymentConfig = codedeploy.EcsDeploymentConfig.fromEcsDeploymentConfigName(
this,
'ExistingDeploymentConfiguration',
'MyExistingDeploymentConfiguration',
);
```
## ECS Deployments
[![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg)](https://constructs.dev/packages/@cdklabs/cdk-ecs-codedeploy)
An experimental construct is available on the Construct Hub called [@cdklabs/cdk-ecs-codedeploy](https://constructs.dev/packages/@cdklabs/cdk-ecs-codedeploy) that manages ECS CodeDeploy deployments.
```ts fixture=constructhub
declare const deploymentGroup: codedeploy.IEcsDeploymentGroup;
declare const taskDefinition: ecs.ITaskDefinition;
new EcsDeployment({
deploymentGroup,
targetService: {
taskDefinition,
containerName: 'mycontainer',
containerPort: 80,
},
});
```
The deployment will use the AutoRollbackConfig for the EcsDeploymentGroup unless it is overridden in the deployment:
```ts fixture=constructhub
declare const deploymentGroup: codedeploy.IEcsDeploymentGroup;
declare const taskDefinition: ecs.ITaskDefinition;
new EcsDeployment({
deploymentGroup,
targetService: {
taskDefinition,
containerName: 'mycontainer',
containerPort: 80,
},
autoRollback: {
failedDeployment: true,
deploymentInAlarm: true,
stoppedDeployment: false,
},
});
```
By default, the CodeDeploy Deployment will timeout after 30 minutes. The timeout value can be overridden:
```ts fixture=constructhub
declare const deploymentGroup: codedeploy.IEcsDeploymentGroup;
declare const taskDefinition: ecs.ITaskDefinition;
new EcsDeployment({
deploymentGroup,
targetService: {
taskDefinition,
containerName: 'mycontainer',
containerPort: 80,
},
timeout: Duration.minutes(60),
});
```

View File

@@ -0,0 +1 @@
export * from './lib';

1
cdk/node_modules/aws-cdk-lib/aws-codedeploy/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,155 @@
import type { Construct } from 'constructs';
import type { MinimumHealthyHosts, MinimumHealthyHostsPerZone } from './host-health-config';
import type { TrafficRouting } from './traffic-routing-config';
import type { Duration } from '../../core';
import { Resource } from '../../core';
import type { DeploymentConfigReference, IDeploymentConfigRef, IDeploymentGroupRef } from '../../interfaces/generated/aws-codedeploy-interfaces.generated';
/**
* The base class for ServerDeploymentConfig, EcsDeploymentConfig,
* and LambdaDeploymentConfig deployment configurations.
*/
export interface IBaseDeploymentConfig extends IDeploymentConfigRef {
/**
* The physical, human-readable name of the Deployment Configuration.
* @attribute
*/
readonly deploymentConfigName: string;
/**
* The ARN of the Deployment Configuration.
* @attribute
*/
readonly deploymentConfigArn: string;
}
/**
* Construction properties of `BaseDeploymentConfig`.
*/
export interface BaseDeploymentConfigOptions {
/**
* The physical, human-readable name of the Deployment Configuration.
* @default - automatically generated name
*/
readonly deploymentConfigName?: string;
}
/**
* The compute platform of a deployment configuration
*/
export declare enum ComputePlatform {
/**
* The deployment will target EC2 instances or on-premise servers
*/
SERVER = "Server",
/**
* The deployment will target a Lambda function
*/
LAMBDA = "Lambda",
/**
* The deployment will target an ECS server
*/
ECS = "ECS"
}
/**
* Configuration for CodeDeploy to deploy your application to one Availability Zone at a time within an AWS Region.
*/
export interface ZonalConfig {
/**
* The period of time that CodeDeploy must wait after completing a deployment to an Availability Zone.
*
* Accepted Values:
* * 0
* * Greater than or equal to 1
*
* @default - CodeDeploy starts deploying to the next Availability Zone immediately
*/
readonly monitorDuration?: Duration;
/**
* The period of time that CodeDeploy must wait after completing a deployment to the first Availability Zone.
*
* Accepted Values:
* * 0
* * Greater than or equal to 1
*
* @default - the same value as `monitorDuration`
*/
readonly firstZoneMonitorDuration?: Duration;
/**
* The number or percentage of instances that must remain available per Availability Zone during a deployment.
* This option works in conjunction with the `minimumHealthyHosts` option.
*
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/instances-health.html#minimum-healthy-hosts-az
*
* @default - 0 percent
*/
readonly minimumHealthyHostsPerZone?: MinimumHealthyHostsPerZone;
}
/**
* Complete base deployment config properties that are required to be supplied by the implementation
* of the BaseDeploymentConfig class.
*/
export interface BaseDeploymentConfigProps extends BaseDeploymentConfigOptions {
/**
* The destination compute platform for the deployment.
*
* @default ComputePlatform.Server
*/
readonly computePlatform?: ComputePlatform;
/**
* The configuration that specifies how traffic is shifted during a deployment.
* Only applicable to ECS and Lambda deployments, and must not be specified for Server deployments.
* @default None
*/
readonly trafficRouting?: TrafficRouting;
/**
* Minimum number of healthy hosts.
* @default None
*/
readonly minimumHealthyHosts?: MinimumHealthyHosts;
/**
* Configure CodeDeploy to deploy your application to one Availability Zone at a time within an AWS Region.
*
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations-create.html#zonal-config
*
* @default - deploy your application to a random selection of hosts across a Region
*/
readonly zonalConfig?: ZonalConfig;
}
/**
* The base class for ServerDeploymentConfig, EcsDeploymentConfig,
* and LambdaDeploymentConfig deployment configurations.
*
* @resource AWS::CodeDeploy::DeploymentConfig
*/
export declare abstract class BaseDeploymentConfig extends Resource implements IBaseDeploymentConfig {
/**
* Import a custom Deployment Configuration for a Deployment Group defined outside the CDK.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param deploymentConfigName the name of the referenced custom Deployment Configuration
* @returns a Construct representing a reference to an existing custom Deployment Configuration
*/
protected static fromDeploymentConfigName(scope: Construct, id: string, deploymentConfigName: string): IBaseDeploymentConfig;
private readonly resource;
get deploymentConfigName(): string;
get deploymentConfigArn(): string;
get deploymentConfigRef(): DeploymentConfigReference;
constructor(scope: Construct, id: string, props?: BaseDeploymentConfigProps);
private validateMinimumDuration;
}
/**
* A DeploymentConfig that can specialize itself based on the target group it will be used for
*
* For example, this is used for AWS-managed deployment configs: these are already
* present in every region, but we need a region-specific ARN to reference them.
* Since we might use them in conjunction with cross-region DeploymentGroups, we
* need to specialize the account and region to the DeploymentGroup before
* using.
*
* A DeploymentGroup must call `bindEnvironment()` first if it detects this type,
* before reading the DeploymentConfig ARN.
*/
export interface IBindableDeploymentConfig extends IDeploymentConfigRef {
/**
* Bind the predefined deployment config to the environment of the given resource
*/
bindEnvironment(deploymentGroup: IDeploymentGroupRef): IDeploymentConfigRef;
}

File diff suppressed because one or more lines are too long

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,66 @@
import type { Construct } from 'constructs';
import type { IResource } from '../../../core';
import { Resource } from '../../../core';
import type { ApplicationReference, IApplicationRef } from '../../../interfaces/generated/aws-codedeploy-interfaces.generated';
/**
* Represents a reference to a CodeDeploy Application deploying to Amazon ECS.
*
* If you're managing the Application alongside the rest of your CDK resources,
* use the `EcsApplication` class.
*
* If you want to reference an already existing Application,
* or one defined in a different CDK Stack,
* use the `EcsApplication#fromEcsApplicationName` method.
*/
export interface IEcsApplication extends IResource, IApplicationRef {
/** @attribute */
readonly applicationArn: string;
/** @attribute */
readonly applicationName: string;
}
/**
* Construction properties for `EcsApplication`.
*/
export interface EcsApplicationProps {
/**
* The physical, human-readable name of the CodeDeploy Application.
*
* @default an auto-generated name will be used
*/
readonly applicationName?: string;
}
/**
* A CodeDeploy Application that deploys to an Amazon ECS service.
*
* @resource AWS::CodeDeploy::Application
*/
export declare class EcsApplication extends Resource implements IEcsApplication {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an Application defined either outside the CDK, or in a different CDK Stack.
*
* The Application's account and region are assumed to be the same as the stack it is being imported
* into. If not, use `fromEcsApplicationArn`.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param ecsApplicationName the name of the application to import
* @returns a Construct representing a reference to an existing Application
*/
static fromEcsApplicationName(scope: Construct, id: string, ecsApplicationName: string): IEcsApplication;
/**
* Import an Application defined either outside the CDK, or in a different CDK Stack, by ARN.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param ecsApplicationArn the ARN of the application to import
* @returns a Construct representing a reference to an existing Application
*/
static fromEcsApplicationArn(scope: Construct, id: string, ecsApplicationArn: string): IEcsApplication;
private readonly resource;
get applicationArn(): string;
get applicationName(): string;
get applicationRef(): ApplicationReference;
constructor(scope: Construct, id: string, props?: EcsApplicationProps);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,60 @@
import type { Construct } from 'constructs';
import type { BaseDeploymentConfigOptions, IBaseDeploymentConfig } from '../base-deployment-config';
import { BaseDeploymentConfig } from '../base-deployment-config';
import { TrafficRouting } from '../traffic-routing-config';
/**
* The Deployment Configuration of an ECS Deployment Group.
*
* If you're managing the Deployment Configuration alongside the rest of your CDK resources,
* use the `EcsDeploymentConfig` class.
*
* If you want to reference an already existing deployment configuration,
* or one defined in a different CDK Stack,
* use the `EcsDeploymentConfig#fromEcsDeploymentConfigName` method.
*
* The default, pre-defined Configurations are available as constants on the `EcsDeploymentConfig` class
* (for example, `EcsDeploymentConfig.AllAtOnce`).
*/
export interface IEcsDeploymentConfig extends IBaseDeploymentConfig {
}
/**
* Construction properties of `EcsDeploymentConfig`.
*/
export interface EcsDeploymentConfigProps extends BaseDeploymentConfigOptions {
/**
* The configuration that specifies how traffic is shifted from the 'blue'
* target group to the 'green' target group during a deployment.
* @default AllAtOnce
*/
readonly trafficRouting?: TrafficRouting;
}
/**
* A custom Deployment Configuration for an ECS Deployment Group.
*
* @resource AWS::CodeDeploy::DeploymentConfig
*/
export declare class EcsDeploymentConfig extends BaseDeploymentConfig implements IEcsDeploymentConfig {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/** CodeDeploy predefined deployment configuration that shifts all traffic to the updated ECS task set at once. */
static readonly ALL_AT_ONCE: IEcsDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every minute until all traffic is shifted. */
static readonly LINEAR_10PERCENT_EVERY_1MINUTES: IEcsDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every three minutes until all traffic is shifted. */
static readonly LINEAR_10PERCENT_EVERY_3MINUTES: IEcsDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed five minutes later. */
static readonly CANARY_10PERCENT_5MINUTES: IEcsDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 15 minutes later. */
static readonly CANARY_10PERCENT_15MINUTES: IEcsDeploymentConfig;
/**
* Import a custom Deployment Configuration for an ECS Deployment Group defined outside the CDK.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param ecsDeploymentConfigName the name of the referenced custom Deployment Configuration
* @returns a Construct representing a reference to an existing custom Deployment Configuration
*/
static fromEcsDeploymentConfigName(scope: Construct, id: string, ecsDeploymentConfigName: string): IEcsDeploymentConfig;
private static deploymentConfig;
constructor(scope: Construct, id: string, props?: EcsDeploymentConfigProps);
}

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.EcsDeploymentConfig=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var metadata_resource_1=()=>{var tmp=require("../../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp},prop_injectable_1=()=>{var tmp=require("../../../core/lib/prop-injectable");return prop_injectable_1=()=>tmp,tmp},base_deployment_config_1=()=>{var tmp=require("../base-deployment-config");return base_deployment_config_1=()=>tmp,tmp},utils_1=()=>{var tmp=require("../private/utils");return utils_1=()=>tmp,tmp},traffic_routing_config_1=()=>{var tmp=require("../traffic-routing-config");return traffic_routing_config_1=()=>tmp,tmp};let EcsDeploymentConfig=(()=>{let _classDecorators=[prop_injectable_1().propertyInjectable],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=base_deployment_config_1().BaseDeploymentConfig;var EcsDeploymentConfig2=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),EcsDeploymentConfig2=_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_codedeploy.EcsDeploymentConfig",version:"2.252.0"};static PROPERTY_INJECTION_ID="aws-cdk-lib.aws-codedeploy.EcsDeploymentConfig";static ALL_AT_ONCE=EcsDeploymentConfig2.deploymentConfig("CodeDeployDefault.ECSAllAtOnce");static LINEAR_10PERCENT_EVERY_1MINUTES=EcsDeploymentConfig2.deploymentConfig("CodeDeployDefault.ECSLinear10PercentEvery1Minutes");static LINEAR_10PERCENT_EVERY_3MINUTES=EcsDeploymentConfig2.deploymentConfig("CodeDeployDefault.ECSLinear10PercentEvery3Minutes");static CANARY_10PERCENT_5MINUTES=EcsDeploymentConfig2.deploymentConfig("CodeDeployDefault.ECSCanary10Percent5Minutes");static CANARY_10PERCENT_15MINUTES=EcsDeploymentConfig2.deploymentConfig("CodeDeployDefault.ECSCanary10Percent15Minutes");static fromEcsDeploymentConfigName(scope,id,ecsDeploymentConfigName){return this.fromDeploymentConfigName(scope,id,ecsDeploymentConfigName)}static deploymentConfig(name){return(0,utils_1().deploymentConfig)(name)}constructor(scope,id,props){super(scope,id,{...props,computePlatform:base_deployment_config_1().ComputePlatform.ECS,trafficRouting:props?.trafficRouting??traffic_routing_config_1().TrafficRouting.allAtOnce()});try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codedeploy_EcsDeploymentConfigProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,EcsDeploymentConfig2),error}(0,metadata_resource_1().addConstructMetadata)(this,props)}static{__runInitializers(_classThis,_classExtraInitializers)}};return EcsDeploymentConfig2=_classThis})();exports.EcsDeploymentConfig=EcsDeploymentConfig;

View File

@@ -0,0 +1,226 @@
import { Construct } from 'constructs';
import type { IEcsApplication } from './application';
import type { IEcsDeploymentConfig } from './deployment-config';
import * as ecs from '../../../aws-ecs';
import type * as elbv2 from '../../../aws-elasticloadbalancingv2';
import * as iam from '../../../aws-iam';
import * as cdk from '../../../core';
import type { IAlarmRef } from '../../../interfaces/generated/aws-cloudwatch-interfaces.generated';
import type { IDeploymentGroupRef, IApplicationRef, IDeploymentConfigRef } from '../../../interfaces/generated/aws-codedeploy-interfaces.generated';
import { DeploymentGroupBase } from '../private/base-deployment-group';
import type { AutoRollbackConfig } from '../rollback-config';
/**
* Interface for an ECS deployment group.
*/
export interface IEcsDeploymentGroup extends cdk.IResource, IDeploymentGroupRef {
/**
* The reference to the CodeDeploy ECS Application that this Deployment Group belongs to.
*/
readonly application: IEcsApplication;
/**
* The physical name of the CodeDeploy Deployment Group.
* @attribute
*/
readonly deploymentGroupName: string;
/**
* The ARN of this Deployment Group.
* @attribute
*/
readonly deploymentGroupArn: string;
/**
* The Deployment Configuration this Group uses.
*/
readonly deploymentConfig: IEcsDeploymentConfig;
}
/**
* Specify how the deployment behaves and how traffic is routed to the ECS service during a blue-green ECS deployment.
*
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-steps-ecs.html#deployment-steps-what-happens
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#appspec-hooks-ecs
*/
export interface EcsBlueGreenDeploymentConfig {
/**
* The target group that will be associated with the 'blue' ECS task set during a blue-green deployment.
*/
readonly blueTargetGroup: elbv2.ITargetGroup;
/**
* The target group that will be associated with the 'green' ECS task set during a blue-green deployment.
*/
readonly greenTargetGroup: elbv2.ITargetGroup;
/**
* The load balancer listener used to serve production traffic and to shift production traffic from the
* 'blue' ECS task set to the 'green' ECS task set during a blue-green deployment.
*/
readonly listener: elbv2.IListenerRef;
/**
* The load balancer listener used to route test traffic to the 'green' ECS task set during a blue-green deployment.
*
* During a blue-green deployment, validation can occur after test traffic has been re-routed and before production
* traffic has been re-routed to the 'green' ECS task set. You can specify one or more Lambda functions in the
* deployment's AppSpec file that run during the AfterAllowTestTraffic hook. The functions can run validation tests.
* If a validation test fails, a deployment rollback is triggered. If the validation tests succeed, the next hook in
* the deployment lifecycle, BeforeAllowTraffic, is triggered.
*
* If a test listener is not specified, the deployment will proceed to routing the production listener to the 'green' ECS task set
* and will skip the AfterAllowTestTraffic hook.
*
* @default No test listener will be added
*/
readonly testListener?: elbv2.IListenerRef;
/**
* Specify how long CodeDeploy waits for approval to continue a blue-green deployment before it stops the deployment.
*
* After provisioning the 'green' ECS task set and re-routing test traffic, CodeDeploy can wait for approval before
* continuing the deployment and re-routing production traffic. During this wait time, validation such as manual
* testing or running integration tests can occur using the test traffic port, prior to exposing the new 'green' task
* set to production traffic. To approve the deployment, validation steps use the CodeDeploy
* [ContinueDeployment API(https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_ContinueDeployment.html).
* If the ContinueDeployment API is not called within the wait time period, CodeDeploy will stop the deployment.
*
* By default, CodeDeploy will not wait for deployment approval. After re-routing test traffic to the 'green' ECS task set
* and running any 'AfterAllowTestTraffic' and 'BeforeAllowTraffic' lifecycle hooks, the deployment will immediately
* re-route production traffic to the 'green' ECS task set.
*
* @default 0
*/
readonly deploymentApprovalWaitTime?: cdk.Duration;
/**
* Specify how long CodeDeploy waits before it terminates the original 'blue' ECS task set when a blue-green deployment is complete.
*
* During this wait time, CodeDeploy will continue to monitor any CloudWatch alarms specified for the deployment group,
* and the deployment group can be configured to automatically roll back if those alarms fire. Once CodeDeploy begins to
* terminate the 'blue' ECS task set, the deployment can no longer be rolled back, manually or automatically.
*
* By default, the deployment will immediately terminate the 'blue' ECS task set after production traffic is successfully
* routed to the 'green' ECS task set.
*
* @default 0
*/
readonly terminationWaitTime?: cdk.Duration;
}
/**
* Construction properties for `EcsDeploymentGroup`.
*/
export interface EcsDeploymentGroupProps {
/**
* The reference to the CodeDeploy ECS Application that this Deployment Group belongs to.
*
* @default One will be created for you.
*/
readonly application?: IApplicationRef;
/**
* The physical, human-readable name of the CodeDeploy Deployment Group.
*
* @default An auto-generated name will be used.
*/
readonly deploymentGroupName?: string;
/**
* The Deployment Configuration this Deployment Group uses.
*
* @default EcsDeploymentConfig.ALL_AT_ONCE
*/
readonly deploymentConfig?: IDeploymentConfigRef;
/**
* The CloudWatch alarms associated with this Deployment Group.
* CodeDeploy will stop (and optionally roll back)
* a deployment if during it any of the alarms trigger.
*
* Alarms can also be added after the Deployment Group is created using the `#addAlarm` method.
*
* @default []
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html
*/
readonly alarms?: IAlarmRef[];
/**
* The service Role of this Deployment Group.
*
* @default - A new Role will be created.
*/
readonly role?: iam.IRole;
/**
* The ECS service to deploy with this Deployment Group.
*/
readonly service: ecs.IBaseService;
/**
* The configuration options for blue-green ECS deployments
*/
readonly blueGreenDeploymentConfig: EcsBlueGreenDeploymentConfig;
/**
* Whether to continue a deployment even if fetching the alarm status from CloudWatch failed.
*
* @default false
*/
readonly ignorePollAlarmsFailure?: boolean;
/**
* The auto-rollback configuration for this Deployment Group.
*
* @default - default AutoRollbackConfig.
*/
readonly autoRollback?: AutoRollbackConfig;
/**
* Whether to skip the step of checking CloudWatch alarms during the deployment process
*
* @default - false
*/
readonly ignoreAlarmConfiguration?: boolean;
}
/**
* A CodeDeploy deployment group that orchestrates ECS blue-green deployments.
* @resource AWS::CodeDeploy::DeploymentGroup
*/
export declare class EcsDeploymentGroup extends DeploymentGroupBase implements IEcsDeploymentGroup {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Reference an ECS Deployment Group defined outside the CDK app.
*
* Account and region for the DeploymentGroup are taken from the application.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param attrs the properties of the referenced Deployment Group
* @returns a Construct representing a reference to an existing Deployment Group
*/
static fromEcsDeploymentGroupAttributes(scope: Construct, id: string, attrs: EcsDeploymentGroupAttributes): IEcsDeploymentGroup;
private readonly _application;
private readonly _deploymentConfig;
/**
* The service Role of this Deployment Group.
*/
readonly role: iam.IRole;
private readonly alarms;
constructor(scope: Construct, id: string, props: EcsDeploymentGroupProps);
get application(): IEcsApplication;
get deploymentConfig(): IEcsDeploymentConfig;
/**
* Associates an additional alarm with this Deployment Group.
*
* @param alarm the alarm to associate with this Deployment Group
*/
addAlarm(alarm: IAlarmRef): void;
private renderBlueGreenDeploymentConfiguration;
private renderLoadBalancerInfo;
}
/**
* Properties of a reference to a CodeDeploy ECS Deployment Group.
*
* @see EcsDeploymentGroup#fromEcsDeploymentGroupAttributes
*/
export interface EcsDeploymentGroupAttributes {
/**
* The reference to the CodeDeploy ECS Application
* that this Deployment Group belongs to.
*/
readonly application: IApplicationRef;
/**
* The physical, human-readable name of the CodeDeploy ECS Deployment Group
* that we are referencing.
*/
readonly deploymentGroupName: string;
/**
* The Deployment Configuration this Deployment Group uses.
*
* @default EcsDeploymentConfig.ALL_AT_ONCE
*/
readonly deploymentConfig?: IDeploymentConfigRef;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
export * from './application';
export * from './deployment-config';
export * from './deployment-group';

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.EcsApplication=void 0,Object.defineProperty(exports,_noFold="EcsApplication",{enumerable:!0,configurable:!0,get:()=>{var value=require("./application").EcsApplication;return Object.defineProperty(exports,_noFold="EcsApplication",{enumerable:!0,configurable:!0,value}),value}}),exports.EcsDeploymentConfig=void 0,Object.defineProperty(exports,_noFold="EcsDeploymentConfig",{enumerable:!0,configurable:!0,get:()=>{var value=require("./deployment-config").EcsDeploymentConfig;return Object.defineProperty(exports,_noFold="EcsDeploymentConfig",{enumerable:!0,configurable:!0,value}),value}}),exports.EcsDeploymentGroup=void 0,Object.defineProperty(exports,_noFold="EcsDeploymentGroup",{enumerable:!0,configurable:!0,get:()=>{var value=require("./deployment-group").EcsDeploymentGroup;return Object.defineProperty(exports,_noFold="EcsDeploymentGroup",{enumerable:!0,configurable:!0,value}),value}});

View File

@@ -0,0 +1,39 @@
import type { CfnDeploymentConfig } from './codedeploy.generated';
/**
* Minimum number of healthy hosts for a server deployment.
*/
export declare class MinimumHealthyHosts {
private readonly json;
/**
* The minimum healthy hosts threshold expressed as an absolute number.
*/
static count(value: number): MinimumHealthyHosts;
/**
* The minimum healthy hosts threshold expressed as a percentage of the fleet.
*/
static percentage(value: number): MinimumHealthyHosts;
private constructor();
/**
* @internal
*/
get _json(): CfnDeploymentConfig.MinimumHealthyHostsProperty;
}
/**
* Minimum number of healthy hosts per availability zone for a server deployment.
*/
export declare class MinimumHealthyHostsPerZone {
private readonly json;
/**
* The minimum healthy hosts threshold expressed as an absolute number.
*/
static count(value: number): MinimumHealthyHostsPerZone;
/**
* The minimum healthy hosts threshold expressed as a percentage of the fleet.
*/
static percentage(value: number): MinimumHealthyHostsPerZone;
private constructor();
/**
* @internal
*/
get _json(): CfnDeploymentConfig.MinimumHealthyHostsProperty;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MinimumHealthyHostsPerZone=exports.MinimumHealthyHosts=void 0;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 MinimumHealthyHosts{json;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_codedeploy.MinimumHealthyHosts",version:"2.252.0"};static count(value){return new MinimumHealthyHosts({type:"HOST_COUNT",value})}static percentage(value){return new MinimumHealthyHosts({type:"FLEET_PERCENT",value})}constructor(json){this.json=json}get _json(){return this.json}}exports.MinimumHealthyHosts=MinimumHealthyHosts;class MinimumHealthyHostsPerZone{json;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_codedeploy.MinimumHealthyHostsPerZone",version:"2.252.0"};static count(value){return new MinimumHealthyHostsPerZone({type:"HOST_COUNT",value})}static percentage(value){return new MinimumHealthyHostsPerZone({type:"FLEET_PERCENT",value})}constructor(json){if(this.json=json,!Number.isInteger(json.value))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`MustBePercentageCountValue`,`The percentage or count value of minimumHealthyHostsPerZone must be an integer, got: ${json.value}`)}get _json(){return this.json}}exports.MinimumHealthyHostsPerZone=MinimumHealthyHostsPerZone;

View File

@@ -0,0 +1,8 @@
export * from './base-deployment-config';
export * from './host-health-config';
export * from './rollback-config';
export * from './traffic-routing-config';
export * from './ecs';
export * from './lambda';
export * from './server';
export * from './codedeploy.generated';

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,66 @@
import type { Construct } from 'constructs';
import type { IResource } from '../../../core';
import { Resource } from '../../../core';
import type { ApplicationReference, IApplicationRef } from '../../../interfaces/generated/aws-codedeploy-interfaces.generated';
/**
* Represents a reference to a CodeDeploy Application deploying to AWS Lambda.
*
* If you're managing the Application alongside the rest of your CDK resources,
* use the `LambdaApplication` class.
*
* If you want to reference an already existing Application,
* or one defined in a different CDK Stack,
* use the `LambdaApplication#fromLambdaApplicationName` method.
*/
export interface ILambdaApplication extends IResource, IApplicationRef {
/** @attribute */
readonly applicationArn: string;
/** @attribute */
readonly applicationName: string;
}
/**
* Construction properties for `LambdaApplication`.
*/
export interface LambdaApplicationProps {
/**
* The physical, human-readable name of the CodeDeploy Application.
*
* @default an auto-generated name will be used
*/
readonly applicationName?: string;
}
/**
* A CodeDeploy Application that deploys to an AWS Lambda function.
*
* @resource AWS::CodeDeploy::Application
*/
export declare class LambdaApplication extends Resource implements ILambdaApplication {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an Application defined either outside the CDK, or in a different CDK Stack.
*
* The Application's account and region are assumed to be the same as the stack it is being imported
* into. If not, use `fromLambdaApplicationArn`.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param lambdaApplicationName the name of the application to import
* @returns a Construct representing a reference to an existing Application
*/
static fromLambdaApplicationName(scope: Construct, id: string, lambdaApplicationName: string): ILambdaApplication;
/**
* Import an Application defined either outside the CDK, or in a different CDK Stack, by ARN.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param lambdaApplicationArn the ARN of the application to import
* @returns a Construct representing a reference to an existing Application
*/
static fromLambdaApplicationArn(scope: Construct, id: string, lambdaApplicationArn: string): ILambdaApplication;
private readonly resource;
get applicationArn(): string;
get applicationName(): string;
get applicationRef(): ApplicationReference;
constructor(scope: Construct, id: string, props?: LambdaApplicationProps);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,79 @@
import type { Construct } from 'constructs';
import type { ILambdaDeploymentConfig } from './deployment-config';
import type { Duration } from '../../../core';
import { Resource } from '../../../core';
import type { IBindableDeploymentConfig } from '../base-deployment-config';
import type { DeploymentConfigReference, IDeploymentConfigRef, IDeploymentGroupRef } from '../codedeploy.generated';
/**
* Lambda Deployment config type
* @deprecated Use `LambdaDeploymentConfig`
*/
export declare enum CustomLambdaDeploymentConfigType {
/**
* Canary deployment type
* @deprecated Use `LambdaDeploymentConfig`
*/
CANARY = "Canary",
/**
* Linear deployment type
* @deprecated Use `LambdaDeploymentConfig`
*/
LINEAR = "Linear"
}
/**
* Properties of a reference to a CodeDeploy Lambda Deployment Configuration.
* @deprecated Use `LambdaDeploymentConfig`
*/
export interface CustomLambdaDeploymentConfigProps {
/**
* The type of deployment config, either CANARY or LINEAR
* @deprecated Use `LambdaDeploymentConfig`
*/
readonly type: CustomLambdaDeploymentConfigType;
/**
* The integer percentage of traffic to shift:
* - For LINEAR, the percentage to shift every interval
* - For CANARY, the percentage to shift until the interval passes, before the full deployment
* @deprecated Use `LambdaDeploymentConfig`
*/
readonly percentage: number;
/**
* The interval, in number of minutes:
* - For LINEAR, how frequently additional traffic is shifted
* - For CANARY, how long to shift traffic before the full deployment
* @deprecated Use `LambdaDeploymentConfig`
*/
readonly interval: Duration;
/**
* The verbatim name of the deployment config. Must be unique per account/region.
* Other parameters cannot be updated if this name is provided.
* @default - automatically generated name
* @deprecated Use `LambdaDeploymentConfig`
*/
readonly deploymentConfigName?: string;
}
/**
* A custom Deployment Configuration for a Lambda Deployment Group.
* @resource AWS::CodeDeploy::DeploymentGroup
* @deprecated CloudFormation now supports Lambda deployment configurations without custom resources. Use `LambdaDeploymentConfig`.
*/
export declare class CustomLambdaDeploymentConfig extends Resource implements ILambdaDeploymentConfig, IBindableDeploymentConfig {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* The name of the deployment config
* @attribute
* @deprecated Use `LambdaDeploymentConfig`
*/
readonly deploymentConfigName: string;
/**
* The arn of the deployment config
* @attribute
* @deprecated Use `LambdaDeploymentConfig`
*/
readonly deploymentConfigArn: string;
get deploymentConfigRef(): DeploymentConfigReference;
constructor(scope: Construct, id: string, props: CustomLambdaDeploymentConfigProps);
bindEnvironment(deploymentGroup: IDeploymentGroupRef): IDeploymentConfigRef;
private validateParameters;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,89 @@
import type { Construct } from 'constructs';
import type { BaseDeploymentConfigOptions, IBaseDeploymentConfig } from '../base-deployment-config';
import { BaseDeploymentConfig } from '../base-deployment-config';
import { TrafficRouting } from '../traffic-routing-config';
/**
* The Deployment Configuration of a Lambda Deployment Group.
*
* If you're managing the Deployment Configuration alongside the rest of your CDK resources,
* use the `LambdaDeploymentConfig` class.
*
* If you want to reference an already existing deployment configuration,
* or one defined in a different CDK Stack,
* use the `LambdaDeploymentConfig#fromLambdaDeploymentConfigName` method.
*
* The default, pre-defined Configurations are available as constants on the `LambdaDeploymentConfig` class
* (`LambdaDeploymentConfig.AllAtOnce`, `LambdaDeploymentConfig.Canary10Percent30Minutes`, etc.).
*/
export interface ILambdaDeploymentConfig extends IBaseDeploymentConfig {
}
/**
* Properties of a reference to a CodeDeploy Lambda Deployment Configuration.
*
* @see LambdaDeploymentConfig#import
*/
export interface LambdaDeploymentConfigImportProps {
/**
* The physical, human-readable name of the custom CodeDeploy Lambda Deployment Configuration
* that we are referencing.
*/
readonly deploymentConfigName: string;
}
/**
* Construction properties of `LambdaDeploymentConfig`.
*/
export interface LambdaDeploymentConfigProps extends BaseDeploymentConfigOptions {
/**
* The configuration that specifies how traffic is shifted from the 'blue'
* target group to the 'green' target group during a deployment.
* @default AllAtOnce
*/
readonly trafficRouting?: TrafficRouting;
}
/**
* A custom Deployment Configuration for a Lambda Deployment Group.
* @resource AWS::CodeDeploy::DeploymentConfig
*/
export declare class LambdaDeploymentConfig extends BaseDeploymentConfig implements ILambdaDeploymentConfig {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/** CodeDeploy predefined deployment configuration that shifts all traffic to the updated Lambda function at once. */
static readonly ALL_AT_ONCE: ILambdaDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 30 minutes later. */
static readonly CANARY_10PERCENT_30MINUTES: ILambdaDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed five minutes later. */
static readonly CANARY_10PERCENT_5MINUTES: ILambdaDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 10 minutes later. */
static readonly CANARY_10PERCENT_10MINUTES: ILambdaDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 15 minutes later. */
static readonly CANARY_10PERCENT_15MINUTES: ILambdaDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every 10 minutes until all traffic is shifted. */
static readonly LINEAR_10PERCENT_EVERY_10MINUTES: ILambdaDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every minute until all traffic is shifted. */
static readonly LINEAR_10PERCENT_EVERY_1MINUTE: ILambdaDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every two minutes until all traffic is shifted. */
static readonly LINEAR_10PERCENT_EVERY_2MINUTES: ILambdaDeploymentConfig;
/** CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every three minutes until all traffic is shifted. */
static readonly LINEAR_10PERCENT_EVERY_3MINUTES: ILambdaDeploymentConfig;
/**
* Import a Deployment Configuration for a Lambda Deployment Group defined outside the CDK.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param lambdaDeploymentConfigName the name of the Lambda Deployment Configuration to import
* @returns a Construct representing a reference to an existing Lambda Deployment Configuration
*/
static fromLambdaDeploymentConfigName(scope: Construct, id: string, lambdaDeploymentConfigName: string): ILambdaDeploymentConfig;
/**
* Import a Deployment Configuration for a Lambda Deployment Group defined outside the CDK.
*
* @param _scope the parent Construct for this new Construct
* @param _id the logical ID of this new Construct
* @param props the properties of the referenced custom Deployment Configuration
* @returns a Construct representing a reference to an existing custom Deployment Configuration
* @deprecated use `fromLambdaDeploymentConfigName`
*/
static import(_scope: Construct, _id: string, props: LambdaDeploymentConfigImportProps): ILambdaDeploymentConfig;
private static deploymentConfig;
constructor(scope: Construct, id: string, props?: LambdaDeploymentConfigProps);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,187 @@
import type { Construct } from 'constructs';
import type { ILambdaApplication } from './application';
import type { ILambdaDeploymentConfig } from './deployment-config';
import * as iam from '../../../aws-iam';
import type * as lambda from '../../../aws-lambda';
import * as cdk from '../../../core';
import type { IAlarmRef } from '../../../interfaces/generated/aws-cloudwatch-interfaces.generated';
import type { IDeploymentGroupRef } from '../../../interfaces/generated/aws-codedeploy-interfaces.generated';
import { DeploymentGroupBase } from '../private/base-deployment-group';
import type { AutoRollbackConfig } from '../rollback-config';
/**
* Interface for a Lambda deployment groups.
*/
export interface ILambdaDeploymentGroup extends cdk.IResource, IDeploymentGroupRef {
/**
* The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to.
*/
readonly application: ILambdaApplication;
/**
* The physical name of the CodeDeploy Deployment Group.
* @attribute
*/
readonly deploymentGroupName: string;
/**
* The ARN of this Deployment Group.
* @attribute
*/
readonly deploymentGroupArn: string;
/**
* The Deployment Configuration this Group uses.
*/
readonly deploymentConfig: ILambdaDeploymentConfig;
}
/**
* Construction properties for `LambdaDeploymentGroup`.
*/
export interface LambdaDeploymentGroupProps {
/**
* The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to.
*
* @default - One will be created for you.
*/
readonly application?: ILambdaApplication;
/**
* The physical, human-readable name of the CodeDeploy Deployment Group.
*
* @default - An auto-generated name will be used.
*/
readonly deploymentGroupName?: string;
/**
* The Deployment Configuration this Deployment Group uses.
*
* @default LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES
*/
readonly deploymentConfig?: ILambdaDeploymentConfig;
/**
* The CloudWatch alarms associated with this Deployment Group.
* CodeDeploy will stop (and optionally roll back)
* a deployment if during it any of the alarms trigger.
*
* Alarms can also be added after the Deployment Group is created using the `#addAlarm` method.
*
* @default []
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html
*/
readonly alarms?: IAlarmRef[];
/**
* The service Role of this Deployment Group.
*
* @default - A new Role will be created.
*/
readonly role?: iam.IRole;
/**
* Lambda Alias to shift traffic. Updating the version
* of the alias will trigger a CodeDeploy deployment.
*
* [disable-awslint:ref-via-interface] since we need to modify the alias CFN resource update policy
*/
readonly alias: lambda.Alias;
/**
* The Lambda function to run before traffic routing starts.
*
* @default - None.
*/
readonly preHook?: lambda.IFunction;
/**
* The Lambda function to run after traffic routing starts.
*
* @default - None.
*/
readonly postHook?: lambda.IFunction;
/**
* Whether to continue a deployment even if fetching the alarm status from CloudWatch failed.
*
* @default false
*/
readonly ignorePollAlarmsFailure?: boolean;
/**
* The auto-rollback configuration for this Deployment Group.
*
* @default - default AutoRollbackConfig.
*/
readonly autoRollback?: AutoRollbackConfig;
/**
* Whether to skip the step of checking CloudWatch alarms during the deployment process
*
* @default - false
*/
readonly ignoreAlarmConfiguration?: boolean;
}
/**
* @resource AWS::CodeDeploy::DeploymentGroup
*/
export declare class LambdaDeploymentGroup extends DeploymentGroupBase implements ILambdaDeploymentGroup {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an Lambda Deployment Group defined either outside the CDK app, or in a different AWS region.
*
* Account and region for the DeploymentGroup are taken from the application.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param attrs the properties of the referenced Deployment Group
* @returns a Construct representing a reference to an existing Deployment Group
*/
static fromLambdaDeploymentGroupAttributes(scope: Construct, id: string, attrs: LambdaDeploymentGroupAttributes): ILambdaDeploymentGroup;
readonly application: ILambdaApplication;
/**
* The service Role of this Deployment Group.
*/
readonly role: iam.IRole;
private readonly alarms;
private readonly _preHook;
private readonly _postHook;
private readonly _deploymentConfig;
constructor(scope: Construct, id: string, props: LambdaDeploymentGroupProps);
/**
* Associates an additional alarm with this Deployment Group.
*
* @param alarm the alarm to associate with this Deployment Group
*/
addAlarm(alarm: IAlarmRef): void;
/**
* Associate a function to run before deployment begins.
* @param preHook function to run before deployment beings
* @throws an error if a pre-hook function is already configured
*/
addPreHook(preHook: lambda.IFunction): void;
/**
* Associate a function to run after deployment completes.
* @param postHook function to run after deployment completes
* @throws an error if a post-hook function is already configured
*/
addPostHook(postHook: lambda.IFunction): void;
/**
* Grant a principal permission to codedeploy:PutLifecycleEventHookExecutionStatus
* on this deployment group resource.
* [disable-awslint:no-grants]
* @param grantee to grant permission to
*/
grantPutLifecycleEventHookExecutionStatus(grantee: iam.IGrantable): iam.Grant;
get deploymentConfig(): ILambdaDeploymentConfig;
}
/**
* Properties of a reference to a CodeDeploy Lambda Deployment Group.
*
* @see LambdaDeploymentGroup#fromLambdaDeploymentGroupAttributes
*/
export interface LambdaDeploymentGroupAttributes {
/**
* The reference to the CodeDeploy Lambda Application
* that this Deployment Group belongs to.
*/
readonly application: ILambdaApplication;
/**
* The physical, human-readable name of the CodeDeploy Lambda Deployment Group
* that we are referencing.
*/
readonly deploymentGroupName: string;
/**
* The Deployment Configuration this Deployment Group uses.
*
* @default LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES
*/
readonly deploymentConfig?: ILambdaDeploymentConfig;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
export * from './application';
export * from './custom-deployment-config';
export * from './deployment-config';
export * from './deployment-group';

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.LambdaApplication=void 0,Object.defineProperty(exports,_noFold="LambdaApplication",{enumerable:!0,configurable:!0,get:()=>{var value=require("./application").LambdaApplication;return Object.defineProperty(exports,_noFold="LambdaApplication",{enumerable:!0,configurable:!0,value}),value}}),exports.CustomLambdaDeploymentConfigType=void 0,Object.defineProperty(exports,_noFold="CustomLambdaDeploymentConfigType",{enumerable:!0,configurable:!0,get:()=>{var value=require("./custom-deployment-config").CustomLambdaDeploymentConfigType;return Object.defineProperty(exports,_noFold="CustomLambdaDeploymentConfigType",{enumerable:!0,configurable:!0,value}),value}}),exports.CustomLambdaDeploymentConfig=void 0,Object.defineProperty(exports,_noFold="CustomLambdaDeploymentConfig",{enumerable:!0,configurable:!0,get:()=>{var value=require("./custom-deployment-config").CustomLambdaDeploymentConfig;return Object.defineProperty(exports,_noFold="CustomLambdaDeploymentConfig",{enumerable:!0,configurable:!0,value}),value}}),exports.LambdaDeploymentConfig=void 0,Object.defineProperty(exports,_noFold="LambdaDeploymentConfig",{enumerable:!0,configurable:!0,get:()=>{var value=require("./deployment-config").LambdaDeploymentConfig;return Object.defineProperty(exports,_noFold="LambdaDeploymentConfig",{enumerable:!0,configurable:!0,value}),value}}),exports.LambdaDeploymentGroup=void 0,Object.defineProperty(exports,_noFold="LambdaDeploymentGroup",{enumerable:!0,configurable:!0,get:()=>{var value=require("./deployment-group").LambdaDeploymentGroup;return Object.defineProperty(exports,_noFold="LambdaDeploymentGroup",{enumerable:!0,configurable:!0,value}),value}});

View File

@@ -0,0 +1,106 @@
import type { Construct } from 'constructs';
import * as iam from '../../../aws-iam';
import { Resource } from '../../../core';
import type { DeploymentGroupReference, IApplicationRef, IDeploymentConfigRef } from '../../../interfaces/generated/aws-codedeploy-interfaces.generated';
import type { CfnDeploymentGroup } from '../codedeploy.generated';
/**
*/
export interface ImportedDeploymentGroupBaseProps {
/**
* The reference to the CodeDeploy Application that this Deployment Group belongs to.
*/
readonly application: IApplicationRef;
/**
* The physical, human-readable name of the CodeDeploy Deployment Group
* that we are referencing.
*
* @default Either deploymentGroupName or deploymentGroupArn is required
*/
readonly deploymentGroupName: string;
}
/**
* @internal
*/
export declare class ImportedDeploymentGroupBase extends Resource {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
readonly applicationName: string;
readonly deploymentGroupName: string;
readonly deploymentGroupArn: string;
get deploymentGroupRef(): DeploymentGroupReference;
constructor(scope: Construct, id: string, props: ImportedDeploymentGroupBaseProps);
/**
* Bind DeploymentGroupConfig to the current group, if supported
*
* @internal
*/
protected _bindDeploymentConfig(config: IDeploymentConfigRef): IDeploymentConfigRef;
}
export interface DeploymentGroupBaseProps {
/**
* The physical, human-readable name of the CodeDeploy Deployment Group.
*
* @default An auto-generated name will be used.
*/
readonly deploymentGroupName?: string;
/**
* The service Role of this Deployment Group.
*
* @default A new Role will be created.
*/
readonly role?: iam.IRole;
/**
* Id of the role construct, if created by this construct
*
* Exists because when we factored this out, there was a difference between the
* 3 deployment groups.
*/
readonly roleConstructId: string;
}
/**
* @internal
*/
export declare class DeploymentGroupBase extends Resource {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* The name of the Application.
*/
readonly applicationName: string;
/**
* The name of the Deployment Group.
*/
readonly deploymentGroupName: string;
/**
* The ARN of the Deployment Group.
*/
readonly deploymentGroupArn: string;
/**
* A reference to a DeploymentGroup resource.
*/
get deploymentGroupRef(): DeploymentGroupReference;
/**
* The service Role of this Deployment Group.
*
* (Can't make `role` properly public here, as it's typed as optional in one
* interface and typing it here as definitely set interferes with that.)
*
* @internal
*/
readonly _role: iam.IRole;
constructor(scope: Construct, id: string, props: DeploymentGroupBaseProps);
/**
* Bind DeploymentGroupConfig to the current group, if supported
*
* @internal
*/
protected _bindDeploymentConfig(config: IDeploymentConfigRef): IDeploymentConfigRef;
/**
* Set name and ARN properties.
*
* Must be called in the child constructor.
*
* @internal
*/
protected _setNameAndArn(resource: CfnDeploymentGroup, application: IApplicationRef): void;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
import type { IBindableDeploymentConfig } from '../base-deployment-config';
import type { IDeploymentConfigRef } from '../codedeploy.generated';
export declare function isIBindableDeploymentConfig(x: IDeploymentConfigRef): x is IBindableDeploymentConfig;

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isIBindableDeploymentConfig=isIBindableDeploymentConfig;function isIBindableDeploymentConfig(x){return typeof x=="object"&&!!x&&"bindEnvironment"in x}

View File

@@ -0,0 +1,31 @@
import type { IApplicationRef, IDeploymentConfigRef } from '../../../interfaces/generated/aws-codedeploy-interfaces.generated';
import type { IBaseDeploymentConfig } from '../base-deployment-config';
import type { IEcsApplication } from '../ecs/application';
import type { IEcsDeploymentConfig } from '../ecs/deployment-config';
import type { ILambdaApplication } from '../lambda/application';
import type { IServerApplication } from '../server/application';
import type { IServerDeploymentConfig } from '../server/deployment-config';
/**
* Convert an IApplicationRef to IServerApplication, validating it has the required properties
*/
export declare function toIServerApplication(app: IApplicationRef): IServerApplication;
/**
* Convert an IApplicationRef to IEcsApplication, validating it has the required properties
*/
export declare function toIEcsApplication(app: IApplicationRef): IEcsApplication;
/**
* Convert an IApplicationRef to ILambdaApplication, validating it has the required properties
*/
export declare function toILambdaApplication(app: IApplicationRef): ILambdaApplication;
/**
* Convert an IDeploymentConfigRef to IServerDeploymentConfig, validating it has the required properties
*/
export declare function toIServerDeploymentConfig(config: IDeploymentConfigRef): IServerDeploymentConfig;
/**
* Convert an IDeploymentConfigRef to IEcsDeploymentConfig, validating it has the required properties
*/
export declare function toIEcsDeploymentConfig(config: IDeploymentConfigRef): IEcsDeploymentConfig;
/**
* Convert an IDeploymentConfigRef to ILambdaDeploymentConfig, validating it has the required properties
*/
export declare function toIBaseDeploymentConfig(config: IDeploymentConfigRef): IBaseDeploymentConfig;

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.toIServerApplication=toIServerApplication,exports.toIEcsApplication=toIEcsApplication,exports.toILambdaApplication=toILambdaApplication,exports.toIServerDeploymentConfig=toIServerDeploymentConfig,exports.toIEcsDeploymentConfig=toIEcsDeploymentConfig,exports.toIBaseDeploymentConfig=toIBaseDeploymentConfig;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};function toIServerApplication(app){if(!("applicationArn"in app)||!("applicationName"in app))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`ApplicationInstanceShouldImplement`,`'application' instance should implement IServerApplication, but doesn't: ${app.constructor.name}`);return app}function toIEcsApplication(app){if(!("applicationArn"in app)||!("applicationName"in app))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`ApplicationInstanceShouldImplement`,`'application' instance should implement IEcsApplication, but doesn't: ${app.constructor.name}`);return app}function toILambdaApplication(app){if(!("applicationArn"in app)||!("applicationName"in app))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`ApplicationInstanceShouldImplement`,`'application' instance should implement ILambdaApplication, but doesn't: ${app.constructor.name}`);return app}function toIServerDeploymentConfig(config){if(!("deploymentConfigArn"in config)||!("deploymentConfigName"in config))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`DeploymentConfigInstanceImplementServer`,`'deploymentConfig' instance should implement IServerDeploymentConfig, but doesn't: ${config.constructor.name}`);return config}function toIEcsDeploymentConfig(config){if(!("deploymentConfigArn"in config)||!("deploymentConfigName"in config))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`DeploymentConfigInstanceImplementEcs`,`'deploymentConfig' instance should implement IEcsDeploymentConfig, but doesn't: ${config.constructor.name}`);return config}function toIBaseDeploymentConfig(config){if(!("deploymentConfigArn"in config)||!("deploymentConfigName"in config))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`DeploymentConfigInstanceImplementLambda`,`'deploymentConfig' instance should implement ILambdaDeploymentConfig, but doesn't: ${config.constructor.name}`);return config}

View File

@@ -0,0 +1,36 @@
import type { Construct } from 'constructs';
import type { Stack, IEnvironmentAware } from '../../../core';
import type { IAlarmRef } from '../../../interfaces/generated/aws-cloudwatch-interfaces.generated';
import type { IBaseDeploymentConfig, IBindableDeploymentConfig } from '../base-deployment-config';
import type { CfnDeploymentGroup } from '../codedeploy.generated';
import type { AutoRollbackConfig } from '../rollback-config';
export declare function arnForApplication(stack: Stack, applicationName: string): string;
export declare function nameFromDeploymentGroupArn(deploymentGroupArn: string): string;
export declare function arnForDeploymentConfig(name: string, resource?: IEnvironmentAware): string;
export interface renderAlarmConfigProps {
/**
* Array of Cloudwatch alarms
*/
readonly alarms: IAlarmRef[];
/**
* Whether to ignore failure to fetch the status of alarms from CloudWatch
*/
readonly ignorePollAlarmFailure?: boolean;
/**
* When no alarms are provided on an update, removes previously existing alarms from the construct.
* @see {@link https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/cx-api/FEATURE_FLAGS.md#aws-cdkaws-codedeployremovealarmsfromdeploymentgroup}
*
* @default true
*/
readonly removeAlarms?: boolean;
/**
* Whether to skip the step of checking CloudWatch alarms during the deployment process
*
* @default false
*/
ignoreAlarmConfiguration?: boolean;
}
export declare function renderAlarmConfiguration(props: renderAlarmConfigProps): CfnDeploymentGroup.AlarmConfigurationProperty | undefined;
export declare function deploymentConfig(name: string): IBaseDeploymentConfig & IBindableDeploymentConfig;
export declare function renderAutoRollbackConfiguration(scope: Construct, alarms: IAlarmRef[], autoRollbackConfig?: AutoRollbackConfig): CfnDeploymentGroup.AutoRollbackConfigurationProperty | undefined;
export declare function validateName(type: 'Application' | 'Deployment group' | 'Deployment config', name: string): string[];

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.arnForApplication=arnForApplication,exports.nameFromDeploymentGroupArn=nameFromDeploymentGroupArn,exports.arnForDeploymentConfig=arnForDeploymentConfig,exports.renderAlarmConfiguration=renderAlarmConfiguration,exports.deploymentConfig=deploymentConfig,exports.renderAutoRollbackConfiguration=renderAutoRollbackConfiguration,exports.validateName=validateName;var core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},detached_construct_1=()=>{var tmp=require("../../../core/lib/private/detached-construct");return detached_construct_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};function arnForApplication(stack,applicationName){return stack.formatArn({service:"codedeploy",resource:"application",resourceName:applicationName,arnFormat:core_1().ArnFormat.COLON_RESOURCE_NAME})}function nameFromDeploymentGroupArn(deploymentGroupArn){const components=core_1().Arn.split(deploymentGroupArn,core_1().ArnFormat.COLON_RESOURCE_NAME);return core_1().Fn.select(1,core_1().Fn.split("/",components.resourceName??""))}function arnForDeploymentConfig(name,resource){return core_1().Arn.format({partition:core_1().Aws.PARTITION,account:resource?.env.account??core_1().Aws.ACCOUNT_ID,region:resource?.env.region??core_1().Aws.REGION,service:"codedeploy",resource:"deploymentconfig",resourceName:name,arnFormat:core_1().ArnFormat.COLON_RESOURCE_NAME})}function renderAlarmConfiguration(props){const ignoreAlarmConfiguration=props.ignoreAlarmConfiguration??!1;return props.removeAlarms??!0?{alarms:props.alarms.length>0?props.alarms.map(a=>({name:a.alarmRef.alarmName})):void 0,enabled:!ignoreAlarmConfiguration&&props.alarms.length>0,ignorePollAlarmFailure:props.ignorePollAlarmFailure}:props.alarms.length===0?void 0:{alarms:props.alarms.map(a=>({name:a.alarmRef.alarmName})),enabled:!ignoreAlarmConfiguration,ignorePollAlarmFailure:props.ignorePollAlarmFailure}}function deploymentConfig(name){return new class extends detached_construct_1().DetachedConstruct{deploymentConfigName=name;deploymentConfigArn=arnForDeploymentConfig(name);deploymentConfigRef={deploymentConfigName:name};bindEnvironment(resource){return new class extends detached_construct_1().DetachedConstruct{deploymentConfigName=name;deploymentConfigArn=arnForDeploymentConfig(name,resource);deploymentConfigRef={deploymentConfigName:name}}("Objects returned by 'deploymentConfig()' cannot be used in this API: they are not real constructs and do not have a construct tree")}}("Objects returned by 'deploymentConfig()' cannot be used in this API: they are not real constructs and do not have a construct tree")}var AutoRollbackEvent;(function(AutoRollbackEvent2){AutoRollbackEvent2.DEPLOYMENT_FAILURE="DEPLOYMENT_FAILURE",AutoRollbackEvent2.DEPLOYMENT_STOP_ON_ALARM="DEPLOYMENT_STOP_ON_ALARM",AutoRollbackEvent2.DEPLOYMENT_STOP_ON_REQUEST="DEPLOYMENT_STOP_ON_REQUEST"})(AutoRollbackEvent||(AutoRollbackEvent={}));function renderAutoRollbackConfiguration(scope,alarms,autoRollbackConfig={}){const events=new Array;if(autoRollbackConfig.failedDeployment!==!1&&events.push(AutoRollbackEvent.DEPLOYMENT_FAILURE),autoRollbackConfig.stoppedDeployment===!0&&events.push(AutoRollbackEvent.DEPLOYMENT_STOP_ON_REQUEST),autoRollbackConfig.deploymentInAlarm!==!1){if(alarms.length>0)events.push(AutoRollbackEvent.DEPLOYMENT_STOP_ON_ALARM);else if(autoRollbackConfig.deploymentInAlarm===!0)throw new(core_1()).ValidationError((0,literal_string_1().lit)`DeploymentInAlarmRequiresCloudWatchAlarms`,"The auto-rollback setting 'deploymentInAlarm' does not have any effect unless you associate at least one CloudWatch alarm with the Deployment Group",scope)}return autoRollbackConfig.failedDeployment===!1&&autoRollbackConfig.stoppedDeployment!==!0&&autoRollbackConfig.deploymentInAlarm===!1?{enabled:!1}:events.length>0?{enabled:!0,events}:void 0}function validateName(type,name){const ret=[];return!core_1().Token.isUnresolved(name)&&name!==void 0&&(name.length>100&&ret.push(`${type} name: "${name}" can be a max of 100 characters.`),/^[a-z0-9._+=,@-]+$/i.test(name)||ret.push(`${type} name: "${name}" can only contain letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), + (plus signs), = (equals signs), , (commas), @ (at signs), - (minus signs).`)),ret}

View File

@@ -0,0 +1,24 @@
/**
* The configuration for automatically rolling back deployments in a given Deployment Group.
*/
export interface AutoRollbackConfig {
/**
* Whether to automatically roll back a deployment that fails.
*
* @default true
*/
readonly failedDeployment?: boolean;
/**
* Whether to automatically roll back a deployment that was manually stopped.
*
* @default false
*/
readonly stoppedDeployment?: boolean;
/**
* Whether to automatically roll back a deployment during which one of the configured
* CloudWatch alarms for this Deployment Group went off.
*
* @default true if you've provided any Alarms with the `alarms` property, false otherwise
*/
readonly deploymentInAlarm?: boolean;
}

View File

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

View File

@@ -0,0 +1,66 @@
import type { Construct } from 'constructs';
import type { IResource } from '../../../core';
import { Resource } from '../../../core';
import type { ApplicationReference, IApplicationRef } from '../../../interfaces/generated/aws-codedeploy-interfaces.generated';
/**
* Represents a reference to a CodeDeploy Application deploying to EC2/on-premise instances.
*
* If you're managing the Application alongside the rest of your CDK resources,
* use the `ServerApplication` class.
*
* If you want to reference an already existing Application,
* or one defined in a different CDK Stack,
* use the `#fromServerApplicationName` method.
*/
export interface IServerApplication extends IResource, IApplicationRef {
/** @attribute */
readonly applicationArn: string;
/** @attribute */
readonly applicationName: string;
}
/**
* Construction properties for `ServerApplication`.
*/
export interface ServerApplicationProps {
/**
* The physical, human-readable name of the CodeDeploy Application.
*
* @default an auto-generated name will be used
*/
readonly applicationName?: string;
}
/**
* A CodeDeploy Application that deploys to EC2/on-premise instances.
*
* @resource AWS::CodeDeploy::Application
*/
export declare class ServerApplication extends Resource implements IServerApplication {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an Application defined either outside the CDK app, or in a different region.
*
* The Application's account and region are assumed to be the same as the stack it is being imported
* into. If not, use `fromServerApplicationArn`.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param serverApplicationName the name of the application to import
* @returns a Construct representing a reference to an existing Application
*/
static fromServerApplicationName(scope: Construct, id: string, serverApplicationName: string): IServerApplication;
/**
* Import an Application defined either outside the CDK, or in a different CDK Stack, by ARN.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param serverApplicationArn the ARN of the application to import
* @returns a Construct representing a reference to an existing Application
*/
static fromServerApplicationArn(scope: Construct, id: string, serverApplicationArn: string): IServerApplication;
private readonly resource;
get applicationArn(): string;
get applicationName(): string;
get applicationRef(): ApplicationReference;
constructor(scope: Construct, id: string, props?: ServerApplicationProps);
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,67 @@
import type { Construct } from 'constructs';
import type { BaseDeploymentConfigOptions, IBaseDeploymentConfig, ZonalConfig } from '../base-deployment-config';
import { BaseDeploymentConfig } from '../base-deployment-config';
import type { MinimumHealthyHosts } from '../host-health-config';
/**
* The Deployment Configuration of an EC2/on-premise Deployment Group.
* The default, pre-defined Configurations are available as constants on the `ServerDeploymentConfig` class
* (`ServerDeploymentConfig.HALF_AT_A_TIME`, `ServerDeploymentConfig.ALL_AT_ONCE`, etc.).
* To create a custom Deployment Configuration,
* instantiate the `ServerDeploymentConfig` Construct.
*/
export interface IServerDeploymentConfig extends IBaseDeploymentConfig {
}
/**
* Construction properties of `ServerDeploymentConfig`.
*/
export interface ServerDeploymentConfigProps extends BaseDeploymentConfigOptions {
/**
* Minimum number of healthy hosts.
*/
readonly minimumHealthyHosts: MinimumHealthyHosts;
/**
* Configure CodeDeploy to deploy your application to one Availability Zone at a time within an AWS Region.
*
* @default - deploy your application to a random selection of hosts across a Region
*/
readonly zonalConfig?: ZonalConfig;
}
/**
* A custom Deployment Configuration for an EC2/on-premise Deployment Group.
*
* @resource AWS::CodeDeploy::DeploymentConfig
*/
export declare class ServerDeploymentConfig extends BaseDeploymentConfig implements IServerDeploymentConfig {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* The CodeDeployDefault.OneAtATime predefined deployment configuration for EC2/on-premises compute platform
*
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html#deployment-configuration-server
*/
static readonly ONE_AT_A_TIME: IServerDeploymentConfig;
/**
* The CodeDeployDefault.HalfAtATime predefined deployment configuration for EC2/on-premises compute platform
*
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html#deployment-configuration-server
*/
static readonly HALF_AT_A_TIME: IServerDeploymentConfig;
/**
* The CodeDeployDefault.AllAtOnce predefined deployment configuration for EC2/on-premises compute platform
*
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html#deployment-configuration-server
*/
static readonly ALL_AT_ONCE: IServerDeploymentConfig;
/**
* Import a custom Deployment Configuration for an EC2/on-premise Deployment Group defined either outside the CDK app,
* or in a different region.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param serverDeploymentConfigName the properties of the referenced custom Deployment Configuration
* @returns a Construct representing a reference to an existing custom Deployment Configuration
*/
static fromServerDeploymentConfigName(scope: Construct, id: string, serverDeploymentConfigName: string): IServerDeploymentConfig;
private static deploymentConfig;
constructor(scope: Construct, id: string, props: ServerDeploymentConfigProps);
}

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.ServerDeploymentConfig=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var metadata_resource_1=()=>{var tmp=require("../../../core/lib/metadata-resource");return metadata_resource_1=()=>tmp,tmp},prop_injectable_1=()=>{var tmp=require("../../../core/lib/prop-injectable");return prop_injectable_1=()=>tmp,tmp},base_deployment_config_1=()=>{var tmp=require("../base-deployment-config");return base_deployment_config_1=()=>tmp,tmp},utils_1=()=>{var tmp=require("../private/utils");return utils_1=()=>tmp,tmp};let ServerDeploymentConfig=(()=>{let _classDecorators=[prop_injectable_1().propertyInjectable],_classDescriptor,_classExtraInitializers=[],_classThis,_classSuper=base_deployment_config_1().BaseDeploymentConfig;var ServerDeploymentConfig2=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),ServerDeploymentConfig2=_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_codedeploy.ServerDeploymentConfig",version:"2.252.0"};static PROPERTY_INJECTION_ID="aws-cdk-lib.aws-codedeploy.ServerDeploymentConfig";static ONE_AT_A_TIME=ServerDeploymentConfig2.deploymentConfig("CodeDeployDefault.OneAtATime");static HALF_AT_A_TIME=ServerDeploymentConfig2.deploymentConfig("CodeDeployDefault.HalfAtATime");static ALL_AT_ONCE=ServerDeploymentConfig2.deploymentConfig("CodeDeployDefault.AllAtOnce");static fromServerDeploymentConfigName(scope,id,serverDeploymentConfigName){return this.fromDeploymentConfigName(scope,id,serverDeploymentConfigName)}static deploymentConfig(name){return(0,utils_1().deploymentConfig)(name)}constructor(scope,id,props){super(scope,id,props);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codedeploy_ServerDeploymentConfigProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ServerDeploymentConfig2),error}(0,metadata_resource_1().addConstructMetadata)(this,props)}static{__runInitializers(_classThis,_classExtraInitializers)}};return ServerDeploymentConfig2=_classThis})();exports.ServerDeploymentConfig=ServerDeploymentConfig;

View File

@@ -0,0 +1,240 @@
import type { Construct } from 'constructs';
import type { IServerApplication } from './application';
import type { IServerDeploymentConfig } from './deployment-config';
import type { LoadBalancer } from './load-balancer';
import type * as autoscaling from '../../../aws-autoscaling';
import * as iam from '../../../aws-iam';
import * as cdk from '../../../core';
import type { IAlarmRef } from '../../../interfaces/generated/aws-cloudwatch-interfaces.generated';
import type { IDeploymentGroupRef, IApplicationRef, IDeploymentConfigRef } from '../../../interfaces/generated/aws-codedeploy-interfaces.generated';
import { DeploymentGroupBase } from '../private/base-deployment-group';
import type { AutoRollbackConfig } from '../rollback-config';
export interface IServerDeploymentGroup extends cdk.IResource, IDeploymentGroupRef {
readonly application: IServerApplication;
readonly role?: iam.IRole;
/**
* @attribute
*/
readonly deploymentGroupName: string;
/**
* @attribute
*/
readonly deploymentGroupArn: string;
readonly deploymentConfig: IServerDeploymentConfig;
readonly autoScalingGroups?: autoscaling.IAutoScalingGroup[];
}
/**
* Properties of a reference to a CodeDeploy EC2/on-premise Deployment Group.
*
* @see ServerDeploymentGroup#import
*/
export interface ServerDeploymentGroupAttributes {
/**
* The reference to the CodeDeploy EC2/on-premise Application
* that this Deployment Group belongs to.
*/
readonly application: IApplicationRef;
/**
* The physical, human-readable name of the CodeDeploy EC2/on-premise Deployment Group
* that we are referencing.
*/
readonly deploymentGroupName: string;
/**
* The Deployment Configuration this Deployment Group uses.
*
* @default ServerDeploymentConfig#OneAtATime
*/
readonly deploymentConfig?: IDeploymentConfigRef;
}
/**
* Represents a group of instance tags.
* An instance will match a group if it has a tag matching
* any of the group's tags by key and any of the provided values -
* in other words, tag groups follow 'or' semantics.
* If the value for a given key is an empty array,
* an instance will match when it has a tag with the given key,
* regardless of the value.
* If the key is an empty string, any tag,
* regardless of its key, with any of the given values, will match.
*/
export type InstanceTagGroup = {
[key: string]: string[];
};
/**
* Represents a set of instance tag groups.
* An instance will match a set if it matches all of the groups in the set -
* in other words, sets follow 'and' semantics.
* You can have a maximum of 3 tag groups inside a set.
*/
export declare class InstanceTagSet {
private readonly _instanceTagGroups;
constructor(...instanceTagGroups: InstanceTagGroup[]);
get instanceTagGroups(): InstanceTagGroup[];
}
/**
* Construction properties for `ServerDeploymentGroup`.
*/
export interface ServerDeploymentGroupProps {
/**
* The CodeDeploy EC2/on-premise Application this Deployment Group belongs to.
*
* @default - A new Application will be created.
*/
readonly application?: IApplicationRef;
/**
* The service Role of this Deployment Group.
*
* @default - A new Role will be created.
*/
readonly role?: iam.IRole;
/**
* The physical, human-readable name of the CodeDeploy Deployment Group.
*
* @default - An auto-generated name will be used.
*/
readonly deploymentGroupName?: string;
/**
* The EC2/on-premise Deployment Configuration to use for this Deployment Group.
*
* @default ServerDeploymentConfig#OneAtATime
*/
readonly deploymentConfig?: IDeploymentConfigRef;
/**
* The auto-scaling groups belonging to this Deployment Group.
*
* Auto-scaling groups can also be added after the Deployment Group is created
* using the `#addAutoScalingGroup` method.
*
* [disable-awslint:ref-via-interface] is needed because we update userdata
* for ASGs to install the codedeploy agent.
*
* @default []
*/
readonly autoScalingGroups?: autoscaling.IAutoScalingGroup[];
/**
* If you've provided any auto-scaling groups with the `#autoScalingGroups` property,
* you can set this property to add User Data that installs the CodeDeploy agent on the instances.
*
* @default true
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install.html
*/
readonly installAgent?: boolean;
/**
* The load balancer to place in front of this Deployment Group.
* Can be created from either a classic Elastic Load Balancer,
* or an Application Load Balancer / Network Load Balancer Target Group.
*
* @default - Deployment Group will not have a load balancer defined.
* @deprecated - Use `loadBalancers` instead.
*/
readonly loadBalancer?: LoadBalancer;
/**
* CodeDeploy supports the deployment to multiple load balancers.
* Specify either multiple Classic Load Balancers, or
* Application Load Balancers / Network Load Balancers Target Groups.
*
* @default - Deployment Group will not have load balancers defined.
*/
readonly loadBalancers?: LoadBalancer[];
/**
* All EC2 instances matching the given set of tags when a deployment occurs will be added to this Deployment Group.
*
* @default - No additional EC2 instances will be added to the Deployment Group.
*/
readonly ec2InstanceTags?: InstanceTagSet;
/**
* All on-premise instances matching the given set of tags when a deployment occurs will be added to this Deployment Group.
*
* @default - No additional on-premise instances will be added to the Deployment Group.
*/
readonly onPremiseInstanceTags?: InstanceTagSet;
/**
* The CloudWatch alarms associated with this Deployment Group.
* CodeDeploy will stop (and optionally roll back)
* a deployment if during it any of the alarms trigger.
*
* Alarms can also be added after the Deployment Group is created using the `#addAlarm` method.
*
* @default []
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html
*/
readonly alarms?: IAlarmRef[];
/**
* Whether to continue a deployment even if fetching the alarm status from CloudWatch failed.
*
* @default false
*/
readonly ignorePollAlarmsFailure?: boolean;
/**
* The auto-rollback configuration for this Deployment Group.
*
* @default - default AutoRollbackConfig.
*/
readonly autoRollback?: AutoRollbackConfig;
/**
* Whether to skip the step of checking CloudWatch alarms during the deployment process
*
* @default - false
*/
readonly ignoreAlarmConfiguration?: boolean;
/**
* Indicates whether the deployment group was configured to have CodeDeploy install a termination hook into an Auto Scaling group.
*
* @see https://docs.aws.amazon.com/codedeploy/latest/userguide/integrations-aws-auto-scaling.html#integrations-aws-auto-scaling-behaviors
*
* @default - false
*/
readonly terminationHook?: boolean;
}
/**
* A CodeDeploy Deployment Group that deploys to EC2/on-premise instances.
* @resource AWS::CodeDeploy::DeploymentGroup
*/
export declare class ServerDeploymentGroup extends DeploymentGroupBase implements IServerDeploymentGroup {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Import an EC2/on-premise Deployment Group defined either outside the CDK app,
* or in a different region.
*
* @param scope the parent Construct for this new Construct
* @param id the logical ID of this new Construct
* @param attrs the properties of the referenced Deployment Group
* @returns a Construct representing a reference to an existing Deployment Group
*/
static fromServerDeploymentGroupAttributes(scope: Construct, id: string, attrs: ServerDeploymentGroupAttributes): IServerDeploymentGroup;
private readonly _application;
private readonly _deploymentConfig;
/**
* The service Role of this Deployment Group.
*/
readonly role?: iam.IRole;
private readonly _autoScalingGroups;
private readonly installAgent;
private readonly codeDeployBucket;
private readonly alarms;
private readonly loadBalancers?;
constructor(scope: Construct, id: string, props?: ServerDeploymentGroupProps);
get application(): IServerApplication;
get deploymentConfig(): IServerDeploymentConfig;
/**
* Adds an additional auto-scaling group to this Deployment Group.
*
* @param asg the auto-scaling group to add to this Deployment Group.
* [disable-awslint:ref-via-interface] is needed in order to install the code
* deploy agent by updating the ASGs user data.
*/
addAutoScalingGroup(asg: autoscaling.AutoScalingGroup): void;
/**
* Associates an additional alarm with this Deployment Group.
*
* @param alarm the alarm to associate with this Deployment Group
*/
addAlarm(alarm: IAlarmRef): void;
get autoScalingGroups(): autoscaling.IAutoScalingGroup[] | undefined;
private addCodeDeployAgentInstallUserData;
private loadBalancersInfo;
private ec2TagSet;
private onPremiseTagSet;
private tagGroup2TagsArray;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
export * from './application';
export * from './deployment-config';
export * from './deployment-group';
export * from './load-balancer';

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.ServerApplication=void 0,Object.defineProperty(exports,_noFold="ServerApplication",{enumerable:!0,configurable:!0,get:()=>{var value=require("./application").ServerApplication;return Object.defineProperty(exports,_noFold="ServerApplication",{enumerable:!0,configurable:!0,value}),value}}),exports.ServerDeploymentConfig=void 0,Object.defineProperty(exports,_noFold="ServerDeploymentConfig",{enumerable:!0,configurable:!0,get:()=>{var value=require("./deployment-config").ServerDeploymentConfig;return Object.defineProperty(exports,_noFold="ServerDeploymentConfig",{enumerable:!0,configurable:!0,value}),value}}),exports.InstanceTagSet=void 0,Object.defineProperty(exports,_noFold="InstanceTagSet",{enumerable:!0,configurable:!0,get:()=>{var value=require("./deployment-group").InstanceTagSet;return Object.defineProperty(exports,_noFold="InstanceTagSet",{enumerable:!0,configurable:!0,value}),value}}),exports.ServerDeploymentGroup=void 0,Object.defineProperty(exports,_noFold="ServerDeploymentGroup",{enumerable:!0,configurable:!0,get:()=>{var value=require("./deployment-group").ServerDeploymentGroup;return Object.defineProperty(exports,_noFold="ServerDeploymentGroup",{enumerable:!0,configurable:!0,value}),value}}),exports.LoadBalancerGeneration=void 0,Object.defineProperty(exports,_noFold="LoadBalancerGeneration",{enumerable:!0,configurable:!0,get:()=>{var value=require("./load-balancer").LoadBalancerGeneration;return Object.defineProperty(exports,_noFold="LoadBalancerGeneration",{enumerable:!0,configurable:!0,value}),value}}),exports.LoadBalancer=void 0,Object.defineProperty(exports,_noFold="LoadBalancer",{enumerable:!0,configurable:!0,get:()=>{var value=require("./load-balancer").LoadBalancer;return Object.defineProperty(exports,_noFold="LoadBalancer",{enumerable:!0,configurable:!0,value}),value}});

View File

@@ -0,0 +1,42 @@
import type * as elb from '../../../aws-elasticloadbalancing';
import type * as elbv2 from '../../../aws-elasticloadbalancingv2';
/**
* The generations of AWS load balancing solutions.
*/
export declare enum LoadBalancerGeneration {
/**
* The first generation (ELB Classic).
*/
FIRST = 0,
/**
* The second generation (ALB and NLB).
*/
SECOND = 1
}
/**
* An interface of an abstract load balancer, as needed by CodeDeploy.
* Create instances using the static factory methods:
* `#classic`, `#application` and `#network`.
*/
export declare abstract class LoadBalancer {
/**
* Creates a new CodeDeploy load balancer from a Classic ELB Load Balancer.
*
* @param loadBalancer a classic ELB Load Balancer
*/
static classic(loadBalancer: elb.LoadBalancer): LoadBalancer;
/**
* Creates a new CodeDeploy load balancer from an Application Load Balancer Target Group.
*
* @param albTargetGroup an ALB Target Group
*/
static application(albTargetGroup: elbv2.IApplicationTargetGroup): LoadBalancer;
/**
* Creates a new CodeDeploy load balancer from a Network Load Balancer Target Group.
*
* @param nlbTargetGroup an NLB Target Group
*/
static network(nlbTargetGroup: elbv2.INetworkTargetGroup): LoadBalancer;
abstract readonly generation: LoadBalancerGeneration;
abstract readonly name: string;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LoadBalancer=exports.LoadBalancerGeneration=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var LoadBalancerGeneration;(function(LoadBalancerGeneration2){LoadBalancerGeneration2[LoadBalancerGeneration2.FIRST=0]="FIRST",LoadBalancerGeneration2[LoadBalancerGeneration2.SECOND=1]="SECOND"})(LoadBalancerGeneration||(exports.LoadBalancerGeneration=LoadBalancerGeneration={}));class LoadBalancer{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_codedeploy.LoadBalancer",version:"2.252.0"};static classic(loadBalancer){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_elasticloadbalancing_LoadBalancer(loadBalancer)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.classic),error}class ClassicLoadBalancer extends LoadBalancer{generation=LoadBalancerGeneration.FIRST;name=loadBalancer.loadBalancerName}return new ClassicLoadBalancer}static application(albTargetGroup){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_elasticloadbalancingv2_IApplicationTargetGroup(albTargetGroup)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.application),error}class AlbLoadBalancer extends LoadBalancer{generation=LoadBalancerGeneration.SECOND;name=albTargetGroup.targetGroupName}return new AlbLoadBalancer}static network(nlbTargetGroup){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_elasticloadbalancingv2_INetworkTargetGroup(nlbTargetGroup)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.network),error}class NlbLoadBalancer extends LoadBalancer{generation=LoadBalancerGeneration.SECOND;name=nlbTargetGroup.targetGroupName}return new NlbLoadBalancer}}exports.LoadBalancer=LoadBalancer;

View File

@@ -0,0 +1,137 @@
import type { Construct } from 'constructs';
import type { Duration } from '../../core';
/**
* Represents the structure to pass into the underlying CfnDeploymentConfig class.
*/
export interface TrafficRoutingConfig {
/**
* The type of traffic shifting ( `TimeBasedCanary` or `TimeBasedLinear` ) used by a deployment configuration.
*/
readonly type: string;
/**
* A configuration that shifts traffic from one version of a Lambda function or ECS task set to another in two increments.
* @default none
*/
readonly timeBasedCanary?: CanaryTrafficRoutingConfig;
/**
* A configuration that shifts traffic from one version of a Lambda function or Amazon ECS task set to another in equal increments, with an equal number of minutes between each increment.
* @default none
*/
readonly timeBasedLinear?: LinearTrafficRoutingConfig;
}
/**
* Represents the configuration specific to canary traffic shifting.
*/
export interface CanaryTrafficRoutingConfig {
/**
* The number of minutes between the first and second traffic shifts of a `TimeBasedCanary` deployment.
*/
readonly canaryInterval: number;
/**
* The percentage of traffic to shift in the first increment of a `TimeBasedCanary` deployment.
*/
readonly canaryPercentage: number;
}
/**
* Represents the configuration specific to linear traffic shifting.
*/
export interface LinearTrafficRoutingConfig {
/**
* The number of minutes between each incremental traffic shift of a `TimeBasedLinear` deployment.
*/
readonly linearInterval: number;
/**
* The percentage of traffic that is shifted at the start of each increment of a `TimeBasedLinear` deployment.
*/
readonly linearPercentage: number;
}
/**
* Represents how traffic is shifted during a CodeDeploy deployment.
*/
export declare abstract class TrafficRouting {
/**
* Shifts 100% of traffic in a single shift.
*/
static allAtOnce(): TrafficRouting;
/**
* Shifts a specified percentage of traffic, waits for a specified amount of time, then shifts the rest of traffic.
*/
static timeBasedCanary(props: TimeBasedCanaryTrafficRoutingProps): TrafficRouting;
/**
* Keeps shifting a specified percentage of traffic until reaching 100%, waiting for a specified amount of time in between each traffic shift.
*/
static timeBasedLinear(props: TimeBasedLinearTrafficRoutingProps): TrafficRouting;
/**
* Returns the traffic routing configuration.
*/
abstract bind(scope: Construct): TrafficRoutingConfig;
}
/**
* Common properties of traffic shifting routing configurations
*/
export interface BaseTrafficShiftingConfigProps {
/**
* The amount of time between traffic shifts.
*/
readonly interval: Duration;
/**
* The percentage to increase traffic on each traffic shift.
*/
readonly percentage: number;
}
/**
* Define a traffic routing config of type 'AllAtOnce'.
*/
export declare class AllAtOnceTrafficRouting extends TrafficRouting {
constructor();
/**
* Return a TrafficRoutingConfig of type `AllAtOnce`.
*/
bind(_scope: Construct): TrafficRoutingConfig;
}
/**
* Construction properties for `TimeBasedCanaryTrafficRouting`.
*/
export interface TimeBasedCanaryTrafficRoutingProps extends BaseTrafficShiftingConfigProps {
}
/**
* Define a traffic routing config of type 'TimeBasedCanary'.
*/
export declare class TimeBasedCanaryTrafficRouting extends TrafficRouting {
/**
* The amount of time between additional traffic shifts.
*/
readonly interval: Duration;
/**
* The percentage to increase traffic on each traffic shift.
*/
readonly percentage: number;
constructor(props: TimeBasedCanaryTrafficRoutingProps);
/**
* Return a TrafficRoutingConfig of type `TimeBasedCanary`.
*/
bind(_scope: Construct): TrafficRoutingConfig;
}
/**
* Construction properties for `TimeBasedLinearTrafficRouting`.
*/
export interface TimeBasedLinearTrafficRoutingProps extends BaseTrafficShiftingConfigProps {
}
/**
* Define a traffic routing config of type 'TimeBasedLinear'.
*/
export declare class TimeBasedLinearTrafficRouting extends TrafficRouting {
/**
* The amount of time between additional traffic shifts.
*/
readonly interval: Duration;
/**
* The percentage to increase traffic on each traffic shift.
*/
readonly percentage: number;
constructor(props: TimeBasedLinearTrafficRoutingProps);
/**
* Return a TrafficRoutingConfig of type `TimeBasedLinear`.
*/
bind(_scope: Construct): TrafficRoutingConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TimeBasedLinearTrafficRouting=exports.TimeBasedCanaryTrafficRouting=exports.AllAtOnceTrafficRouting=exports.TrafficRouting=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");class TrafficRouting{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_codedeploy.TrafficRouting",version:"2.252.0"};static allAtOnce(){return new AllAtOnceTrafficRouting}static timeBasedCanary(props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codedeploy_TimeBasedCanaryTrafficRoutingProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.timeBasedCanary),error}return new TimeBasedCanaryTrafficRouting(props)}static timeBasedLinear(props){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codedeploy_TimeBasedLinearTrafficRoutingProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.timeBasedLinear),error}return new TimeBasedLinearTrafficRouting(props)}}exports.TrafficRouting=TrafficRouting;class AllAtOnceTrafficRouting extends TrafficRouting{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_codedeploy.AllAtOnceTrafficRouting",version:"2.252.0"};constructor(){super()}bind(_scope){return{type:"AllAtOnce"}}}exports.AllAtOnceTrafficRouting=AllAtOnceTrafficRouting;class TimeBasedCanaryTrafficRouting extends TrafficRouting{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_codedeploy.TimeBasedCanaryTrafficRouting",version:"2.252.0"};interval;percentage;constructor(props){super();try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codedeploy_TimeBasedCanaryTrafficRoutingProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,TimeBasedCanaryTrafficRouting),error}this.interval=props.interval,this.percentage=props.percentage}bind(_scope){return{type:"TimeBasedCanary",timeBasedCanary:{canaryInterval:this.interval.toMinutes(),canaryPercentage:this.percentage}}}}exports.TimeBasedCanaryTrafficRouting=TimeBasedCanaryTrafficRouting;class TimeBasedLinearTrafficRouting extends TrafficRouting{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_codedeploy.TimeBasedLinearTrafficRouting",version:"2.252.0"};interval;percentage;constructor(props){super();try{jsiiDeprecationWarnings().aws_cdk_lib_aws_codedeploy_TimeBasedLinearTrafficRoutingProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,TimeBasedLinearTrafficRouting),error}this.interval=props.interval,this.percentage=props.percentage}bind(_scope){return{type:"TimeBasedLinear",timeBasedLinear:{linearInterval:this.interval.toMinutes(),linearPercentage:this.percentage}}}}exports.TimeBasedLinearTrafficRouting=TimeBasedLinearTrafficRouting;