UNPKG

7.86 kBTypeScriptView Raw
1import * as ec2 from '@aws-cdk/aws-ec2';
2import * as iam from '@aws-cdk/aws-iam';
3import { Duration, Resource } from '@aws-cdk/core';
4import { Construct } from 'constructs';
5import { HostedZoneProviderProps } from './hosted-zone-provider';
6import { HostedZoneAttributes, IHostedZone, PublicHostedZoneAttributes } from './hosted-zone-ref';
7import { CfnHostedZone } from './route53.generated';
8/**
9 * Common properties to create a Route 53 hosted zone
10 */
11export interface CommonHostedZoneProps {
12 /**
13 * The name of the domain. For resource record types that include a domain
14 * name, specify a fully qualified domain name.
15 */
16 readonly zoneName: string;
17 /**
18 * Any comments that you want to include about the hosted zone.
19 *
20 * @default none
21 */
22 readonly comment?: string;
23 /**
24 * The Amazon Resource Name (ARN) for the log group that you want Amazon Route 53 to send query logs to.
25 *
26 * @default disabled
27 */
28 readonly queryLogsLogGroupArn?: string;
29}
30/**
31 * Properties of a new hosted zone
32 */
33export interface HostedZoneProps extends CommonHostedZoneProps {
34 /**
35 * A VPC that you want to associate with this hosted zone. When you specify
36 * this property, a private hosted zone will be created.
37 *
38 * You can associate additional VPCs to this private zone using `addVpc(vpc)`.
39 *
40 * @default public (no VPCs associated)
41 */
42 readonly vpcs?: ec2.IVpc[];
43}
44/**
45 * Container for records, and records contain information about how to route traffic for a
46 * specific domain, such as example.com and its subdomains (acme.example.com, zenith.example.com)
47 */
48export declare class HostedZone extends Resource implements IHostedZone {
49 get hostedZoneArn(): string;
50 /**
51 * Import a Route 53 hosted zone defined either outside the CDK, or in a different CDK stack
52 *
53 * Use when hosted zone ID is known. Hosted zone name becomes unavailable through this query.
54 *
55 * @param scope the parent Construct for this Construct
56 * @param id the logical name of this Construct
57 * @param hostedZoneId the ID of the hosted zone to import
58 */
59 static fromHostedZoneId(scope: Construct, id: string, hostedZoneId: string): IHostedZone;
60 /**
61 * Imports a hosted zone from another stack.
62 *
63 * Use when both hosted zone ID and hosted zone name are known.
64 *
65 * @param scope the parent Construct for this Construct
66 * @param id the logical name of this Construct
67 * @param attrs the HostedZoneAttributes (hosted zone ID and hosted zone name)
68 */
69 static fromHostedZoneAttributes(scope: Construct, id: string, attrs: HostedZoneAttributes): IHostedZone;
70 /**
71 * Lookup a hosted zone in the current account/region based on query parameters.
72 * Requires environment, you must specify env for the stack.
73 *
74 * Use to easily query hosted zones.
75 *
76 * @see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
77 */
78 static fromLookup(scope: Construct, id: string, query: HostedZoneProviderProps): IHostedZone;
79 readonly hostedZoneId: string;
80 readonly zoneName: string;
81 readonly hostedZoneNameServers?: string[];
82 /**
83 * VPCs to which this hosted zone will be added
84 */
85 protected readonly vpcs: CfnHostedZone.VPCProperty[];
86 constructor(scope: Construct, id: string, props: HostedZoneProps);
87 /**
88 * Add another VPC to this private hosted zone.
89 *
90 * @param vpc the other VPC to add.
91 */
92 addVpc(vpc: ec2.IVpc): void;
93}
94/**
95 * Construction properties for a PublicHostedZone.
96 */
97export interface PublicHostedZoneProps extends CommonHostedZoneProps {
98 /**
99 * Whether to create a CAA record to restrict certificate authorities allowed
100 * to issue certificates for this domain to Amazon only.
101 *
102 * @default false
103 */
104 readonly caaAmazon?: boolean;
105 /**
106 * A principal which is trusted to assume a role for zone delegation
107 *
108 * @default - No delegation configuration
109 */
110 readonly crossAccountZoneDelegationPrincipal?: iam.IPrincipal;
111 /**
112 * The name of the role created for cross account delegation
113 *
114 * @default - A role name is generated automatically
115 */
116 readonly crossAccountZoneDelegationRoleName?: string;
117}
118/**
119 * Represents a Route 53 public hosted zone
120 */
121export interface IPublicHostedZone extends IHostedZone {
122}
123/**
124 * Create a Route53 public hosted zone.
125 *
126 * @resource AWS::Route53::HostedZone
127 */
128export declare class PublicHostedZone extends HostedZone implements IPublicHostedZone {
129 /**
130 * Import a Route 53 public hosted zone defined either outside the CDK, or in a different CDK stack
131 *
132 * @param scope the parent Construct for this Construct
133 * @param id the logical name of this Construct
134 * @param publicHostedZoneId the ID of the public hosted zone to import
135 */
136 static fromPublicHostedZoneId(scope: Construct, id: string, publicHostedZoneId: string): IPublicHostedZone;
137 /**
138 * Imports a public hosted zone from another stack.
139 *
140 * Use when both hosted zone ID and hosted zone name are known.
141 *
142 * @param scope the parent Construct for this Construct
143 * @param id the logical name of this Construct
144 * @param attrs the PublicHostedZoneAttributes (hosted zone ID and hosted zone name)
145 */
146 static fromPublicHostedZoneAttributes(scope: Construct, id: string, attrs: PublicHostedZoneAttributes): IHostedZone;
147 /**
148 * Role for cross account zone delegation
149 */
150 readonly crossAccountZoneDelegationRole?: iam.Role;
151 constructor(scope: Construct, id: string, props: PublicHostedZoneProps);
152 addVpc(_vpc: ec2.IVpc): void;
153 /**
154 * Adds a delegation from this zone to a designated zone.
155 *
156 * @param delegate the zone being delegated to.
157 * @param opts options for creating the DNS record, if any.
158 */
159 addDelegation(delegate: IPublicHostedZone, opts?: ZoneDelegationOptions): void;
160}
161/**
162 * Options available when creating a delegation relationship from one PublicHostedZone to another.
163 */
164export interface ZoneDelegationOptions {
165 /**
166 * A comment to add on the DNS record created to incorporate the delegation.
167 *
168 * @default none
169 */
170 readonly comment?: string;
171 /**
172 * The TTL (Time To Live) of the DNS delegation record in DNS caches.
173 *
174 * @default 172800
175 */
176 readonly ttl?: Duration;
177}
178/**
179 * Properties to create a Route 53 private hosted zone
180 */
181export interface PrivateHostedZoneProps extends CommonHostedZoneProps {
182 /**
183 * A VPC that you want to associate with this hosted zone.
184 *
185 * Private hosted zones must be associated with at least one VPC. You can
186 * associated additional VPCs using `addVpc(vpc)`.
187 */
188 readonly vpc: ec2.IVpc;
189}
190/**
191 * Represents a Route 53 private hosted zone
192 */
193export interface IPrivateHostedZone extends IHostedZone {
194}
195/**
196 * Create a Route53 private hosted zone for use in one or more VPCs.
197 *
198 * Note that `enableDnsHostnames` and `enableDnsSupport` must have been enabled
199 * for the VPC you're configuring for private hosted zones.
200 *
201 * @resource AWS::Route53::HostedZone
202 */
203export declare class PrivateHostedZone extends HostedZone implements IPrivateHostedZone {
204 /**
205 * Import a Route 53 private hosted zone defined either outside the CDK, or in a different CDK stack
206 *
207 * @param scope the parent Construct for this Construct
208 * @param id the logical name of this Construct
209 * @param privateHostedZoneId the ID of the private hosted zone to import
210 */
211 static fromPrivateHostedZoneId(scope: Construct, id: string, privateHostedZoneId: string): IPrivateHostedZone;
212 constructor(scope: Construct, id: string, props: PrivateHostedZoneProps);
213}