@gradientedge/cdk-utils 9.39.1 → 9.40.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 (40) hide show
  1. package/dist/src/lib/azure/common/construct.d.ts +9 -7
  2. package/dist/src/lib/azure/common/construct.js +14 -10
  3. package/dist/src/lib/azure/services/api-management/types.d.ts +2 -1
  4. package/dist/src/lib/azure/services/application-insights/main.js +2 -1
  5. package/dist/src/lib/azure/services/application-insights/types.d.ts +3 -1
  6. package/dist/src/lib/azure/services/dns/index.d.ts +2 -0
  7. package/dist/src/lib/azure/services/dns/index.js +18 -0
  8. package/dist/src/lib/azure/services/dns/main.d.ts +48 -0
  9. package/dist/src/lib/azure/services/dns/main.js +115 -0
  10. package/dist/src/lib/azure/services/dns/types.d.ts +9 -0
  11. package/dist/src/lib/azure/services/dns/types.js +2 -0
  12. package/dist/src/lib/azure/services/eventgrid/main.d.ts +9 -0
  13. package/dist/src/lib/azure/services/eventgrid/main.js +30 -0
  14. package/dist/src/lib/azure/services/eventgrid/types.d.ts +2 -1
  15. package/dist/src/lib/azure/services/function/main.js +1 -0
  16. package/dist/src/lib/azure/services/function/types.d.ts +1 -0
  17. package/dist/src/lib/azure/services/index.d.ts +2 -0
  18. package/dist/src/lib/azure/services/index.js +2 -0
  19. package/dist/src/lib/azure/services/log-analytics-workspace/index.d.ts +2 -0
  20. package/dist/src/lib/azure/services/log-analytics-workspace/index.js +18 -0
  21. package/dist/src/lib/azure/services/log-analytics-workspace/main.d.ts +30 -0
  22. package/dist/src/lib/azure/services/log-analytics-workspace/main.js +57 -0
  23. package/dist/src/lib/azure/services/log-analytics-workspace/types.d.ts +3 -0
  24. package/dist/src/lib/azure/services/log-analytics-workspace/types.js +2 -0
  25. package/package.json +1 -1
  26. package/src/lib/azure/common/construct.ts +17 -10
  27. package/src/lib/azure/services/api-management/types.ts +3 -1
  28. package/src/lib/azure/services/application-insights/main.ts +2 -1
  29. package/src/lib/azure/services/application-insights/types.ts +4 -1
  30. package/src/lib/azure/services/dns/index.ts +2 -0
  31. package/src/lib/azure/services/dns/main.ts +125 -0
  32. package/src/lib/azure/services/dns/types.ts +7 -0
  33. package/src/lib/azure/services/eventgrid/main.ts +37 -0
  34. package/src/lib/azure/services/eventgrid/types.ts +4 -1
  35. package/src/lib/azure/services/function/main.ts +1 -0
  36. package/src/lib/azure/services/function/types.ts +1 -0
  37. package/src/lib/azure/services/index.ts +2 -0
  38. package/src/lib/azure/services/log-analytics-workspace/index.ts +2 -0
  39. package/src/lib/azure/services/log-analytics-workspace/main.ts +59 -0
  40. package/src/lib/azure/services/log-analytics-workspace/types.ts +3 -0
@@ -1,23 +1,25 @@
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 } from '../services';
3
+ import { AzureStorageManager, AzureKeyVaultManager, AzureApiManagementManager, AzureFunctionManager, AzureResourceGroupManager, AzureAppServiceManager, AzureApplicationInsightsManager, AzureAppConfigurationManager, AzureCosmosDbManager, AzureServicebusManager, AzureEventgridManager, AzureDnsManager, AzureLogAnalyticsWorkspaceManager } from '../services';
4
4
  import { CommonAzureStackProps } from './types';
5
5
  export declare class CommonAzureConstruct extends TerraformStack {
6
6
  props: CommonAzureStackProps;
7
- id: string;
8
- fullyQualifiedDomainName: string;
9
- tenantId: string;
10
7
  apiManagementManager: AzureApiManagementManager;
8
+ appConfigurationManager: AzureAppConfigurationManager;
11
9
  appServiceManager: AzureAppServiceManager;
12
10
  applicationInsightsManager: AzureApplicationInsightsManager;
13
- appConfigurationManager: AzureAppConfigurationManager;
14
11
  cosmosDbManager: AzureCosmosDbManager;
12
+ dnsManager: AzureDnsManager;
13
+ eventgridManager: AzureEventgridManager;
14
+ fullyQualifiedDomainName: string;
15
15
  functiontManager: AzureFunctionManager;
16
+ id: string;
16
17
  keyVaultManager: AzureKeyVaultManager;
18
+ logAnalyticsWorkspaceManager: AzureLogAnalyticsWorkspaceManager;
17
19
  resourceGroupManager: AzureResourceGroupManager;
18
- storageManager: AzureStorageManager;
19
20
  servicebusManager: AzureServicebusManager;
20
- eventgridManager: AzureEventgridManager;
21
+ storageManager: AzureStorageManager;
22
+ tenantId: string;
21
23
  constructor(scope: Construct, id: string, props: CommonAzureStackProps);
22
24
  /**
23
25
  * @summary Determine the fully qualified domain name based on domainName & subDomain
@@ -9,40 +9,44 @@ const common_1 = require("../../common");
9
9
  const services_1 = require("../services");
10
10
  const constants_1 = require("./constants");
11
11
  class CommonAzureConstruct extends cdktf_1.TerraformStack {
12
- id;
13
- fullyQualifiedDomainName;
14
- tenantId;
15
12
  apiManagementManager;
13
+ appConfigurationManager;
16
14
  appServiceManager;
17
15
  applicationInsightsManager;
18
- appConfigurationManager;
19
16
  cosmosDbManager;
17
+ dnsManager;
18
+ eventgridManager;
19
+ fullyQualifiedDomainName;
20
20
  functiontManager;
21
+ id;
21
22
  keyVaultManager;
23
+ logAnalyticsWorkspaceManager;
22
24
  resourceGroupManager;
23
- storageManager;
24
25
  servicebusManager;
25
- eventgridManager;
26
+ storageManager;
27
+ tenantId;
26
28
  constructor(scope, id, props) {
27
29
  super(scope, id);
28
30
  this.props = props;
29
31
  this.id = id;
30
32
  this.apiManagementManager = new services_1.AzureApiManagementManager();
33
+ this.appConfigurationManager = new services_1.AzureAppConfigurationManager();
31
34
  this.appServiceManager = new services_1.AzureAppServiceManager();
32
35
  this.applicationInsightsManager = new services_1.AzureApplicationInsightsManager();
33
- this.appConfigurationManager = new services_1.AzureAppConfigurationManager();
34
36
  this.cosmosDbManager = new services_1.AzureCosmosDbManager();
37
+ this.dnsManager = new services_1.AzureDnsManager();
38
+ this.eventgridManager = new services_1.AzureEventgridManager();
35
39
  this.functiontManager = new services_1.AzureFunctionManager();
36
40
  this.keyVaultManager = new services_1.AzureKeyVaultManager();
41
+ this.logAnalyticsWorkspaceManager = new services_1.AzureLogAnalyticsWorkspaceManager();
37
42
  this.resourceGroupManager = new services_1.AzureResourceGroupManager();
38
- this.storageManager = new services_1.AzureStorageManager();
39
43
  this.servicebusManager = new services_1.AzureServicebusManager();
40
- this.eventgridManager = new services_1.AzureEventgridManager();
44
+ this.storageManager = new services_1.AzureStorageManager();
41
45
  this.determineFullyQualifiedDomain();
42
46
  this.determineRemoteBackend();
43
47
  this.determineTenantId();
44
- new provider_1.AzurermProvider(this, `${this.id}-provider`, this.props);
45
48
  new provider_2.AzapiProvider(this, `${this.id}-azapi-provider`, this.props);
49
+ new provider_1.AzurermProvider(this, `${this.id}-provider`, this.props);
46
50
  }
47
51
  /**
48
52
  * @summary Determine the fully qualified domain name based on domainName & subDomain
@@ -3,7 +3,8 @@ import { ApiManagementBackendConfig } from '@cdktf/provider-azurerm/lib/api-mana
3
3
  import { ApiManagementApiConfig } from '@cdktf/provider-azurerm/lib/api-management-api';
4
4
  import { ApiManagementApiOperationConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation';
5
5
  import { ApiManagementApiOperationPolicyConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation-policy';
6
- export interface ApiManagementProps extends ApiManagementConfig {
6
+ export interface ApiManagementProps extends Omit<ApiManagementConfig, 'name'> {
7
+ name?: string | undefined;
7
8
  }
8
9
  export interface ApiManagementBackendProps extends ApiManagementBackendConfig {
9
10
  }
@@ -41,8 +41,9 @@ class AzureApplicationInsightsManager {
41
41
  throw `Resource group undefined for ${id}`;
42
42
  const applicationInsights = new application_insights_1.ApplicationInsights(scope, `${id}-am`, {
43
43
  ...props,
44
- name: `${props.name}-${scope.props.stage}`,
44
+ name: `${props.name}-${scope.props.stage}` || '',
45
45
  resourceGroupName: resourceGroup.name,
46
+ applicationType: props.applicationType || 'web',
46
47
  tags: props.tags ?? {
47
48
  environment: scope.props.stage,
48
49
  },
@@ -1,3 +1,5 @@
1
1
  import { ApplicationInsightsConfig } from '@cdktf/provider-azurerm/lib/application-insights';
2
- export interface ApplicationInsightsProps extends ApplicationInsightsConfig {
2
+ export interface ApplicationInsightsProps extends Omit<ApplicationInsightsConfig, 'applicationType' | 'name'> {
3
+ name?: string | undefined;
4
+ applicationType?: string | undefined;
3
5
  }
@@ -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,48 @@
1
+ import { DnsZone } from '@cdktf/provider-azurerm/lib/dns-zone';
2
+ import { DnsARecord } from '@cdktf/provider-azurerm/lib/dns-a-record';
3
+ import { DnsCnameRecord } from '@cdktf/provider-azurerm/lib/dns-cname-record';
4
+ import { CommonAzureConstruct } from '../../common';
5
+ import { DnsZoneProps, DnsARecordProps, DnsCnameRecordProps } from './types';
6
+ /**
7
+ * @classdesc Provides operations on Azure DNS
8
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
9
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
10
+ * @example
11
+ * ```
12
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
13
+ *
14
+ * class CustomConstruct extends CommonAzureConstruct {
15
+ * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
16
+ * super(parent, id, props)
17
+ * this.props = props
18
+ * this.dnsManager.createAppService('MyDnsZone', this, props)
19
+ * }
20
+ * }
21
+ * ```
22
+ */
23
+ export declare class AzureDnsManager {
24
+ /**
25
+ * @summary Method to create a new DNS Zone
26
+ * @param id scoped id of the resource
27
+ * @param scope scope in which this resource is defined
28
+ * @param props dns zone properties
29
+ * @see [CDKTF DNS Zone Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsZone.typescript.md}
30
+ */
31
+ createDnsZone(id: string, scope: CommonAzureConstruct, props: DnsZoneProps): DnsZone;
32
+ /**
33
+ * @summary Method to create a new DNS A Record
34
+ * @param id scoped id of the resource
35
+ * @param scope scope in which this resource is defined
36
+ * @param props dns a record properties
37
+ * @see [CDKTF DNS A Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsARecord.typescript.md}
38
+ */
39
+ createDnsARecord(id: string, scope: CommonAzureConstruct, props: DnsARecordProps): DnsARecord;
40
+ /**
41
+ * @summary Method to create a new DNS CNAME Record
42
+ * @param id scoped id of the resource
43
+ * @param scope scope in which this resource is defined
44
+ * @param props dns cname record properties
45
+ * @see [CDKTF DNS CNAME Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsCnameRecord.typescript.md}
46
+ */
47
+ createDnsCnameRecord(id: string, scope: CommonAzureConstruct, props: DnsCnameRecordProps): DnsCnameRecord;
48
+ }
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AzureDnsManager = void 0;
4
+ const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-resource-group");
5
+ const data_azurerm_dns_zone_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-dns-zone");
6
+ const dns_zone_1 = require("@cdktf/provider-azurerm/lib/dns-zone");
7
+ const dns_a_record_1 = require("@cdktf/provider-azurerm/lib/dns-a-record");
8
+ const dns_cname_record_1 = require("@cdktf/provider-azurerm/lib/dns-cname-record");
9
+ const utils_1 = require("../../utils");
10
+ /**
11
+ * @classdesc Provides operations on Azure DNS
12
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
13
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
14
+ * @example
15
+ * ```
16
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
17
+ *
18
+ * class CustomConstruct extends CommonAzureConstruct {
19
+ * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
20
+ * super(parent, id, props)
21
+ * this.props = props
22
+ * this.dnsManager.createAppService('MyDnsZone', this, props)
23
+ * }
24
+ * }
25
+ * ```
26
+ */
27
+ class AzureDnsManager {
28
+ /**
29
+ * @summary Method to create a new DNS Zone
30
+ * @param id scoped id of the resource
31
+ * @param scope scope in which this resource is defined
32
+ * @param props dns zone properties
33
+ * @see [CDKTF DNS Zone Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsZone.typescript.md}
34
+ */
35
+ createDnsZone(id, scope, props) {
36
+ if (!props)
37
+ throw `Props undefined for ${id}`;
38
+ const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-am-rg`, {
39
+ name: scope.props.resourceGroupName
40
+ ? `${scope.props.resourceGroupName}-${scope.props.stage}`
41
+ : `${props.resourceGroupName}`,
42
+ });
43
+ if (!resourceGroup)
44
+ throw `Resource group undefined for ${id}`;
45
+ const dnsZone = new dns_zone_1.DnsZone(scope, `${id}-dz`, {
46
+ ...props,
47
+ name: `${props.name}-${scope.props.stage}`,
48
+ resourceGroupName: resourceGroup.name,
49
+ tags: props.tags ?? {
50
+ environment: scope.props.stage,
51
+ },
52
+ });
53
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsZoneName`, scope, dnsZone.name);
54
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsZoneFriendlyUniqueId`, scope, dnsZone.friendlyUniqueId);
55
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsZoneId`, scope, dnsZone.id);
56
+ return dnsZone;
57
+ }
58
+ /**
59
+ * @summary Method to create a new DNS A Record
60
+ * @param id scoped id of the resource
61
+ * @param scope scope in which this resource is defined
62
+ * @param props dns a record properties
63
+ * @see [CDKTF DNS A Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsARecord.typescript.md}
64
+ */
65
+ createDnsARecord(id, scope, props) {
66
+ if (!props)
67
+ throw `Props undefined for ${id}`;
68
+ const dnsZone = new data_azurerm_dns_zone_1.DataAzurermDnsZone(scope, `${id}-da-dz`, {
69
+ name: props.zoneName,
70
+ resourceGroupName: props.resourceGroupName,
71
+ });
72
+ const dnsARecord = new dns_a_record_1.DnsARecord(scope, `${id}-da`, {
73
+ ...props,
74
+ name: `${props.name}-${scope.props.stage}`,
75
+ resourceGroupName: dnsZone.resourceGroupName,
76
+ zoneName: dnsZone.name,
77
+ tags: props.tags ?? {
78
+ environment: scope.props.stage,
79
+ },
80
+ });
81
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsARecordName`, scope, dnsARecord.name);
82
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsARecordFriendlyUniqueId`, scope, dnsARecord.friendlyUniqueId);
83
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsARecordId`, scope, dnsARecord.id);
84
+ return dnsARecord;
85
+ }
86
+ /**
87
+ * @summary Method to create a new DNS CNAME Record
88
+ * @param id scoped id of the resource
89
+ * @param scope scope in which this resource is defined
90
+ * @param props dns cname record properties
91
+ * @see [CDKTF DNS CNAME Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsCnameRecord.typescript.md}
92
+ */
93
+ createDnsCnameRecord(id, scope, props) {
94
+ if (!props)
95
+ throw `Props undefined for ${id}`;
96
+ const dnsZone = new data_azurerm_dns_zone_1.DataAzurermDnsZone(scope, `${id}-dc-dz`, {
97
+ name: props.zoneName,
98
+ resourceGroupName: props.resourceGroupName,
99
+ });
100
+ const dnsCnameRecord = new dns_cname_record_1.DnsCnameRecord(scope, `${id}-dc`, {
101
+ ...props,
102
+ name: `${props.name}-${scope.props.stage}`,
103
+ resourceGroupName: dnsZone.resourceGroupName,
104
+ zoneName: dnsZone.name,
105
+ tags: props.tags ?? {
106
+ environment: scope.props.stage,
107
+ },
108
+ });
109
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsCnameRecordName`, scope, dnsCnameRecord.name);
110
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsCnameRecordFriendlyUniqueId`, scope, dnsCnameRecord.friendlyUniqueId);
111
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsCnameRecordId`, scope, dnsCnameRecord.id);
112
+ return dnsCnameRecord;
113
+ }
114
+ }
115
+ exports.AzureDnsManager = AzureDnsManager;
@@ -0,0 +1,9 @@
1
+ import { DnsZoneConfig } from '@cdktf/provider-azurerm/lib/dns-zone';
2
+ import { DnsARecordConfig } from '@cdktf/provider-azurerm/lib/dns-a-record';
3
+ import { DnsCnameRecordConfig } from '@cdktf/provider-azurerm/lib/dns-cname-record';
4
+ export interface DnsZoneProps extends DnsZoneConfig {
5
+ }
6
+ export interface DnsARecordProps extends DnsARecordConfig {
7
+ }
8
+ export interface DnsCnameRecordProps extends DnsCnameRecordConfig {
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ import { DataAzurermEventgridTopic, DataAzurermEventgridTopicConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-eventgrid-topic';
1
2
  import { EventgridTopic } from '@cdktf/provider-azurerm/lib/eventgrid-topic';
2
3
  import { EventgridEventSubscription } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription';
3
4
  import { CommonAzureConstruct } from '../../common';
@@ -28,6 +29,14 @@ export declare class AzureEventgridManager {
28
29
  * @see [CDKTF Eventgrid Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridTopic.typescript.md}
29
30
  */
30
31
  createEventgridTopic(id: string, scope: CommonAzureConstruct, props: EventgridTopicProps): EventgridTopic;
32
+ /**
33
+ * @summary Method to resolve an existing eventgrid topic
34
+ * @param id scoped id of the resource
35
+ * @param scope scope in which this resource is defined
36
+ * @param props eventgrid topic properties
37
+ * @see [CDKTF Eventgrid Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridTopic.typescript.md}
38
+ */
39
+ resolveEventgridTopic(id: string, scope: CommonAzureConstruct, props: DataAzurermEventgridTopicConfig): DataAzurermEventgridTopic;
31
40
  /**
32
41
  * @summary Method to create a new eventgrid subscription
33
42
  * @param id scoped id of the resource
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AzureEventgridManager = void 0;
4
4
  const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-resource-group");
5
+ const data_azurerm_eventgrid_topic_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-eventgrid-topic");
5
6
  const eventgrid_topic_1 = require("@cdktf/provider-azurerm/lib/eventgrid-topic");
6
7
  const eventgrid_event_subscription_1 = require("@cdktf/provider-azurerm/lib/eventgrid-event-subscription");
7
8
  const utils_1 = require("../../utils");
@@ -52,6 +53,35 @@ class AzureEventgridManager {
52
53
  (0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicName`, scope, eventgridTopic.name);
53
54
  (0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicFriendlyUniqueId`, scope, eventgridTopic.friendlyUniqueId);
54
55
  (0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicId`, scope, eventgridTopic.id);
56
+ (0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicEndpoint`, scope, eventgridTopic.endpoint);
57
+ return eventgridTopic;
58
+ }
59
+ /**
60
+ * @summary Method to resolve an existing eventgrid topic
61
+ * @param id scoped id of the resource
62
+ * @param scope scope in which this resource is defined
63
+ * @param props eventgrid topic properties
64
+ * @see [CDKTF Eventgrid Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridTopic.typescript.md}
65
+ */
66
+ resolveEventgridTopic(id, scope, props) {
67
+ if (!props)
68
+ throw `Props undefined for ${id}`;
69
+ const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-et-rg`, {
70
+ name: scope.props.resourceGroupName
71
+ ? `${scope.props.resourceGroupName}-${scope.props.stage}`
72
+ : `${props.resourceGroupName}`,
73
+ });
74
+ if (!resourceGroup)
75
+ throw `Resource group undefined for ${id}`;
76
+ const eventgridTopic = new data_azurerm_eventgrid_topic_1.DataAzurermEventgridTopic(scope, `${id}-et`, {
77
+ ...props,
78
+ name: `${props.name}-${scope.props.stage}`,
79
+ resourceGroupName: resourceGroup.name,
80
+ });
81
+ (0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicName`, scope, eventgridTopic.name);
82
+ (0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicFriendlyUniqueId`, scope, eventgridTopic.friendlyUniqueId);
83
+ (0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicId`, scope, eventgridTopic.id);
84
+ (0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicEndpoint`, scope, eventgridTopic.endpoint);
55
85
  return eventgridTopic;
56
86
  }
57
87
  /**
@@ -1,6 +1,7 @@
1
1
  import { EventgridTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-topic';
2
2
  import { EventgridEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription';
3
- export interface EventgridTopicProps extends EventgridTopicConfig {
3
+ export interface EventgridTopicProps extends Omit<EventgridTopicConfig, 'name'> {
4
+ name?: string | undefined;
4
5
  }
5
6
  export interface EventgridEventSubscriptionProps extends EventgridEventSubscriptionConfig {
6
7
  }
@@ -117,6 +117,7 @@ class AzureFunctionManager {
117
117
  version: props.runtimeVersion || '20',
118
118
  },
119
119
  scaleAndConcurrency: {
120
+ alwaysReady: props.alwaysReady,
120
121
  instanceMemoryMB: props.instanceMemory || 2048,
121
122
  maximumInstanceCount: props.maximumInstanceCount || 40,
122
123
  triggers: {},
@@ -5,6 +5,7 @@ export interface FunctionAppProps extends LinuxFunctionAppConfig {
5
5
  export interface FunctionProps extends FunctionAppFunctionConfig {
6
6
  }
7
7
  export interface FunctionAppFlexConsumptionProps {
8
+ alwaysReady?: any;
8
9
  appServicePlanId: string;
9
10
  appSettings: any;
10
11
  blobEndpoint: string;
@@ -3,9 +3,11 @@ export * from './app-configuration';
3
3
  export * from './app-service';
4
4
  export * from './application-insights';
5
5
  export * from './cosmosdb';
6
+ export * from './dns';
6
7
  export * from './eventgrid';
7
8
  export * from './function';
8
9
  export * from './key-vault';
10
+ export * from './log-analytics-workspace';
9
11
  export * from './resource-group';
10
12
  export * from './servicebus';
11
13
  export * from './storage';
@@ -19,9 +19,11 @@ __exportStar(require("./app-configuration"), exports);
19
19
  __exportStar(require("./app-service"), exports);
20
20
  __exportStar(require("./application-insights"), exports);
21
21
  __exportStar(require("./cosmosdb"), exports);
22
+ __exportStar(require("./dns"), exports);
22
23
  __exportStar(require("./eventgrid"), exports);
23
24
  __exportStar(require("./function"), exports);
24
25
  __exportStar(require("./key-vault"), exports);
26
+ __exportStar(require("./log-analytics-workspace"), exports);
25
27
  __exportStar(require("./resource-group"), exports);
26
28
  __exportStar(require("./servicebus"), exports);
27
29
  __exportStar(require("./storage"), exports);
@@ -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 { LogAnalyticsWorkspace } from '@cdktf/provider-azurerm/lib/log-analytics-workspace';
2
+ import { CommonAzureConstruct } from '../../common';
3
+ import { LogAnalyticsWorkspaceProps } from './types';
4
+ /**
5
+ * @classdesc Provides operations on Azure Log Analytics Workspace
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.LogAnalyticWorkspaceManager.createLogAnalyticsWorkspace('MyLogAnalyticsWorkspace', this, props)
17
+ * }
18
+ * }
19
+ * ```
20
+ */
21
+ export declare class AzureLogAnalyticsWorkspaceManager {
22
+ /**
23
+ * @summary Method to create a new cosmosdb account
24
+ * @param id scoped id of the resource
25
+ * @param scope scope in which this resource is defined
26
+ * @param props cosmosdb account properties
27
+ * @see [CDKTF CosmosDb Account Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/logAnalyticsWorkspace.typescript.md}
28
+ */
29
+ createLogAnalyticsWorkspace(id: string, scope: CommonAzureConstruct, props: LogAnalyticsWorkspaceProps): LogAnalyticsWorkspace;
30
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AzureLogAnalyticsWorkspaceManager = void 0;
4
+ const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-resource-group");
5
+ const log_analytics_workspace_1 = require("@cdktf/provider-azurerm/lib/log-analytics-workspace");
6
+ const utils_1 = require("../../utils");
7
+ /**
8
+ * @classdesc Provides operations on Azure Log Analytics Workspace
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.LogAnalyticWorkspaceManager.createLogAnalyticsWorkspace('MyLogAnalyticsWorkspace', this, props)
20
+ * }
21
+ * }
22
+ * ```
23
+ */
24
+ class AzureLogAnalyticsWorkspaceManager {
25
+ /**
26
+ * @summary Method to create a new cosmosdb account
27
+ * @param id scoped id of the resource
28
+ * @param scope scope in which this resource is defined
29
+ * @param props cosmosdb account properties
30
+ * @see [CDKTF CosmosDb Account Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/logAnalyticsWorkspace.typescript.md}
31
+ */
32
+ createLogAnalyticsWorkspace(id, scope, props) {
33
+ if (!props)
34
+ throw `Props undefined for ${id}`;
35
+ const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-lw-rg`, {
36
+ name: scope.props.resourceGroupName
37
+ ? `${scope.props.resourceGroupName}-${scope.props.stage}`
38
+ : `${props.resourceGroupName}`,
39
+ });
40
+ if (!resourceGroup)
41
+ throw `Resource group undefined for ${id}`;
42
+ const logAnalyticsWorkspace = new log_analytics_workspace_1.LogAnalyticsWorkspace(scope, `${id}-lw`, {
43
+ ...props,
44
+ name: `${props.name}-${scope.props.stage}`,
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}-logAnalyticsWorkspaceName`, scope, logAnalyticsWorkspace.name);
52
+ (0, utils_1.createAzureTfOutput)(`${id}-logAnalyticsWorkspaceFriendlyUniqueId`, scope, logAnalyticsWorkspace.friendlyUniqueId);
53
+ (0, utils_1.createAzureTfOutput)(`${id}-logAnalyticsWorkspaceId`, scope, logAnalyticsWorkspace.id);
54
+ return logAnalyticsWorkspace;
55
+ }
56
+ }
57
+ exports.AzureLogAnalyticsWorkspaceManager = AzureLogAnalyticsWorkspaceManager;
@@ -0,0 +1,3 @@
1
+ import { LogAnalyticsWorkspaceConfig } from '@cdktf/provider-azurerm/lib/log-analytics-workspace';
2
+ export interface LogAnalyticsWorkspaceProps extends LogAnalyticsWorkspaceConfig {
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "9.39.1",
3
+ "version": "9.40.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -16,26 +16,30 @@ import {
16
16
  AzureCosmosDbManager,
17
17
  AzureServicebusManager,
18
18
  AzureEventgridManager,
19
+ AzureDnsManager,
20
+ AzureLogAnalyticsWorkspaceManager,
19
21
  } from '../services'
20
22
  import { CommonAzureStackProps } from './types'
21
23
  import { AzureRemoteBackend } from './constants'
22
24
 
23
25
  export class CommonAzureConstruct extends TerraformStack {
24
26
  declare props: CommonAzureStackProps
25
- id: string
26
- fullyQualifiedDomainName: string
27
- tenantId: string
28
27
  apiManagementManager: AzureApiManagementManager
28
+ appConfigurationManager: AzureAppConfigurationManager
29
29
  appServiceManager: AzureAppServiceManager
30
30
  applicationInsightsManager: AzureApplicationInsightsManager
31
- appConfigurationManager: AzureAppConfigurationManager
32
31
  cosmosDbManager: AzureCosmosDbManager
32
+ dnsManager: AzureDnsManager
33
+ eventgridManager: AzureEventgridManager
34
+ fullyQualifiedDomainName: string
33
35
  functiontManager: AzureFunctionManager
36
+ id: string
34
37
  keyVaultManager: AzureKeyVaultManager
38
+ logAnalyticsWorkspaceManager: AzureLogAnalyticsWorkspaceManager
35
39
  resourceGroupManager: AzureResourceGroupManager
36
- storageManager: AzureStorageManager
37
40
  servicebusManager: AzureServicebusManager
38
- eventgridManager: AzureEventgridManager
41
+ storageManager: AzureStorageManager
42
+ tenantId: string
39
43
 
40
44
  constructor(scope: Construct, id: string, props: CommonAzureStackProps) {
41
45
  super(scope, id)
@@ -43,22 +47,25 @@ export class CommonAzureConstruct extends TerraformStack {
43
47
  this.id = id
44
48
 
45
49
  this.apiManagementManager = new AzureApiManagementManager()
50
+ this.appConfigurationManager = new AzureAppConfigurationManager()
46
51
  this.appServiceManager = new AzureAppServiceManager()
47
52
  this.applicationInsightsManager = new AzureApplicationInsightsManager()
48
- this.appConfigurationManager = new AzureAppConfigurationManager()
49
53
  this.cosmosDbManager = new AzureCosmosDbManager()
54
+ this.dnsManager = new AzureDnsManager()
55
+ this.eventgridManager = new AzureEventgridManager()
50
56
  this.functiontManager = new AzureFunctionManager()
51
57
  this.keyVaultManager = new AzureKeyVaultManager()
58
+ this.logAnalyticsWorkspaceManager = new AzureLogAnalyticsWorkspaceManager()
52
59
  this.resourceGroupManager = new AzureResourceGroupManager()
53
- this.storageManager = new AzureStorageManager()
54
60
  this.servicebusManager = new AzureServicebusManager()
55
- this.eventgridManager = new AzureEventgridManager()
61
+ this.storageManager = new AzureStorageManager()
56
62
 
57
63
  this.determineFullyQualifiedDomain()
58
64
  this.determineRemoteBackend()
59
65
  this.determineTenantId()
60
- new AzurermProvider(this, `${this.id}-provider`, this.props)
66
+
61
67
  new AzapiProvider(this, `${this.id}-azapi-provider`, this.props)
68
+ new AzurermProvider(this, `${this.id}-provider`, this.props)
62
69
  }
63
70
 
64
71
  /**
@@ -4,7 +4,9 @@ import { ApiManagementApiConfig } from '@cdktf/provider-azurerm/lib/api-manageme
4
4
  import { ApiManagementApiOperationConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation'
5
5
  import { ApiManagementApiOperationPolicyConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation-policy'
6
6
 
7
- export interface ApiManagementProps extends ApiManagementConfig {}
7
+ export interface ApiManagementProps extends Omit<ApiManagementConfig, 'name'> {
8
+ name?: string | undefined
9
+ }
8
10
 
9
11
  export interface ApiManagementBackendProps extends ApiManagementBackendConfig {}
10
12
 
@@ -42,8 +42,9 @@ export class AzureApplicationInsightsManager {
42
42
 
43
43
  const applicationInsights = new ApplicationInsights(scope, `${id}-am`, {
44
44
  ...props,
45
- name: `${props.name}-${scope.props.stage}`,
45
+ name: `${props.name}-${scope.props.stage}` || '',
46
46
  resourceGroupName: resourceGroup.name,
47
+ applicationType: props.applicationType || 'web',
47
48
  tags: props.tags ?? {
48
49
  environment: scope.props.stage,
49
50
  },
@@ -1,3 +1,6 @@
1
1
  import { ApplicationInsightsConfig } from '@cdktf/provider-azurerm/lib/application-insights'
2
2
 
3
- export interface ApplicationInsightsProps extends ApplicationInsightsConfig {}
3
+ export interface ApplicationInsightsProps extends Omit<ApplicationInsightsConfig, 'applicationType' | 'name'> {
4
+ name?: string | undefined
5
+ applicationType?: string | undefined
6
+ }
@@ -0,0 +1,2 @@
1
+ export * from './main'
2
+ export * from './types'
@@ -0,0 +1,125 @@
1
+ import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group'
2
+ import { DataAzurermDnsZone } from '@cdktf/provider-azurerm/lib/data-azurerm-dns-zone'
3
+ import { DnsZone } from '@cdktf/provider-azurerm/lib/dns-zone'
4
+ import { DnsARecord } from '@cdktf/provider-azurerm/lib/dns-a-record'
5
+ import { DnsCnameRecord } from '@cdktf/provider-azurerm/lib/dns-cname-record'
6
+ import { CommonAzureConstruct } from '../../common'
7
+ import { createAzureTfOutput } from '../../utils'
8
+ import { DnsZoneProps, DnsARecordProps, DnsCnameRecordProps } from './types'
9
+
10
+ /**
11
+ * @classdesc Provides operations on Azure DNS
12
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
13
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
14
+ * @example
15
+ * ```
16
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
17
+ *
18
+ * class CustomConstruct extends CommonAzureConstruct {
19
+ * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
20
+ * super(parent, id, props)
21
+ * this.props = props
22
+ * this.dnsManager.createAppService('MyDnsZone', this, props)
23
+ * }
24
+ * }
25
+ * ```
26
+ */
27
+ export class AzureDnsManager {
28
+ /**
29
+ * @summary Method to create a new DNS Zone
30
+ * @param id scoped id of the resource
31
+ * @param scope scope in which this resource is defined
32
+ * @param props dns zone properties
33
+ * @see [CDKTF DNS Zone Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsZone.typescript.md}
34
+ */
35
+ public createDnsZone(id: string, scope: CommonAzureConstruct, props: DnsZoneProps) {
36
+ if (!props) throw `Props undefined for ${id}`
37
+
38
+ const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-am-rg`, {
39
+ name: scope.props.resourceGroupName
40
+ ? `${scope.props.resourceGroupName}-${scope.props.stage}`
41
+ : `${props.resourceGroupName}`,
42
+ })
43
+
44
+ if (!resourceGroup) throw `Resource group undefined for ${id}`
45
+
46
+ const dnsZone = new DnsZone(scope, `${id}-dz`, {
47
+ ...props,
48
+ name: `${props.name}-${scope.props.stage}`,
49
+ resourceGroupName: resourceGroup.name,
50
+ tags: props.tags ?? {
51
+ environment: scope.props.stage,
52
+ },
53
+ })
54
+
55
+ createAzureTfOutput(`${id}-dnsZoneName`, scope, dnsZone.name)
56
+ createAzureTfOutput(`${id}-dnsZoneFriendlyUniqueId`, scope, dnsZone.friendlyUniqueId)
57
+ createAzureTfOutput(`${id}-dnsZoneId`, scope, dnsZone.id)
58
+
59
+ return dnsZone
60
+ }
61
+
62
+ /**
63
+ * @summary Method to create a new DNS A Record
64
+ * @param id scoped id of the resource
65
+ * @param scope scope in which this resource is defined
66
+ * @param props dns a record properties
67
+ * @see [CDKTF DNS A Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsARecord.typescript.md}
68
+ */
69
+ public createDnsARecord(id: string, scope: CommonAzureConstruct, props: DnsARecordProps) {
70
+ if (!props) throw `Props undefined for ${id}`
71
+
72
+ const dnsZone = new DataAzurermDnsZone(scope, `${id}-da-dz`, {
73
+ name: props.zoneName,
74
+ resourceGroupName: props.resourceGroupName,
75
+ })
76
+
77
+ const dnsARecord = new DnsARecord(scope, `${id}-da`, {
78
+ ...props,
79
+ name: `${props.name}-${scope.props.stage}`,
80
+ resourceGroupName: dnsZone.resourceGroupName,
81
+ zoneName: dnsZone.name,
82
+ tags: props.tags ?? {
83
+ environment: scope.props.stage,
84
+ },
85
+ })
86
+
87
+ createAzureTfOutput(`${id}-dnsARecordName`, scope, dnsARecord.name)
88
+ createAzureTfOutput(`${id}-dnsARecordFriendlyUniqueId`, scope, dnsARecord.friendlyUniqueId)
89
+ createAzureTfOutput(`${id}-dnsARecordId`, scope, dnsARecord.id)
90
+
91
+ return dnsARecord
92
+ }
93
+
94
+ /**
95
+ * @summary Method to create a new DNS CNAME Record
96
+ * @param id scoped id of the resource
97
+ * @param scope scope in which this resource is defined
98
+ * @param props dns cname record properties
99
+ * @see [CDKTF DNS CNAME Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsCnameRecord.typescript.md}
100
+ */
101
+ public createDnsCnameRecord(id: string, scope: CommonAzureConstruct, props: DnsCnameRecordProps) {
102
+ if (!props) throw `Props undefined for ${id}`
103
+
104
+ const dnsZone = new DataAzurermDnsZone(scope, `${id}-dc-dz`, {
105
+ name: props.zoneName,
106
+ resourceGroupName: props.resourceGroupName,
107
+ })
108
+
109
+ const dnsCnameRecord = new DnsCnameRecord(scope, `${id}-dc`, {
110
+ ...props,
111
+ name: `${props.name}-${scope.props.stage}`,
112
+ resourceGroupName: dnsZone.resourceGroupName,
113
+ zoneName: dnsZone.name,
114
+ tags: props.tags ?? {
115
+ environment: scope.props.stage,
116
+ },
117
+ })
118
+
119
+ createAzureTfOutput(`${id}-dnsCnameRecordName`, scope, dnsCnameRecord.name)
120
+ createAzureTfOutput(`${id}-dnsCnameRecordFriendlyUniqueId`, scope, dnsCnameRecord.friendlyUniqueId)
121
+ createAzureTfOutput(`${id}-dnsCnameRecordId`, scope, dnsCnameRecord.id)
122
+
123
+ return dnsCnameRecord
124
+ }
125
+ }
@@ -0,0 +1,7 @@
1
+ import { DnsZoneConfig } from '@cdktf/provider-azurerm/lib/dns-zone'
2
+ import { DnsARecordConfig } from '@cdktf/provider-azurerm/lib/dns-a-record'
3
+ import { DnsCnameRecordConfig } from '@cdktf/provider-azurerm/lib/dns-cname-record'
4
+
5
+ export interface DnsZoneProps extends DnsZoneConfig {}
6
+ export interface DnsARecordProps extends DnsARecordConfig {}
7
+ export interface DnsCnameRecordProps extends DnsCnameRecordConfig {}
@@ -1,4 +1,8 @@
1
1
  import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group'
2
+ import {
3
+ DataAzurermEventgridTopic,
4
+ DataAzurermEventgridTopicConfig,
5
+ } from '@cdktf/provider-azurerm/lib/data-azurerm-eventgrid-topic'
2
6
  import { EventgridTopic } from '@cdktf/provider-azurerm/lib/eventgrid-topic'
3
7
  import { EventgridEventSubscription } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription'
4
8
  import { CommonAzureConstruct } from '../../common'
@@ -54,6 +58,39 @@ export class AzureEventgridManager {
54
58
  createAzureTfOutput(`${id}-eventgridTopicName`, scope, eventgridTopic.name)
55
59
  createAzureTfOutput(`${id}-eventgridTopicFriendlyUniqueId`, scope, eventgridTopic.friendlyUniqueId)
56
60
  createAzureTfOutput(`${id}-eventgridTopicId`, scope, eventgridTopic.id)
61
+ createAzureTfOutput(`${id}-eventgridTopicEndpoint`, scope, eventgridTopic.endpoint)
62
+
63
+ return eventgridTopic
64
+ }
65
+
66
+ /**
67
+ * @summary Method to resolve an existing eventgrid topic
68
+ * @param id scoped id of the resource
69
+ * @param scope scope in which this resource is defined
70
+ * @param props eventgrid topic properties
71
+ * @see [CDKTF Eventgrid Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridTopic.typescript.md}
72
+ */
73
+ public resolveEventgridTopic(id: string, scope: CommonAzureConstruct, props: DataAzurermEventgridTopicConfig) {
74
+ if (!props) throw `Props undefined for ${id}`
75
+
76
+ const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-et-rg`, {
77
+ name: scope.props.resourceGroupName
78
+ ? `${scope.props.resourceGroupName}-${scope.props.stage}`
79
+ : `${props.resourceGroupName}`,
80
+ })
81
+
82
+ if (!resourceGroup) throw `Resource group undefined for ${id}`
83
+
84
+ const eventgridTopic = new DataAzurermEventgridTopic(scope, `${id}-et`, {
85
+ ...props,
86
+ name: `${props.name}-${scope.props.stage}`,
87
+ resourceGroupName: resourceGroup.name,
88
+ })
89
+
90
+ createAzureTfOutput(`${id}-eventgridTopicName`, scope, eventgridTopic.name)
91
+ createAzureTfOutput(`${id}-eventgridTopicFriendlyUniqueId`, scope, eventgridTopic.friendlyUniqueId)
92
+ createAzureTfOutput(`${id}-eventgridTopicId`, scope, eventgridTopic.id)
93
+ createAzureTfOutput(`${id}-eventgridTopicEndpoint`, scope, eventgridTopic.endpoint)
57
94
 
58
95
  return eventgridTopic
59
96
  }
@@ -1,5 +1,8 @@
1
1
  import { EventgridTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-topic'
2
2
  import { EventgridEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription'
3
3
 
4
- export interface EventgridTopicProps extends EventgridTopicConfig {}
4
+ export interface EventgridTopicProps extends Omit<EventgridTopicConfig, 'name'> {
5
+ name?: string | undefined
6
+ }
7
+
5
8
  export interface EventgridEventSubscriptionProps extends EventgridEventSubscriptionConfig {}
@@ -133,6 +133,7 @@ export class AzureFunctionManager {
133
133
  version: props.runtimeVersion || '20',
134
134
  },
135
135
  scaleAndConcurrency: {
136
+ alwaysReady: props.alwaysReady,
136
137
  instanceMemoryMB: props.instanceMemory || 2048,
137
138
  maximumInstanceCount: props.maximumInstanceCount || 40,
138
139
  triggers: {},
@@ -7,6 +7,7 @@ export interface FunctionAppProps extends LinuxFunctionAppConfig {}
7
7
  export interface FunctionProps extends FunctionAppFunctionConfig {}
8
8
 
9
9
  export interface FunctionAppFlexConsumptionProps {
10
+ alwaysReady?: any
10
11
  appServicePlanId: string
11
12
  appSettings: any
12
13
  blobEndpoint: string
@@ -3,9 +3,11 @@ export * from './app-configuration'
3
3
  export * from './app-service'
4
4
  export * from './application-insights'
5
5
  export * from './cosmosdb'
6
+ export * from './dns'
6
7
  export * from './eventgrid'
7
8
  export * from './function'
8
9
  export * from './key-vault'
10
+ export * from './log-analytics-workspace'
9
11
  export * from './resource-group'
10
12
  export * from './servicebus'
11
13
  export * from './storage'
@@ -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 { LogAnalyticsWorkspace } from '@cdktf/provider-azurerm/lib/log-analytics-workspace'
3
+ import { CommonAzureConstruct } from '../../common'
4
+ import { createAzureTfOutput } from '../../utils'
5
+ import { LogAnalyticsWorkspaceProps } from './types'
6
+
7
+ /**
8
+ * @classdesc Provides operations on Azure Log Analytics Workspace
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.LogAnalyticWorkspaceManager.createLogAnalyticsWorkspace('MyLogAnalyticsWorkspace', this, props)
20
+ * }
21
+ * }
22
+ * ```
23
+ */
24
+ export class AzureLogAnalyticsWorkspaceManager {
25
+ /**
26
+ * @summary Method to create a new cosmosdb account
27
+ * @param id scoped id of the resource
28
+ * @param scope scope in which this resource is defined
29
+ * @param props cosmosdb account properties
30
+ * @see [CDKTF CosmosDb Account Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/logAnalyticsWorkspace.typescript.md}
31
+ */
32
+ public createLogAnalyticsWorkspace(id: string, scope: CommonAzureConstruct, props: LogAnalyticsWorkspaceProps) {
33
+ if (!props) throw `Props undefined for ${id}`
34
+
35
+ const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-lw-rg`, {
36
+ name: scope.props.resourceGroupName
37
+ ? `${scope.props.resourceGroupName}-${scope.props.stage}`
38
+ : `${props.resourceGroupName}`,
39
+ })
40
+
41
+ if (!resourceGroup) throw `Resource group undefined for ${id}`
42
+
43
+ const logAnalyticsWorkspace = new LogAnalyticsWorkspace(scope, `${id}-lw`, {
44
+ ...props,
45
+ name: `${props.name}-${scope.props.stage}`,
46
+ location: resourceGroup.location,
47
+ resourceGroupName: resourceGroup.name,
48
+ tags: props.tags ?? {
49
+ environment: scope.props.stage,
50
+ },
51
+ })
52
+
53
+ createAzureTfOutput(`${id}-logAnalyticsWorkspaceName`, scope, logAnalyticsWorkspace.name)
54
+ createAzureTfOutput(`${id}-logAnalyticsWorkspaceFriendlyUniqueId`, scope, logAnalyticsWorkspace.friendlyUniqueId)
55
+ createAzureTfOutput(`${id}-logAnalyticsWorkspaceId`, scope, logAnalyticsWorkspace.id)
56
+
57
+ return logAnalyticsWorkspace
58
+ }
59
+ }
@@ -0,0 +1,3 @@
1
+ import { LogAnalyticsWorkspaceConfig } from '@cdktf/provider-azurerm/lib/log-analytics-workspace'
2
+
3
+ export interface LogAnalyticsWorkspaceProps extends LogAnalyticsWorkspaceConfig {}