@gradientedge/cdk-utils 10.2.0 → 10.3.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.
@@ -1,4 +1,11 @@
1
- import * as cloudflare from '@pulumi/cloudflare'
1
+ import {
2
+ WorkersCronTrigger,
3
+ WorkersCustomDomain,
4
+ WorkersKv,
5
+ WorkersKvNamespace,
6
+ WorkersRoute,
7
+ WorkersScript,
8
+ } from '@pulumi/cloudflare'
2
9
  import { CommonCloudflareConstruct } from '../../common/index.js'
3
10
  import {
4
11
  WorkerCronTriggerProps,
@@ -40,11 +47,15 @@ export class CloudflareWorkerManager {
40
47
  const zoneId = props.zoneId
41
48
  ? props.zoneId
42
49
  : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })?.id
43
- return new cloudflare.WorkersCustomDomain(id, {
44
- ...props,
45
- accountId: props.accountId ?? scope.props.accountId,
46
- zoneId,
47
- })
50
+ return new WorkersCustomDomain(
51
+ id,
52
+ {
53
+ ...props,
54
+ accountId: props.accountId ?? scope.props.accountId,
55
+ zoneId,
56
+ },
57
+ { parent: scope }
58
+ )
48
59
  }
49
60
 
50
61
  /**
@@ -61,11 +72,15 @@ export class CloudflareWorkerManager {
61
72
  ? props.zoneId
62
73
  : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })?.id
63
74
 
64
- return new cloudflare.WorkersRoute(id, {
65
- ...props,
66
- script: `${props.script}-${scope.props.stage}`,
67
- zoneId,
68
- })
75
+ return new WorkersRoute(
76
+ id,
77
+ {
78
+ ...props,
79
+ script: `${props.script}-${scope.props.stage}`,
80
+ zoneId,
81
+ },
82
+ { parent: scope }
83
+ )
69
84
  }
70
85
 
71
86
  /**
@@ -78,11 +93,15 @@ export class CloudflareWorkerManager {
78
93
  public createWorkerScript(id: string, scope: CommonCloudflareConstruct, props: WorkerScriptProps) {
79
94
  if (!props) throw `Props undefined for ${id}`
80
95
 
81
- return new cloudflare.WorkersScript(id, {
82
- ...props,
83
- accountId: props.accountId ?? scope.props.accountId,
84
- scriptName: `${props.scriptName}-${scope.props.stage}`,
85
- })
96
+ return new WorkersScript(
97
+ id,
98
+ {
99
+ ...props,
100
+ accountId: props.accountId ?? scope.props.accountId,
101
+ scriptName: `${props.scriptName}-${scope.props.stage}`,
102
+ },
103
+ { parent: scope }
104
+ )
86
105
  }
87
106
 
88
107
  /**
@@ -95,11 +114,15 @@ export class CloudflareWorkerManager {
95
114
  public createWorkersKvNamespace(id: string, scope: CommonCloudflareConstruct, props: WorkersKvNamespaceProps) {
96
115
  if (!props) throw `Props undefined for ${id}`
97
116
 
98
- return new cloudflare.WorkersKvNamespace(id, {
99
- ...props,
100
- accountId: props.accountId ?? scope.props.accountId,
101
- title: scope.isProductionStage() ? props.title : `${props.title}-${scope.props.stage}`,
102
- })
117
+ return new WorkersKvNamespace(
118
+ id,
119
+ {
120
+ ...props,
121
+ accountId: props.accountId ?? scope.props.accountId,
122
+ title: scope.isProductionStage() ? props.title : `${props.title}-${scope.props.stage}`,
123
+ },
124
+ { parent: scope }
125
+ )
103
126
  }
104
127
 
105
128
  /**
@@ -112,10 +135,14 @@ export class CloudflareWorkerManager {
112
135
  public createWorkersKv(id: string, scope: CommonCloudflareConstruct, props: WorkersKvProps) {
113
136
  if (!props) throw `Props undefined for ${id}`
114
137
 
115
- return new cloudflare.WorkersKv(id, {
116
- ...props,
117
- accountId: props.accountId ?? scope.props.accountId,
118
- })
138
+ return new WorkersKv(
139
+ id,
140
+ {
141
+ ...props,
142
+ accountId: props.accountId ?? scope.props.accountId,
143
+ },
144
+ { parent: scope }
145
+ )
119
146
  }
120
147
 
121
148
  /**
@@ -128,9 +155,13 @@ export class CloudflareWorkerManager {
128
155
  public createWorkerCronTrigger(id: string, scope: CommonCloudflareConstruct, props: WorkerCronTriggerProps) {
129
156
  if (!props) throw `Props undefined for ${id}`
130
157
 
131
- return new cloudflare.WorkersCronTrigger(id, {
132
- ...props,
133
- accountId: props.accountId ?? scope.props.accountId,
134
- })
158
+ return new WorkersCronTrigger(
159
+ id,
160
+ {
161
+ ...props,
162
+ accountId: props.accountId ?? scope.props.accountId,
163
+ },
164
+ { parent: scope }
165
+ )
135
166
  }
136
167
  }
@@ -1,4 +1,12 @@
1
- import * as cloudflare from '@pulumi/cloudflare'
1
+ import {
2
+ Zone,
3
+ ZoneCacheReserve,
4
+ ZoneCacheVariants,
5
+ ZoneDnssec,
6
+ ZoneHold,
7
+ ZoneLockdown,
8
+ ZoneSetting,
9
+ } from '@pulumi/cloudflare'
2
10
  import * as pulumi from '@pulumi/pulumi'
3
11
  import { CommonCloudflareConstruct } from '../../common/index.js'
4
12
  import {
@@ -39,16 +47,20 @@ export class CloudflareZoneManager {
39
47
  public createZone(id: string, scope: CommonCloudflareConstruct, props: ZoneProps) {
40
48
  if (!props) throw `Props undefined for ${id}`
41
49
 
42
- return new cloudflare.Zone(id, {
43
- ...props,
44
- account: props.account ?? scope.props.accountId,
45
- name: scope.props.domainName,
46
- })
50
+ return new Zone(
51
+ id,
52
+ {
53
+ ...props,
54
+ account: props.account ?? scope.props.accountId,
55
+ name: scope.props.domainName,
56
+ },
57
+ { parent: scope }
58
+ )
47
59
  }
48
60
 
49
61
  public resolveZone(id: string, scope: CommonCloudflareConstruct, options?: GetZoneProps) {
50
62
  const name = options?.filter?.name ?? scope.props.domainName
51
- return cloudflare.Zone.get(name, id)
63
+ return Zone.get(name, id)
52
64
  }
53
65
 
54
66
  /**
@@ -63,10 +75,14 @@ export class CloudflareZoneManager {
63
75
  const zoneId =
64
76
  props.zoneId ??
65
77
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
66
- return new cloudflare.ZoneCacheReserve(id, {
67
- ...props,
68
- zoneId,
69
- })
78
+ return new ZoneCacheReserve(
79
+ id,
80
+ {
81
+ ...props,
82
+ zoneId,
83
+ },
84
+ { parent: scope }
85
+ )
70
86
  }
71
87
 
72
88
  /**
@@ -81,10 +97,14 @@ export class CloudflareZoneManager {
81
97
  const zoneId =
82
98
  props.zoneId ??
83
99
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
84
- return new cloudflare.ZoneCacheVariants(id, {
85
- ...props,
86
- zoneId,
87
- })
100
+ return new ZoneCacheVariants(
101
+ id,
102
+ {
103
+ ...props,
104
+ zoneId,
105
+ },
106
+ { parent: scope }
107
+ )
88
108
  }
89
109
 
90
110
  /**
@@ -99,10 +119,14 @@ export class CloudflareZoneManager {
99
119
  const zoneId =
100
120
  props.zoneId ??
101
121
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
102
- return new cloudflare.ZoneDnssec(id, {
103
- ...props,
104
- zoneId,
105
- })
122
+ return new ZoneDnssec(
123
+ id,
124
+ {
125
+ ...props,
126
+ zoneId,
127
+ },
128
+ { parent: scope }
129
+ )
106
130
  }
107
131
 
108
132
  /**
@@ -117,10 +141,14 @@ export class CloudflareZoneManager {
117
141
  const zoneId =
118
142
  props.zoneId ??
119
143
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
120
- return new cloudflare.ZoneHold(id, {
121
- ...props,
122
- zoneId,
123
- })
144
+ return new ZoneHold(
145
+ id,
146
+ {
147
+ ...props,
148
+ zoneId,
149
+ },
150
+ { parent: scope }
151
+ )
124
152
  }
125
153
 
126
154
  /**
@@ -135,10 +163,14 @@ export class CloudflareZoneManager {
135
163
  const zoneId =
136
164
  props.zoneId ??
137
165
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
138
- return new cloudflare.ZoneLockdown(id, {
139
- ...props,
140
- zoneId,
141
- })
166
+ return new ZoneLockdown(
167
+ id,
168
+ {
169
+ ...props,
170
+ zoneId,
171
+ },
172
+ { parent: scope }
173
+ )
142
174
  }
143
175
 
144
176
  /**
@@ -153,10 +185,14 @@ export class CloudflareZoneManager {
153
185
  const zoneId =
154
186
  props.zoneId ??
155
187
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
156
- const zoneDnsSettings = new cloudflare.ZoneSetting(id, {
157
- ...props,
158
- zoneId,
159
- })
188
+ const zoneDnsSettings = new ZoneSetting(
189
+ id,
190
+ {
191
+ ...props,
192
+ zoneId,
193
+ },
194
+ { parent: scope }
195
+ )
160
196
 
161
197
  return zoneDnsSettings
162
198
  }
@@ -173,9 +209,13 @@ export class CloudflareZoneManager {
173
209
  const zoneId =
174
210
  props.zoneId ??
175
211
  pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id
176
- return new cloudflare.ZoneSetting(id, {
177
- ...props,
178
- zoneId,
179
- })
212
+ return new ZoneSetting(
213
+ id,
214
+ {
215
+ ...props,
216
+ zoneId,
217
+ },
218
+ { parent: scope }
219
+ )
180
220
  }
181
221
  }