@gradientedge/cdk-utils 8.136.0 → 8.137.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/lib/cloudflare/services/zone/main.d.ts +59 -2
- package/dist/src/lib/cloudflare/services/zone/main.js +144 -0
- package/dist/src/lib/cloudflare/services/zone/types.d.ts +22 -0
- package/package.json +12 -12
- package/src/lib/cloudflare/services/zone/main.ts +176 -2
- package/src/lib/cloudflare/services/zone/types.ts +16 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataCloudflareZone } from '@cdktf/provider-cloudflare/lib/data-cloudflare-zone';
|
|
2
|
+
import { Zone } from '@cdktf/provider-cloudflare/lib/zone';
|
|
3
|
+
import { ZoneCacheReserve } from '@cdktf/provider-cloudflare/lib/zone-cache-reserve';
|
|
4
|
+
import { ZoneCacheVariants } from '@cdktf/provider-cloudflare/lib/zone-cache-variants';
|
|
5
|
+
import { ZoneDnssec } from '@cdktf/provider-cloudflare/lib/zone-dnssec';
|
|
6
|
+
import { ZoneHold } from '@cdktf/provider-cloudflare/lib/zone-hold';
|
|
7
|
+
import { ZoneLockdown } from '@cdktf/provider-cloudflare/lib/zone-lockdown';
|
|
8
|
+
import { ZoneSettingsOverride } from '@cdktf/provider-cloudflare/lib/zone-settings-override';
|
|
2
9
|
import { CommonCloudflareConstruct } from '../../common';
|
|
10
|
+
import { ZoneCacheReserveProps, ZoneCacheVariantsProps, ZoneDnssecProps, ZoneHoldProps, ZoneLockdownProps, ZoneOptions, ZoneProps, ZoneSettingsOverrideProps } from './types';
|
|
3
11
|
/**
|
|
4
12
|
* @classdesc Provides operations on Cloudflare Zone
|
|
5
13
|
* - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
|
|
@@ -25,5 +33,54 @@ export declare class CloudflareZoneManager {
|
|
|
25
33
|
* @param props zone properties
|
|
26
34
|
* @see [CDKTF Zone Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zone.typescript.md}
|
|
27
35
|
*/
|
|
28
|
-
createZone(id: string, scope: CommonCloudflareConstruct, props: ZoneProps):
|
|
36
|
+
createZone(id: string, scope: CommonCloudflareConstruct, props: ZoneProps): Zone;
|
|
37
|
+
resolveZone(id: string, scope: CommonCloudflareConstruct, options: ZoneOptions): DataCloudflareZone;
|
|
38
|
+
/**
|
|
39
|
+
* @summary Method to create a new zone cache reserve
|
|
40
|
+
* @param id scoped id of the resource
|
|
41
|
+
* @param scope scope in which this resource is defined
|
|
42
|
+
* @param props zone cache reserve properties
|
|
43
|
+
* @see [CDKTF Zone Cache Reserve Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneCacheReserve.typescript.md}
|
|
44
|
+
*/
|
|
45
|
+
createZoneCacheReserve(id: string, scope: CommonCloudflareConstruct, props: ZoneCacheReserveProps): ZoneCacheReserve;
|
|
46
|
+
/**
|
|
47
|
+
* @summary Method to create a new zone cache variants
|
|
48
|
+
* @param id scoped id of the resource
|
|
49
|
+
* @param scope scope in which this resource is defined
|
|
50
|
+
* @param props zone cache variants properties
|
|
51
|
+
* @see [CDKTF Zone Cache Variants Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneCacheVariants.typescript.md}
|
|
52
|
+
*/
|
|
53
|
+
createZoneCacheVariants(id: string, scope: CommonCloudflareConstruct, props: ZoneCacheVariantsProps): ZoneCacheVariants;
|
|
54
|
+
/**
|
|
55
|
+
* @summary Method to create a new zone dnssec
|
|
56
|
+
* @param id scoped id of the resource
|
|
57
|
+
* @param scope scope in which this resource is defined
|
|
58
|
+
* @param props zone dnssec properties
|
|
59
|
+
* @see [CDKTF Zone DNS Security Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneDnssec.typescript.md}
|
|
60
|
+
*/
|
|
61
|
+
createZoneDnssec(id: string, scope: CommonCloudflareConstruct, props: ZoneDnssecProps): ZoneDnssec;
|
|
62
|
+
/**
|
|
63
|
+
* @summary Method to create a new zone hold
|
|
64
|
+
* @param id scoped id of the resource
|
|
65
|
+
* @param scope scope in which this resource is defined
|
|
66
|
+
* @param props zone hold properties
|
|
67
|
+
* @see [CDKTF Zone Hold Security Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneHold.typescript.md}
|
|
68
|
+
*/
|
|
69
|
+
createZoneHold(id: string, scope: CommonCloudflareConstruct, props: ZoneHoldProps): ZoneHold;
|
|
70
|
+
/**
|
|
71
|
+
* @summary Method to create a new zone lockdown
|
|
72
|
+
* @param id scoped id of the resource
|
|
73
|
+
* @param scope scope in which this resource is defined
|
|
74
|
+
* @param props zone lockdown properties
|
|
75
|
+
* @see [CDKTF Zone Lockdown Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneLockdown.typescript.md}
|
|
76
|
+
*/
|
|
77
|
+
createZoneLockdown(id: string, scope: CommonCloudflareConstruct, props: ZoneLockdownProps): ZoneLockdown;
|
|
78
|
+
/**
|
|
79
|
+
* @summary Method to create a new zone settings override
|
|
80
|
+
* @param id scoped id of the resource
|
|
81
|
+
* @param scope scope in which this resource is defined
|
|
82
|
+
* @param props zone settings override properties
|
|
83
|
+
* @see [CDKTF Zone Settings Override Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneSettingsOverride.typescript.md}
|
|
84
|
+
*/
|
|
85
|
+
createZoneSettingsOverride(id: string, scope: CommonCloudflareConstruct, props: ZoneSettingsOverrideProps): ZoneSettingsOverride;
|
|
29
86
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CloudflareZoneManager = void 0;
|
|
4
|
+
const data_cloudflare_zone_1 = require("@cdktf/provider-cloudflare/lib/data-cloudflare-zone");
|
|
4
5
|
const zone_1 = require("@cdktf/provider-cloudflare/lib/zone");
|
|
6
|
+
const zone_cache_reserve_1 = require("@cdktf/provider-cloudflare/lib/zone-cache-reserve");
|
|
7
|
+
const zone_cache_variants_1 = require("@cdktf/provider-cloudflare/lib/zone-cache-variants");
|
|
8
|
+
const zone_dnssec_1 = require("@cdktf/provider-cloudflare/lib/zone-dnssec");
|
|
9
|
+
const zone_hold_1 = require("@cdktf/provider-cloudflare/lib/zone-hold");
|
|
10
|
+
const zone_lockdown_1 = require("@cdktf/provider-cloudflare/lib/zone-lockdown");
|
|
11
|
+
const zone_settings_override_1 = require("@cdktf/provider-cloudflare/lib/zone-settings-override");
|
|
5
12
|
const utils_1 = require("../../utils");
|
|
6
13
|
/**
|
|
7
14
|
* @classdesc Provides operations on Cloudflare Zone
|
|
@@ -39,6 +46,143 @@ class CloudflareZoneManager {
|
|
|
39
46
|
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneName`, scope, zone.zone);
|
|
40
47
|
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneFriendlyUniqueId`, scope, zone.friendlyUniqueId);
|
|
41
48
|
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneId`, scope, zone.id);
|
|
49
|
+
return zone;
|
|
50
|
+
}
|
|
51
|
+
resolveZone(id, scope, options) {
|
|
52
|
+
if (!options)
|
|
53
|
+
throw `Options undefined for ${id}`;
|
|
54
|
+
const zone = new data_cloudflare_zone_1.DataCloudflareZone(scope, `${id}-data-zone`, {
|
|
55
|
+
accountId: scope.props.accountId,
|
|
56
|
+
name: options.name ?? scope.props.domainName,
|
|
57
|
+
zoneId: options.id,
|
|
58
|
+
});
|
|
59
|
+
return zone;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @summary Method to create a new zone cache reserve
|
|
63
|
+
* @param id scoped id of the resource
|
|
64
|
+
* @param scope scope in which this resource is defined
|
|
65
|
+
* @param props zone cache reserve properties
|
|
66
|
+
* @see [CDKTF Zone Cache Reserve Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneCacheReserve.typescript.md}
|
|
67
|
+
*/
|
|
68
|
+
createZoneCacheReserve(id, scope, props) {
|
|
69
|
+
if (!props)
|
|
70
|
+
throw `Props undefined for ${id}`;
|
|
71
|
+
const zoneId = props.zoneId
|
|
72
|
+
? props.zoneId
|
|
73
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
|
|
74
|
+
const zoneCacheReserve = new zone_cache_reserve_1.ZoneCacheReserve(scope, `${id}`, {
|
|
75
|
+
...props,
|
|
76
|
+
zoneId,
|
|
77
|
+
});
|
|
78
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneCacheReserveFriendlyUniqueId`, scope, zoneCacheReserve.friendlyUniqueId);
|
|
79
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneCacheReserveId`, scope, zoneCacheReserve.id);
|
|
80
|
+
return zoneCacheReserve;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @summary Method to create a new zone cache variants
|
|
84
|
+
* @param id scoped id of the resource
|
|
85
|
+
* @param scope scope in which this resource is defined
|
|
86
|
+
* @param props zone cache variants properties
|
|
87
|
+
* @see [CDKTF Zone Cache Variants Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneCacheVariants.typescript.md}
|
|
88
|
+
*/
|
|
89
|
+
createZoneCacheVariants(id, scope, props) {
|
|
90
|
+
if (!props)
|
|
91
|
+
throw `Props undefined for ${id}`;
|
|
92
|
+
const zoneId = props.zoneId
|
|
93
|
+
? props.zoneId
|
|
94
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
|
|
95
|
+
const zoneCacheVariants = new zone_cache_variants_1.ZoneCacheVariants(scope, `${id}`, {
|
|
96
|
+
...props,
|
|
97
|
+
zoneId,
|
|
98
|
+
});
|
|
99
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneCacheVariantsFriendlyUniqueId`, scope, zoneCacheVariants.friendlyUniqueId);
|
|
100
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneCacheVariantsId`, scope, zoneCacheVariants.id);
|
|
101
|
+
return zoneCacheVariants;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* @summary Method to create a new zone dnssec
|
|
105
|
+
* @param id scoped id of the resource
|
|
106
|
+
* @param scope scope in which this resource is defined
|
|
107
|
+
* @param props zone dnssec properties
|
|
108
|
+
* @see [CDKTF Zone DNS Security Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneDnssec.typescript.md}
|
|
109
|
+
*/
|
|
110
|
+
createZoneDnssec(id, scope, props) {
|
|
111
|
+
if (!props)
|
|
112
|
+
throw `Props undefined for ${id}`;
|
|
113
|
+
const zoneId = props.zoneId
|
|
114
|
+
? props.zoneId
|
|
115
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
|
|
116
|
+
const zoneDnssec = new zone_dnssec_1.ZoneDnssec(scope, `${id}`, {
|
|
117
|
+
...props,
|
|
118
|
+
zoneId,
|
|
119
|
+
});
|
|
120
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneDnssecFriendlyUniqueId`, scope, zoneDnssec.friendlyUniqueId);
|
|
121
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneDnssecId`, scope, zoneDnssec.id);
|
|
122
|
+
return zoneDnssec;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* @summary Method to create a new zone hold
|
|
126
|
+
* @param id scoped id of the resource
|
|
127
|
+
* @param scope scope in which this resource is defined
|
|
128
|
+
* @param props zone hold properties
|
|
129
|
+
* @see [CDKTF Zone Hold Security Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneHold.typescript.md}
|
|
130
|
+
*/
|
|
131
|
+
createZoneHold(id, scope, props) {
|
|
132
|
+
if (!props)
|
|
133
|
+
throw `Props undefined for ${id}`;
|
|
134
|
+
const zoneId = props.zoneId
|
|
135
|
+
? props.zoneId
|
|
136
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
|
|
137
|
+
const zoneHold = new zone_hold_1.ZoneHold(scope, `${id}`, {
|
|
138
|
+
...props,
|
|
139
|
+
zoneId,
|
|
140
|
+
});
|
|
141
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneHoldFriendlyUniqueId`, scope, zoneHold.friendlyUniqueId);
|
|
142
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneHoldId`, scope, zoneHold.id);
|
|
143
|
+
return zoneHold;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* @summary Method to create a new zone lockdown
|
|
147
|
+
* @param id scoped id of the resource
|
|
148
|
+
* @param scope scope in which this resource is defined
|
|
149
|
+
* @param props zone lockdown properties
|
|
150
|
+
* @see [CDKTF Zone Lockdown Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneLockdown.typescript.md}
|
|
151
|
+
*/
|
|
152
|
+
createZoneLockdown(id, scope, props) {
|
|
153
|
+
if (!props)
|
|
154
|
+
throw `Props undefined for ${id}`;
|
|
155
|
+
const zoneId = props.zoneId
|
|
156
|
+
? props.zoneId
|
|
157
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
|
|
158
|
+
const zoneLockdown = new zone_lockdown_1.ZoneLockdown(scope, `${id}`, {
|
|
159
|
+
...props,
|
|
160
|
+
zoneId,
|
|
161
|
+
});
|
|
162
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneLockdownFriendlyUniqueId`, scope, zoneLockdown.friendlyUniqueId);
|
|
163
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneLockdownId`, scope, zoneLockdown.id);
|
|
164
|
+
return zoneLockdown;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @summary Method to create a new zone settings override
|
|
168
|
+
* @param id scoped id of the resource
|
|
169
|
+
* @param scope scope in which this resource is defined
|
|
170
|
+
* @param props zone settings override properties
|
|
171
|
+
* @see [CDKTF Zone Settings Override Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneSettingsOverride.typescript.md}
|
|
172
|
+
*/
|
|
173
|
+
createZoneSettingsOverride(id, scope, props) {
|
|
174
|
+
if (!props)
|
|
175
|
+
throw `Props undefined for ${id}`;
|
|
176
|
+
const zoneId = props.zoneId
|
|
177
|
+
? props.zoneId
|
|
178
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
|
|
179
|
+
const zoneSettingsOverride = new zone_settings_override_1.ZoneSettingsOverride(scope, `${id}`, {
|
|
180
|
+
...props,
|
|
181
|
+
zoneId,
|
|
182
|
+
});
|
|
183
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneSettingsOverrideFriendlyUniqueId`, scope, zoneSettingsOverride.friendlyUniqueId);
|
|
184
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-zoneSettingsOverrideId`, scope, zoneSettingsOverride.id);
|
|
185
|
+
return zoneSettingsOverride;
|
|
42
186
|
}
|
|
43
187
|
}
|
|
44
188
|
exports.CloudflareZoneManager = CloudflareZoneManager;
|
|
@@ -1,3 +1,25 @@
|
|
|
1
1
|
import { ZoneConfig } from '@cdktf/provider-cloudflare/lib/zone';
|
|
2
|
+
import { ZoneCacheReserveConfig } from '@cdktf/provider-cloudflare/lib/zone-cache-reserve';
|
|
3
|
+
import { ZoneCacheVariantsConfig } from '@cdktf/provider-cloudflare/lib/zone-cache-variants';
|
|
4
|
+
import { ZoneDnssecConfig } from '@cdktf/provider-cloudflare/lib/zone-dnssec';
|
|
5
|
+
import { ZoneHoldConfig } from '@cdktf/provider-cloudflare/lib/zone-hold';
|
|
6
|
+
import { ZoneLockdownConfig } from '@cdktf/provider-cloudflare/lib/zone-lockdown';
|
|
7
|
+
import { ZoneSettingsOverrideConfig } from '@cdktf/provider-cloudflare/lib/zone-settings-override';
|
|
2
8
|
export interface ZoneProps extends ZoneConfig {
|
|
3
9
|
}
|
|
10
|
+
export interface ZoneOptions {
|
|
11
|
+
id?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ZoneCacheReserveProps extends ZoneCacheReserveConfig {
|
|
15
|
+
}
|
|
16
|
+
export interface ZoneCacheVariantsProps extends ZoneCacheVariantsConfig {
|
|
17
|
+
}
|
|
18
|
+
export interface ZoneDnssecProps extends ZoneDnssecConfig {
|
|
19
|
+
}
|
|
20
|
+
export interface ZoneHoldProps extends ZoneHoldConfig {
|
|
21
|
+
}
|
|
22
|
+
export interface ZoneLockdownProps extends ZoneLockdownConfig {
|
|
23
|
+
}
|
|
24
|
+
export interface ZoneSettingsOverrideProps extends ZoneSettingsOverrideConfig {
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.137.0",
|
|
4
4
|
"description": "Utilities for AWS CDK provisioning",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
51
|
-
"@aws-sdk/credential-providers": "^3.
|
|
52
|
-
"@aws-sdk/types": "^3.
|
|
53
|
-
"@cdktf/provider-azurerm": "^11.0.
|
|
50
|
+
"@aws-sdk/client-secrets-manager": "^3.454.0",
|
|
51
|
+
"@aws-sdk/credential-providers": "^3.454.0",
|
|
52
|
+
"@aws-sdk/types": "^3.451.0",
|
|
53
|
+
"@cdktf/provider-azurerm": "^11.0.5",
|
|
54
54
|
"@cdktf/provider-cloudflare": "^10.0.3",
|
|
55
55
|
"@types/lodash": "^4.14.201",
|
|
56
|
-
"@types/node": "^20.9.
|
|
56
|
+
"@types/node": "^20.9.2",
|
|
57
57
|
"@types/uuid": "^9.0.7",
|
|
58
58
|
"app-root-path": "^3.1.0",
|
|
59
|
-
"aws-cdk-lib": "^2.
|
|
59
|
+
"aws-cdk-lib": "^2.110.0",
|
|
60
60
|
"cdktf": "^0.19.1",
|
|
61
61
|
"constructs": "^10.3.0",
|
|
62
62
|
"lodash": "^4.17.21",
|
|
@@ -71,15 +71,15 @@
|
|
|
71
71
|
"@babel/eslint-parser": "^7.23.3",
|
|
72
72
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
73
73
|
"@types/jest": "^29.5.8",
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
75
|
-
"@typescript-eslint/parser": "^6.
|
|
76
|
-
"aws-cdk": "^2.
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
|
75
|
+
"@typescript-eslint/parser": "^6.11.0",
|
|
76
|
+
"aws-cdk": "^2.110.0",
|
|
77
77
|
"better-docs": "^2.7.2",
|
|
78
78
|
"codecov": "^3.8.3",
|
|
79
79
|
"commitizen": "^4.3.0",
|
|
80
80
|
"docdash": "^2.0.2",
|
|
81
81
|
"dotenv": "^16.3.1",
|
|
82
|
-
"eslint": "^8.
|
|
82
|
+
"eslint": "^8.54.0",
|
|
83
83
|
"eslint-config-prettier": "^9.0.0",
|
|
84
84
|
"eslint-plugin-import": "^2.29.0",
|
|
85
85
|
"eslint-plugin-jsdoc": "^46.9.0",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"prettier": "^3.1.0",
|
|
96
96
|
"prettier-plugin-organize-imports": "^3.2.4",
|
|
97
97
|
"rimraf": "^5.0.5",
|
|
98
|
-
"semantic-release": "^22.0.
|
|
98
|
+
"semantic-release": "^22.0.8",
|
|
99
99
|
"taffydb": "^2.7.3",
|
|
100
100
|
"ts-jest": "^29.1.1",
|
|
101
101
|
"ts-node": "^10.9.1",
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
import { DataCloudflareZone } from '@cdktf/provider-cloudflare/lib/data-cloudflare-zone'
|
|
1
2
|
import { Zone } from '@cdktf/provider-cloudflare/lib/zone'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { ZoneCacheReserve } from '@cdktf/provider-cloudflare/lib/zone-cache-reserve'
|
|
4
|
+
import { ZoneCacheVariants } from '@cdktf/provider-cloudflare/lib/zone-cache-variants'
|
|
5
|
+
import { ZoneDnssec } from '@cdktf/provider-cloudflare/lib/zone-dnssec'
|
|
6
|
+
import { ZoneHold } from '@cdktf/provider-cloudflare/lib/zone-hold'
|
|
7
|
+
import { ZoneLockdown } from '@cdktf/provider-cloudflare/lib/zone-lockdown'
|
|
8
|
+
import { ZoneSettingsOverride } from '@cdktf/provider-cloudflare/lib/zone-settings-override'
|
|
4
9
|
import { CommonCloudflareConstruct } from '../../common'
|
|
10
|
+
import { createCloudflareTfOutput } from '../../utils'
|
|
11
|
+
import {
|
|
12
|
+
ZoneCacheReserveProps,
|
|
13
|
+
ZoneCacheVariantsProps,
|
|
14
|
+
ZoneDnssecProps,
|
|
15
|
+
ZoneHoldProps,
|
|
16
|
+
ZoneLockdownProps,
|
|
17
|
+
ZoneOptions,
|
|
18
|
+
ZoneProps,
|
|
19
|
+
ZoneSettingsOverrideProps,
|
|
20
|
+
} from './types'
|
|
5
21
|
|
|
6
22
|
/**
|
|
7
23
|
* @classdesc Provides operations on Cloudflare Zone
|
|
@@ -40,5 +56,163 @@ export class CloudflareZoneManager {
|
|
|
40
56
|
createCloudflareTfOutput(`${id}-zoneName`, scope, zone.zone)
|
|
41
57
|
createCloudflareTfOutput(`${id}-zoneFriendlyUniqueId`, scope, zone.friendlyUniqueId)
|
|
42
58
|
createCloudflareTfOutput(`${id}-zoneId`, scope, zone.id)
|
|
59
|
+
|
|
60
|
+
return zone
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public resolveZone(id: string, scope: CommonCloudflareConstruct, options: ZoneOptions) {
|
|
64
|
+
if (!options) throw `Options undefined for ${id}`
|
|
65
|
+
|
|
66
|
+
const zone = new DataCloudflareZone(scope, `${id}-data-zone`, {
|
|
67
|
+
accountId: scope.props.accountId,
|
|
68
|
+
name: options.name ?? scope.props.domainName,
|
|
69
|
+
zoneId: options.id,
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
return zone
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @summary Method to create a new zone cache reserve
|
|
77
|
+
* @param id scoped id of the resource
|
|
78
|
+
* @param scope scope in which this resource is defined
|
|
79
|
+
* @param props zone cache reserve properties
|
|
80
|
+
* @see [CDKTF Zone Cache Reserve Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneCacheReserve.typescript.md}
|
|
81
|
+
*/
|
|
82
|
+
public createZoneCacheReserve(id: string, scope: CommonCloudflareConstruct, props: ZoneCacheReserveProps) {
|
|
83
|
+
if (!props) throw `Props undefined for ${id}`
|
|
84
|
+
|
|
85
|
+
const zoneId = props.zoneId
|
|
86
|
+
? props.zoneId
|
|
87
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
|
|
88
|
+
const zoneCacheReserve = new ZoneCacheReserve(scope, `${id}`, {
|
|
89
|
+
...props,
|
|
90
|
+
zoneId,
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
createCloudflareTfOutput(`${id}-zoneCacheReserveFriendlyUniqueId`, scope, zoneCacheReserve.friendlyUniqueId)
|
|
94
|
+
createCloudflareTfOutput(`${id}-zoneCacheReserveId`, scope, zoneCacheReserve.id)
|
|
95
|
+
|
|
96
|
+
return zoneCacheReserve
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @summary Method to create a new zone cache variants
|
|
101
|
+
* @param id scoped id of the resource
|
|
102
|
+
* @param scope scope in which this resource is defined
|
|
103
|
+
* @param props zone cache variants properties
|
|
104
|
+
* @see [CDKTF Zone Cache Variants Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneCacheVariants.typescript.md}
|
|
105
|
+
*/
|
|
106
|
+
public createZoneCacheVariants(id: string, scope: CommonCloudflareConstruct, props: ZoneCacheVariantsProps) {
|
|
107
|
+
if (!props) throw `Props undefined for ${id}`
|
|
108
|
+
|
|
109
|
+
const zoneId = props.zoneId
|
|
110
|
+
? props.zoneId
|
|
111
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
|
|
112
|
+
const zoneCacheVariants = new ZoneCacheVariants(scope, `${id}`, {
|
|
113
|
+
...props,
|
|
114
|
+
zoneId,
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
createCloudflareTfOutput(`${id}-zoneCacheVariantsFriendlyUniqueId`, scope, zoneCacheVariants.friendlyUniqueId)
|
|
118
|
+
createCloudflareTfOutput(`${id}-zoneCacheVariantsId`, scope, zoneCacheVariants.id)
|
|
119
|
+
|
|
120
|
+
return zoneCacheVariants
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @summary Method to create a new zone dnssec
|
|
125
|
+
* @param id scoped id of the resource
|
|
126
|
+
* @param scope scope in which this resource is defined
|
|
127
|
+
* @param props zone dnssec properties
|
|
128
|
+
* @see [CDKTF Zone DNS Security Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneDnssec.typescript.md}
|
|
129
|
+
*/
|
|
130
|
+
public createZoneDnssec(id: string, scope: CommonCloudflareConstruct, props: ZoneDnssecProps) {
|
|
131
|
+
if (!props) throw `Props undefined for ${id}`
|
|
132
|
+
|
|
133
|
+
const zoneId = props.zoneId
|
|
134
|
+
? props.zoneId
|
|
135
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
|
|
136
|
+
const zoneDnssec = new ZoneDnssec(scope, `${id}`, {
|
|
137
|
+
...props,
|
|
138
|
+
zoneId,
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
createCloudflareTfOutput(`${id}-zoneDnssecFriendlyUniqueId`, scope, zoneDnssec.friendlyUniqueId)
|
|
142
|
+
createCloudflareTfOutput(`${id}-zoneDnssecId`, scope, zoneDnssec.id)
|
|
143
|
+
|
|
144
|
+
return zoneDnssec
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @summary Method to create a new zone hold
|
|
149
|
+
* @param id scoped id of the resource
|
|
150
|
+
* @param scope scope in which this resource is defined
|
|
151
|
+
* @param props zone hold properties
|
|
152
|
+
* @see [CDKTF Zone Hold Security Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneHold.typescript.md}
|
|
153
|
+
*/
|
|
154
|
+
public createZoneHold(id: string, scope: CommonCloudflareConstruct, props: ZoneHoldProps) {
|
|
155
|
+
if (!props) throw `Props undefined for ${id}`
|
|
156
|
+
|
|
157
|
+
const zoneId = props.zoneId
|
|
158
|
+
? props.zoneId
|
|
159
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
|
|
160
|
+
const zoneHold = new ZoneHold(scope, `${id}`, {
|
|
161
|
+
...props,
|
|
162
|
+
zoneId,
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
createCloudflareTfOutput(`${id}-zoneHoldFriendlyUniqueId`, scope, zoneHold.friendlyUniqueId)
|
|
166
|
+
createCloudflareTfOutput(`${id}-zoneHoldId`, scope, zoneHold.id)
|
|
167
|
+
|
|
168
|
+
return zoneHold
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @summary Method to create a new zone lockdown
|
|
173
|
+
* @param id scoped id of the resource
|
|
174
|
+
* @param scope scope in which this resource is defined
|
|
175
|
+
* @param props zone lockdown properties
|
|
176
|
+
* @see [CDKTF Zone Lockdown Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneLockdown.typescript.md}
|
|
177
|
+
*/
|
|
178
|
+
public createZoneLockdown(id: string, scope: CommonCloudflareConstruct, props: ZoneLockdownProps) {
|
|
179
|
+
if (!props) throw `Props undefined for ${id}`
|
|
180
|
+
|
|
181
|
+
const zoneId = props.zoneId
|
|
182
|
+
? props.zoneId
|
|
183
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
|
|
184
|
+
const zoneLockdown = new ZoneLockdown(scope, `${id}`, {
|
|
185
|
+
...props,
|
|
186
|
+
zoneId,
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
createCloudflareTfOutput(`${id}-zoneLockdownFriendlyUniqueId`, scope, zoneLockdown.friendlyUniqueId)
|
|
190
|
+
createCloudflareTfOutput(`${id}-zoneLockdownId`, scope, zoneLockdown.id)
|
|
191
|
+
|
|
192
|
+
return zoneLockdown
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @summary Method to create a new zone settings override
|
|
197
|
+
* @param id scoped id of the resource
|
|
198
|
+
* @param scope scope in which this resource is defined
|
|
199
|
+
* @param props zone settings override properties
|
|
200
|
+
* @see [CDKTF Zone Settings Override Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneSettingsOverride.typescript.md}
|
|
201
|
+
*/
|
|
202
|
+
public createZoneSettingsOverride(id: string, scope: CommonCloudflareConstruct, props: ZoneSettingsOverrideProps) {
|
|
203
|
+
if (!props) throw `Props undefined for ${id}`
|
|
204
|
+
|
|
205
|
+
const zoneId = props.zoneId
|
|
206
|
+
? props.zoneId
|
|
207
|
+
: this.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
|
|
208
|
+
const zoneSettingsOverride = new ZoneSettingsOverride(scope, `${id}`, {
|
|
209
|
+
...props,
|
|
210
|
+
zoneId,
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
createCloudflareTfOutput(`${id}-zoneSettingsOverrideFriendlyUniqueId`, scope, zoneSettingsOverride.friendlyUniqueId)
|
|
214
|
+
createCloudflareTfOutput(`${id}-zoneSettingsOverrideId`, scope, zoneSettingsOverride.id)
|
|
215
|
+
|
|
216
|
+
return zoneSettingsOverride
|
|
43
217
|
}
|
|
44
218
|
}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
import { ZoneConfig } from '@cdktf/provider-cloudflare/lib/zone'
|
|
2
|
+
import { ZoneCacheReserveConfig } from '@cdktf/provider-cloudflare/lib/zone-cache-reserve'
|
|
3
|
+
import { ZoneCacheVariantsConfig } from '@cdktf/provider-cloudflare/lib/zone-cache-variants'
|
|
4
|
+
import { ZoneDnssecConfig } from '@cdktf/provider-cloudflare/lib/zone-dnssec'
|
|
5
|
+
import { ZoneHoldConfig } from '@cdktf/provider-cloudflare/lib/zone-hold'
|
|
6
|
+
import { ZoneLockdownConfig } from '@cdktf/provider-cloudflare/lib/zone-lockdown'
|
|
7
|
+
import { ZoneSettingsOverrideConfig } from '@cdktf/provider-cloudflare/lib/zone-settings-override'
|
|
2
8
|
|
|
3
9
|
export interface ZoneProps extends ZoneConfig {}
|
|
10
|
+
export interface ZoneOptions {
|
|
11
|
+
id?: string
|
|
12
|
+
name?: string
|
|
13
|
+
}
|
|
14
|
+
export interface ZoneCacheReserveProps extends ZoneCacheReserveConfig {}
|
|
15
|
+
export interface ZoneCacheVariantsProps extends ZoneCacheVariantsConfig {}
|
|
16
|
+
export interface ZoneDnssecProps extends ZoneDnssecConfig {}
|
|
17
|
+
export interface ZoneHoldProps extends ZoneHoldConfig {}
|
|
18
|
+
export interface ZoneLockdownProps extends ZoneLockdownConfig {}
|
|
19
|
+
export interface ZoneSettingsOverrideProps extends ZoneSettingsOverrideConfig {}
|