Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(appconfig): add atDeploymentTick extension action point to L2 Constructs #32490

Merged
merged 12 commits into from
Dec 12, 2024
Merged

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
Loading