@gradientedge/cdk-utils 9.69.1 → 9.70.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.
@@ -335,9 +335,15 @@ class AzureApiManagementManager {
335
335
  </choose>`;
336
336
  }
337
337
  }
338
+ // Inject rate limiting policy (if configured)
339
+ let rateLimitPolicy = '';
340
+ if (props.rateLimit) {
341
+ rateLimitPolicy = `<rate-limit-by-key calls="${props.rateLimit.calls}" renewal-period="${props.rateLimit.renewalPeriodInSecs}"/>`;
342
+ }
338
343
  const policyXmlContent = `<policies>
339
344
  <inbound>
340
345
  <base />
346
+ ${rateLimitPolicy}
341
347
  ${cacheInboundPolicy}
342
348
  ${props.commonInboundPolicyXml ?? ''}
343
349
  </inbound>
@@ -17,6 +17,7 @@ export interface ApiManagementApiProps extends ApiManagementApiConfig {
17
17
  commonInboundPolicyXml: string;
18
18
  commonOutboundPolicyXml: string;
19
19
  caching?: ApiManagementApiCaching;
20
+ rateLimit?: ApiManagementApiRateLimit;
20
21
  }
21
22
  export interface ApiManagementV2Props extends ApiManagementConfig {
22
23
  body: any;
@@ -27,3 +28,7 @@ export interface ApiManagementApiCaching {
27
28
  enabled: boolean;
28
29
  ttlInSecs?: number;
29
30
  }
31
+ export interface ApiManagementApiRateLimit {
32
+ calls: number;
33
+ renewalPeriodInSecs: number;
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "9.69.1",
3
+ "version": "9.70.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -400,9 +400,15 @@ export class AzureApiManagementManager {
400
400
  }
401
401
  }
402
402
 
403
+ // Inject rate limiting policy (if configured)
404
+ let rateLimitPolicy = ''
405
+ if (props.rateLimit) {
406
+ rateLimitPolicy = `<rate-limit-by-key calls="${props.rateLimit.calls}" renewal-period="${props.rateLimit.renewalPeriodInSecs}"/>`
407
+ }
403
408
  const policyXmlContent = `<policies>
404
409
  <inbound>
405
410
  <base />
411
+ ${rateLimitPolicy}
406
412
  ${cacheInboundPolicy}
407
413
  ${props.commonInboundPolicyXml ?? ''}
408
414
  </inbound>
@@ -19,6 +19,7 @@ export interface ApiManagementApiProps extends ApiManagementApiConfig {
19
19
  commonInboundPolicyXml: string
20
20
  commonOutboundPolicyXml: string
21
21
  caching?: ApiManagementApiCaching
22
+ rateLimit?: ApiManagementApiRateLimit
22
23
  }
23
24
 
24
25
  export interface ApiManagementV2Props extends ApiManagementConfig {
@@ -31,3 +32,8 @@ export interface ApiManagementApiCaching {
31
32
  enabled: boolean
32
33
  ttlInSecs?: number
33
34
  }
35
+
36
+ export interface ApiManagementApiRateLimit {
37
+ calls: number
38
+ renewalPeriodInSecs: number
39
+ }