@gradientedge/cdk-utils 8.138.0 → 8.139.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 +2 -1
- package/dist/src/lib/cloudflare/common/construct.js +2 -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/index.d.ts +1 -0
- package/dist/src/lib/cloudflare/services/index.js +1 -0
- package/package.json +1 -1
- package/src/lib/cloudflare/common/construct.ts +3 -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/index.ts +1 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TerraformStack } from 'cdktf';
|
|
2
2
|
import { Construct } from 'constructs';
|
|
3
|
-
import { CloudflareWorkerManager, CloudflareZoneManager } from '../services';
|
|
3
|
+
import { CloudflareApiShieldManager, 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;
|
|
9
10
|
workerManager: CloudflareWorkerManager;
|
|
10
11
|
zoneManager: CloudflareZoneManager;
|
|
11
12
|
constructor(scope: Construct, id: string, props: CommonCloudflareStackProps);
|
|
@@ -8,12 +8,14 @@ const services_1 = require("../services");
|
|
|
8
8
|
class CommonCloudflareConstruct extends cdktf_1.TerraformStack {
|
|
9
9
|
id;
|
|
10
10
|
fullyQualifiedDomainName;
|
|
11
|
+
apiShieldManager;
|
|
11
12
|
workerManager;
|
|
12
13
|
zoneManager;
|
|
13
14
|
constructor(scope, id, props) {
|
|
14
15
|
super(scope, id);
|
|
15
16
|
this.props = props;
|
|
16
17
|
this.id = id;
|
|
18
|
+
this.apiShieldManager = new services_1.CloudflareApiShieldManager();
|
|
17
19
|
this.zoneManager = new services_1.CloudflareZoneManager();
|
|
18
20
|
this.workerManager = new services_1.CloudflareWorkerManager();
|
|
19
21
|
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
|
+
}
|
|
@@ -14,5 +14,6 @@ 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);
|
|
17
18
|
__exportStar(require("./worker"), exports);
|
|
18
19
|
__exportStar(require("./zone"), exports);
|
package/package.json
CHANGED
|
@@ -2,13 +2,14 @@ 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 { CloudflareWorkerManager, CloudflareZoneManager } from '../services'
|
|
5
|
+
import { CloudflareApiShieldManager, CloudflareWorkerManager, CloudflareZoneManager } from '../services'
|
|
6
6
|
import { CommonCloudflareStackProps } from './types'
|
|
7
7
|
|
|
8
8
|
export class CommonCloudflareConstruct extends TerraformStack {
|
|
9
9
|
declare props: CommonCloudflareStackProps
|
|
10
10
|
id: string
|
|
11
11
|
fullyQualifiedDomainName: string
|
|
12
|
+
apiShieldManager: CloudflareApiShieldManager
|
|
12
13
|
workerManager: CloudflareWorkerManager
|
|
13
14
|
zoneManager: CloudflareZoneManager
|
|
14
15
|
|
|
@@ -17,6 +18,7 @@ export class CommonCloudflareConstruct extends TerraformStack {
|
|
|
17
18
|
this.props = props
|
|
18
19
|
this.id = id
|
|
19
20
|
|
|
21
|
+
this.apiShieldManager = new CloudflareApiShieldManager()
|
|
20
22
|
this.zoneManager = new CloudflareZoneManager()
|
|
21
23
|
this.workerManager = new CloudflareWorkerManager()
|
|
22
24
|
|
|
@@ -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 {}
|