@gradientedge/cdk-utils 8.138.0 → 8.140.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/common/construct.d.ts +4 -1
- package/dist/src/lib/cloudflare/common/construct.js +6 -0
- package/dist/src/lib/cloudflare/services/api-shield/index.d.ts +2 -0
- package/dist/src/lib/cloudflare/services/api-shield/index.js +18 -0
- package/dist/src/lib/cloudflare/services/api-shield/main.d.ts +66 -0
- package/dist/src/lib/cloudflare/services/api-shield/main.js +135 -0
- package/dist/src/lib/cloudflare/services/api-shield/types.d.ts +15 -0
- package/dist/src/lib/cloudflare/services/api-shield/types.js +2 -0
- package/dist/src/lib/cloudflare/services/filter/index.d.ts +2 -0
- package/dist/src/lib/cloudflare/services/filter/index.js +18 -0
- package/dist/src/lib/cloudflare/services/filter/main.d.ts +30 -0
- package/dist/src/lib/cloudflare/services/filter/main.js +46 -0
- package/dist/src/lib/cloudflare/services/filter/types.d.ts +3 -0
- package/dist/src/lib/cloudflare/services/filter/types.js +2 -0
- package/dist/src/lib/cloudflare/services/firewall/index.d.ts +2 -0
- package/dist/src/lib/cloudflare/services/firewall/index.js +18 -0
- package/dist/src/lib/cloudflare/services/firewall/main.d.ts +30 -0
- package/dist/src/lib/cloudflare/services/firewall/main.js +46 -0
- package/dist/src/lib/cloudflare/services/firewall/types.d.ts +3 -0
- package/dist/src/lib/cloudflare/services/firewall/types.js +2 -0
- package/dist/src/lib/cloudflare/services/index.d.ts +3 -0
- package/dist/src/lib/cloudflare/services/index.js +3 -0
- package/package.json +1 -1
- package/src/lib/cloudflare/common/construct.ts +13 -1
- package/src/lib/cloudflare/services/api-shield/index.ts +2 -0
- package/src/lib/cloudflare/services/api-shield/main.ts +179 -0
- package/src/lib/cloudflare/services/api-shield/types.ts +12 -0
- package/src/lib/cloudflare/services/filter/index.ts +2 -0
- package/src/lib/cloudflare/services/filter/main.ts +48 -0
- package/src/lib/cloudflare/services/filter/types.ts +3 -0
- package/src/lib/cloudflare/services/firewall/index.ts +2 -0
- package/src/lib/cloudflare/services/firewall/main.ts +48 -0
- package/src/lib/cloudflare/services/firewall/types.ts +3 -0
- package/src/lib/cloudflare/services/index.ts +3 -0
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { TerraformStack } from 'cdktf';
|
|
2
2
|
import { Construct } from 'constructs';
|
|
3
|
-
import { CloudflareWorkerManager, CloudflareZoneManager } from '../services';
|
|
3
|
+
import { CloudflareApiShieldManager, CloudflareFilterManager, CloudflareFirewallManager, CloudflareWorkerManager, CloudflareZoneManager } from '../services';
|
|
4
4
|
import { CommonCloudflareStackProps } from './types';
|
|
5
5
|
export declare class CommonCloudflareConstruct extends TerraformStack {
|
|
6
6
|
props: CommonCloudflareStackProps;
|
|
7
7
|
id: string;
|
|
8
8
|
fullyQualifiedDomainName: string;
|
|
9
|
+
apiShieldManager: CloudflareApiShieldManager;
|
|
10
|
+
filterManager: CloudflareFilterManager;
|
|
11
|
+
firewallManager: CloudflareFirewallManager;
|
|
9
12
|
workerManager: CloudflareWorkerManager;
|
|
10
13
|
zoneManager: CloudflareZoneManager;
|
|
11
14
|
constructor(scope: Construct, id: string, props: CommonCloudflareStackProps);
|
|
@@ -8,12 +8,18 @@ const services_1 = require("../services");
|
|
|
8
8
|
class CommonCloudflareConstruct extends cdktf_1.TerraformStack {
|
|
9
9
|
id;
|
|
10
10
|
fullyQualifiedDomainName;
|
|
11
|
+
apiShieldManager;
|
|
12
|
+
filterManager;
|
|
13
|
+
firewallManager;
|
|
11
14
|
workerManager;
|
|
12
15
|
zoneManager;
|
|
13
16
|
constructor(scope, id, props) {
|
|
14
17
|
super(scope, id);
|
|
15
18
|
this.props = props;
|
|
16
19
|
this.id = id;
|
|
20
|
+
this.apiShieldManager = new services_1.CloudflareApiShieldManager();
|
|
21
|
+
this.filterManager = new services_1.CloudflareFilterManager();
|
|
22
|
+
this.firewallManager = new services_1.CloudflareFirewallManager();
|
|
17
23
|
this.zoneManager = new services_1.CloudflareZoneManager();
|
|
18
24
|
this.workerManager = new services_1.CloudflareWorkerManager();
|
|
19
25
|
this.determineFullyQualifiedDomain();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./main"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ApiShield } from '@cdktf/provider-cloudflare/lib/api-shield';
|
|
2
|
+
import { ApiShieldOperation } from '@cdktf/provider-cloudflare/lib/api-shield-operation';
|
|
3
|
+
import { ApiShieldOperationSchemaValidationSettings } from '@cdktf/provider-cloudflare/lib/api-shield-operation-schema-validation-settings';
|
|
4
|
+
import { ApiShieldSchema } from '@cdktf/provider-cloudflare/lib/api-shield-schema';
|
|
5
|
+
import { CommonCloudflareConstruct } from '../../common';
|
|
6
|
+
import { ApiShieldOperationProps, ApiShieldOperationSchemaValidationSettingsProps, ApiShieldProps, ApiShieldSchemaProps, ApiShieldSchemaValidationSettingsProps } from './types';
|
|
7
|
+
import { ApiShieldSchemaValidationSettings } from '@cdktf/provider-cloudflare/lib/api-shield-schema-validation-settings';
|
|
8
|
+
/**
|
|
9
|
+
* @classdesc Provides operations on Cloudflare Api Shield
|
|
10
|
+
* - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
|
|
11
|
+
* - If a custom construct extends {@link CommonCloudflareConstruct}, an instance is available within the context.
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* import { CommonCloudflareConstruct, CommonCloudflareConstruct } from '@gradientedge/cdk-utils'
|
|
15
|
+
*
|
|
16
|
+
* class CustomConstruct extends CommonCloudflareConstruct {
|
|
17
|
+
* constructor(parent: Construct, id: string, props: CommonCloudflareStackProps) {
|
|
18
|
+
* super(parent, id, props)
|
|
19
|
+
* this.props = props
|
|
20
|
+
* this.apiShieldManager.createApiShield('MyApiShield', this, props)
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare class CloudflareApiShieldManager {
|
|
26
|
+
/**
|
|
27
|
+
* @summary Method to create a new Cloudflare Api Shield
|
|
28
|
+
* @param id scoped id of the resource
|
|
29
|
+
* @param scope scope in which this resource is defined
|
|
30
|
+
* @param props api shield properties
|
|
31
|
+
* @see [CDKTF API Shield Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShield.typescript.md}
|
|
32
|
+
*/
|
|
33
|
+
createApiShield(id: string, scope: CommonCloudflareConstruct, props: ApiShieldProps): ApiShield;
|
|
34
|
+
/**
|
|
35
|
+
* @summary Method to create a new Cloudflare Api Shield Schema
|
|
36
|
+
* @param id scoped id of the resource
|
|
37
|
+
* @param scope scope in which this resource is defined
|
|
38
|
+
* @param props api shield schema properties
|
|
39
|
+
* @see [CDKTF API Shield Schema Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldSchema.typescript.md}
|
|
40
|
+
*/
|
|
41
|
+
createApiShieldSchema(id: string, scope: CommonCloudflareConstruct, props: ApiShieldSchemaProps): ApiShieldSchema;
|
|
42
|
+
/**
|
|
43
|
+
* @summary Method to create a new Cloudflare Api Shield Schema Validation Settings
|
|
44
|
+
* @param id scoped id of the resource
|
|
45
|
+
* @param scope scope in which this resource is defined
|
|
46
|
+
* @param props api shield schema validation settings properties
|
|
47
|
+
* @see [CDKTF API Shield Schema Validation Settings Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldSchema.typescript.md}
|
|
48
|
+
*/
|
|
49
|
+
createApiShieldSchemaValidationSettings(id: string, scope: CommonCloudflareConstruct, props: ApiShieldSchemaValidationSettingsProps): ApiShieldSchemaValidationSettings;
|
|
50
|
+
/**
|
|
51
|
+
* @summary Method to create a new Cloudflare Api Shield Operation
|
|
52
|
+
* @param id scoped id of the resource
|
|
53
|
+
* @param scope scope in which this resource is defined
|
|
54
|
+
* @param props api shield operation properties
|
|
55
|
+
* @see [CDKTF API Shield Operation Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldOperation.typescript.md}
|
|
56
|
+
*/
|
|
57
|
+
createApiShieldOperation(id: string, scope: CommonCloudflareConstruct, props: ApiShieldOperationProps): ApiShieldOperation;
|
|
58
|
+
/**
|
|
59
|
+
* @summary Method to create a new Cloudflare Api Shield Operation Schema Validation Settings
|
|
60
|
+
* @param id scoped id of the resource
|
|
61
|
+
* @param scope scope in which this resource is defined
|
|
62
|
+
* @param props api shield operation schema validation settings properties
|
|
63
|
+
* @see [CDKTF API Shield Operation Schema Validation Settings Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldOperationSchemaValidationSettings.typescript.md}
|
|
64
|
+
*/
|
|
65
|
+
createApiShieldOperationSchemaValidationSettings(id: string, scope: CommonCloudflareConstruct, props: ApiShieldOperationSchemaValidationSettingsProps): ApiShieldOperationSchemaValidationSettings;
|
|
66
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudflareApiShieldManager = void 0;
|
|
4
|
+
const api_shield_1 = require("@cdktf/provider-cloudflare/lib/api-shield");
|
|
5
|
+
const api_shield_operation_1 = require("@cdktf/provider-cloudflare/lib/api-shield-operation");
|
|
6
|
+
const api_shield_operation_schema_validation_settings_1 = require("@cdktf/provider-cloudflare/lib/api-shield-operation-schema-validation-settings");
|
|
7
|
+
const api_shield_schema_1 = require("@cdktf/provider-cloudflare/lib/api-shield-schema");
|
|
8
|
+
const utils_1 = require("../../utils");
|
|
9
|
+
const api_shield_schema_validation_settings_1 = require("@cdktf/provider-cloudflare/lib/api-shield-schema-validation-settings");
|
|
10
|
+
/**
|
|
11
|
+
* @classdesc Provides operations on Cloudflare Api Shield
|
|
12
|
+
* - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
|
|
13
|
+
* - If a custom construct extends {@link CommonCloudflareConstruct}, an instance is available within the context.
|
|
14
|
+
* @example
|
|
15
|
+
* ```
|
|
16
|
+
* import { CommonCloudflareConstruct, CommonCloudflareConstruct } from '@gradientedge/cdk-utils'
|
|
17
|
+
*
|
|
18
|
+
* class CustomConstruct extends CommonCloudflareConstruct {
|
|
19
|
+
* constructor(parent: Construct, id: string, props: CommonCloudflareStackProps) {
|
|
20
|
+
* super(parent, id, props)
|
|
21
|
+
* this.props = props
|
|
22
|
+
* this.apiShieldManager.createApiShield('MyApiShield', this, props)
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
class CloudflareApiShieldManager {
|
|
28
|
+
/**
|
|
29
|
+
* @summary Method to create a new Cloudflare Api Shield
|
|
30
|
+
* @param id scoped id of the resource
|
|
31
|
+
* @param scope scope in which this resource is defined
|
|
32
|
+
* @param props api shield properties
|
|
33
|
+
* @see [CDKTF API Shield Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShield.typescript.md}
|
|
34
|
+
*/
|
|
35
|
+
createApiShield(id, scope, props) {
|
|
36
|
+
if (!props)
|
|
37
|
+
throw `Props undefined for ${id}`;
|
|
38
|
+
const zoneId = props.zoneId
|
|
39
|
+
? props.zoneId
|
|
40
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
|
|
41
|
+
const apiShield = new api_shield_1.ApiShield(scope, `${id}`, {
|
|
42
|
+
...props,
|
|
43
|
+
zoneId,
|
|
44
|
+
});
|
|
45
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-apiShieldFriendlyUniqueId`, scope, apiShield.friendlyUniqueId);
|
|
46
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-apiShieldId`, scope, apiShield.id);
|
|
47
|
+
return apiShield;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @summary Method to create a new Cloudflare Api Shield Schema
|
|
51
|
+
* @param id scoped id of the resource
|
|
52
|
+
* @param scope scope in which this resource is defined
|
|
53
|
+
* @param props api shield schema properties
|
|
54
|
+
* @see [CDKTF API Shield Schema Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldSchema.typescript.md}
|
|
55
|
+
*/
|
|
56
|
+
createApiShieldSchema(id, scope, props) {
|
|
57
|
+
if (!props)
|
|
58
|
+
throw `Props undefined for ${id}`;
|
|
59
|
+
const zoneId = props.zoneId
|
|
60
|
+
? props.zoneId
|
|
61
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
|
|
62
|
+
const apiShieldSchema = new api_shield_schema_1.ApiShieldSchema(scope, `${id}`, {
|
|
63
|
+
...props,
|
|
64
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
65
|
+
zoneId,
|
|
66
|
+
});
|
|
67
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-apiShieldSchemaFriendlyUniqueId`, scope, apiShieldSchema.friendlyUniqueId);
|
|
68
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-apiShieldSchemaId`, scope, apiShieldSchema.id);
|
|
69
|
+
return apiShieldSchema;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @summary Method to create a new Cloudflare Api Shield Schema Validation Settings
|
|
73
|
+
* @param id scoped id of the resource
|
|
74
|
+
* @param scope scope in which this resource is defined
|
|
75
|
+
* @param props api shield schema validation settings properties
|
|
76
|
+
* @see [CDKTF API Shield Schema Validation Settings Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldSchema.typescript.md}
|
|
77
|
+
*/
|
|
78
|
+
createApiShieldSchemaValidationSettings(id, scope, props) {
|
|
79
|
+
if (!props)
|
|
80
|
+
throw `Props undefined for ${id}`;
|
|
81
|
+
const zoneId = props.zoneId
|
|
82
|
+
? props.zoneId
|
|
83
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
|
|
84
|
+
const apiShieldSchemaValidationSettings = new api_shield_schema_validation_settings_1.ApiShieldSchemaValidationSettings(scope, `${id}`, {
|
|
85
|
+
...props,
|
|
86
|
+
zoneId,
|
|
87
|
+
});
|
|
88
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-apiShieldSchemaValidationSettingsFriendlyUniqueId`, scope, apiShieldSchemaValidationSettings.friendlyUniqueId);
|
|
89
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-apiShieldSchemaValidationSettingsId`, scope, apiShieldSchemaValidationSettings.id);
|
|
90
|
+
return apiShieldSchemaValidationSettings;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @summary Method to create a new Cloudflare Api Shield Operation
|
|
94
|
+
* @param id scoped id of the resource
|
|
95
|
+
* @param scope scope in which this resource is defined
|
|
96
|
+
* @param props api shield operation properties
|
|
97
|
+
* @see [CDKTF API Shield Operation Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldOperation.typescript.md}
|
|
98
|
+
*/
|
|
99
|
+
createApiShieldOperation(id, scope, props) {
|
|
100
|
+
if (!props)
|
|
101
|
+
throw `Props undefined for ${id}`;
|
|
102
|
+
const zoneId = props.zoneId
|
|
103
|
+
? props.zoneId
|
|
104
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
|
|
105
|
+
const apiShieldOperation = new api_shield_operation_1.ApiShieldOperation(scope, `${id}`, {
|
|
106
|
+
...props,
|
|
107
|
+
zoneId,
|
|
108
|
+
});
|
|
109
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-apiShieldOperationFriendlyUniqueId`, scope, apiShieldOperation.friendlyUniqueId);
|
|
110
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-apiShieldOperationId`, scope, apiShieldOperation.id);
|
|
111
|
+
return apiShieldOperation;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @summary Method to create a new Cloudflare Api Shield Operation Schema Validation Settings
|
|
115
|
+
* @param id scoped id of the resource
|
|
116
|
+
* @param scope scope in which this resource is defined
|
|
117
|
+
* @param props api shield operation schema validation settings properties
|
|
118
|
+
* @see [CDKTF API Shield Operation Schema Validation Settings Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldOperationSchemaValidationSettings.typescript.md}
|
|
119
|
+
*/
|
|
120
|
+
createApiShieldOperationSchemaValidationSettings(id, scope, props) {
|
|
121
|
+
if (!props)
|
|
122
|
+
throw `Props undefined for ${id}`;
|
|
123
|
+
const zoneId = props.zoneId
|
|
124
|
+
? props.zoneId
|
|
125
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id;
|
|
126
|
+
const apiShieldOperationSchemaValidationSettings = new api_shield_operation_schema_validation_settings_1.ApiShieldOperationSchemaValidationSettings(scope, `${id}`, {
|
|
127
|
+
...props,
|
|
128
|
+
zoneId,
|
|
129
|
+
});
|
|
130
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-apiShieldOperationSchemaValidationSettingsFriendlyUniqueId`, scope, apiShieldOperationSchemaValidationSettings.friendlyUniqueId);
|
|
131
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-apiShieldOperationSchemaValidationSettingsId`, scope, apiShieldOperationSchemaValidationSettings.id);
|
|
132
|
+
return apiShieldOperationSchemaValidationSettings;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.CloudflareApiShieldManager = CloudflareApiShieldManager;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ApiShieldConfig } from '@cdktf/provider-cloudflare/lib/api-shield';
|
|
2
|
+
import { ApiShieldOperationConfig } from '@cdktf/provider-cloudflare/lib/api-shield-operation';
|
|
3
|
+
import { ApiShieldOperationSchemaValidationSettingsConfig } from '@cdktf/provider-cloudflare/lib/api-shield-operation-schema-validation-settings';
|
|
4
|
+
import { ApiShieldSchemaConfig } from '@cdktf/provider-cloudflare/lib/api-shield-schema';
|
|
5
|
+
import { ApiShieldSchemaValidationSettingsConfig } from '@cdktf/provider-cloudflare/lib/api-shield-schema-validation-settings';
|
|
6
|
+
export interface ApiShieldProps extends ApiShieldConfig {
|
|
7
|
+
}
|
|
8
|
+
export interface ApiShieldSchemaProps extends ApiShieldSchemaConfig {
|
|
9
|
+
}
|
|
10
|
+
export interface ApiShieldSchemaValidationSettingsProps extends ApiShieldSchemaValidationSettingsConfig {
|
|
11
|
+
}
|
|
12
|
+
export interface ApiShieldOperationProps extends ApiShieldOperationConfig {
|
|
13
|
+
}
|
|
14
|
+
export interface ApiShieldOperationSchemaValidationSettingsProps extends ApiShieldOperationSchemaValidationSettingsConfig {
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./main"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Filter } from '@cdktf/provider-cloudflare/lib/filter';
|
|
2
|
+
import { CommonCloudflareConstruct } from '../../common';
|
|
3
|
+
import { FilterProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* @classdesc Provides operations on Cloudflare Filters
|
|
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.filterManager.createApiShield('MyFilter', this, props)
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class CloudflareFilterManager {
|
|
22
|
+
/**
|
|
23
|
+
* @summary Method to create a new Cloudflare Filter
|
|
24
|
+
* @param id scoped id of the resource
|
|
25
|
+
* @param scope scope in which this resource is defined
|
|
26
|
+
* @param props filter properties
|
|
27
|
+
* @see [CDKTF Filter Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/filter.typescript.md}
|
|
28
|
+
*/
|
|
29
|
+
createApiShield(id: string, scope: CommonCloudflareConstruct, props: FilterProps): Filter;
|
|
30
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudflareFilterManager = void 0;
|
|
4
|
+
const filter_1 = require("@cdktf/provider-cloudflare/lib/filter");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
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
|
+
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
|
+
createApiShield(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 filter = new filter_1.Filter(scope, `${id}`, {
|
|
38
|
+
...props,
|
|
39
|
+
zoneId,
|
|
40
|
+
});
|
|
41
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-filterFriendlyUniqueId`, scope, filter.friendlyUniqueId);
|
|
42
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-filterId`, scope, filter.id);
|
|
43
|
+
return filter;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.CloudflareFilterManager = CloudflareFilterManager;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./main"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -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;
|
|
@@ -14,5 +14,8 @@ 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("./api-shield"), exports);
|
|
18
|
+
__exportStar(require("./filter"), exports);
|
|
19
|
+
__exportStar(require("./firewall"), exports);
|
|
17
20
|
__exportStar(require("./worker"), exports);
|
|
18
21
|
__exportStar(require("./zone"), exports);
|
package/package.json
CHANGED
|
@@ -2,13 +2,22 @@ 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 {
|
|
5
|
+
import {
|
|
6
|
+
CloudflareApiShieldManager,
|
|
7
|
+
CloudflareFilterManager,
|
|
8
|
+
CloudflareFirewallManager,
|
|
9
|
+
CloudflareWorkerManager,
|
|
10
|
+
CloudflareZoneManager,
|
|
11
|
+
} from '../services'
|
|
6
12
|
import { CommonCloudflareStackProps } from './types'
|
|
7
13
|
|
|
8
14
|
export class CommonCloudflareConstruct extends TerraformStack {
|
|
9
15
|
declare props: CommonCloudflareStackProps
|
|
10
16
|
id: string
|
|
11
17
|
fullyQualifiedDomainName: string
|
|
18
|
+
apiShieldManager: CloudflareApiShieldManager
|
|
19
|
+
filterManager: CloudflareFilterManager
|
|
20
|
+
firewallManager: CloudflareFirewallManager
|
|
12
21
|
workerManager: CloudflareWorkerManager
|
|
13
22
|
zoneManager: CloudflareZoneManager
|
|
14
23
|
|
|
@@ -17,6 +26,9 @@ export class CommonCloudflareConstruct extends TerraformStack {
|
|
|
17
26
|
this.props = props
|
|
18
27
|
this.id = id
|
|
19
28
|
|
|
29
|
+
this.apiShieldManager = new CloudflareApiShieldManager()
|
|
30
|
+
this.filterManager = new CloudflareFilterManager()
|
|
31
|
+
this.firewallManager = new CloudflareFirewallManager()
|
|
20
32
|
this.zoneManager = new CloudflareZoneManager()
|
|
21
33
|
this.workerManager = new CloudflareWorkerManager()
|
|
22
34
|
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { ApiShield } from '@cdktf/provider-cloudflare/lib/api-shield'
|
|
2
|
+
import { ApiShieldOperation } from '@cdktf/provider-cloudflare/lib/api-shield-operation'
|
|
3
|
+
import { ApiShieldOperationSchemaValidationSettings } from '@cdktf/provider-cloudflare/lib/api-shield-operation-schema-validation-settings'
|
|
4
|
+
import { ApiShieldSchema } from '@cdktf/provider-cloudflare/lib/api-shield-schema'
|
|
5
|
+
import { CommonCloudflareConstruct } from '../../common'
|
|
6
|
+
import { createCloudflareTfOutput } from '../../utils'
|
|
7
|
+
import {
|
|
8
|
+
ApiShieldOperationProps,
|
|
9
|
+
ApiShieldOperationSchemaValidationSettingsProps,
|
|
10
|
+
ApiShieldProps,
|
|
11
|
+
ApiShieldSchemaProps,
|
|
12
|
+
ApiShieldSchemaValidationSettingsProps,
|
|
13
|
+
} from './types'
|
|
14
|
+
import { ApiShieldSchemaValidationSettings } from '@cdktf/provider-cloudflare/lib/api-shield-schema-validation-settings'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @classdesc Provides operations on Cloudflare Api Shield
|
|
18
|
+
* - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
|
|
19
|
+
* - If a custom construct extends {@link CommonCloudflareConstruct}, an instance is available within the context.
|
|
20
|
+
* @example
|
|
21
|
+
* ```
|
|
22
|
+
* import { CommonCloudflareConstruct, CommonCloudflareConstruct } from '@gradientedge/cdk-utils'
|
|
23
|
+
*
|
|
24
|
+
* class CustomConstruct extends CommonCloudflareConstruct {
|
|
25
|
+
* constructor(parent: Construct, id: string, props: CommonCloudflareStackProps) {
|
|
26
|
+
* super(parent, id, props)
|
|
27
|
+
* this.props = props
|
|
28
|
+
* this.apiShieldManager.createApiShield('MyApiShield', this, props)
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export class CloudflareApiShieldManager {
|
|
34
|
+
/**
|
|
35
|
+
* @summary Method to create a new Cloudflare Api Shield
|
|
36
|
+
* @param id scoped id of the resource
|
|
37
|
+
* @param scope scope in which this resource is defined
|
|
38
|
+
* @param props api shield properties
|
|
39
|
+
* @see [CDKTF API Shield Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShield.typescript.md}
|
|
40
|
+
*/
|
|
41
|
+
public createApiShield(id: string, scope: CommonCloudflareConstruct, props: ApiShieldProps) {
|
|
42
|
+
if (!props) throw `Props undefined for ${id}`
|
|
43
|
+
|
|
44
|
+
const zoneId = props.zoneId
|
|
45
|
+
? props.zoneId
|
|
46
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
|
|
47
|
+
|
|
48
|
+
const apiShield = new ApiShield(scope, `${id}`, {
|
|
49
|
+
...props,
|
|
50
|
+
zoneId,
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
createCloudflareTfOutput(`${id}-apiShieldFriendlyUniqueId`, scope, apiShield.friendlyUniqueId)
|
|
54
|
+
createCloudflareTfOutput(`${id}-apiShieldId`, scope, apiShield.id)
|
|
55
|
+
|
|
56
|
+
return apiShield
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @summary Method to create a new Cloudflare Api Shield Schema
|
|
61
|
+
* @param id scoped id of the resource
|
|
62
|
+
* @param scope scope in which this resource is defined
|
|
63
|
+
* @param props api shield schema properties
|
|
64
|
+
* @see [CDKTF API Shield Schema Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldSchema.typescript.md}
|
|
65
|
+
*/
|
|
66
|
+
public createApiShieldSchema(id: string, scope: CommonCloudflareConstruct, props: ApiShieldSchemaProps) {
|
|
67
|
+
if (!props) throw `Props undefined for ${id}`
|
|
68
|
+
|
|
69
|
+
const zoneId = props.zoneId
|
|
70
|
+
? props.zoneId
|
|
71
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
|
|
72
|
+
|
|
73
|
+
const apiShieldSchema = new ApiShieldSchema(scope, `${id}`, {
|
|
74
|
+
...props,
|
|
75
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
76
|
+
zoneId,
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
createCloudflareTfOutput(`${id}-apiShieldSchemaFriendlyUniqueId`, scope, apiShieldSchema.friendlyUniqueId)
|
|
80
|
+
createCloudflareTfOutput(`${id}-apiShieldSchemaId`, scope, apiShieldSchema.id)
|
|
81
|
+
|
|
82
|
+
return apiShieldSchema
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @summary Method to create a new Cloudflare Api Shield Schema Validation Settings
|
|
87
|
+
* @param id scoped id of the resource
|
|
88
|
+
* @param scope scope in which this resource is defined
|
|
89
|
+
* @param props api shield schema validation settings properties
|
|
90
|
+
* @see [CDKTF API Shield Schema Validation Settings Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldSchema.typescript.md}
|
|
91
|
+
*/
|
|
92
|
+
public createApiShieldSchemaValidationSettings(
|
|
93
|
+
id: string,
|
|
94
|
+
scope: CommonCloudflareConstruct,
|
|
95
|
+
props: ApiShieldSchemaValidationSettingsProps
|
|
96
|
+
) {
|
|
97
|
+
if (!props) throw `Props undefined for ${id}`
|
|
98
|
+
|
|
99
|
+
const zoneId = props.zoneId
|
|
100
|
+
? props.zoneId
|
|
101
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
|
|
102
|
+
|
|
103
|
+
const apiShieldSchemaValidationSettings = new ApiShieldSchemaValidationSettings(scope, `${id}`, {
|
|
104
|
+
...props,
|
|
105
|
+
zoneId,
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
createCloudflareTfOutput(
|
|
109
|
+
`${id}-apiShieldSchemaValidationSettingsFriendlyUniqueId`,
|
|
110
|
+
scope,
|
|
111
|
+
apiShieldSchemaValidationSettings.friendlyUniqueId
|
|
112
|
+
)
|
|
113
|
+
createCloudflareTfOutput(`${id}-apiShieldSchemaValidationSettingsId`, scope, apiShieldSchemaValidationSettings.id)
|
|
114
|
+
|
|
115
|
+
return apiShieldSchemaValidationSettings
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @summary Method to create a new Cloudflare Api Shield Operation
|
|
120
|
+
* @param id scoped id of the resource
|
|
121
|
+
* @param scope scope in which this resource is defined
|
|
122
|
+
* @param props api shield operation properties
|
|
123
|
+
* @see [CDKTF API Shield Operation Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldOperation.typescript.md}
|
|
124
|
+
*/
|
|
125
|
+
public createApiShieldOperation(id: string, scope: CommonCloudflareConstruct, props: ApiShieldOperationProps) {
|
|
126
|
+
if (!props) throw `Props undefined for ${id}`
|
|
127
|
+
|
|
128
|
+
const zoneId = props.zoneId
|
|
129
|
+
? props.zoneId
|
|
130
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
|
|
131
|
+
|
|
132
|
+
const apiShieldOperation = new ApiShieldOperation(scope, `${id}`, {
|
|
133
|
+
...props,
|
|
134
|
+
zoneId,
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
createCloudflareTfOutput(`${id}-apiShieldOperationFriendlyUniqueId`, scope, apiShieldOperation.friendlyUniqueId)
|
|
138
|
+
createCloudflareTfOutput(`${id}-apiShieldOperationId`, scope, apiShieldOperation.id)
|
|
139
|
+
|
|
140
|
+
return apiShieldOperation
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @summary Method to create a new Cloudflare Api Shield Operation Schema Validation Settings
|
|
145
|
+
* @param id scoped id of the resource
|
|
146
|
+
* @param scope scope in which this resource is defined
|
|
147
|
+
* @param props api shield operation schema validation settings properties
|
|
148
|
+
* @see [CDKTF API Shield Operation Schema Validation Settings Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/apiShieldOperationSchemaValidationSettings.typescript.md}
|
|
149
|
+
*/
|
|
150
|
+
public createApiShieldOperationSchemaValidationSettings(
|
|
151
|
+
id: string,
|
|
152
|
+
scope: CommonCloudflareConstruct,
|
|
153
|
+
props: ApiShieldOperationSchemaValidationSettingsProps
|
|
154
|
+
) {
|
|
155
|
+
if (!props) throw `Props undefined for ${id}`
|
|
156
|
+
|
|
157
|
+
const zoneId = props.zoneId
|
|
158
|
+
? props.zoneId
|
|
159
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.id
|
|
160
|
+
|
|
161
|
+
const apiShieldOperationSchemaValidationSettings = new ApiShieldOperationSchemaValidationSettings(scope, `${id}`, {
|
|
162
|
+
...props,
|
|
163
|
+
zoneId,
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
createCloudflareTfOutput(
|
|
167
|
+
`${id}-apiShieldOperationSchemaValidationSettingsFriendlyUniqueId`,
|
|
168
|
+
scope,
|
|
169
|
+
apiShieldOperationSchemaValidationSettings.friendlyUniqueId
|
|
170
|
+
)
|
|
171
|
+
createCloudflareTfOutput(
|
|
172
|
+
`${id}-apiShieldOperationSchemaValidationSettingsId`,
|
|
173
|
+
scope,
|
|
174
|
+
apiShieldOperationSchemaValidationSettings.id
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
return apiShieldOperationSchemaValidationSettings
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ApiShieldConfig } from '@cdktf/provider-cloudflare/lib/api-shield'
|
|
2
|
+
import { ApiShieldOperationConfig } from '@cdktf/provider-cloudflare/lib/api-shield-operation'
|
|
3
|
+
import { ApiShieldOperationSchemaValidationSettingsConfig } from '@cdktf/provider-cloudflare/lib/api-shield-operation-schema-validation-settings'
|
|
4
|
+
import { ApiShieldSchemaConfig } from '@cdktf/provider-cloudflare/lib/api-shield-schema'
|
|
5
|
+
import { ApiShieldSchemaValidationSettingsConfig } from '@cdktf/provider-cloudflare/lib/api-shield-schema-validation-settings'
|
|
6
|
+
|
|
7
|
+
export interface ApiShieldProps extends ApiShieldConfig {}
|
|
8
|
+
export interface ApiShieldSchemaProps extends ApiShieldSchemaConfig {}
|
|
9
|
+
export interface ApiShieldSchemaValidationSettingsProps extends ApiShieldSchemaValidationSettingsConfig {}
|
|
10
|
+
export interface ApiShieldOperationProps extends ApiShieldOperationConfig {}
|
|
11
|
+
export interface ApiShieldOperationSchemaValidationSettingsProps
|
|
12
|
+
extends ApiShieldOperationSchemaValidationSettingsConfig {}
|
|
@@ -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,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
|
+
}
|