Skip to content

Commit

Permalink
feat(appconfig): add atDeploymentTick extension action point to L2 Co…
Browse files Browse the repository at this point in the history
…nstructs (#32490)

### Issue # (if applicable)

Not Applicable

### Reason for this change

Missing feature for AppConfig Extension Action Point

### Description of changes

Added feature and unit tests. Updated Integration tests.

### Description of how you validated changes

Unit tests and integ tests

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
cpaluch-aws authored Dec 12, 2024
1 parent 5e73dd0 commit 225d261
Show file tree
Hide file tree
Showing 16 changed files with 193 additions and 37 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,23 @@
]
}
}
],
"AT_DEPLOYMENT_TICK": [
{
"Name": "awsappconfigextension-MyLambdaExtension-68C15290-0",
"Uri": {
"Fn::GetAtt": [
"MyFunction3BAA72D1",
"Arn"
]
},
"RoleArn": {
"Fn::GetAtt": [
"MyLambdaExtensionRoleBC958D3F13B04",
"Arn"
]
}
}
]
},
"Name": "awsappconfigextension-MyLambdaExtension-68C15290"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const lambdaExtension = new Extension(stack, 'MyLambdaExtension', {
actionPoints: [
ActionPoint.PRE_CREATE_HOSTED_CONFIGURATION_VERSION,
ActionPoint.ON_DEPLOYMENT_START,
ActionPoint.AT_DEPLOYMENT_TICK,
],
eventDestination: new LambdaDestination(lambda),
}),
Expand Down
15 changes: 14 additions & 1 deletion packages/aws-cdk-lib/aws-appconfig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,22 @@ new appconfig.SourcedConfiguration(this, 'MySourcedConfiguration', {
## Extension

An extension augments your ability to inject logic or behavior at different points during the AWS AppConfig workflow of
creating or deploying a configuration.
creating or deploying a configuration. You can associate these types of tasks with AWS AppConfig applications, environments, and configuration profiles.
See: https://docs.aws.amazon.com/appconfig/latest/userguide/working-with-appconfig-extensions.html

An extension defines one or more actions, that it performs during an AWS AppConfig workflow. Each action is invoked either when you interact with AWS AppConfig or when AWS AppConfig is performing a process on your behalf. These invocation points are called action points. AWS AppConfig extensions support the following action points:

* PRE_START_DEPLOYMENT
* PRE_CREATE_HOSTED_CONFIGURATION_VERSION
* ON_DEPLOYMENT_START
* ON_DEPLOYMENT_STEP
* ON_DEPLOYMENT_BAKING
* ON_DEPLOYMENT_COMPLETE
* ON_DEPLOYMENT_ROLLED_BACK
* AT_DEPLOYMENT_TICK

See: https://docs.aws.amazon.com/appconfig/latest/userguide/working-with-appconfig-extensions-about.html

### AWS Lambda destination

Use an AWS Lambda as the event destination for an extension.
Expand Down
20 changes: 20 additions & 0 deletions packages/aws-cdk-lib/aws-appconfig/lib/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ export interface IApplication extends cdk.IResource {
*/
onDeploymentRolledBack(eventDestination: IEventDestination, options?: ExtensionOptions): void;

/**
* Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and
* also creates an extension association to an application.
*
* @param eventDestination The event that occurs during the extension
* @param options Options for the extension
*/
atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions): void;

/**
* Adds an extension association to the application.
*
Expand Down Expand Up @@ -297,6 +306,17 @@ abstract class ApplicationBase extends cdk.Resource implements IApplication, IEx
this.extensible.onDeploymentRolledBack(eventDestination, options);
}

/**
* Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and
* also creates an extension association to an application.
*
* @param eventDestination The event that occurs during the extension
* @param options Options for the extension
*/
public atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions) {
this.extensible.atDeploymentTick(eventDestination, options);
}

/**
* Adds an extension association to the application.
*
Expand Down
11 changes: 11 additions & 0 deletions packages/aws-cdk-lib/aws-appconfig/lib/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,17 @@ abstract class ConfigurationBase extends Construct implements IConfiguration, IE
this.extensible.onDeploymentRolledBack(eventDestination, options);
}

/**
* Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and
* also creates an extension association to an application.
*
* @param eventDestination The event that occurs during the extension
* @param options Options for the extension
*/
public atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions) {
this.extensible.atDeploymentTick(eventDestination, options);
}

/**
* Adds an extension association to the configuration profile.
*
Expand Down
13 changes: 13 additions & 0 deletions packages/aws-cdk-lib/aws-appconfig/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ abstract class EnvironmentBase extends Resource implements IEnvironment, IExtens
this.extensible.onDeploymentRolledBack(eventDestination, options);
}

public atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions) {
this.extensible.atDeploymentTick(eventDestination, options);
}

public addExtension(extension: IExtension) {
this.extensible.addExtension(extension);
}
Expand Down Expand Up @@ -556,6 +560,15 @@ export interface IEnvironment extends IResource {
*/
onDeploymentRolledBack(eventDestination: IEventDestination, options?: ExtensionOptions): void;

/**
* Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and
* also creates an extension association to an application.
*
* @param eventDestination The event that occurs during the extension
* @param options Options for the extension
*/
atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions): void;

/**
* Adds an extension association to the environment.
*
Expand Down
14 changes: 14 additions & 0 deletions packages/aws-cdk-lib/aws-appconfig/lib/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export enum ActionPoint {
ON_DEPLOYMENT_BAKING = 'ON_DEPLOYMENT_BAKING',
ON_DEPLOYMENT_COMPLETE = 'ON_DEPLOYMENT_COMPLETE',
ON_DEPLOYMENT_ROLLED_BACK = 'ON_DEPLOYMENT_ROLLED_BACK',
AT_DEPLOYMENT_TICK = 'AT_DEPLOYMENT_TICK',
}

/**
Expand Down Expand Up @@ -657,6 +658,10 @@ export class ExtensibleBase implements IExtensible {
this.getExtensionForActionPoint(eventDestination, ActionPoint.ON_DEPLOYMENT_ROLLED_BACK, options);
}

public atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions) {
this.getExtensionForActionPoint(eventDestination, ActionPoint.AT_DEPLOYMENT_TICK, options);
}

public addExtension(extension: IExtension) {
this.addExtensionAssociation(extension);
}
Expand Down Expand Up @@ -793,6 +798,15 @@ export interface IExtensible {
*/
onDeploymentRolledBack(eventDestination: IEventDestination, options?: ExtensionOptions): void;

/**
* Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and
* also creates an extension association to the derived resource.
*
* @param eventDestination The event that occurs during the extension
* @param options Options for the extension
*/
atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions): void;

/**
* Adds an extension association to the derived resource.
*
Expand Down
Loading

0 comments on commit 225d261

Please sign in to comment.