Skip to content

Commit

Permalink
feat(client-ecs): This release adds support for alarm-based rollbacks…
Browse files Browse the repository at this point in the history
… in ECS, a new feature that allows customers to add automated safeguards for Amazon ECS service rolling updates.
  • Loading branch information
awstools committed Dec 19, 2022
1 parent cbb5b21 commit d184e6b
Show file tree
Hide file tree
Showing 3 changed files with 380 additions and 278 deletions.
50 changes: 48 additions & 2 deletions clients/client-ecs/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,40 @@ export class ClusterNotFoundException extends __BaseException {
}
}

/**
* <p>One of the methods which provide a way for you to quickly identify when a deployment
* has failed, and then to optionally roll back the failure to the last working
* deployment.</p>
* <p>When the alarms are generated, Amazon ECS sets the service deployment to failed. Set the rollback
* parameter to have Amazon ECS to roll back your service to the last completed deployment
* after a failure.</p>
* <p>You can only use the <code>DeploymentAlarms</code> method to detect failures when the
* <code>DeploymentController</code> is set to <code>ECS</code> (rolling
* update).</p>
* <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-ecs.html">Rolling
* update</a> in the <i>
* <i>Amazon Elastic Container Service Developer Guide</i>
* </i>.</p>
*/
export interface DeploymentAlarms {
/**
* <p>One or more CloudWatch alarm names. Use a "," to separate the alarms.</p>
*/
alarmNames: string[] | undefined;

/**
* <p>Determines whether to use the CloudWatch alarm option in the service deployment process.</p>
*/
enable: boolean | undefined;

/**
* <p>Determines whether to configure Amazon ECS to roll back the service if a service deployment
* fails. If rollback is used, when a service deployment fails, the service is rolled back
* to the last deployment that completed successfully.</p>
*/
rollback: boolean | undefined;
}

/**
* <note>
* <p>The deployment circuit breaker can only be used for services using the rolling
Expand All @@ -1085,8 +1119,8 @@ export interface DeploymentCircuitBreaker {

/**
* <p>Determines whether to configure Amazon ECS to roll back the service if a service deployment
* fails. If rollback is enabled, when a service deployment fails, the service is rolled
* back to the last deployment that completed successfully.</p>
* fails. If rollback is on, when a service deployment fails, the service is rolled back to
* the last deployment that completed successfully.</p>
*/
rollback: boolean | undefined;
}
Expand Down Expand Up @@ -1191,6 +1225,11 @@ export interface DeploymentConfiguration {
* your service.</p>
*/
minimumHealthyPercent?: number;

/**
* <p>Information about the CloudWatch alarms.</p>
*/
alarms?: DeploymentAlarms;
}

export enum DeploymentControllerType {
Expand Down Expand Up @@ -9931,6 +9970,13 @@ export const CreateClusterResponseFilterSensitiveLog = (obj: CreateClusterRespon
...obj,
});

/**
* @internal
*/
export const DeploymentAlarmsFilterSensitiveLog = (obj: DeploymentAlarms): any => ({
...obj,
});

/**
* @internal
*/
Expand Down
19 changes: 19 additions & 0 deletions clients/client-ecs/src/protocols/Aws_json1_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ import {
DeleteTaskSetRequest,
DeleteTaskSetResponse,
Deployment,
DeploymentAlarms,
DeploymentCircuitBreaker,
DeploymentConfiguration,
DeploymentController,
Expand Down Expand Up @@ -4781,6 +4782,14 @@ const serializeAws_json1_1DeleteTaskSetRequest = (input: DeleteTaskSetRequest, c
};
};

const serializeAws_json1_1DeploymentAlarms = (input: DeploymentAlarms, context: __SerdeContext): any => {
return {
...(input.alarmNames != null && { alarmNames: serializeAws_json1_1StringList(input.alarmNames, context) }),
...(input.enable != null && { enable: input.enable }),
...(input.rollback != null && { rollback: input.rollback }),
};
};

const serializeAws_json1_1DeploymentCircuitBreaker = (
input: DeploymentCircuitBreaker,
context: __SerdeContext
Expand All @@ -4793,6 +4802,7 @@ const serializeAws_json1_1DeploymentCircuitBreaker = (

const serializeAws_json1_1DeploymentConfiguration = (input: DeploymentConfiguration, context: __SerdeContext): any => {
return {
...(input.alarms != null && { alarms: serializeAws_json1_1DeploymentAlarms(input.alarms, context) }),
...(input.deploymentCircuitBreaker != null && {
deploymentCircuitBreaker: serializeAws_json1_1DeploymentCircuitBreaker(input.deploymentCircuitBreaker, context),
}),
Expand Down Expand Up @@ -6883,6 +6893,14 @@ const deserializeAws_json1_1Deployment = (output: any, context: __SerdeContext):
} as any;
};

const deserializeAws_json1_1DeploymentAlarms = (output: any, context: __SerdeContext): DeploymentAlarms => {
return {
alarmNames: output.alarmNames != null ? deserializeAws_json1_1StringList(output.alarmNames, context) : undefined,
enable: __expectBoolean(output.enable),
rollback: __expectBoolean(output.rollback),
} as any;
};

const deserializeAws_json1_1DeploymentCircuitBreaker = (
output: any,
context: __SerdeContext
Expand All @@ -6898,6 +6916,7 @@ const deserializeAws_json1_1DeploymentConfiguration = (
context: __SerdeContext
): DeploymentConfiguration => {
return {
alarms: output.alarms != null ? deserializeAws_json1_1DeploymentAlarms(output.alarms, context) : undefined,
deploymentCircuitBreaker:
output.deploymentCircuitBreaker != null
? deserializeAws_json1_1DeploymentCircuitBreaker(output.deploymentCircuitBreaker, context)
Expand Down

0 comments on commit d184e6b

Please sign in to comment.