Skip to content

Commit 78daec4

Browse files
committed
expose internal constructs
1 parent 6bcde01 commit 78daec4

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

packages/constructs/edge-api/src/edge-api.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ import { EdgeAPIProps, Endpoint } from './types'
44
import { ProductionEdgeAPI } from './production-edge-api'
55
import { RecordTarget } from 'aws-cdk-lib/aws-route53'
66
import { DevEdgeAPI } from './dev-edge-api'
7+
import { Distribution } from 'aws-cdk-lib/aws-cloudfront'
8+
import { HttpApi } from '@aws-cdk/aws-apigatewayv2-alpha'
9+
710
export class EdgeAPI extends Construct {
811
private api: ProductionEdgeAPI | DevEdgeAPI
912
route53Target: RecordTarget
13+
_distribution?: Distribution
14+
_httpApi?: HttpApi
1015

1116
constructor(scope: Construct, id: string, props: EdgeAPIProps) {
1217
super(scope, id)
@@ -22,6 +27,12 @@ export class EdgeAPI extends Construct {
2227
}
2328
this.api = props.devMode ? new DevEdgeAPI(this, 'api', props) : new ProductionEdgeAPI(this, 'api', props)
2429
this.route53Target = this.api.r53Target
30+
if (this.api instanceof ProductionEdgeAPI) {
31+
this._distribution = this.api.distribution
32+
}
33+
if (this.api instanceof DevEdgeAPI) {
34+
this._httpApi = this.api.api
35+
}
2536
}
2637

2738
addEndpoint(endpoint: Endpoint) {

0 commit comments

Comments
 (0)