forked from aws/aws-cdk
/
integ.base-path-mapping.ts
46 lines (36 loc) · 1.13 KB
/
integ.base-path-mapping.ts
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
34
35
36
37
38
39
40
41
42
43
44
45
46
import * as cdk from '@aws-cdk/core';
import { IntegTest } from '@aws-cdk/integ-tests';
import * as apigateway from '../lib';
export class TestStack extends cdk.Stack {
constructor(scope: cdk.App, id: string) {
super(scope, id);
const restApi = new apigateway.RestApi(this, 'Api');
restApi.root.addMethod('GET');
const domainName = apigateway.DomainName.fromDomainNameAttributes(this, 'Domain', {
domainName: 'domainName',
domainNameAliasHostedZoneId: 'domainNameAliasHostedZoneId',
domainNameAliasTarget: 'domainNameAliasTarget',
});
new apigateway.BasePathMapping(this, 'MappingOne', {
domainName,
restApi,
});
new apigateway.BasePathMapping(this, 'MappingTwo', {
domainName,
restApi,
basePath: 'path',
attachToStage: false,
});
new apigateway.BasePathMapping(this, 'MappingThree', {
domainName,
restApi,
basePath: 'api/v1/multi-level-path',
attachToStage: false,
});
}
}
const app = new cdk.App();
const testStack = new TestStack(app, 'test-stack');
new IntegTest(app, 'base-path-mapping', {
testCases: [testStack],
});