@gradientedge/cdk-utils 8.143.0 → 8.144.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/index.d.ts +1 -0
- package/dist/src/lib/cloudflare/services/index.js +1 -0
- package/dist/src/lib/cloudflare/services/record/index.d.ts +2 -0
- package/dist/src/lib/cloudflare/services/record/index.js +18 -0
- package/dist/src/lib/cloudflare/services/record/main.d.ts +30 -0
- package/dist/src/lib/cloudflare/services/record/main.js +46 -0
- package/dist/src/lib/cloudflare/services/record/types.d.ts +3 -0
- package/dist/src/lib/cloudflare/services/record/types.js +2 -0
- package/package.json +1 -1
- package/src/lib/cloudflare/common/construct.ts +3 -0
- package/src/lib/cloudflare/services/index.ts +1 -0
- package/src/lib/cloudflare/services/record/index.ts +2 -0
- package/src/lib/cloudflare/services/record/main.ts +48 -0
- package/src/lib/cloudflare/services/record/types.ts +3 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TerraformStack } from 'cdktf';
|
|
2
2
|
import { Construct } from 'constructs';
|
|
3
|
-
import { CloudflareAccessManager, CloudflareApiShieldManager, CloudflareArgoManager, CloudflareFilterManager, CloudflareFirewallManager, CloudflarePageManager, CloudflareWorkerManager, CloudflareZoneManager } from '../services';
|
|
3
|
+
import { CloudflareAccessManager, CloudflareApiShieldManager, CloudflareArgoManager, CloudflareFilterManager, CloudflareFirewallManager, CloudflarePageManager, CloudflareRecordManager, CloudflareWorkerManager, CloudflareZoneManager } from '../services';
|
|
4
4
|
import { CommonCloudflareStackProps } from './types';
|
|
5
5
|
export declare class CommonCloudflareConstruct extends TerraformStack {
|
|
6
6
|
props: CommonCloudflareStackProps;
|
|
@@ -12,6 +12,7 @@ export declare class CommonCloudflareConstruct extends TerraformStack {
|
|
|
12
12
|
filterManager: CloudflareFilterManager;
|
|
13
13
|
firewallManager: CloudflareFirewallManager;
|
|
14
14
|
pageManager: CloudflarePageManager;
|
|
15
|
+
recordManager: CloudflareRecordManager;
|
|
15
16
|
workerManager: CloudflareWorkerManager;
|
|
16
17
|
zoneManager: CloudflareZoneManager;
|
|
17
18
|
constructor(scope: Construct, id: string, props: CommonCloudflareStackProps);
|
|
@@ -14,6 +14,7 @@ class CommonCloudflareConstruct extends cdktf_1.TerraformStack {
|
|
|
14
14
|
filterManager;
|
|
15
15
|
firewallManager;
|
|
16
16
|
pageManager;
|
|
17
|
+
recordManager;
|
|
17
18
|
workerManager;
|
|
18
19
|
zoneManager;
|
|
19
20
|
constructor(scope, id, props) {
|
|
@@ -26,6 +27,7 @@ class CommonCloudflareConstruct extends cdktf_1.TerraformStack {
|
|
|
26
27
|
this.filterManager = new services_1.CloudflareFilterManager();
|
|
27
28
|
this.firewallManager = new services_1.CloudflareFirewallManager();
|
|
28
29
|
this.pageManager = new services_1.CloudflarePageManager();
|
|
30
|
+
this.recordManager = new services_1.CloudflareRecordManager();
|
|
29
31
|
this.workerManager = new services_1.CloudflareWorkerManager();
|
|
30
32
|
this.zoneManager = new services_1.CloudflareZoneManager();
|
|
31
33
|
this.determineFullyQualifiedDomain();
|
|
@@ -20,5 +20,6 @@ __exportStar(require("./argo"), exports);
|
|
|
20
20
|
__exportStar(require("./filter"), exports);
|
|
21
21
|
__exportStar(require("./firewall"), exports);
|
|
22
22
|
__exportStar(require("./page"), exports);
|
|
23
|
+
__exportStar(require("./record"), exports);
|
|
23
24
|
__exportStar(require("./worker"), exports);
|
|
24
25
|
__exportStar(require("./zone"), exports);
|
|
@@ -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 { Record } from '@cdktf/provider-cloudflare/lib/record';
|
|
2
|
+
import { CommonCloudflareConstruct } from '../../common';
|
|
3
|
+
import { RecordProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* @classdesc Provides operations on Cloudflare Records
|
|
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.recordManager.createRecord('MyRecord', this, props)
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class CloudflareRecordManager {
|
|
22
|
+
/**
|
|
23
|
+
* @summary Method to create a new Cloudflare Record
|
|
24
|
+
* @param id scoped id of the resource
|
|
25
|
+
* @param scope scope in which this resource is defined
|
|
26
|
+
* @param props record properties
|
|
27
|
+
* @see [CDKTF Record Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/record.typescript.md}
|
|
28
|
+
*/
|
|
29
|
+
createRecord(id: string, scope: CommonCloudflareConstruct, props: RecordProps): Record;
|
|
30
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudflareRecordManager = void 0;
|
|
4
|
+
const record_1 = require("@cdktf/provider-cloudflare/lib/record");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
/**
|
|
7
|
+
* @classdesc Provides operations on Cloudflare Records
|
|
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.recordManager.createRecord('MyRecord', this, props)
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
class CloudflareRecordManager {
|
|
24
|
+
/**
|
|
25
|
+
* @summary Method to create a new Cloudflare Record
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param scope scope in which this resource is defined
|
|
28
|
+
* @param props record properties
|
|
29
|
+
* @see [CDKTF Record Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/record.typescript.md}
|
|
30
|
+
*/
|
|
31
|
+
createRecord(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 record = new record_1.Record(scope, `${id}`, {
|
|
38
|
+
...props,
|
|
39
|
+
zoneId,
|
|
40
|
+
});
|
|
41
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-recordFriendlyUniqueId`, scope, record.friendlyUniqueId);
|
|
42
|
+
(0, utils_1.createCloudflareTfOutput)(`${id}-recordId`, scope, record.id);
|
|
43
|
+
return record;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.CloudflareRecordManager = CloudflareRecordManager;
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
CloudflareFilterManager,
|
|
10
10
|
CloudflareFirewallManager,
|
|
11
11
|
CloudflarePageManager,
|
|
12
|
+
CloudflareRecordManager,
|
|
12
13
|
CloudflareWorkerManager,
|
|
13
14
|
CloudflareZoneManager,
|
|
14
15
|
} from '../services'
|
|
@@ -24,6 +25,7 @@ export class CommonCloudflareConstruct extends TerraformStack {
|
|
|
24
25
|
filterManager: CloudflareFilterManager
|
|
25
26
|
firewallManager: CloudflareFirewallManager
|
|
26
27
|
pageManager: CloudflarePageManager
|
|
28
|
+
recordManager: CloudflareRecordManager
|
|
27
29
|
workerManager: CloudflareWorkerManager
|
|
28
30
|
zoneManager: CloudflareZoneManager
|
|
29
31
|
|
|
@@ -38,6 +40,7 @@ export class CommonCloudflareConstruct extends TerraformStack {
|
|
|
38
40
|
this.filterManager = new CloudflareFilterManager()
|
|
39
41
|
this.firewallManager = new CloudflareFirewallManager()
|
|
40
42
|
this.pageManager = new CloudflarePageManager()
|
|
43
|
+
this.recordManager = new CloudflareRecordManager()
|
|
41
44
|
this.workerManager = new CloudflareWorkerManager()
|
|
42
45
|
this.zoneManager = new CloudflareZoneManager()
|
|
43
46
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Record } from '@cdktf/provider-cloudflare/lib/record'
|
|
2
|
+
import { CommonCloudflareConstruct } from '../../common'
|
|
3
|
+
import { createCloudflareTfOutput } from '../../utils'
|
|
4
|
+
import { RecordProps } from './types'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @classdesc Provides operations on Cloudflare Records
|
|
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.recordManager.createRecord('MyRecord', this, props)
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export class CloudflareRecordManager {
|
|
24
|
+
/**
|
|
25
|
+
* @summary Method to create a new Cloudflare Record
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param scope scope in which this resource is defined
|
|
28
|
+
* @param props record properties
|
|
29
|
+
* @see [CDKTF Record Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/record.typescript.md}
|
|
30
|
+
*/
|
|
31
|
+
public createRecord(id: string, scope: CommonCloudflareConstruct, props: RecordProps) {
|
|
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 record = new Record(scope, `${id}`, {
|
|
39
|
+
...props,
|
|
40
|
+
zoneId,
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
createCloudflareTfOutput(`${id}-recordFriendlyUniqueId`, scope, record.friendlyUniqueId)
|
|
44
|
+
createCloudflareTfOutput(`${id}-recordId`, scope, record.id)
|
|
45
|
+
|
|
46
|
+
return record
|
|
47
|
+
}
|
|
48
|
+
}
|