From c67c4633744868b20f49fcddc293d29a7c1a53ec Mon Sep 17 00:00:00 2001 From: Gowri Sankar Date: Thu, 23 May 2024 11:47:02 +0930 Subject: [PATCH] DO-1652: add top level props for rest, queue names --- .../lib/prerender-fargate-options.ts | 14 ++++++++++++++ .../prerender-fargate/lib/prerender-fargate.ts | 4 ++++ .../recaching/prerender-recache-api-construct.ts | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/packages/prerender-fargate/lib/prerender-fargate-options.ts b/packages/prerender-fargate/lib/prerender-fargate-options.ts index af28261a..7e9fc393 100644 --- a/packages/prerender-fargate/lib/prerender-fargate-options.ts +++ b/packages/prerender-fargate/lib/prerender-fargate-options.ts @@ -126,6 +126,20 @@ export interface PrerenderFargateOptions { * @default - AWS generated load balancer name */ loadBalancerName?: string; + + /** + * A name for the recache queue + * + * @default CloudFormation-generated name + */ + queueName?: string; + + /** + * A name for the API Gateway RestApi resource. + * + * @default - ID of the RestApi construct. + */ + restApiName?: string; } /** diff --git a/packages/prerender-fargate/lib/prerender-fargate.ts b/packages/prerender-fargate/lib/prerender-fargate.ts index 5f343b07..d5ca41e4 100644 --- a/packages/prerender-fargate/lib/prerender-fargate.ts +++ b/packages/prerender-fargate/lib/prerender-fargate.ts @@ -91,6 +91,8 @@ export class PrerenderFargate extends Construct { enableRecache, enablePrerenderHeader, usePrivateSubnets, + queueName, + restApiName, } = props; // Create bucket for prerender storage @@ -253,6 +255,8 @@ export class PrerenderFargate extends Construct { maxConcurrentExecutions: prerenderFargateRecachingOptions?.maxConcurrentExecutions || 1, tokenSecret, + queueName, + restApiName, }); } } diff --git a/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.ts b/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.ts index ba375cc7..3183cd54 100644 --- a/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.ts +++ b/packages/prerender-fargate/lib/recaching/prerender-recache-api-construct.ts @@ -30,6 +30,13 @@ export interface PrerenderRecacheApiOptions { * @default CloudFormation-generated name */ queueName?: string; + + /** + * A name for the API Gateway RestApi resource. + * + * @default - ID of the RestApi construct. + */ + restApiName?: string; } /** @@ -78,6 +85,8 @@ export class PrerenderRecacheApi extends Construct { this.api = new LambdaRestApi(this, "prerenderRecacheApi", { handler: apiHandler, proxy: false, + restApiName: + options.restApiName !== undefined ? options.restApiName : undefined, }); const recache = this.api.root.addResource("recache");