@gradientedge/cdk-utils 8.135.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.
Files changed (47) hide show
  1. package/dist/src/lib/azure/services/storage/main.d.ts +3 -1
  2. package/dist/src/lib/azure/services/storage/main.js +12 -10
  3. package/dist/src/lib/azure/services/storage/types.d.ts +3 -3
  4. package/dist/src/lib/azure/types/index.d.ts +1 -1
  5. package/dist/src/lib/azure/utils/index.d.ts +1 -1
  6. package/dist/src/lib/azure/utils/index.js +3 -3
  7. package/dist/src/lib/cloudflare/common/construct.d.ts +35 -0
  8. package/dist/src/lib/cloudflare/common/construct.js +49 -0
  9. package/dist/src/lib/cloudflare/common/index.d.ts +3 -0
  10. package/dist/src/lib/cloudflare/common/index.js +19 -0
  11. package/dist/src/lib/cloudflare/common/stack.d.ts +52 -0
  12. package/dist/src/lib/cloudflare/common/stack.js +134 -0
  13. package/dist/src/lib/cloudflare/common/types.d.ts +7 -0
  14. package/dist/src/lib/cloudflare/common/types.js +2 -0
  15. package/dist/src/lib/cloudflare/index.d.ts +4 -0
  16. package/dist/src/lib/cloudflare/index.js +20 -0
  17. package/dist/src/lib/cloudflare/services/index.d.ts +1 -0
  18. package/dist/src/lib/cloudflare/services/index.js +17 -0
  19. package/dist/src/lib/cloudflare/services/zone/index.d.ts +2 -0
  20. package/dist/src/lib/cloudflare/services/zone/index.js +18 -0
  21. package/dist/src/lib/cloudflare/services/zone/main.d.ts +86 -0
  22. package/dist/src/lib/cloudflare/services/zone/main.js +188 -0
  23. package/dist/src/lib/cloudflare/services/zone/types.d.ts +25 -0
  24. package/dist/src/lib/cloudflare/services/zone/types.js +2 -0
  25. package/dist/src/lib/cloudflare/types/index.d.ts +3 -0
  26. package/dist/src/lib/cloudflare/types/index.js +2 -0
  27. package/dist/src/lib/cloudflare/utils/index.d.ts +3 -0
  28. package/dist/src/lib/cloudflare/utils/index.js +20 -0
  29. package/dist/src/lib/index.d.ts +1 -0
  30. package/dist/src/lib/index.js +1 -0
  31. package/package.json +14 -12
  32. package/src/lib/azure/services/storage/main.ts +13 -11
  33. package/src/lib/azure/services/storage/types.ts +3 -3
  34. package/src/lib/azure/types/index.ts +1 -1
  35. package/src/lib/azure/utils/index.ts +1 -1
  36. package/src/lib/cloudflare/common/construct.ts +57 -0
  37. package/src/lib/cloudflare/common/index.ts +3 -0
  38. package/src/lib/cloudflare/common/stack.ts +143 -0
  39. package/src/lib/cloudflare/common/types.ts +8 -0
  40. package/src/lib/cloudflare/index.ts +4 -0
  41. package/src/lib/cloudflare/services/index.ts +1 -0
  42. package/src/lib/cloudflare/services/zone/index.ts +2 -0
  43. package/src/lib/cloudflare/services/zone/main.ts +218 -0
  44. package/src/lib/cloudflare/services/zone/types.ts +19 -0
  45. package/src/lib/cloudflare/types/index.ts +3 -0
  46. package/src/lib/cloudflare/utils/index.ts +23 -0
  47. package/src/lib/index.ts +1 -0
@@ -0,0 +1 @@
1
+ export * from './zone'
@@ -0,0 +1,2 @@
1
+ export * from './main'
2
+ export * from './types'
@@ -0,0 +1,218 @@
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'
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'
21
+
22
+ /**
23
+ * @classdesc Provides operations on Cloudflare Zone
24
+ * - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
25
+ * - If a custom construct extends {@link CommonCloudflareConstruct}, an instance is available within the context.
26
+ * @example
27
+ * ```
28
+ * import { CommonCloudflareConstruct, CommonCloudflareConstruct } from '@gradientedge/cdk-utils'
29
+ *
30
+ * class CustomConstruct extends CommonCloudflareConstruct {
31
+ * constructor(parent: Construct, id: string, props: CommonCloudflareStackProps) {
32
+ * super(parent, id, props)
33
+ * this.props = props
34
+ * this.zoneManager.createZone('MyZone', this, props)
35
+ * }
36
+ * }
37
+ * ```
38
+ */
39
+ export class CloudflareZoneManager {
40
+ /**
41
+ * @summary Method to create a new zone
42
+ * @param id scoped id of the resource
43
+ * @param scope scope in which this resource is defined
44
+ * @param props zone properties
45
+ * @see [CDKTF Zone Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zone.typescript.md}
46
+ */
47
+ public createZone(id: string, scope: CommonCloudflareConstruct, props: ZoneProps) {
48
+ if (!props) throw `Props undefined for ${id}`
49
+
50
+ const zone = new Zone(scope, `${id}`, {
51
+ ...props,
52
+ accountId: props.accountId ?? scope.props.accountId,
53
+ zone: props.zone ?? scope.props.domainName,
54
+ })
55
+
56
+ createCloudflareTfOutput(`${id}-zoneName`, scope, zone.zone)
57
+ createCloudflareTfOutput(`${id}-zoneFriendlyUniqueId`, scope, zone.friendlyUniqueId)
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
217
+ }
218
+ }
@@ -0,0 +1,19 @@
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'
8
+
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 {}
@@ -0,0 +1,3 @@
1
+ export interface BaseCloudflareProps {
2
+ accountId: string
3
+ }
@@ -0,0 +1,23 @@
1
+ import { TerraformOutput } from 'cdktf'
2
+ import _ from 'lodash'
3
+ import { CommonCloudflareConstruct } from '../common'
4
+
5
+ export const createCloudflareTfOutput = (
6
+ id: string,
7
+ scope: CommonCloudflareConstruct,
8
+ value?: string,
9
+ description?: string,
10
+ sensitive?: boolean,
11
+ overrideId = true
12
+ ) => {
13
+ const output = new TerraformOutput(scope, id, {
14
+ description,
15
+ sensitive,
16
+ value,
17
+ })
18
+
19
+ if (overrideId) {
20
+ output.overrideLogicalId(_.camelCase(id))
21
+ }
22
+ return output
23
+ }
package/src/lib/index.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './aws'
2
2
  export * from './azure'
3
+ export * from './cloudflare'
3
4
  export * from './common'