@gradientedge/cdk-utils 9.77.0 → 9.79.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.
@@ -226,28 +226,27 @@ class AzureApiManagementManager {
226
226
  </when>
227
227
  </choose>
228
228
  </when>
229
+ <when condition="@((string)context.Variables["bypassCache"] == "true")">
230
+ <cache-remove-value key="@((string)context.Variables["customCacheKey"])" />
231
+ </when>
229
232
  </choose>`;
230
- cacheSetOutboundPolicy = `<choose>
231
- <when condition="@((string)context.Variables["bypassCache"] != "true")">
232
- <!-- Store the response body in cache -->
233
- <choose>
234
- <when condition="@(context.Response.StatusCode == 200)">
235
- <cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" />
236
- <!-- Add cache status header -->
237
- <set-header name="X-Apim-Cache-Status" exists-action="override">
238
- <value>MISS</value>
239
- </set-header>
240
- </when>
241
- </choose>
242
- <!-- Add debug headers -->
243
- <set-header name="X-Apim-Cache-Key" exists-action="override">
244
- <value>@((string)context.Variables["customCacheKey"])</value>
245
- </set-header>
246
- <set-header name="X-Apim-API-Name" exists-action="override">
247
- <value>@(context.Api.Name)</value>
233
+ cacheSetOutboundPolicy = `<!-- Store the response body in cache -->
234
+ <choose>
235
+ <when condition="@(context.Response.StatusCode == 200)">
236
+ <cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" />
237
+ <!-- Add cache status header -->
238
+ <set-header name="X-Apim-Cache-Status" exists-action="override">
239
+ <value>MISS</value>
248
240
  </set-header>
249
241
  </when>
250
- </choose>`;
242
+ </choose>
243
+ <!-- Add debug headers -->
244
+ <set-header name="X-Apim-Cache-Key" exists-action="override">
245
+ <value>@((string)context.Variables["customCacheKey"])</value>
246
+ </set-header>
247
+ <set-header name="X-Apim-API-Name" exists-action="override">
248
+ <value>@(context.Api.Name)</value>
249
+ </set-header>`;
251
250
  }
252
251
  if (operation.caching.enableCacheInvalidation) {
253
252
  cacheInvalidateInboundPolicy = `<set-variable name="clearCache" value="@(context.Request.Headers.GetValueOrDefault("X-Apim-Clear-Cache", "false").ToLower())" />
@@ -1,8 +1,10 @@
1
1
  import { DataAzurermEventgridTopic, DataAzurermEventgridTopicConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-eventgrid-topic';
2
2
  import { EventgridTopic } from '@cdktf/provider-azurerm/lib/eventgrid-topic';
3
3
  import { EventgridEventSubscription } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription';
4
+ import { EventgridSystemTopic } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic';
5
+ import { EventgridSystemTopicEventSubscription } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic-event-subscription/index.js';
4
6
  import { CommonAzureConstruct } from '../../common';
5
- import { EventgridTopicProps, EventgridEventSubscriptionProps } from './types';
7
+ import { EventgridTopicProps, EventgridEventSubscriptionProps, EventgridSystemTopicProps, EventgridSystemTopicEventSubscriptionProps } from './types';
6
8
  /**
7
9
  * @classdesc Provides operations on Azure Event Grid
8
10
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
@@ -45,4 +47,20 @@ export declare class AzureEventgridManager {
45
47
  * @see [CDKTF Eventgrid Subscription Container Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridEventSubscription.typescript.md}
46
48
  */
47
49
  createEventgridSubscription(id: string, scope: CommonAzureConstruct, props: EventgridEventSubscriptionProps): EventgridEventSubscription;
50
+ /**
51
+ * @summary Method to create a new eventgrid system topic
52
+ * @param id scoped id of the resource
53
+ * @param scope scope in which this resource is defined
54
+ * @param props eventgrid system topic properties
55
+ * @see [CDKTF Eventgrid System Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridSystemTopic.typescript.md}
56
+ */
57
+ createEventgridSystemTopic(id: string, scope: CommonAzureConstruct, props: EventgridSystemTopicProps): EventgridSystemTopic;
58
+ /**
59
+ * @summary Method to create a new eventgrid system topic subscription
60
+ * @param id scoped id of the resource
61
+ * @param scope scope in which this resource is defined
62
+ * @param props eventgrid system topic subscription properties
63
+ * @see [CDKTF Eventgrid System Topic Subscription Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridSystemTopicEventSubscription.typescript.md}
64
+ */
65
+ createEventgridSystemTopicEventSubscription(id: string, scope: CommonAzureConstruct, props: EventgridSystemTopicEventSubscriptionProps, systemTopic: EventgridSystemTopic): EventgridSystemTopicEventSubscription;
48
66
  }
@@ -5,6 +5,8 @@ const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-
5
5
  const data_azurerm_eventgrid_topic_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-eventgrid-topic");
6
6
  const eventgrid_topic_1 = require("@cdktf/provider-azurerm/lib/eventgrid-topic");
7
7
  const eventgrid_event_subscription_1 = require("@cdktf/provider-azurerm/lib/eventgrid-event-subscription");
8
+ const eventgrid_system_topic_1 = require("@cdktf/provider-azurerm/lib/eventgrid-system-topic");
9
+ const index_js_1 = require("@cdktf/provider-azurerm/lib/eventgrid-system-topic-event-subscription/index.js");
8
10
  const utils_1 = require("../../utils");
9
11
  /**
10
12
  * @classdesc Provides operations on Azure Event Grid
@@ -109,5 +111,64 @@ class AzureEventgridManager {
109
111
  (0, utils_1.createAzureTfOutput)(`${id}-eventgridSubscriptionId`, scope, eventgridSubscription.id);
110
112
  return eventgridSubscription;
111
113
  }
114
+ /**
115
+ * @summary Method to create a new eventgrid system topic
116
+ * @param id scoped id of the resource
117
+ * @param scope scope in which this resource is defined
118
+ * @param props eventgrid system topic properties
119
+ * @see [CDKTF Eventgrid System Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridSystemTopic.typescript.md}
120
+ */
121
+ createEventgridSystemTopic(id, scope, props) {
122
+ if (!props)
123
+ throw `Props undefined for ${id}`;
124
+ const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-est-rg`, {
125
+ name: scope.props.resourceGroupName
126
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
127
+ : `${props.resourceGroupName}`,
128
+ });
129
+ if (!resourceGroup)
130
+ throw `Resource group undefined for ${id}`;
131
+ const eventgridSystemTopic = new eventgrid_system_topic_1.EventgridSystemTopic(scope, `${id}-est`, {
132
+ ...props,
133
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridSystemTopic),
134
+ location: resourceGroup.location,
135
+ resourceGroupName: resourceGroup.name,
136
+ tags: props.tags ?? {
137
+ environment: scope.props.stage,
138
+ },
139
+ });
140
+ (0, utils_1.createAzureTfOutput)(`${id}-eventgridSystemTopicName`, scope, eventgridSystemTopic.name);
141
+ (0, utils_1.createAzureTfOutput)(`${id}-eventgridSystemTopicFriendlyUniqueId`, scope, eventgridSystemTopic.friendlyUniqueId);
142
+ (0, utils_1.createAzureTfOutput)(`${id}-eventgridSystemTopicId`, scope, eventgridSystemTopic.id);
143
+ return eventgridSystemTopic;
144
+ }
145
+ /**
146
+ * @summary Method to create a new eventgrid system topic subscription
147
+ * @param id scoped id of the resource
148
+ * @param scope scope in which this resource is defined
149
+ * @param props eventgrid system topic subscription properties
150
+ * @see [CDKTF Eventgrid System Topic Subscription Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridSystemTopicEventSubscription.typescript.md}
151
+ */
152
+ createEventgridSystemTopicEventSubscription(id, scope, props, systemTopic) {
153
+ if (!props)
154
+ throw `Props undefined for ${id}`;
155
+ const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-ests-rg`, {
156
+ name: scope.props.resourceGroupName
157
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
158
+ : `${props.resourceGroupName}`,
159
+ });
160
+ if (!resourceGroup)
161
+ throw `Resource group undefined for ${id}`;
162
+ const eventgridSystemTopicSubscription = new index_js_1.EventgridSystemTopicEventSubscription(scope, `${id}-ests`, {
163
+ ...props,
164
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridSystemTopicEventSubscription),
165
+ systemTopic: systemTopic.name,
166
+ resourceGroupName: resourceGroup.name,
167
+ });
168
+ (0, utils_1.createAzureTfOutput)(`${id}-eventgridSystemTopicEventSubscriptionName`, scope, eventgridSystemTopicSubscription.name);
169
+ (0, utils_1.createAzureTfOutput)(`${id}-eventgridSystemTopicEventSubscriptionFriendlyUniqueId`, scope, eventgridSystemTopicSubscription.friendlyUniqueId);
170
+ (0, utils_1.createAzureTfOutput)(`${id}-eventgridSystemTopicEventSubscriptionId`, scope, eventgridSystemTopicSubscription.id);
171
+ return eventgridSystemTopicSubscription;
172
+ }
112
173
  }
113
174
  exports.AzureEventgridManager = AzureEventgridManager;
@@ -1,6 +1,12 @@
1
1
  import { EventgridTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-topic';
2
2
  import { EventgridEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription';
3
+ import { EventgridSystemTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic';
4
+ import { EventgridSystemTopicEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic-event-subscription/index.js';
3
5
  export interface EventgridTopicProps extends EventgridTopicConfig {
4
6
  }
5
7
  export interface EventgridEventSubscriptionProps extends EventgridEventSubscriptionConfig {
6
8
  }
9
+ export interface EventgridSystemTopicProps extends EventgridSystemTopicConfig {
10
+ }
11
+ export interface EventgridSystemTopicEventSubscriptionProps extends EventgridSystemTopicEventSubscriptionConfig {
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "9.77.0",
3
+ "version": "9.79.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -273,28 +273,27 @@ export class AzureApiManagementManager {
273
273
  </when>
274
274
  </choose>
275
275
  </when>
276
+ <when condition="@((string)context.Variables["bypassCache"] == "true")">
277
+ <cache-remove-value key="@((string)context.Variables["customCacheKey"])" />
278
+ </when>
276
279
  </choose>`
277
- cacheSetOutboundPolicy = `<choose>
278
- <when condition="@((string)context.Variables["bypassCache"] != "true")">
279
- <!-- Store the response body in cache -->
280
- <choose>
281
- <when condition="@(context.Response.StatusCode == 200)">
282
- <cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" />
283
- <!-- Add cache status header -->
284
- <set-header name="X-Apim-Cache-Status" exists-action="override">
285
- <value>MISS</value>
286
- </set-header>
287
- </when>
288
- </choose>
289
- <!-- Add debug headers -->
290
- <set-header name="X-Apim-Cache-Key" exists-action="override">
291
- <value>@((string)context.Variables["customCacheKey"])</value>
292
- </set-header>
293
- <set-header name="X-Apim-API-Name" exists-action="override">
294
- <value>@(context.Api.Name)</value>
280
+ cacheSetOutboundPolicy = `<!-- Store the response body in cache -->
281
+ <choose>
282
+ <when condition="@(context.Response.StatusCode == 200)">
283
+ <cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" />
284
+ <!-- Add cache status header -->
285
+ <set-header name="X-Apim-Cache-Status" exists-action="override">
286
+ <value>MISS</value>
295
287
  </set-header>
296
288
  </when>
297
- </choose>`
289
+ </choose>
290
+ <!-- Add debug headers -->
291
+ <set-header name="X-Apim-Cache-Key" exists-action="override">
292
+ <value>@((string)context.Variables["customCacheKey"])</value>
293
+ </set-header>
294
+ <set-header name="X-Apim-API-Name" exists-action="override">
295
+ <value>@(context.Api.Name)</value>
296
+ </set-header>`
298
297
  }
299
298
 
300
299
  if (operation.caching.enableCacheInvalidation) {
@@ -5,9 +5,16 @@ import {
5
5
  } from '@cdktf/provider-azurerm/lib/data-azurerm-eventgrid-topic'
6
6
  import { EventgridTopic } from '@cdktf/provider-azurerm/lib/eventgrid-topic'
7
7
  import { EventgridEventSubscription } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription'
8
+ import { EventgridSystemTopic } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic'
9
+ import { EventgridSystemTopicEventSubscription } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic-event-subscription/index.js'
8
10
  import { CommonAzureConstruct } from '../../common'
9
11
  import { createAzureTfOutput } from '../../utils'
10
- import { EventgridTopicProps, EventgridEventSubscriptionProps } from './types'
12
+ import {
13
+ EventgridTopicProps,
14
+ EventgridEventSubscriptionProps,
15
+ EventgridSystemTopicProps,
16
+ EventgridSystemTopicEventSubscriptionProps,
17
+ } from './types'
11
18
 
12
19
  /**
13
20
  * @classdesc Provides operations on Azure Event Grid
@@ -122,4 +129,83 @@ export class AzureEventgridManager {
122
129
 
123
130
  return eventgridSubscription
124
131
  }
132
+
133
+ /**
134
+ * @summary Method to create a new eventgrid system topic
135
+ * @param id scoped id of the resource
136
+ * @param scope scope in which this resource is defined
137
+ * @param props eventgrid system topic properties
138
+ * @see [CDKTF Eventgrid System Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridSystemTopic.typescript.md}
139
+ */
140
+ public createEventgridSystemTopic(id: string, scope: CommonAzureConstruct, props: EventgridSystemTopicProps) {
141
+ if (!props) throw `Props undefined for ${id}`
142
+
143
+ const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-est-rg`, {
144
+ name: scope.props.resourceGroupName
145
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
146
+ : `${props.resourceGroupName}`,
147
+ })
148
+
149
+ if (!resourceGroup) throw `Resource group undefined for ${id}`
150
+
151
+ const eventgridSystemTopic = new EventgridSystemTopic(scope, `${id}-est`, {
152
+ ...props,
153
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridSystemTopic),
154
+ location: resourceGroup.location,
155
+ resourceGroupName: resourceGroup.name,
156
+ tags: props.tags ?? {
157
+ environment: scope.props.stage,
158
+ },
159
+ })
160
+
161
+ createAzureTfOutput(`${id}-eventgridSystemTopicName`, scope, eventgridSystemTopic.name)
162
+ createAzureTfOutput(`${id}-eventgridSystemTopicFriendlyUniqueId`, scope, eventgridSystemTopic.friendlyUniqueId)
163
+ createAzureTfOutput(`${id}-eventgridSystemTopicId`, scope, eventgridSystemTopic.id)
164
+
165
+ return eventgridSystemTopic
166
+ }
167
+
168
+ /**
169
+ * @summary Method to create a new eventgrid system topic subscription
170
+ * @param id scoped id of the resource
171
+ * @param scope scope in which this resource is defined
172
+ * @param props eventgrid system topic subscription properties
173
+ * @see [CDKTF Eventgrid System Topic Subscription Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridSystemTopicEventSubscription.typescript.md}
174
+ */
175
+ public createEventgridSystemTopicEventSubscription(
176
+ id: string,
177
+ scope: CommonAzureConstruct,
178
+ props: EventgridSystemTopicEventSubscriptionProps,
179
+ systemTopic: EventgridSystemTopic
180
+ ) {
181
+ if (!props) throw `Props undefined for ${id}`
182
+
183
+ const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-ests-rg`, {
184
+ name: scope.props.resourceGroupName
185
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
186
+ : `${props.resourceGroupName}`,
187
+ })
188
+
189
+ if (!resourceGroup) throw `Resource group undefined for ${id}`
190
+
191
+ const eventgridSystemTopicSubscription = new EventgridSystemTopicEventSubscription(scope, `${id}-ests`, {
192
+ ...props,
193
+ name: scope.resourceNameFormatter.format(
194
+ props.name,
195
+ scope.props.resourceNameOptions?.eventGridSystemTopicEventSubscription
196
+ ),
197
+ systemTopic: systemTopic.name,
198
+ resourceGroupName: resourceGroup.name,
199
+ })
200
+
201
+ createAzureTfOutput(`${id}-eventgridSystemTopicEventSubscriptionName`, scope, eventgridSystemTopicSubscription.name)
202
+ createAzureTfOutput(
203
+ `${id}-eventgridSystemTopicEventSubscriptionFriendlyUniqueId`,
204
+ scope,
205
+ eventgridSystemTopicSubscription.friendlyUniqueId
206
+ )
207
+ createAzureTfOutput(`${id}-eventgridSystemTopicEventSubscriptionId`, scope, eventgridSystemTopicSubscription.id)
208
+
209
+ return eventgridSystemTopicSubscription
210
+ }
125
211
  }
@@ -1,6 +1,12 @@
1
1
  import { EventgridTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-topic'
2
2
  import { EventgridEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription'
3
+ import { EventgridSystemTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic'
4
+ import { EventgridSystemTopicEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic-event-subscription/index.js'
3
5
 
4
6
  export interface EventgridTopicProps extends EventgridTopicConfig {}
5
7
 
6
8
  export interface EventgridEventSubscriptionProps extends EventgridEventSubscriptionConfig {}
9
+
10
+ export interface EventgridSystemTopicProps extends EventgridSystemTopicConfig {}
11
+
12
+ export interface EventgridSystemTopicEventSubscriptionProps extends EventgridSystemTopicEventSubscriptionConfig {}