forked from sampsasaarela/serverless-domain-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDomainInfo.ts
26 lines (22 loc) · 919 Bytes
/
DomainInfo.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
/**
* Wrapper class for Custom Domain information
*/
class DomainInfo {
public domainName: string;
public hostedZoneId: string;
/**
* Sometimes, the getDomainName call doesn't return either a distributionHostedZoneId or a regionalHostedZoneId.
* AFAICT, this only happens with edge-optimized endpoints.
* The hostedZoneId for these endpoints is always the one below.
* Docs: https://docs.aws.amazon.com/general/latest/gr/rande.html#apigateway_region
* PR: https://github.com/amplify-education/serverless-domain-manager/pull/171
*/
private defaultHostedZoneId: string = "Z2FDTNDATAQYW2";
constructor(data: any) {
this.domainName = data.distributionDomainName || data.regionalDomainName;
this.hostedZoneId = data.distributionHostedZoneId ||
data.regionalHostedZoneId ||
this.defaultHostedZoneId;
}
}
export = DomainInfo;