-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathapi-rest-include-stack.ts
More file actions
33 lines (29 loc) · 952 Bytes
/
api-rest-include-stack.ts
File metadata and controls
33 lines (29 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { CfnDeployment, CfnRestApi } from 'aws-cdk-lib/aws-apigateway';
import { IncludedNestedStack } from 'aws-cdk-lib/cloudformation-include';
import { BaseIncludedStack } from '../base-included-stack';
export class APIRestIncludedStack
extends BaseIncludedStack {
resourceName: string;
constructor(includedStack: IncludedNestedStack, resourceName: string) {
super(includedStack);
this.resourceName = resourceName;
}
/**
* Gets the RestApi of the API stack
* @returns {CfnRestApi}
* @throws {CfnResourceNotFoundError} if not found
*/
restAPI(): CfnRestApi {
return this.getResourceConstruct<CfnRestApi>(this.resourceName);
}
/**
* Gets the Deployment of the Rest API
* @returns {CfnDeployment}
* @throws {CfnResourceNotFoundError} if not found
*/
apiDeployment(): CfnDeployment {
return this.getResourceConstruct<CfnDeployment>(
`DeploymentAPIGW${this.resourceName}`,
);
}
}