From 57bf4489a6fb6769d817457e9d582b8f13dee561 Mon Sep 17 00:00:00 2001 From: Dayan Paez Date: Fri, 3 Nov 2023 20:45:41 +0000 Subject: [PATCH] feat: buildEnforcer() returns created instance --- API.md | 2 +- src/CodePipelineHelper.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/API.md b/API.md index 9c8bf75..1180130 100644 --- a/API.md +++ b/API.md @@ -145,7 +145,7 @@ set of SSM ChangeCalendar name or ARNs to block on. ##### `buildEnforcer` ```typescript -public buildEnforcer(): void +public buildEnforcer(): DeploymentSafetyEnforcer ``` Performs one-time building of resources. May not be called multiple times. diff --git a/src/CodePipelineHelper.ts b/src/CodePipelineHelper.ts index c0a6f05..e844490 100644 --- a/src/CodePipelineHelper.ts +++ b/src/CodePipelineHelper.ts @@ -149,12 +149,13 @@ export class CodePipelineHelper extends Construct { if (this.built) { throw new Error('build() has already been called: can only call it once'); } - this.doBuild(); + const enforcer = this.doBuild(); this.built = true; + return enforcer; } private doBuild() { - new DeploymentSafetyEnforcer(this, 'Enforcer', { + return new DeploymentSafetyEnforcer(this, 'Enforcer', { pipeline: this.pipeline.pipeline, changeCalendars: this.changeCalendarsByStageName, bakeSteps: this.bakeSteps,