@gradientedge/cdk-utils 9.80.0 → 9.82.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.
Files changed (32) hide show
  1. package/dist/src/lib/azure/common/construct.d.ts +2 -1
  2. package/dist/src/lib/azure/common/construct.js +2 -0
  3. package/dist/src/lib/azure/services/api-management/main.d.ts +2 -1
  4. package/dist/src/lib/azure/services/api-management/main.js +11 -1
  5. package/dist/src/lib/azure/services/api-management/types.d.ts +3 -0
  6. package/dist/src/lib/azure/services/eventgrid/main.d.ts +1 -1
  7. package/dist/src/lib/azure/services/index.d.ts +1 -0
  8. package/dist/src/lib/azure/services/index.js +1 -0
  9. package/dist/src/lib/azure/services/key-vault/main.js +1 -1
  10. package/dist/src/lib/azure/services/redis/index.d.ts +2 -0
  11. package/dist/src/lib/azure/services/redis/index.js +18 -0
  12. package/dist/src/lib/azure/services/redis/main.d.ts +30 -0
  13. package/dist/src/lib/azure/services/redis/main.js +57 -0
  14. package/dist/src/lib/azure/services/redis/types.d.ts +3 -0
  15. package/dist/src/lib/azure/services/redis/types.js +2 -0
  16. package/dist/src/lib/azure/services/servicebus/main.d.ts +10 -1
  17. package/dist/src/lib/azure/services/servicebus/main.js +21 -0
  18. package/dist/src/lib/azure/services/servicebus/types.d.ts +3 -0
  19. package/dist/src/lib/cloudflare/services/access/main.js +1 -1
  20. package/package.json +1 -1
  21. package/src/lib/azure/common/construct.ts +3 -0
  22. package/src/lib/azure/services/api-management/main.ts +15 -1
  23. package/src/lib/azure/services/api-management/types.ts +3 -0
  24. package/src/lib/azure/services/eventgrid/main.ts +1 -1
  25. package/src/lib/azure/services/index.ts +1 -0
  26. package/src/lib/azure/services/key-vault/main.ts +1 -1
  27. package/src/lib/azure/services/redis/index.ts +2 -0
  28. package/src/lib/azure/services/redis/main.ts +59 -0
  29. package/src/lib/azure/services/redis/types.ts +3 -0
  30. package/src/lib/azure/services/servicebus/main.ts +25 -0
  31. package/src/lib/azure/services/servicebus/types.ts +2 -0
  32. package/src/lib/cloudflare/services/access/main.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  import { TerraformStack } from 'cdktf';
2
2
  import { Construct } from 'constructs';
3
- import { AzureStorageManager, AzureKeyVaultManager, AzureApiManagementManager, AzureFunctionManager, AzureResourceGroupManager, AzureAppServiceManager, AzureApplicationInsightsManager, AzureAppConfigurationManager, AzureCosmosDbManager, AzureServicebusManager, AzureEventgridManager, AzureDnsManager, AzureLogAnalyticsWorkspaceManager, AzureMonitorManager } from '../services';
3
+ import { AzureStorageManager, AzureKeyVaultManager, AzureApiManagementManager, AzureFunctionManager, AzureResourceGroupManager, AzureAppServiceManager, AzureApplicationInsightsManager, AzureAppConfigurationManager, AzureCosmosDbManager, AzureServicebusManager, AzureEventgridManager, AzureDnsManager, AzureLogAnalyticsWorkspaceManager, AzureMonitorManager, AzureRedisManager } from '../services';
4
4
  import { CommonAzureStackProps } from './types';
5
5
  import { AzureResourceNameFormatter } from './resource-name-formatter';
6
6
  export declare class CommonAzureConstruct extends TerraformStack {
@@ -18,6 +18,7 @@ export declare class CommonAzureConstruct extends TerraformStack {
18
18
  keyVaultManager: AzureKeyVaultManager;
19
19
  logAnalyticsWorkspaceManager: AzureLogAnalyticsWorkspaceManager;
20
20
  monitorManager: AzureMonitorManager;
21
+ redisManager: AzureRedisManager;
21
22
  resourceGroupManager: AzureResourceGroupManager;
22
23
  resourceNameFormatter: AzureResourceNameFormatter;
23
24
  servicebusManager: AzureServicebusManager;
@@ -24,6 +24,7 @@ class CommonAzureConstruct extends cdktf_1.TerraformStack {
24
24
  keyVaultManager;
25
25
  logAnalyticsWorkspaceManager;
26
26
  monitorManager;
27
+ redisManager;
27
28
  resourceGroupManager;
28
29
  resourceNameFormatter;
29
30
  servicebusManager;
@@ -44,6 +45,7 @@ class CommonAzureConstruct extends cdktf_1.TerraformStack {
44
45
  this.keyVaultManager = new services_1.AzureKeyVaultManager();
45
46
  this.logAnalyticsWorkspaceManager = new services_1.AzureLogAnalyticsWorkspaceManager();
46
47
  this.monitorManager = new services_1.AzureMonitorManager();
48
+ this.redisManager = new services_1.AzureRedisManager();
47
49
  this.resourceGroupManager = new services_1.AzureResourceGroupManager();
48
50
  this.resourceNameFormatter = new resource_name_formatter_1.AzureResourceNameFormatter(this, `${id}-rnf`, props);
49
51
  this.servicebusManager = new services_1.AzureServicebusManager();
@@ -3,6 +3,7 @@ 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 { RedisCache } from '@cdktf/provider-azurerm/lib/redis-cache';
6
7
  import { Resource } from '../../.gen/providers/azapi/resource';
7
8
  import { CommonAzureConstruct } from '../../common';
8
9
  import { ApiManagementProps, ApiManagementBackendProps, ApiManagementApiProps, ApiManagementCustomDomainProps } from './types';
@@ -31,7 +32,7 @@ export declare class AzureApiManagementManager {
31
32
  * @param props api management properties
32
33
  * @see [CDKTF Api management Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/apiManagement.typescript.md}
33
34
  */
34
- createApiManagement(id: string, scope: CommonAzureConstruct, props: ApiManagementProps, applicationInsightsKey?: ApiManagementLoggerApplicationInsights['instrumentationKey']): ApiManagement;
35
+ createApiManagement(id: string, scope: CommonAzureConstruct, props: ApiManagementProps, applicationInsightsKey?: ApiManagementLoggerApplicationInsights['instrumentationKey'], externalRedisCache?: RedisCache): ApiManagement;
35
36
  /**
36
37
  * @summary Method to resolve an api management
37
38
  * @param id scoped id of the resource
@@ -12,6 +12,7 @@ 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_redis_cache_1 = require("@cdktf/provider-azurerm/lib/api-management-redis-cache");
15
16
  const resource_1 = require("../../.gen/providers/azapi/resource");
16
17
  const utils_1 = require("../../utils");
17
18
  const lodash_1 = __importDefault(require("lodash"));
@@ -40,7 +41,7 @@ class AzureApiManagementManager {
40
41
  * @param props api management properties
41
42
  * @see [CDKTF Api management Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/apiManagement.typescript.md}
42
43
  */
43
- createApiManagement(id, scope, props, applicationInsightsKey) {
44
+ createApiManagement(id, scope, props, applicationInsightsKey, externalRedisCache) {
44
45
  if (!props)
45
46
  throw `Props undefined for ${id}`;
46
47
  const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-am-rg`, {
@@ -68,6 +69,15 @@ class AzureApiManagementManager {
68
69
  },
69
70
  });
70
71
  }
72
+ if (externalRedisCache) {
73
+ new api_management_redis_cache_1.ApiManagementRedisCache(scope, `${id}-am-redis-cache`, {
74
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementRedisCache),
75
+ apiManagementId: apiManagement.id,
76
+ connectionString: externalRedisCache.primaryConnectionString,
77
+ cacheLocation: externalRedisCache.location,
78
+ redisCacheId: externalRedisCache.id,
79
+ });
80
+ }
71
81
  (0, utils_1.createAzureTfOutput)(`${id}-apiManagementName`, scope, apiManagement.name);
72
82
  (0, utils_1.createAzureTfOutput)(`${id}-apiManagementFriendlyUniqueId`, scope, apiManagement.friendlyUniqueId);
73
83
  (0, utils_1.createAzureTfOutput)(`${id}-apiManagementId`, scope, apiManagement.id);
@@ -3,6 +3,7 @@ import { ApiManagementBackendConfig } from '@cdktf/provider-azurerm/lib/api-mana
3
3
  import { ApiManagementCustomDomainConfig } from '@cdktf/provider-azurerm/lib/api-management-custom-domain';
4
4
  import { ApiManagementApiConfig } from '@cdktf/provider-azurerm/lib/api-management-api';
5
5
  import { ApiManagementApiOperationConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation';
6
+ import { ApiManagementRedisCacheConfig } from '@cdktf/provider-azurerm/lib/api-management-redis-cache';
6
7
  export interface ApiManagementProps extends ApiManagementConfig {
7
8
  }
8
9
  export interface ApiManagementBackendProps extends ApiManagementBackendConfig {
@@ -30,3 +31,5 @@ export interface ApiManagementApiRateLimit {
30
31
  calls: number;
31
32
  renewalPeriodInSecs: number;
32
33
  }
34
+ export interface ApiManagementRedisCacheProps extends ApiManagementRedisCacheConfig {
35
+ }
@@ -62,5 +62,5 @@ export declare class AzureEventgridManager {
62
62
  * @param props eventgrid system topic subscription properties
63
63
  * @see [CDKTF Eventgrid System Topic Subscription Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridSystemTopicEventSubscription.typescript.md}
64
64
  */
65
- createEventgridSystemTopicEventSubscription(id: string, scope: CommonAzureConstruct, props: EventgridSystemTopicEventSubscriptionProps, systemTopic: EventgridSystemTopic): EventgridSystemTopicEventSubscription;
65
+ createEventgridSystemTopicEventSubscription(id: string, scope: CommonAzureConstruct, props: EventgridSystemTopicEventSubscriptionProps, systemTopic: EventgridSystemTopic | DataAzurermEventgridTopic): EventgridSystemTopicEventSubscription;
66
66
  }
@@ -9,6 +9,7 @@ export * from './function';
9
9
  export * from './key-vault';
10
10
  export * from './log-analytics-workspace';
11
11
  export * from './monitor';
12
+ export * from './redis';
12
13
  export * from './resource-group';
13
14
  export * from './servicebus';
14
15
  export * from './storage';
@@ -25,6 +25,7 @@ __exportStar(require("./function"), exports);
25
25
  __exportStar(require("./key-vault"), exports);
26
26
  __exportStar(require("./log-analytics-workspace"), exports);
27
27
  __exportStar(require("./monitor"), exports);
28
+ __exportStar(require("./redis"), exports);
28
29
  __exportStar(require("./resource-group"), exports);
29
30
  __exportStar(require("./servicebus"), exports);
30
31
  __exportStar(require("./storage"), exports);
@@ -45,7 +45,7 @@ class AzureKeyVaultManager {
45
45
  location: resourceGroup.location,
46
46
  resourceGroupName: resourceGroup.name,
47
47
  skuName: props.skuName ?? 'standard',
48
- enableRbacAuthorization: props.enableRbacAuthorization ?? true,
48
+ rbacAuthorizationEnabled: props.rbacAuthorizationEnabled ?? true,
49
49
  softDeleteRetentionDays: props.softDeleteRetentionDays ?? 90,
50
50
  purgeProtectionEnabled: props.purgeProtectionEnabled ?? true,
51
51
  tags: props.tags ?? {
@@ -0,0 +1,2 @@
1
+ export * from './main';
2
+ export * from './types';
@@ -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 { RedisCache } from '@cdktf/provider-azurerm/lib/redis-cache';
2
+ import { CommonAzureConstruct } from '../../common';
3
+ import { RedisCacheProps } from './types';
4
+ /**
5
+ * @classdesc Provides operations on Azure Redis
6
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
7
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
8
+ * @example
9
+ * ```
10
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
11
+ *
12
+ * class CustomConstruct extends CommonAzureConstruct {
13
+ * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
14
+ * super(parent, id, props)
15
+ * this.props = props
16
+ * this.redisManager.createRedis('MyRedisCache', this, props)
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ export declare class AzureRedisManager {
22
+ /**
23
+ * @summary Method to create a new redis cache
24
+ * @param id scoped id of the resource
25
+ * @param scope scope in which this resource is defined
26
+ * @param props redis cache properties
27
+ * @see [CDKTF Redis Cache Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/redisCache.typescript.md}
28
+ */
29
+ createRedisCache(id: string, scope: CommonAzureConstruct, props: RedisCacheProps): RedisCache;
30
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AzureRedisManager = void 0;
4
+ const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-resource-group");
5
+ const redis_cache_1 = require("@cdktf/provider-azurerm/lib/redis-cache");
6
+ const utils_1 = require("../../utils");
7
+ /**
8
+ * @classdesc Provides operations on Azure Redis
9
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
10
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
11
+ * @example
12
+ * ```
13
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
14
+ *
15
+ * class CustomConstruct extends CommonAzureConstruct {
16
+ * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
17
+ * super(parent, id, props)
18
+ * this.props = props
19
+ * this.redisManager.createRedis('MyRedisCache', this, props)
20
+ * }
21
+ * }
22
+ * ```
23
+ */
24
+ class AzureRedisManager {
25
+ /**
26
+ * @summary Method to create a new redis cache
27
+ * @param id scoped id of the resource
28
+ * @param scope scope in which this resource is defined
29
+ * @param props redis cache properties
30
+ * @see [CDKTF Redis Cache Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/redisCache.typescript.md}
31
+ */
32
+ createRedisCache(id, scope, props) {
33
+ if (!props)
34
+ throw `Props undefined for ${id}`;
35
+ const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-rc-rg`, {
36
+ name: scope.props.resourceGroupName
37
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
38
+ : `${props.resourceGroupName}`,
39
+ });
40
+ if (!resourceGroup)
41
+ throw `Resource group undefined for ${id}`;
42
+ const redisCache = new redis_cache_1.RedisCache(scope, `${id}-rc`, {
43
+ ...props,
44
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.redisCache),
45
+ location: resourceGroup.location,
46
+ resourceGroupName: resourceGroup.name,
47
+ tags: props.tags ?? {
48
+ environment: scope.props.stage,
49
+ },
50
+ });
51
+ (0, utils_1.createAzureTfOutput)(`${id}-redisCacheName`, scope, redisCache.name);
52
+ (0, utils_1.createAzureTfOutput)(`${id}-redisCacheFriendlyUniqueId`, scope, redisCache.friendlyUniqueId);
53
+ (0, utils_1.createAzureTfOutput)(`${id}-redisCacheId`, scope, redisCache.id);
54
+ return redisCache;
55
+ }
56
+ }
57
+ exports.AzureRedisManager = AzureRedisManager;
@@ -0,0 +1,3 @@
1
+ import { RedisCacheConfig } from '@cdktf/provider-azurerm/lib/redis-cache';
2
+ export interface RedisCacheProps extends RedisCacheConfig {
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,8 +2,9 @@ import { ServicebusNamespace } from '@cdktf/provider-azurerm/lib/servicebus-name
2
2
  import { ServicebusTopic } from '@cdktf/provider-azurerm/lib/servicebus-topic';
3
3
  import { ServicebusSubscription } from '@cdktf/provider-azurerm/lib/servicebus-subscription';
4
4
  import { ServicebusQueue } from '@cdktf/provider-azurerm/lib/servicebus-queue';
5
+ import { DataAzurermServicebusQueue } from '@cdktf/provider-azurerm/lib/data-azurerm-servicebus-queue';
5
6
  import { CommonAzureConstruct } from '../../common';
6
- import { ServicebusTopicProps, ServicebusSubscriptionProps, ServicebusNamespaceProps, ServicebusQueueProps } from './types';
7
+ import { ServicebusTopicProps, ServicebusSubscriptionProps, ServicebusNamespaceProps, ServicebusQueueProps, DataAzurermServicebusQueueProps } from './types';
7
8
  /**
8
9
  * @classdesc Provides operations on Azure Servicebus
9
10
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
@@ -54,4 +55,12 @@ export declare class AzureServicebusManager {
54
55
  * @see [CDKTF Servicebus Subscription Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusSubscription.typescript.md}
55
56
  */
56
57
  createServicebusSubscription(id: string, scope: CommonAzureConstruct, props: ServicebusSubscriptionProps): ServicebusSubscription;
58
+ /**
59
+ * @summary Method to resolve a new servicebus queue
60
+ * @param id scoped id of the resource
61
+ * @param scope scope in which this resource is defined
62
+ * @param props servicebus queue properties
63
+ * @see [CDKTF Servicebus Queue Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusQueue.typescript.md}
64
+ */
65
+ resolveServicebusQueue(id: string, scope: CommonAzureConstruct, props: DataAzurermServicebusQueueProps): DataAzurermServicebusQueue;
57
66
  }
@@ -6,6 +6,7 @@ const servicebus_namespace_1 = require("@cdktf/provider-azurerm/lib/servicebus-n
6
6
  const servicebus_topic_1 = require("@cdktf/provider-azurerm/lib/servicebus-topic");
7
7
  const servicebus_subscription_1 = require("@cdktf/provider-azurerm/lib/servicebus-subscription");
8
8
  const servicebus_queue_1 = require("@cdktf/provider-azurerm/lib/servicebus-queue");
9
+ const data_azurerm_servicebus_queue_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-servicebus-queue");
9
10
  const utils_1 = require("../../utils");
10
11
  /**
11
12
  * @classdesc Provides operations on Azure Servicebus
@@ -124,5 +125,25 @@ class AzureServicebusManager {
124
125
  (0, utils_1.createAzureTfOutput)(`${id}-servicebusSubscriptionId`, scope, servicebusSubscription.id);
125
126
  return servicebusSubscription;
126
127
  }
128
+ /**
129
+ * @summary Method to resolve a new servicebus queue
130
+ * @param id scoped id of the resource
131
+ * @param scope scope in which this resource is defined
132
+ * @param props servicebus queue properties
133
+ * @see [CDKTF Servicebus Queue Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusQueue.typescript.md}
134
+ */
135
+ resolveServicebusQueue(id, scope, props) {
136
+ if (!props)
137
+ throw `Props undefined for ${id}`;
138
+ const servicebusQueue = new data_azurerm_servicebus_queue_1.DataAzurermServicebusQueue(scope, `${id}-sq`, {
139
+ ...props,
140
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusQueue),
141
+ namespaceId: props.namespaceId,
142
+ });
143
+ (0, utils_1.createAzureTfOutput)(`${id}-servicebusQueueName`, scope, servicebusQueue.name);
144
+ (0, utils_1.createAzureTfOutput)(`${id}-servicebusQueueFriendlyUniqueId`, scope, servicebusQueue.friendlyUniqueId);
145
+ (0, utils_1.createAzureTfOutput)(`${id}-servicebusQueueId`, scope, servicebusQueue.id);
146
+ return servicebusQueue;
147
+ }
127
148
  }
128
149
  exports.AzureServicebusManager = AzureServicebusManager;
@@ -2,6 +2,7 @@ import { ServicebusNamespaceConfig } from '@cdktf/provider-azurerm/lib/servicebu
2
2
  import { ServicebusTopicConfig } from '@cdktf/provider-azurerm/lib/servicebus-topic';
3
3
  import { ServicebusQueueConfig } from '@cdktf/provider-azurerm/lib/servicebus-queue';
4
4
  import { ServicebusSubscriptionConfig } from '@cdktf/provider-azurerm/lib/servicebus-subscription';
5
+ import { DataAzurermServicebusQueueConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-servicebus-queue';
5
6
  export interface ServicebusNamespaceProps extends ServicebusNamespaceConfig {
6
7
  }
7
8
  export interface ServicebusTopicProps extends ServicebusTopicConfig {
@@ -10,3 +11,5 @@ export interface ServicebusQueueProps extends ServicebusQueueConfig {
10
11
  }
11
12
  export interface ServicebusSubscriptionProps extends ServicebusSubscriptionConfig {
12
13
  }
14
+ export interface DataAzurermServicebusQueueProps extends DataAzurermServicebusQueueConfig {
15
+ }
@@ -109,7 +109,7 @@ class CloudflareAccessManager {
109
109
  : scope.zoneManager.resolveZone(`${id}-data-zone`, scope, { name: scope.props.domainName })?.zoneId;
110
110
  const accessGroup = new zero_trust_access_group_1.ZeroTrustAccessGroup(scope, `${id}`, {
111
111
  ...props,
112
- name: `${props.name}-${scope.props.stage}`,
112
+ name: `${props.name} - ${scope.props.stage.toUpperCase()}`,
113
113
  zoneId,
114
114
  });
115
115
  (0, utils_1.createCloudflareTfOutput)(`${id}-accessGroupFriendlyUniqueId`, scope, accessGroup.friendlyUniqueId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "9.80.0",
3
+ "version": "9.82.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -20,6 +20,7 @@ import {
20
20
  AzureDnsManager,
21
21
  AzureLogAnalyticsWorkspaceManager,
22
22
  AzureMonitorManager,
23
+ AzureRedisManager,
23
24
  } from '../services'
24
25
  import { CommonAzureStackProps } from './types'
25
26
  import { AzureRemoteBackend } from './constants'
@@ -40,6 +41,7 @@ export class CommonAzureConstruct extends TerraformStack {
40
41
  keyVaultManager: AzureKeyVaultManager
41
42
  logAnalyticsWorkspaceManager: AzureLogAnalyticsWorkspaceManager
42
43
  monitorManager: AzureMonitorManager
44
+ redisManager: AzureRedisManager
43
45
  resourceGroupManager: AzureResourceGroupManager
44
46
  resourceNameFormatter: AzureResourceNameFormatter
45
47
  servicebusManager: AzureServicebusManager
@@ -62,6 +64,7 @@ export class CommonAzureConstruct extends TerraformStack {
62
64
  this.keyVaultManager = new AzureKeyVaultManager()
63
65
  this.logAnalyticsWorkspaceManager = new AzureLogAnalyticsWorkspaceManager()
64
66
  this.monitorManager = new AzureMonitorManager()
67
+ this.redisManager = new AzureRedisManager()
65
68
  this.resourceGroupManager = new AzureResourceGroupManager()
66
69
  this.resourceNameFormatter = new AzureResourceNameFormatter(this, `${id}-rnf`, props)
67
70
  this.servicebusManager = new AzureServicebusManager()
@@ -12,6 +12,8 @@ import {
12
12
  ApiManagementLogger,
13
13
  ApiManagementLoggerApplicationInsights,
14
14
  } from '@cdktf/provider-azurerm/lib/api-management-logger'
15
+ import { ApiManagementRedisCache } from '@cdktf/provider-azurerm/lib/api-management-redis-cache'
16
+ import { RedisCache } from '@cdktf/provider-azurerm/lib/redis-cache'
15
17
  import { Resource } from '../../.gen/providers/azapi/resource'
16
18
  import { CommonAzureConstruct } from '../../common'
17
19
  import { createAzureTfOutput } from '../../utils'
@@ -20,6 +22,7 @@ import {
20
22
  ApiManagementBackendProps,
21
23
  ApiManagementApiProps,
22
24
  ApiManagementCustomDomainProps,
25
+ ApiManagementRedisCacheProps,
23
26
  } from './types'
24
27
  import _ from 'lodash'
25
28
 
@@ -52,7 +55,8 @@ export class AzureApiManagementManager {
52
55
  id: string,
53
56
  scope: CommonAzureConstruct,
54
57
  props: ApiManagementProps,
55
- applicationInsightsKey?: ApiManagementLoggerApplicationInsights['instrumentationKey']
58
+ applicationInsightsKey?: ApiManagementLoggerApplicationInsights['instrumentationKey'],
59
+ externalRedisCache?: RedisCache
56
60
  ) {
57
61
  if (!props) throw `Props undefined for ${id}`
58
62
 
@@ -84,6 +88,16 @@ export class AzureApiManagementManager {
84
88
  })
85
89
  }
86
90
 
91
+ if (externalRedisCache) {
92
+ new ApiManagementRedisCache(scope, `${id}-am-redis-cache`, {
93
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementRedisCache),
94
+ apiManagementId: apiManagement.id,
95
+ connectionString: externalRedisCache.primaryConnectionString,
96
+ cacheLocation: externalRedisCache.location,
97
+ redisCacheId: externalRedisCache.id,
98
+ })
99
+ }
100
+
87
101
  createAzureTfOutput(`${id}-apiManagementName`, scope, apiManagement.name)
88
102
  createAzureTfOutput(`${id}-apiManagementFriendlyUniqueId`, scope, apiManagement.friendlyUniqueId)
89
103
  createAzureTfOutput(`${id}-apiManagementId`, scope, apiManagement.id)
@@ -3,6 +3,7 @@ import { ApiManagementBackendConfig } from '@cdktf/provider-azurerm/lib/api-mana
3
3
  import { ApiManagementCustomDomainConfig } from '@cdktf/provider-azurerm/lib/api-management-custom-domain'
4
4
  import { ApiManagementApiConfig } from '@cdktf/provider-azurerm/lib/api-management-api'
5
5
  import { ApiManagementApiOperationConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation'
6
+ import { ApiManagementRedisCacheConfig } from '@cdktf/provider-azurerm/lib/api-management-redis-cache'
6
7
 
7
8
  export interface ApiManagementProps extends ApiManagementConfig {}
8
9
 
@@ -35,3 +36,5 @@ export interface ApiManagementApiRateLimit {
35
36
  calls: number
36
37
  renewalPeriodInSecs: number
37
38
  }
39
+
40
+ export interface ApiManagementRedisCacheProps extends ApiManagementRedisCacheConfig {}
@@ -176,7 +176,7 @@ export class AzureEventgridManager {
176
176
  id: string,
177
177
  scope: CommonAzureConstruct,
178
178
  props: EventgridSystemTopicEventSubscriptionProps,
179
- systemTopic: EventgridSystemTopic
179
+ systemTopic: EventgridSystemTopic | DataAzurermEventgridTopic
180
180
  ) {
181
181
  if (!props) throw `Props undefined for ${id}`
182
182
 
@@ -9,6 +9,7 @@ export * from './function'
9
9
  export * from './key-vault'
10
10
  export * from './log-analytics-workspace'
11
11
  export * from './monitor'
12
+ export * from './redis'
12
13
  export * from './resource-group'
13
14
  export * from './servicebus'
14
15
  export * from './storage'
@@ -46,7 +46,7 @@ export class AzureKeyVaultManager {
46
46
  location: resourceGroup.location,
47
47
  resourceGroupName: resourceGroup.name,
48
48
  skuName: props.skuName ?? 'standard',
49
- enableRbacAuthorization: props.enableRbacAuthorization ?? true,
49
+ rbacAuthorizationEnabled: props.rbacAuthorizationEnabled ?? true,
50
50
  softDeleteRetentionDays: props.softDeleteRetentionDays ?? 90,
51
51
  purgeProtectionEnabled: props.purgeProtectionEnabled ?? true,
52
52
  tags: props.tags ?? {
@@ -0,0 +1,2 @@
1
+ export * from './main'
2
+ export * from './types'
@@ -0,0 +1,59 @@
1
+ import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group'
2
+ import { RedisCache } from '@cdktf/provider-azurerm/lib/redis-cache'
3
+ import { CommonAzureConstruct } from '../../common'
4
+ import { createAzureTfOutput } from '../../utils'
5
+ import { RedisCacheProps } from './types'
6
+
7
+ /**
8
+ * @classdesc Provides operations on Azure Redis
9
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
10
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
11
+ * @example
12
+ * ```
13
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
14
+ *
15
+ * class CustomConstruct extends CommonAzureConstruct {
16
+ * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
17
+ * super(parent, id, props)
18
+ * this.props = props
19
+ * this.redisManager.createRedis('MyRedisCache', this, props)
20
+ * }
21
+ * }
22
+ * ```
23
+ */
24
+ export class AzureRedisManager {
25
+ /**
26
+ * @summary Method to create a new redis cache
27
+ * @param id scoped id of the resource
28
+ * @param scope scope in which this resource is defined
29
+ * @param props redis cache properties
30
+ * @see [CDKTF Redis Cache Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/redisCache.typescript.md}
31
+ */
32
+ public createRedisCache(id: string, scope: CommonAzureConstruct, props: RedisCacheProps) {
33
+ if (!props) throw `Props undefined for ${id}`
34
+
35
+ const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-rc-rg`, {
36
+ name: scope.props.resourceGroupName
37
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
38
+ : `${props.resourceGroupName}`,
39
+ })
40
+
41
+ if (!resourceGroup) throw `Resource group undefined for ${id}`
42
+
43
+ const redisCache = new RedisCache(scope, `${id}-rc`, {
44
+ ...props,
45
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.redisCache),
46
+ location: resourceGroup.location,
47
+ resourceGroupName: resourceGroup.name,
48
+ tags: props.tags ?? {
49
+ environment: scope.props.stage,
50
+ },
51
+ })
52
+
53
+ createAzureTfOutput(`${id}-redisCacheName`, scope, redisCache.name)
54
+ createAzureTfOutput(`${id}-redisCacheFriendlyUniqueId`, scope, redisCache.friendlyUniqueId)
55
+ createAzureTfOutput(`${id}-redisCacheId`, scope, redisCache.id)
56
+
57
+ return redisCache
58
+ }
59
+ }
@@ -0,0 +1,3 @@
1
+ import { RedisCacheConfig } from '@cdktf/provider-azurerm/lib/redis-cache'
2
+
3
+ export interface RedisCacheProps extends RedisCacheConfig {}
@@ -3,6 +3,7 @@ import { ServicebusNamespace } from '@cdktf/provider-azurerm/lib/servicebus-name
3
3
  import { ServicebusTopic } from '@cdktf/provider-azurerm/lib/servicebus-topic'
4
4
  import { ServicebusSubscription } from '@cdktf/provider-azurerm/lib/servicebus-subscription'
5
5
  import { ServicebusQueue } from '@cdktf/provider-azurerm/lib/servicebus-queue'
6
+ import { DataAzurermServicebusQueue } from '@cdktf/provider-azurerm/lib/data-azurerm-servicebus-queue'
6
7
  import { CommonAzureConstruct } from '../../common'
7
8
  import { createAzureTfOutput } from '../../utils'
8
9
  import {
@@ -10,6 +11,7 @@ import {
10
11
  ServicebusSubscriptionProps,
11
12
  ServicebusNamespaceProps,
12
13
  ServicebusQueueProps,
14
+ DataAzurermServicebusQueueProps,
13
15
  } from './types'
14
16
 
15
17
  /**
@@ -141,4 +143,27 @@ export class AzureServicebusManager {
141
143
 
142
144
  return servicebusSubscription
143
145
  }
146
+
147
+ /**
148
+ * @summary Method to resolve a new servicebus queue
149
+ * @param id scoped id of the resource
150
+ * @param scope scope in which this resource is defined
151
+ * @param props servicebus queue properties
152
+ * @see [CDKTF Servicebus Queue Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusQueue.typescript.md}
153
+ */
154
+ public resolveServicebusQueue(id: string, scope: CommonAzureConstruct, props: DataAzurermServicebusQueueProps) {
155
+ if (!props) throw `Props undefined for ${id}`
156
+
157
+ const servicebusQueue = new DataAzurermServicebusQueue(scope, `${id}-sq`, {
158
+ ...props,
159
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusQueue),
160
+ namespaceId: props.namespaceId,
161
+ })
162
+
163
+ createAzureTfOutput(`${id}-servicebusQueueName`, scope, servicebusQueue.name)
164
+ createAzureTfOutput(`${id}-servicebusQueueFriendlyUniqueId`, scope, servicebusQueue.friendlyUniqueId)
165
+ createAzureTfOutput(`${id}-servicebusQueueId`, scope, servicebusQueue.id)
166
+
167
+ return servicebusQueue
168
+ }
144
169
  }
@@ -2,8 +2,10 @@ import { ServicebusNamespaceConfig } from '@cdktf/provider-azurerm/lib/servicebu
2
2
  import { ServicebusTopicConfig } from '@cdktf/provider-azurerm/lib/servicebus-topic'
3
3
  import { ServicebusQueueConfig } from '@cdktf/provider-azurerm/lib/servicebus-queue'
4
4
  import { ServicebusSubscriptionConfig } from '@cdktf/provider-azurerm/lib/servicebus-subscription'
5
+ import { DataAzurermServicebusQueueConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-servicebus-queue'
5
6
 
6
7
  export interface ServicebusNamespaceProps extends ServicebusNamespaceConfig {}
7
8
  export interface ServicebusTopicProps extends ServicebusTopicConfig {}
8
9
  export interface ServicebusQueueProps extends ServicebusQueueConfig {}
9
10
  export interface ServicebusSubscriptionProps extends ServicebusSubscriptionConfig {}
11
+ export interface DataAzurermServicebusQueueProps extends DataAzurermServicebusQueueConfig {}
@@ -141,7 +141,7 @@ export class CloudflareAccessManager {
141
141
 
142
142
  const accessGroup = new ZeroTrustAccessGroup(scope, `${id}`, {
143
143
  ...props,
144
- name: `${props.name}-${scope.props.stage}`,
144
+ name: `${props.name} - ${scope.props.stage.toUpperCase()}`,
145
145
  zoneId,
146
146
  })
147
147