Skip to content

Commit 225d261

Browse files
authored
feat(appconfig): add atDeploymentTick extension action point to L2 Constructs (#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*
1 parent 5e73dd0 commit 225d261

16 files changed

+193
-37
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.extension.js.snapshot/aws-appconfig-extension.assets.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.extension.js.snapshot/aws-appconfig-extension.template.json

+17
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,23 @@
318318
]
319319
}
320320
}
321+
],
322+
"AT_DEPLOYMENT_TICK": [
323+
{
324+
"Name": "awsappconfigextension-MyLambdaExtension-68C15290-0",
325+
"Uri": {
326+
"Fn::GetAtt": [
327+
"MyFunction3BAA72D1",
328+
"Arn"
329+
]
330+
},
331+
"RoleArn": {
332+
"Fn::GetAtt": [
333+
"MyLambdaExtensionRoleBC958D3F13B04",
334+
"Arn"
335+
]
336+
}
337+
}
321338
]
322339
},
323340
"Name": "awsappconfigextension-MyLambdaExtension-68C15290"

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.extension.js.snapshot/awsappconfigextensionMyApplicationappconfigextensionDefaultTestDeployAssert64BA6C4E.assets.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.extension.js.snapshot/cdk.out

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.extension.js.snapshot/integ.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.extension.js.snapshot/manifest.json

+2-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.extension.js.snapshot/tree.json

+27-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-appconfig/test/integ.extension.ts

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const lambdaExtension = new Extension(stack, 'MyLambdaExtension', {
3939
actionPoints: [
4040
ActionPoint.PRE_CREATE_HOSTED_CONFIGURATION_VERSION,
4141
ActionPoint.ON_DEPLOYMENT_START,
42+
ActionPoint.AT_DEPLOYMENT_TICK,
4243
],
4344
eventDestination: new LambdaDestination(lambda),
4445
}),

packages/aws-cdk-lib/aws-appconfig/README.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,22 @@ new appconfig.SourcedConfiguration(this, 'MySourcedConfiguration', {
536536
## Extension
537537

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

542+
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:
543+
544+
* PRE_START_DEPLOYMENT
545+
* PRE_CREATE_HOSTED_CONFIGURATION_VERSION
546+
* ON_DEPLOYMENT_START
547+
* ON_DEPLOYMENT_STEP
548+
* ON_DEPLOYMENT_BAKING
549+
* ON_DEPLOYMENT_COMPLETE
550+
* ON_DEPLOYMENT_ROLLED_BACK
551+
* AT_DEPLOYMENT_TICK
552+
553+
See: https://docs.aws.amazon.com/appconfig/latest/userguide/working-with-appconfig-extensions-about.html
554+
542555
### AWS Lambda destination
543556

544557
Use an AWS Lambda as the event destination for an extension.

packages/aws-cdk-lib/aws-appconfig/lib/application.ts

+20
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ export interface IApplication extends cdk.IResource {
146146
*/
147147
onDeploymentRolledBack(eventDestination: IEventDestination, options?: ExtensionOptions): void;
148148

149+
/**
150+
* Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and
151+
* also creates an extension association to an application.
152+
*
153+
* @param eventDestination The event that occurs during the extension
154+
* @param options Options for the extension
155+
*/
156+
atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions): void;
157+
149158
/**
150159
* Adds an extension association to the application.
151160
*
@@ -297,6 +306,17 @@ abstract class ApplicationBase extends cdk.Resource implements IApplication, IEx
297306
this.extensible.onDeploymentRolledBack(eventDestination, options);
298307
}
299308

309+
/**
310+
* Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and
311+
* also creates an extension association to an application.
312+
*
313+
* @param eventDestination The event that occurs during the extension
314+
* @param options Options for the extension
315+
*/
316+
public atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions) {
317+
this.extensible.atDeploymentTick(eventDestination, options);
318+
}
319+
300320
/**
301321
* Adds an extension association to the application.
302322
*

packages/aws-cdk-lib/aws-appconfig/lib/configuration.ts

+11
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,17 @@ abstract class ConfigurationBase extends Construct implements IConfiguration, IE
295295
this.extensible.onDeploymentRolledBack(eventDestination, options);
296296
}
297297

298+
/**
299+
* Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and
300+
* also creates an extension association to an application.
301+
*
302+
* @param eventDestination The event that occurs during the extension
303+
* @param options Options for the extension
304+
*/
305+
public atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions) {
306+
this.extensible.atDeploymentTick(eventDestination, options);
307+
}
308+
298309
/**
299310
* Adds an extension association to the configuration profile.
300311
*

packages/aws-cdk-lib/aws-appconfig/lib/environment.ts

+13
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ abstract class EnvironmentBase extends Resource implements IEnvironment, IExtens
113113
this.extensible.onDeploymentRolledBack(eventDestination, options);
114114
}
115115

116+
public atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions) {
117+
this.extensible.atDeploymentTick(eventDestination, options);
118+
}
119+
116120
public addExtension(extension: IExtension) {
117121
this.extensible.addExtension(extension);
118122
}
@@ -556,6 +560,15 @@ export interface IEnvironment extends IResource {
556560
*/
557561
onDeploymentRolledBack(eventDestination: IEventDestination, options?: ExtensionOptions): void;
558562

563+
/**
564+
* Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and
565+
* also creates an extension association to an application.
566+
*
567+
* @param eventDestination The event that occurs during the extension
568+
* @param options Options for the extension
569+
*/
570+
atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions): void;
571+
559572
/**
560573
* Adds an extension association to the environment.
561574
*

packages/aws-cdk-lib/aws-appconfig/lib/extension.ts

+14
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export enum ActionPoint {
2121
ON_DEPLOYMENT_BAKING = 'ON_DEPLOYMENT_BAKING',
2222
ON_DEPLOYMENT_COMPLETE = 'ON_DEPLOYMENT_COMPLETE',
2323
ON_DEPLOYMENT_ROLLED_BACK = 'ON_DEPLOYMENT_ROLLED_BACK',
24+
AT_DEPLOYMENT_TICK = 'AT_DEPLOYMENT_TICK',
2425
}
2526

2627
/**
@@ -657,6 +658,10 @@ export class ExtensibleBase implements IExtensible {
657658
this.getExtensionForActionPoint(eventDestination, ActionPoint.ON_DEPLOYMENT_ROLLED_BACK, options);
658659
}
659660

661+
public atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions) {
662+
this.getExtensionForActionPoint(eventDestination, ActionPoint.AT_DEPLOYMENT_TICK, options);
663+
}
664+
660665
public addExtension(extension: IExtension) {
661666
this.addExtensionAssociation(extension);
662667
}
@@ -793,6 +798,15 @@ export interface IExtensible {
793798
*/
794799
onDeploymentRolledBack(eventDestination: IEventDestination, options?: ExtensionOptions): void;
795800

801+
/**
802+
* Adds an AT_DEPLOYMENT_TICK extension with the provided event destination and
803+
* also creates an extension association to the derived resource.
804+
*
805+
* @param eventDestination The event that occurs during the extension
806+
* @param options Options for the extension
807+
*/
808+
atDeploymentTick(eventDestination: IEventDestination, options?: ExtensionOptions): void;
809+
796810
/**
797811
* Adds an extension association to the derived resource.
798812
*

0 commit comments

Comments
 (0)