@gradientedge/cdk-utils 9.82.0 → 9.84.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.
@@ -3,8 +3,8 @@ import { ApiManagementCustomDomain } from '@cdktf/provider-azurerm/lib/api-manag
3
3
  import { ApiManagement } from '@cdktf/provider-azurerm/lib/api-management';
4
4
  import { ApiManagementApi } from '@cdktf/provider-azurerm/lib/api-management-api';
5
5
  import { ApiManagementLoggerApplicationInsights } from '@cdktf/provider-azurerm/lib/api-management-logger';
6
+ import { ApiManagementBackend } from '@cdktf/provider-azurerm/lib/api-management-backend';
6
7
  import { RedisCache } from '@cdktf/provider-azurerm/lib/redis-cache';
7
- import { Resource } from '../../.gen/providers/azapi/resource';
8
8
  import { CommonAzureConstruct } from '../../common';
9
9
  import { ApiManagementProps, ApiManagementBackendProps, ApiManagementApiProps, ApiManagementCustomDomainProps } from './types';
10
10
  /**
@@ -48,7 +48,7 @@ export declare class AzureApiManagementManager {
48
48
  * @param props api management backend properties
49
49
  * @see [CDKTF Api management Backend Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/ApiManagementBackend.typescript.md}
50
50
  */
51
- createApiManagementBackend(id: string, scope: CommonAzureConstruct, props: ApiManagementBackendProps): Resource;
51
+ createApiManagementBackend(id: string, scope: CommonAzureConstruct, props: ApiManagementBackendProps): ApiManagementBackend;
52
52
  /**
53
53
  * @summary Method to create a new api management api
54
54
  * @param id scoped id of the resource
@@ -12,8 +12,8 @@ const api_management_api_1 = require("@cdktf/provider-azurerm/lib/api-management
12
12
  const api_management_api_operation_1 = require("@cdktf/provider-azurerm/lib/api-management-api-operation");
13
13
  const api_management_api_operation_policy_1 = require("@cdktf/provider-azurerm/lib/api-management-api-operation-policy");
14
14
  const api_management_logger_1 = require("@cdktf/provider-azurerm/lib/api-management-logger");
15
+ const api_management_backend_1 = require("@cdktf/provider-azurerm/lib/api-management-backend");
15
16
  const api_management_redis_cache_1 = require("@cdktf/provider-azurerm/lib/api-management-redis-cache");
16
- const resource_1 = require("../../.gen/providers/azapi/resource");
17
17
  const utils_1 = require("../../utils");
18
18
  const lodash_1 = __importDefault(require("lodash"));
19
19
  /**
@@ -119,34 +119,11 @@ class AzureApiManagementManager {
119
119
  createApiManagementBackend(id, scope, props) {
120
120
  if (!props)
121
121
  throw `Props undefined for ${id}`;
122
- // Commenting as circuit breaker config is currently not supported
123
- /*
124
- const apiManagementBackend = new ApiManagementBackend(scope, `${id}-am-be`, {
125
- ...props,
126
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementBackend),
127
- description: props.description ?? `Backend for ${props.name}-${scope.props.stage}`,
128
- protocol: props.protocol ?? 'http',
129
- })
130
- */
131
- const apiManagementBackend = new resource_1.Resource(scope, `${id}-am-be`, {
132
- type: 'Microsoft.ApiManagement/service/backends@2024-06-01-preview',
122
+ const apiManagementBackend = new api_management_backend_1.ApiManagementBackend(scope, `${id}-am-be`, {
123
+ ...props,
133
124
  name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementBackend),
134
- parentId: props.apiManagementId,
135
- body: {
136
- properties: {
137
- circuitBreaker: props.circuitBreaker,
138
- credentials: props.credentials,
139
- description: props.description ?? `Backend for ${props.name}-${scope.props.stage}`,
140
- url: props.url,
141
- resourceId: props.resourceId,
142
- protocol: props.protocol ?? 'http',
143
- },
144
- },
145
- responseExportValues: ['*'],
146
- ignoreMissingProperty: true,
147
- ignoreCasing: true,
148
- schemaValidationEnabled: false,
149
- lifecycle: props.lifecycle,
125
+ description: props.description ?? `Backend for ${props.name}-${scope.props.stage}`,
126
+ protocol: props.protocol ?? 'http',
150
127
  });
151
128
  (0, utils_1.createAzureTfOutput)(`${id}-apiManagementBackendName`, scope, apiManagementBackend.name);
152
129
  (0, utils_1.createAzureTfOutput)(`${id}-apiManagementBackendFriendlyUniqueId`, scope, apiManagementBackend.friendlyUniqueId);
@@ -215,7 +192,7 @@ class AzureApiManagementManager {
215
192
  cacheSetInboundPolicy = `<choose>
216
193
  <when condition="@((string)context.Variables["bypassCache"] != "true")">
217
194
  <!-- Attempt to retrieve cached response -->
218
- <cache-lookup-value key="@((string)context.Variables["customCacheKey"])" variable-name="cachedResponse" />
195
+ <cache-lookup-value key="@((string)context.Variables["customCacheKey"])" variable-name="cachedResponse" caching-type="${operation.caching.cachingType || 'prefer-external'}" />
219
196
 
220
197
  <!-- If cache hit, return cached response -->
221
198
  <choose>
@@ -237,13 +214,13 @@ class AzureApiManagementManager {
237
214
  </choose>
238
215
  </when>
239
216
  <when condition="@((string)context.Variables["bypassCache"] == "true")">
240
- <cache-remove-value key="@((string)context.Variables["customCacheKey"])" />
217
+ <cache-remove-value key="@((string)context.Variables["customCacheKey"])" caching-type="${operation.caching.cachingType || 'prefer-external'}" />
241
218
  </when>
242
219
  </choose>`;
243
220
  cacheSetOutboundPolicy = `<!-- Store the response body in cache -->
244
221
  <choose>
245
222
  <when condition="@(context.Response.StatusCode == 200)">
246
- <cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" />
223
+ <cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" caching-type="${operation.caching.cachingType || 'prefer-external'}" />
247
224
  <!-- Add cache status header -->
248
225
  <set-header name="X-Apim-Cache-Status" exists-action="override">
249
226
  <value>MISS</value>
@@ -263,7 +240,7 @@ class AzureApiManagementManager {
263
240
  <!-- Allow admin to clear specific cache entries -->
264
241
  <choose>
265
242
  <when condition="@((string)context.Variables["clearCache"] == "true")">
266
- <cache-remove-value key="@((string)context.Variables["customCacheKey"])" />
243
+ <cache-remove-value key="@((string)context.Variables["customCacheKey"])" caching-type="${operation.caching.cachingType || 'prefer-external'}" />
267
244
  <return-response>
268
245
  <set-status code="200" reason="OK" />
269
246
  <set-body>Cache entry removed successfully</set-body>
@@ -26,6 +26,7 @@ export interface ApiManagementApiCaching {
26
26
  enableCacheSet?: boolean;
27
27
  enableCacheInvalidation?: boolean;
28
28
  ttlInSecs?: number;
29
+ cachingType?: string;
29
30
  }
30
31
  export interface ApiManagementApiRateLimit {
31
32
  calls: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "9.82.0",
3
+ "version": "9.84.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -54,8 +54,8 @@
54
54
  "@aws-sdk/credential-providers": "^3.886.0",
55
55
  "@aws-sdk/types": "^3.804.0",
56
56
  "@cdktf/provider-aws": "^19.63.0",
57
- "@cdktf/provider-azurerm": "^14.12.0",
58
- "@cdktf/provider-cloudflare": "^13.4.0",
57
+ "@cdktf/provider-azurerm": "^14.22.0",
58
+ "@cdktf/provider-cloudflare": "^13.8.0",
59
59
  "@types/lodash": "^4.17.20",
60
60
  "@types/node": "^22.15.17",
61
61
  "@types/uuid": "^10.0.0",
@@ -63,7 +63,7 @@
63
63
  "aws-cdk-lib": "^2.195.0",
64
64
  "cdktf": "^0.21.0",
65
65
  "cdktf-local-exec": "^0.5.71",
66
- "constructs": "^10.4.2",
66
+ "constructs": "^10.4.3",
67
67
  "lodash": "^4.17.21",
68
68
  "moment": "^2.30.1",
69
69
  "nconf": "^0.13.0",
@@ -12,9 +12,9 @@ import {
12
12
  ApiManagementLogger,
13
13
  ApiManagementLoggerApplicationInsights,
14
14
  } from '@cdktf/provider-azurerm/lib/api-management-logger'
15
+ import { ApiManagementBackend } from '@cdktf/provider-azurerm/lib/api-management-backend'
15
16
  import { ApiManagementRedisCache } from '@cdktf/provider-azurerm/lib/api-management-redis-cache'
16
17
  import { RedisCache } from '@cdktf/provider-azurerm/lib/redis-cache'
17
- import { Resource } from '../../.gen/providers/azapi/resource'
18
18
  import { CommonAzureConstruct } from '../../common'
19
19
  import { createAzureTfOutput } from '../../utils'
20
20
  import {
@@ -22,7 +22,6 @@ import {
22
22
  ApiManagementBackendProps,
23
23
  ApiManagementApiProps,
24
24
  ApiManagementCustomDomainProps,
25
- ApiManagementRedisCacheProps,
26
25
  } from './types'
27
26
  import _ from 'lodash'
28
27
 
@@ -144,39 +143,11 @@ export class AzureApiManagementManager {
144
143
  public createApiManagementBackend(id: string, scope: CommonAzureConstruct, props: ApiManagementBackendProps) {
145
144
  if (!props) throw `Props undefined for ${id}`
146
145
 
147
- // Commenting as circuit breaker config is currently not supported
148
- /*
149
146
  const apiManagementBackend = new ApiManagementBackend(scope, `${id}-am-be`, {
150
- ...props,
151
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementBackend),
152
- description: props.description ?? `Backend for ${props.name}-${scope.props.stage}`,
153
- protocol: props.protocol ?? 'http',
154
- })
155
- */
156
-
157
- const apiManagementBackend = new Resource(scope, `${id}-am-be`, {
158
- type: 'Microsoft.ApiManagement/service/backends@2024-06-01-preview',
147
+ ...props,
159
148
  name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementBackend),
160
- parentId: props.apiManagementId,
161
-
162
- body: {
163
- properties: {
164
- circuitBreaker: props.circuitBreaker,
165
- credentials: props.credentials,
166
- description: props.description ?? `Backend for ${props.name}-${scope.props.stage}`,
167
- url: props.url,
168
- resourceId: props.resourceId,
169
- protocol: props.protocol ?? 'http',
170
- },
171
- },
172
-
173
- responseExportValues: ['*'],
174
-
175
- ignoreMissingProperty: true,
176
- ignoreCasing: true,
177
- schemaValidationEnabled: false,
178
-
179
- lifecycle: props.lifecycle,
149
+ description: props.description ?? `Backend for ${props.name}-${scope.props.stage}`,
150
+ protocol: props.protocol ?? 'http',
180
151
  })
181
152
 
182
153
  createAzureTfOutput(`${id}-apiManagementBackendName`, scope, apiManagementBackend.name)
@@ -266,7 +237,7 @@ export class AzureApiManagementManager {
266
237
  cacheSetInboundPolicy = `<choose>
267
238
  <when condition="@((string)context.Variables["bypassCache"] != "true")">
268
239
  <!-- Attempt to retrieve cached response -->
269
- <cache-lookup-value key="@((string)context.Variables["customCacheKey"])" variable-name="cachedResponse" />
240
+ <cache-lookup-value key="@((string)context.Variables["customCacheKey"])" variable-name="cachedResponse" caching-type="${operation.caching.cachingType || 'prefer-external'}" />
270
241
 
271
242
  <!-- If cache hit, return cached response -->
272
243
  <choose>
@@ -288,13 +259,13 @@ export class AzureApiManagementManager {
288
259
  </choose>
289
260
  </when>
290
261
  <when condition="@((string)context.Variables["bypassCache"] == "true")">
291
- <cache-remove-value key="@((string)context.Variables["customCacheKey"])" />
262
+ <cache-remove-value key="@((string)context.Variables["customCacheKey"])" caching-type="${operation.caching.cachingType || 'prefer-external'}" />
292
263
  </when>
293
264
  </choose>`
294
265
  cacheSetOutboundPolicy = `<!-- Store the response body in cache -->
295
266
  <choose>
296
267
  <when condition="@(context.Response.StatusCode == 200)">
297
- <cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" />
268
+ <cache-store-value key="@((string)context.Variables["customCacheKey"])" value="@(context.Response.Body.As<string>(preserveContent: true))" duration="${operation.caching.ttlInSecs ?? 900}" caching-type="${operation.caching.cachingType || 'prefer-external'}" />
298
269
  <!-- Add cache status header -->
299
270
  <set-header name="X-Apim-Cache-Status" exists-action="override">
300
271
  <value>MISS</value>
@@ -315,7 +286,7 @@ export class AzureApiManagementManager {
315
286
  <!-- Allow admin to clear specific cache entries -->
316
287
  <choose>
317
288
  <when condition="@((string)context.Variables["clearCache"] == "true")">
318
- <cache-remove-value key="@((string)context.Variables["customCacheKey"])" />
289
+ <cache-remove-value key="@((string)context.Variables["customCacheKey"])" caching-type="${operation.caching.cachingType || 'prefer-external'}" />
319
290
  <return-response>
320
291
  <set-status code="200" reason="OK" />
321
292
  <set-body>Cache entry removed successfully</set-body>
@@ -30,6 +30,7 @@ export interface ApiManagementApiCaching {
30
30
  enableCacheSet?: boolean
31
31
  enableCacheInvalidation?: boolean
32
32
  ttlInSecs?: number
33
+ cachingType?: string
33
34
  }
34
35
 
35
36
  export interface ApiManagementApiRateLimit {