@gradientedge/cdk-utils 8.139.0 → 8.141.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 (34) hide show
  1. package/dist/src/lib/cloudflare/common/construct.d.ts +4 -1
  2. package/dist/src/lib/cloudflare/common/construct.js +6 -0
  3. package/dist/src/lib/cloudflare/services/access/index.d.ts +2 -0
  4. package/dist/src/lib/cloudflare/services/access/index.js +18 -0
  5. package/dist/src/lib/cloudflare/services/access/main.d.ts +120 -0
  6. package/dist/src/lib/cloudflare/services/access/main.js +276 -0
  7. package/dist/src/lib/cloudflare/services/access/types.d.ts +33 -0
  8. package/dist/src/lib/cloudflare/services/access/types.js +2 -0
  9. package/dist/src/lib/cloudflare/services/filter/index.d.ts +2 -0
  10. package/dist/src/lib/cloudflare/services/filter/index.js +18 -0
  11. package/dist/src/lib/cloudflare/services/filter/main.d.ts +30 -0
  12. package/dist/src/lib/cloudflare/services/filter/main.js +46 -0
  13. package/dist/src/lib/cloudflare/services/filter/types.d.ts +3 -0
  14. package/dist/src/lib/cloudflare/services/filter/types.js +2 -0
  15. package/dist/src/lib/cloudflare/services/firewall/index.d.ts +2 -0
  16. package/dist/src/lib/cloudflare/services/firewall/index.js +18 -0
  17. package/dist/src/lib/cloudflare/services/firewall/main.d.ts +30 -0
  18. package/dist/src/lib/cloudflare/services/firewall/main.js +46 -0
  19. package/dist/src/lib/cloudflare/services/firewall/types.d.ts +3 -0
  20. package/dist/src/lib/cloudflare/services/firewall/types.js +2 -0
  21. package/dist/src/lib/cloudflare/services/index.d.ts +3 -0
  22. package/dist/src/lib/cloudflare/services/index.js +3 -0
  23. package/package.json +1 -1
  24. package/src/lib/cloudflare/common/construct.ts +14 -1
  25. package/src/lib/cloudflare/services/access/index.ts +2 -0
  26. package/src/lib/cloudflare/services/access/main.ts +346 -0
  27. package/src/lib/cloudflare/services/access/types.ts +23 -0
  28. package/src/lib/cloudflare/services/filter/index.ts +2 -0
  29. package/src/lib/cloudflare/services/filter/main.ts +48 -0
  30. package/src/lib/cloudflare/services/filter/types.ts +3 -0
  31. package/src/lib/cloudflare/services/firewall/index.ts +2 -0
  32. package/src/lib/cloudflare/services/firewall/main.ts +48 -0
  33. package/src/lib/cloudflare/services/firewall/types.ts +3 -0
  34. package/src/lib/cloudflare/services/index.ts +3 -0
@@ -0,0 +1,30 @@
1
+ import { FirewallRule } from '@cdktf/provider-cloudflare/lib/firewall-rule';
2
+ import { CommonCloudflareConstruct } from '../../common';
3
+ import { FirewallRuleProps } from './types';
4
+ /**
5
+ * @classdesc Provides operations on Cloudflare Firewall Rules
6
+ * - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
7
+ * - If a custom construct extends {@link CommonCloudflareConstruct}, an instance is available within the context.
8
+ * @example
9
+ * ```
10
+ * import { CommonCloudflareConstruct, CommonCloudflareConstruct } from '@gradientedge/cdk-utils'
11
+ *
12
+ * class CustomConstruct extends CommonCloudflareConstruct {
13
+ * constructor(parent: Construct, id: string, props: CommonCloudflareStackProps) {
14
+ * super(parent, id, props)
15
+ * this.props = props
16
+ * this.firewallManager.createApiShield('MyFirewallRule', this, props)
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ export declare class CloudflareFirewallManager {
22
+ /**
23
+ * @summary Method to create a new Cloudflare Firewall Rule
24
+ * @param id scoped id of the resource
25
+ * @param scope scope in which this resource is defined
26
+ * @param props firewall rule properties
27
+ * @see [CDKTF Firewall Rule Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/firewallRule.typescript.md}
28
+ */
29
+ createFirewallRule(id: string, scope: CommonCloudflareConstruct, props: FirewallRuleProps): FirewallRule;
30
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CloudflareFirewallManager = void 0;
4
+ const firewall_rule_1 = require("@cdktf/provider-cloudflare/lib/firewall-rule");
5
+ const utils_1 = require("../../utils");
6
+ /**
7
+ * @classdesc Provides operations on Cloudflare Firewall Rules
8
+ * - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
9
+ * - If a custom construct extends {@link CommonCloudflareConstruct}, an instance is available within the context.
10
+ * @example
11
+ * ```
12
+ * import { CommonCloudflareConstruct, CommonCloudflareConstruct } from '@gradientedge/cdk-utils'
13
+ *
14
+ * class CustomConstruct extends CommonCloudflareConstruct {
15
+ * constructor(parent: Construct, id: string, props: CommonCloudflareStackProps) {
16
+ * super(parent, id, props)
17
+ * this.props = props
18
+ * this.firewallManager.createApiShield('MyFirewallRule', this, props)
19
+ * }
20
+ * }
21
+ * ```
22
+ */
23
+ class CloudflareFirewallManager {
24
+ /**
25
+ * @summary Method to create a new Cloudflare Firewall Rule
26
+ * @param id scoped id of the resource
27
+ * @param scope scope in which this resource is defined
28
+ * @param props firewall rule properties
29
+ * @see [CDKTF Firewall Rule Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/firewallRule.typescript.md}
30
+ */
31
+ createFirewallRule(id, scope, props) {
32
+ if (!props)
33
+ throw `Props undefined for ${id}`;
34
+ const zoneId = props.zoneId
35
+ ? props.zoneId
36
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
37
+ const firewallRule = new firewall_rule_1.FirewallRule(scope, `${id}`, {
38
+ ...props,
39
+ zoneId,
40
+ });
41
+ (0, utils_1.createCloudflareTfOutput)(`${id}-firewallRuleFriendlyUniqueId`, scope, firewallRule.friendlyUniqueId);
42
+ (0, utils_1.createCloudflareTfOutput)(`${id}-firewallRuleId`, scope, firewallRule.id);
43
+ return firewallRule;
44
+ }
45
+ }
46
+ exports.CloudflareFirewallManager = CloudflareFirewallManager;
@@ -0,0 +1,3 @@
1
+ import { FirewallRuleConfig } from '@cdktf/provider-cloudflare/lib/firewall-rule';
2
+ export interface FirewallRuleProps extends FirewallRuleConfig {
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,6 @@
1
+ export * from './access';
1
2
  export * from './api-shield';
3
+ export * from './filter';
4
+ export * from './firewall';
2
5
  export * from './worker';
3
6
  export * from './zone';
@@ -14,6 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./access"), exports);
17
18
  __exportStar(require("./api-shield"), exports);
19
+ __exportStar(require("./filter"), exports);
20
+ __exportStar(require("./firewall"), exports);
18
21
  __exportStar(require("./worker"), exports);
19
22
  __exportStar(require("./zone"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.139.0",
3
+ "version": "8.141.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -2,14 +2,24 @@ import { CloudflareProvider } from '@cdktf/provider-cloudflare/lib/provider'
2
2
  import { TerraformStack } from 'cdktf'
3
3
  import { Construct } from 'constructs'
4
4
  import { isDevStage, isPrdStage, isTestStage, isUatStage } from '../../common'
5
- import { CloudflareApiShieldManager, CloudflareWorkerManager, CloudflareZoneManager } from '../services'
5
+ import {
6
+ CloudflareAccessManager,
7
+ CloudflareApiShieldManager,
8
+ CloudflareFilterManager,
9
+ CloudflareFirewallManager,
10
+ CloudflareWorkerManager,
11
+ CloudflareZoneManager,
12
+ } from '../services'
6
13
  import { CommonCloudflareStackProps } from './types'
7
14
 
8
15
  export class CommonCloudflareConstruct extends TerraformStack {
9
16
  declare props: CommonCloudflareStackProps
10
17
  id: string
11
18
  fullyQualifiedDomainName: string
19
+ accessManager: CloudflareAccessManager
12
20
  apiShieldManager: CloudflareApiShieldManager
21
+ filterManager: CloudflareFilterManager
22
+ firewallManager: CloudflareFirewallManager
13
23
  workerManager: CloudflareWorkerManager
14
24
  zoneManager: CloudflareZoneManager
15
25
 
@@ -18,7 +28,10 @@ export class CommonCloudflareConstruct extends TerraformStack {
18
28
  this.props = props
19
29
  this.id = id
20
30
 
31
+ this.accessManager = new CloudflareAccessManager()
21
32
  this.apiShieldManager = new CloudflareApiShieldManager()
33
+ this.filterManager = new CloudflareFilterManager()
34
+ this.firewallManager = new CloudflareFirewallManager()
22
35
  this.zoneManager = new CloudflareZoneManager()
23
36
  this.workerManager = new CloudflareWorkerManager()
24
37
 
@@ -0,0 +1,2 @@
1
+ export * from './main'
2
+ export * from './types'
@@ -0,0 +1,346 @@
1
+ import { AccessApplication } from '@cdktf/provider-cloudflare/lib/access-application'
2
+ import { AccessCaCertificate } from '@cdktf/provider-cloudflare/lib/access-ca-certificate'
3
+ import { AccessCustomPage } from '@cdktf/provider-cloudflare/lib/access-custom-page'
4
+ import { AccessGroup } from '@cdktf/provider-cloudflare/lib/access-group'
5
+ import { AccessIdentityProvider } from '@cdktf/provider-cloudflare/lib/access-identity-provider'
6
+ import { AccessMutualTlsCertificate } from '@cdktf/provider-cloudflare/lib/access-mutual-tls-certificate'
7
+ import { CommonCloudflareConstruct } from '../../common'
8
+ import { createCloudflareTfOutput } from '../../utils'
9
+ import {
10
+ AccessApplicationProps,
11
+ AccessCaCertificateProps,
12
+ AccessCustomPageProps,
13
+ AccessGroupProps,
14
+ AccessIdentityProviderProps,
15
+ AccessMutualTlsCertificateProps,
16
+ AccessOrganizationProps,
17
+ AccessPolicyProps,
18
+ AccessRuleProps,
19
+ AccessServiceTokenProps,
20
+ AccessTagProps,
21
+ } from './types'
22
+ import { AccessOrganization } from '@cdktf/provider-cloudflare/lib/access-organization'
23
+ import { AccessPolicy } from '@cdktf/provider-cloudflare/lib/access-policy'
24
+ import { AccessRule } from '@cdktf/provider-cloudflare/lib/access-rule'
25
+ import { AccessServiceToken } from '@cdktf/provider-cloudflare/lib/access-service-token'
26
+ import { AccessTag } from '@cdktf/provider-cloudflare/lib/access-tag'
27
+
28
+ /**
29
+ * @classdesc Provides operations on Cloudflare Access
30
+ * - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
31
+ * - If a custom construct extends {@link CommonCloudflareConstruct}, an instance is available within the context.
32
+ * @example
33
+ * ```
34
+ * import { CommonCloudflareConstruct, CommonCloudflareConstruct } from '@gradientedge/cdk-utils'
35
+ *
36
+ * class CustomConstruct extends CommonCloudflareConstruct {
37
+ * constructor(parent: Construct, id: string, props: CommonCloudflareStackProps) {
38
+ * super(parent, id, props)
39
+ * this.props = props
40
+ * this.accessManager.createApiShield('MyAppAccess', this, props)
41
+ * }
42
+ * }
43
+ * ```
44
+ */
45
+ export class CloudflareAccessManager {
46
+ /**
47
+ * @summary Method to create a new Cloudflare Application Access
48
+ * @param id scoped id of the resource
49
+ * @param scope scope in which this resource is defined
50
+ * @param props access application properties
51
+ * @see [CDKTF Access Application Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/accessApplication.typescript.md}
52
+ */
53
+ public createAccessApplication(id: string, scope: CommonCloudflareConstruct, props: AccessApplicationProps) {
54
+ if (!props) throw `Props undefined for ${id}`
55
+
56
+ const zoneId = props.zoneId
57
+ ? props.zoneId
58
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
59
+
60
+ const accessApplication = new AccessApplication(scope, `${id}`, {
61
+ ...props,
62
+ domain: `${props.domain}-${scope.props.domainName}`,
63
+ name: `${props.name}-${scope.props.stage}`,
64
+ zoneId,
65
+ })
66
+
67
+ createCloudflareTfOutput(`${id}-accessApplicationFriendlyUniqueId`, scope, accessApplication.friendlyUniqueId)
68
+ createCloudflareTfOutput(`${id}-accessApplicationId`, scope, accessApplication.id)
69
+
70
+ return accessApplication
71
+ }
72
+
73
+ /**
74
+ * @summary Method to create a new Cloudflare Application Access CA Certificate
75
+ * @param id scoped id of the resource
76
+ * @param scope scope in which this resource is defined
77
+ * @param props access ca certificate properties
78
+ * @see [CDKTF Access Ca Certificate Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/accessCaCertificate.typescript.md}
79
+ */
80
+ public createAccessCaCertificate(id: string, scope: CommonCloudflareConstruct, props: AccessCaCertificateProps) {
81
+ if (!props) throw `Props undefined for ${id}`
82
+
83
+ const zoneId = props.zoneId
84
+ ? props.zoneId
85
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
86
+
87
+ const accessCaCertificate = new AccessCaCertificate(scope, `${id}`, {
88
+ ...props,
89
+ zoneId,
90
+ })
91
+
92
+ createCloudflareTfOutput(`${id}-accessCaCertificateFriendlyUniqueId`, scope, accessCaCertificate.friendlyUniqueId)
93
+ createCloudflareTfOutput(`${id}-accessCaCertificateId`, scope, accessCaCertificate.id)
94
+
95
+ return accessCaCertificate
96
+ }
97
+
98
+ /**
99
+ * @summary Method to create a new Cloudflare Application Access Custom Page
100
+ * @param id scoped id of the resource
101
+ * @param scope scope in which this resource is defined
102
+ * @param props access custom page properties
103
+ * @see [CDKTF Access Custom Page Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/accessCustomPage.typescript.md}
104
+ */
105
+ public createAccessCustomPage(id: string, scope: CommonCloudflareConstruct, props: AccessCustomPageProps) {
106
+ if (!props) throw `Props undefined for ${id}`
107
+
108
+ const zoneId = props.zoneId
109
+ ? props.zoneId
110
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
111
+
112
+ const accessCustomPage = new AccessCustomPage(scope, `${id}`, {
113
+ ...props,
114
+ name: `${props.name}-${scope.props.stage}`,
115
+ zoneId,
116
+ })
117
+
118
+ createCloudflareTfOutput(`${id}-accessCustomPageFriendlyUniqueId`, scope, accessCustomPage.friendlyUniqueId)
119
+ createCloudflareTfOutput(`${id}-accessCustomPageId`, scope, accessCustomPage.id)
120
+
121
+ return accessCustomPage
122
+ }
123
+
124
+ /**
125
+ * @summary Method to create a new Cloudflare Application Access Group
126
+ * @param id scoped id of the resource
127
+ * @param scope scope in which this resource is defined
128
+ * @param props access group properties
129
+ * @see [CDKTF Access Group Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/accessGroup.typescript.md}
130
+ */
131
+ public createAccessGroup(id: string, scope: CommonCloudflareConstruct, props: AccessGroupProps) {
132
+ if (!props) throw `Props undefined for ${id}`
133
+
134
+ const zoneId = props.zoneId
135
+ ? props.zoneId
136
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
137
+
138
+ const accessGroup = new AccessGroup(scope, `${id}`, {
139
+ ...props,
140
+ name: `${props.name}-${scope.props.stage}`,
141
+ zoneId,
142
+ })
143
+
144
+ createCloudflareTfOutput(`${id}-accessGroupFriendlyUniqueId`, scope, accessGroup.friendlyUniqueId)
145
+ createCloudflareTfOutput(`${id}-accessGroupId`, scope, accessGroup.id)
146
+
147
+ return accessGroup
148
+ }
149
+
150
+ /**
151
+ * @summary Method to create a new Cloudflare Application Access Identity Provider
152
+ * @param id scoped id of the resource
153
+ * @param scope scope in which this resource is defined
154
+ * @param props access identity provider properties
155
+ * @see [CDKTF Access Identity Provider Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/accessIdentityProvider.typescript.md}
156
+ */
157
+ public createAccessIdentityProvider(
158
+ id: string,
159
+ scope: CommonCloudflareConstruct,
160
+ props: AccessIdentityProviderProps
161
+ ) {
162
+ if (!props) throw `Props undefined for ${id}`
163
+
164
+ const zoneId = props.zoneId
165
+ ? props.zoneId
166
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
167
+
168
+ const accessIdentityProvider = new AccessIdentityProvider(scope, `${id}`, {
169
+ ...props,
170
+ name: `${props.name}-${scope.props.stage}`,
171
+ zoneId,
172
+ })
173
+
174
+ createCloudflareTfOutput(
175
+ `${id}-accessIdentityProviderFriendlyUniqueId`,
176
+ scope,
177
+ accessIdentityProvider.friendlyUniqueId
178
+ )
179
+ createCloudflareTfOutput(`${id}-accessIdentityProviderId`, scope, accessIdentityProvider.id)
180
+
181
+ return accessIdentityProvider
182
+ }
183
+
184
+ /**
185
+ * @summary Method to create a new Cloudflare Application Access Mutual Tls Certificate
186
+ * @param id scoped id of the resource
187
+ * @param scope scope in which this resource is defined
188
+ * @param props access mutual tls certificate properties
189
+ * @see [CDKTF Access Mutual Tls Certificate Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/accessMutualTlsCertificate.typescript.md}
190
+ */
191
+ public createAccessMutualTlsCertificate(
192
+ id: string,
193
+ scope: CommonCloudflareConstruct,
194
+ props: AccessMutualTlsCertificateProps
195
+ ) {
196
+ if (!props) throw `Props undefined for ${id}`
197
+
198
+ const zoneId = props.zoneId
199
+ ? props.zoneId
200
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
201
+
202
+ const accessMutualTlsCertificate = new AccessMutualTlsCertificate(scope, `${id}`, {
203
+ ...props,
204
+ name: `${props.name}-${scope.props.stage}`,
205
+ zoneId,
206
+ })
207
+
208
+ createCloudflareTfOutput(
209
+ `${id}-accessMutualTlsCertificateFriendlyUniqueId`,
210
+ scope,
211
+ accessMutualTlsCertificate.friendlyUniqueId
212
+ )
213
+ createCloudflareTfOutput(`${id}-accessMutualTlsCertificateId`, scope, accessMutualTlsCertificate.id)
214
+
215
+ return accessMutualTlsCertificate
216
+ }
217
+
218
+ /**
219
+ * @summary Method to create a new Cloudflare Application Access Organisation
220
+ * @param id scoped id of the resource
221
+ * @param scope scope in which this resource is defined
222
+ * @param props access organisation properties
223
+ * @see [CDKTF Access Organisation Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/accessOrganization.typescript.md}
224
+ */
225
+ public createAccessOrganization(id: string, scope: CommonCloudflareConstruct, props: AccessOrganizationProps) {
226
+ if (!props) throw `Props undefined for ${id}`
227
+
228
+ const zoneId = props.zoneId
229
+ ? props.zoneId
230
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
231
+
232
+ const accessOrganization = new AccessOrganization(scope, `${id}`, {
233
+ ...props,
234
+ name: `${props.name}-${scope.props.stage}`,
235
+ zoneId,
236
+ })
237
+
238
+ createCloudflareTfOutput(`${id}-accessOrganizationFriendlyUniqueId`, scope, accessOrganization.friendlyUniqueId)
239
+ createCloudflareTfOutput(`${id}-accessOrganizationId`, scope, accessOrganization.id)
240
+
241
+ return accessOrganization
242
+ }
243
+
244
+ /**
245
+ * @summary Method to create a new Cloudflare Application Access Policy
246
+ * @param id scoped id of the resource
247
+ * @param scope scope in which this resource is defined
248
+ * @param props access policy properties
249
+ * @see [CDKTF Access Policy Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/accessPolicy.typescript.md}
250
+ */
251
+ public createAccessPolicy(id: string, scope: CommonCloudflareConstruct, props: AccessPolicyProps) {
252
+ if (!props) throw `Props undefined for ${id}`
253
+
254
+ const zoneId = props.zoneId
255
+ ? props.zoneId
256
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
257
+
258
+ const accessPolicy = new AccessPolicy(scope, `${id}`, {
259
+ ...props,
260
+ name: `${props.name}-${scope.props.stage}`,
261
+ zoneId,
262
+ })
263
+
264
+ createCloudflareTfOutput(`${id}-accessPolicyFriendlyUniqueId`, scope, accessPolicy.friendlyUniqueId)
265
+ createCloudflareTfOutput(`${id}-accessPolicyId`, scope, accessPolicy.id)
266
+
267
+ return accessPolicy
268
+ }
269
+
270
+ /**
271
+ * @summary Method to create a new Cloudflare Application Access Rule
272
+ * @param id scoped id of the resource
273
+ * @param scope scope in which this resource is defined
274
+ * @param props access rule properties
275
+ * @see [CDKTF Access Rule Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/accessRule.typescript.md}
276
+ */
277
+ public createAccessRule(id: string, scope: CommonCloudflareConstruct, props: AccessRuleProps) {
278
+ if (!props) throw `Props undefined for ${id}`
279
+
280
+ const zoneId = props.zoneId
281
+ ? props.zoneId
282
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
283
+
284
+ const accessRule = new AccessRule(scope, `${id}`, {
285
+ ...props,
286
+ zoneId,
287
+ })
288
+
289
+ createCloudflareTfOutput(`${id}-accessRuleFriendlyUniqueId`, scope, accessRule.friendlyUniqueId)
290
+ createCloudflareTfOutput(`${id}-accessRuleId`, scope, accessRule.id)
291
+
292
+ return accessRule
293
+ }
294
+
295
+ /**
296
+ * @summary Method to create a new Cloudflare Application Access Service Token
297
+ * @param id scoped id of the resource
298
+ * @param scope scope in which this resource is defined
299
+ * @param props access service token properties
300
+ * @see [CDKTF Access Service Token Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/accessServiceToken.typescript.md}
301
+ */
302
+ public createAccessServiceToken(id: string, scope: CommonCloudflareConstruct, props: AccessServiceTokenProps) {
303
+ if (!props) throw `Props undefined for ${id}`
304
+
305
+ const zoneId = props.zoneId
306
+ ? props.zoneId
307
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
308
+
309
+ const accessServiceToken = new AccessServiceToken(scope, `${id}`, {
310
+ ...props,
311
+ name: `${props.name}-${scope.props.stage}`,
312
+ zoneId,
313
+ })
314
+
315
+ createCloudflareTfOutput(`${id}-accessServiceTokenFriendlyUniqueId`, scope, accessServiceToken.friendlyUniqueId)
316
+ createCloudflareTfOutput(`${id}-accessServiceTokenId`, scope, accessServiceToken.id)
317
+
318
+ return accessServiceToken
319
+ }
320
+
321
+ /**
322
+ * @summary Method to create a new Cloudflare Application Access Tag
323
+ * @param id scoped id of the resource
324
+ * @param scope scope in which this resource is defined
325
+ * @param props access tag properties
326
+ * @see [CDKTF Access Tag Token Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/accessTag.typescript.md}
327
+ */
328
+ public createAccessTag(id: string, scope: CommonCloudflareConstruct, props: AccessTagProps) {
329
+ if (!props) throw `Props undefined for ${id}`
330
+
331
+ const zoneId = props.zoneId
332
+ ? props.zoneId
333
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
334
+
335
+ const accessTag = new AccessTag(scope, `${id}`, {
336
+ ...props,
337
+ name: `${props.name}-${scope.props.stage}`,
338
+ zoneId,
339
+ })
340
+
341
+ createCloudflareTfOutput(`${id}-accessTagFriendlyUniqueId`, scope, accessTag.friendlyUniqueId)
342
+ createCloudflareTfOutput(`${id}-accessTagId`, scope, accessTag.id)
343
+
344
+ return accessTag
345
+ }
346
+ }
@@ -0,0 +1,23 @@
1
+ import { AccessApplicationConfig } from '@cdktf/provider-cloudflare/lib/access-application'
2
+ import { AccessCaCertificateConfig } from '@cdktf/provider-cloudflare/lib/access-ca-certificate'
3
+ import { AccessCustomPageConfig } from '@cdktf/provider-cloudflare/lib/access-custom-page'
4
+ import { AccessGroupConfig } from '@cdktf/provider-cloudflare/lib/access-group'
5
+ import { AccessIdentityProviderConfig } from '@cdktf/provider-cloudflare/lib/access-identity-provider'
6
+ import { AccessMutualTlsCertificateConfig } from '@cdktf/provider-cloudflare/lib/access-mutual-tls-certificate'
7
+ import { AccessOrganizationConfig } from '@cdktf/provider-cloudflare/lib/access-organization'
8
+ import { AccessPolicyConfig } from '@cdktf/provider-cloudflare/lib/access-policy'
9
+ import { AccessRuleConfig } from '@cdktf/provider-cloudflare/lib/access-rule'
10
+ import { AccessServiceTokenConfig } from '@cdktf/provider-cloudflare/lib/access-service-token'
11
+ import { AccessTagConfig } from '@cdktf/provider-cloudflare/lib/access-tag'
12
+
13
+ export interface AccessApplicationProps extends AccessApplicationConfig {}
14
+ export interface AccessCaCertificateProps extends AccessCaCertificateConfig {}
15
+ export interface AccessCustomPageProps extends AccessCustomPageConfig {}
16
+ export interface AccessGroupProps extends AccessGroupConfig {}
17
+ export interface AccessIdentityProviderProps extends AccessIdentityProviderConfig {}
18
+ export interface AccessMutualTlsCertificateProps extends AccessMutualTlsCertificateConfig {}
19
+ export interface AccessOrganizationProps extends AccessOrganizationConfig {}
20
+ export interface AccessPolicyProps extends AccessPolicyConfig {}
21
+ export interface AccessRuleProps extends AccessRuleConfig {}
22
+ export interface AccessServiceTokenProps extends AccessServiceTokenConfig {}
23
+ export interface AccessTagProps extends AccessTagConfig {}
@@ -0,0 +1,2 @@
1
+ export * from './main'
2
+ export * from './types'
@@ -0,0 +1,48 @@
1
+ import { Filter } from '@cdktf/provider-cloudflare/lib/filter'
2
+ import { CommonCloudflareConstruct } from '../../common'
3
+ import { createCloudflareTfOutput } from '../../utils'
4
+ import { FilterProps } from './types'
5
+
6
+ /**
7
+ * @classdesc Provides operations on Cloudflare Filters
8
+ * - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
9
+ * - If a custom construct extends {@link CommonCloudflareConstruct}, an instance is available within the context.
10
+ * @example
11
+ * ```
12
+ * import { CommonCloudflareConstruct, CommonCloudflareConstruct } from '@gradientedge/cdk-utils'
13
+ *
14
+ * class CustomConstruct extends CommonCloudflareConstruct {
15
+ * constructor(parent: Construct, id: string, props: CommonCloudflareStackProps) {
16
+ * super(parent, id, props)
17
+ * this.props = props
18
+ * this.filterManager.createApiShield('MyFilter', this, props)
19
+ * }
20
+ * }
21
+ * ```
22
+ */
23
+ export class CloudflareFilterManager {
24
+ /**
25
+ * @summary Method to create a new Cloudflare Filter
26
+ * @param id scoped id of the resource
27
+ * @param scope scope in which this resource is defined
28
+ * @param props filter properties
29
+ * @see [CDKTF Filter Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/filter.typescript.md}
30
+ */
31
+ public createApiShield(id: string, scope: CommonCloudflareConstruct, props: FilterProps) {
32
+ if (!props) throw `Props undefined for ${id}`
33
+
34
+ const zoneId = props.zoneId
35
+ ? props.zoneId
36
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
37
+
38
+ const filter = new Filter(scope, `${id}`, {
39
+ ...props,
40
+ zoneId,
41
+ })
42
+
43
+ createCloudflareTfOutput(`${id}-filterFriendlyUniqueId`, scope, filter.friendlyUniqueId)
44
+ createCloudflareTfOutput(`${id}-filterId`, scope, filter.id)
45
+
46
+ return filter
47
+ }
48
+ }
@@ -0,0 +1,3 @@
1
+ import { FilterConfig } from '@cdktf/provider-cloudflare/lib/filter'
2
+
3
+ export interface FilterProps extends FilterConfig {}
@@ -0,0 +1,2 @@
1
+ export * from './main'
2
+ export * from './types'
@@ -0,0 +1,48 @@
1
+ import { FirewallRule } from '@cdktf/provider-cloudflare/lib/firewall-rule'
2
+ import { CommonCloudflareConstruct } from '../../common'
3
+ import { createCloudflareTfOutput } from '../../utils'
4
+ import { FirewallRuleProps } from './types'
5
+
6
+ /**
7
+ * @classdesc Provides operations on Cloudflare Firewall Rules
8
+ * - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
9
+ * - If a custom construct extends {@link CommonCloudflareConstruct}, an instance is available within the context.
10
+ * @example
11
+ * ```
12
+ * import { CommonCloudflareConstruct, CommonCloudflareConstruct } from '@gradientedge/cdk-utils'
13
+ *
14
+ * class CustomConstruct extends CommonCloudflareConstruct {
15
+ * constructor(parent: Construct, id: string, props: CommonCloudflareStackProps) {
16
+ * super(parent, id, props)
17
+ * this.props = props
18
+ * this.firewallManager.createApiShield('MyFirewallRule', this, props)
19
+ * }
20
+ * }
21
+ * ```
22
+ */
23
+ export class CloudflareFirewallManager {
24
+ /**
25
+ * @summary Method to create a new Cloudflare Firewall Rule
26
+ * @param id scoped id of the resource
27
+ * @param scope scope in which this resource is defined
28
+ * @param props firewall rule properties
29
+ * @see [CDKTF Firewall Rule Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/firewallRule.typescript.md}
30
+ */
31
+ public createFirewallRule(id: string, scope: CommonCloudflareConstruct, props: FirewallRuleProps) {
32
+ if (!props) throw `Props undefined for ${id}`
33
+
34
+ const zoneId = props.zoneId
35
+ ? props.zoneId
36
+ : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
37
+
38
+ const firewallRule = new FirewallRule(scope, `${id}`, {
39
+ ...props,
40
+ zoneId,
41
+ })
42
+
43
+ createCloudflareTfOutput(`${id}-firewallRuleFriendlyUniqueId`, scope, firewallRule.friendlyUniqueId)
44
+ createCloudflareTfOutput(`${id}-firewallRuleId`, scope, firewallRule.id)
45
+
46
+ return firewallRule
47
+ }
48
+ }
@@ -0,0 +1,3 @@
1
+ import { FirewallRuleConfig } from '@cdktf/provider-cloudflare/lib/firewall-rule'
2
+
3
+ export interface FirewallRuleProps extends FirewallRuleConfig {}
@@ -1,3 +1,6 @@
1
+ export * from './access'
1
2
  export * from './api-shield'
3
+ export * from './filter'
4
+ export * from './firewall'
2
5
  export * from './worker'
3
6
  export * from './zone'