@gradientedge/cdk-utils 10.0.0 → 10.2.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 (112) hide show
  1. package/dist/src/lib/azure/common/constants.d.ts +3 -2
  2. package/dist/src/lib/azure/common/constants.js +2 -1
  3. package/dist/src/lib/azure/common/construct.d.ts +26 -12
  4. package/dist/src/lib/azure/common/construct.js +31 -45
  5. package/dist/src/lib/azure/common/resource-name-formatter.d.ts +9 -4
  6. package/dist/src/lib/azure/common/resource-name-formatter.js +9 -5
  7. package/dist/src/lib/azure/common/stack.d.ts +18 -32
  8. package/dist/src/lib/azure/common/stack.js +77 -74
  9. package/dist/src/lib/azure/common/tagging.d.ts +29 -8
  10. package/dist/src/lib/azure/common/tagging.js +72 -26
  11. package/dist/src/lib/azure/common/types.d.ts +19 -4
  12. package/dist/src/lib/azure/services/api-management/main.d.ts +29 -32
  13. package/dist/src/lib/azure/services/api-management/main.js +100 -121
  14. package/dist/src/lib/azure/services/api-management/types.d.ts +33 -18
  15. package/dist/src/lib/azure/services/app-configuration/main.d.ts +6 -7
  16. package/dist/src/lib/azure/services/app-configuration/main.js +23 -26
  17. package/dist/src/lib/azure/services/app-configuration/types.d.ts +2 -2
  18. package/dist/src/lib/azure/services/app-service/main.d.ts +10 -12
  19. package/dist/src/lib/azure/services/app-service/main.js +37 -49
  20. package/dist/src/lib/azure/services/app-service/types.d.ts +4 -4
  21. package/dist/src/lib/azure/services/application-insights/main.d.ts +7 -8
  22. package/dist/src/lib/azure/services/application-insights/main.js +20 -26
  23. package/dist/src/lib/azure/services/application-insights/types.d.ts +2 -4
  24. package/dist/src/lib/azure/services/cosmosdb/main.d.ts +12 -15
  25. package/dist/src/lib/azure/services/cosmosdb/main.js +42 -61
  26. package/dist/src/lib/azure/services/cosmosdb/types.d.ts +4 -6
  27. package/dist/src/lib/azure/services/dns/main.d.ts +13 -17
  28. package/dist/src/lib/azure/services/dns/main.js +33 -51
  29. package/dist/src/lib/azure/services/dns/types.d.ts +5 -8
  30. package/dist/src/lib/azure/services/eventgrid/main.d.ts +20 -22
  31. package/dist/src/lib/azure/services/eventgrid/main.js +61 -89
  32. package/dist/src/lib/azure/services/eventgrid/types.d.ts +7 -8
  33. package/dist/src/lib/azure/services/function/main.d.ts +15 -15
  34. package/dist/src/lib/azure/services/function/main.js +54 -59
  35. package/dist/src/lib/azure/services/function/types.d.ts +18 -6
  36. package/dist/src/lib/azure/services/index.d.ts +1 -1
  37. package/dist/src/lib/azure/services/index.js +1 -1
  38. package/dist/src/lib/azure/services/key-vault/main.d.ts +6 -7
  39. package/dist/src/lib/azure/services/key-vault/main.js +29 -28
  40. package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -2
  41. package/dist/src/lib/azure/services/monitor/main.d.ts +7 -8
  42. package/dist/src/lib/azure/services/monitor/main.js +10 -15
  43. package/dist/src/lib/azure/services/monitor/types.d.ts +2 -2
  44. package/dist/src/lib/azure/services/operational-insights/main.d.ts +29 -0
  45. package/dist/src/lib/azure/services/operational-insights/main.js +50 -0
  46. package/dist/src/lib/azure/services/operational-insights/types.d.ts +3 -0
  47. package/dist/src/lib/azure/services/redis/main.d.ts +8 -9
  48. package/dist/src/lib/azure/services/redis/main.js +24 -26
  49. package/dist/src/lib/azure/services/redis/types.d.ts +2 -2
  50. package/dist/src/lib/azure/services/resource-group/main.d.ts +6 -7
  51. package/dist/src/lib/azure/services/resource-group/main.js +9 -14
  52. package/dist/src/lib/azure/services/resource-group/types.d.ts +2 -2
  53. package/dist/src/lib/azure/services/servicebus/main.d.ts +17 -22
  54. package/dist/src/lib/azure/services/servicebus/main.js +47 -70
  55. package/dist/src/lib/azure/services/servicebus/types.d.ts +6 -10
  56. package/dist/src/lib/azure/services/storage/main.d.ts +24 -27
  57. package/dist/src/lib/azure/services/storage/main.js +70 -88
  58. package/dist/src/lib/azure/services/storage/types.d.ts +10 -8
  59. package/dist/src/lib/azure/types/index.d.ts +2 -1
  60. package/dist/src/lib/azure/utils/index.d.ts +19 -3
  61. package/dist/src/lib/azure/utils/index.js +19 -13
  62. package/dist/src/lib/cloudflare/common/stack.js +1 -1
  63. package/package.json +28 -27
  64. package/src/lib/azure/common/constants.ts +2 -1
  65. package/src/lib/azure/common/construct.ts +32 -48
  66. package/src/lib/azure/common/resource-name-formatter.ts +10 -6
  67. package/src/lib/azure/common/stack.ts +78 -78
  68. package/src/lib/azure/common/tagging.ts +78 -29
  69. package/src/lib/azure/common/types.ts +21 -4
  70. package/src/lib/azure/services/api-management/main.ts +172 -169
  71. package/src/lib/azure/services/api-management/types.ts +39 -16
  72. package/src/lib/azure/services/app-configuration/main.ts +33 -31
  73. package/src/lib/azure/services/app-configuration/types.ts +2 -2
  74. package/src/lib/azure/services/app-service/main.ts +61 -62
  75. package/src/lib/azure/services/app-service/types.ts +4 -4
  76. package/src/lib/azure/services/application-insights/main.ts +29 -30
  77. package/src/lib/azure/services/application-insights/types.ts +2 -5
  78. package/src/lib/azure/services/cosmosdb/main.ts +78 -77
  79. package/src/lib/azure/services/cosmosdb/types.ts +10 -6
  80. package/src/lib/azure/services/dns/main.ts +65 -72
  81. package/src/lib/azure/services/dns/types.ts +9 -9
  82. package/src/lib/azure/services/eventgrid/main.ts +120 -122
  83. package/src/lib/azure/services/eventgrid/types.ts +13 -8
  84. package/src/lib/azure/services/function/main.ts +75 -72
  85. package/src/lib/azure/services/function/types.ts +21 -6
  86. package/src/lib/azure/services/index.ts +1 -1
  87. package/src/lib/azure/services/key-vault/main.ts +38 -32
  88. package/src/lib/azure/services/key-vault/types.ts +4 -2
  89. package/src/lib/azure/services/monitor/main.ts +17 -21
  90. package/src/lib/azure/services/monitor/types.ts +2 -2
  91. package/src/lib/azure/services/operational-insights/main.ts +61 -0
  92. package/src/lib/azure/services/operational-insights/types.ts +3 -0
  93. package/src/lib/azure/services/redis/main.ts +30 -30
  94. package/src/lib/azure/services/redis/types.ts +2 -2
  95. package/src/lib/azure/services/resource-group/main.ts +20 -20
  96. package/src/lib/azure/services/resource-group/types.ts +2 -2
  97. package/src/lib/azure/services/servicebus/main.ts +103 -94
  98. package/src/lib/azure/services/servicebus/types.ts +17 -11
  99. package/src/lib/azure/services/storage/main.ts +113 -114
  100. package/src/lib/azure/services/storage/types.ts +16 -8
  101. package/src/lib/azure/types/index.ts +2 -1
  102. package/src/lib/azure/utils/index.ts +20 -22
  103. package/src/lib/cloudflare/common/stack.ts +1 -1
  104. package/dist/src/lib/azure/services/log-analytics-workspace/main.d.ts +0 -30
  105. package/dist/src/lib/azure/services/log-analytics-workspace/main.js +0 -55
  106. package/dist/src/lib/azure/services/log-analytics-workspace/types.d.ts +0 -3
  107. package/src/lib/azure/services/log-analytics-workspace/main.ts +0 -61
  108. package/src/lib/azure/services/log-analytics-workspace/types.ts +0 -3
  109. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.d.ts +0 -0
  110. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.js +0 -0
  111. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/types.js +0 -0
  112. /package/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.ts +0 -0
@@ -1,7 +1,11 @@
1
- import { CosmosdbAccountConfig } from '@cdktf/provider-azurerm/lib/cosmosdb-account/index.js'
2
- import { CosmosdbSqlDatabaseConfig } from '@cdktf/provider-azurerm/lib/cosmosdb-sql-database/index.js'
3
- import { CosmosdbSqlContainerConfig } from '@cdktf/provider-azurerm/lib/cosmosdb-sql-container/index.js'
1
+ import {
2
+ DatabaseAccountArgs,
3
+ SqlResourceSqlContainerArgs,
4
+ SqlResourceSqlDatabaseArgs,
5
+ } from '@pulumi/azure-native/cosmosdb/index.js'
4
6
 
5
- export interface CosmosdbAccountProps extends CosmosdbAccountConfig {}
6
- export interface CosmosdbSqlDatabaseProps extends CosmosdbSqlDatabaseConfig {}
7
- export interface CosmosdbSqlContainerProps extends CosmosdbSqlContainerConfig {}
7
+ export interface CosmosdbAccountProps extends DatabaseAccountArgs {}
8
+
9
+ export interface CosmosdbSqlDatabaseProps extends SqlResourceSqlDatabaseArgs {}
10
+
11
+ export interface CosmosdbSqlContainerProps extends SqlResourceSqlContainerArgs {}
@@ -1,25 +1,20 @@
1
- import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group/index.js'
2
- import { DnsARecord } from '@cdktf/provider-azurerm/lib/dns-a-record/index.js'
3
- import { DnsCnameRecord } from '@cdktf/provider-azurerm/lib/dns-cname-record/index.js'
4
- import { DnsTxtRecord } from '@cdktf/provider-azurerm/lib/dns-txt-record/index.js'
5
- import { DnsZone } from '@cdktf/provider-azurerm/lib/dns-zone/index.js'
1
+ import { RecordSet, Zone } from '@pulumi/azure-native/dns/index.js'
6
2
  import { CommonAzureConstruct } from '../../common/index.js'
7
- import { createAzureTfOutput } from '../../utils/index.js'
8
3
  import { DnsARecordProps, DnsCnameRecordProps, DnsTxtRecordProps, DnsZoneProps } from './types.js'
9
4
 
10
5
  /**
11
- * @classdesc Provides operations on Azure DNS
6
+ * @classdesc Provides operations on Azure DNS using Pulumi
12
7
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
13
8
  * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
14
9
  * @example
15
- * ```
10
+ * ```typescript
16
11
  * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
17
12
  *
18
13
  * class CustomConstruct extends CommonAzureConstruct {
19
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
20
- * super(parent, id, props)
14
+ * constructor(name: string, props: CommonAzureStackProps) {
15
+ * super(name, props)
21
16
  * this.props = props
22
- * this.dnsManager.createAppService('MyDnsZone', this, props)
17
+ * this.dnsManager.createDnsZone('MyDnsZone', this, props)
23
18
  * }
24
19
  * }
25
20
  * ```
@@ -30,33 +25,34 @@ export class AzureDnsManager {
30
25
  * @param id scoped id of the resource
31
26
  * @param scope scope in which this resource is defined
32
27
  * @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}
28
+ * @see [Pulumi Azure Native DNS Zone]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/network/zone/}
34
29
  */
35
30
  public createDnsZone(id: string, scope: CommonAzureConstruct, props: DnsZoneProps) {
36
31
  if (!props) throw `Props undefined for ${id}`
37
32
 
38
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-dz-rg`, {
39
- name: scope.props.resourceGroupName
40
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
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: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.dnsZone),
49
- resourceGroupName: resourceGroup.name,
50
- tags: props.tags ?? {
51
- environment: scope.props.stage,
33
+ // Get resource group name
34
+ const resourceGroupName = scope.props.resourceGroupName
35
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
36
+ : props.resourceGroupName
37
+
38
+ if (!resourceGroupName) throw `Resource group name undefined for ${id}`
39
+
40
+ return new Zone(
41
+ `${id}-dz`,
42
+ {
43
+ ...props,
44
+ zoneName: scope.resourceNameFormatter.format(
45
+ props.zoneName?.toString(),
46
+ scope.props.resourceNameOptions?.dnsZone
47
+ ),
48
+ resourceGroupName: resourceGroupName,
49
+ location: 'global', // DNS zones are always global
50
+ tags: props.tags ?? {
51
+ environment: scope.props.stage,
52
+ },
52
53
  },
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
54
+ { parent: scope }
55
+ )
60
56
  }
61
57
 
62
58
  /**
@@ -64,24 +60,23 @@ export class AzureDnsManager {
64
60
  * @param id scoped id of the resource
65
61
  * @param scope scope in which this resource is defined
66
62
  * @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}
63
+ * @see [Pulumi Azure Native DNS Record Set]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/network/recordset/}
68
64
  */
69
65
  public createDnsARecord(id: string, scope: CommonAzureConstruct, props: DnsARecordProps) {
70
66
  if (!props) throw `Props undefined for ${id}`
71
67
 
72
- const dnsARecord = new DnsARecord(scope, `${id}-da`, {
73
- ...props,
74
- ttl: props.ttl ?? 300,
75
- tags: props.tags ?? {
76
- environment: scope.props.stage,
68
+ return new RecordSet(
69
+ `${id}-da`,
70
+ {
71
+ ...props,
72
+ recordType: 'A',
73
+ ttl: props.ttl ?? 300,
74
+ metadata: props.metadata ?? {
75
+ environment: scope.props.stage,
76
+ },
77
77
  },
78
- })
79
-
80
- createAzureTfOutput(`${id}-dnsARecordName`, scope, dnsARecord.name)
81
- createAzureTfOutput(`${id}-dnsARecordFriendlyUniqueId`, scope, dnsARecord.friendlyUniqueId)
82
- createAzureTfOutput(`${id}-dnsARecordId`, scope, dnsARecord.id)
83
-
84
- return dnsARecord
78
+ { parent: scope }
79
+ )
85
80
  }
86
81
 
87
82
  /**
@@ -89,24 +84,23 @@ export class AzureDnsManager {
89
84
  * @param id scoped id of the resource
90
85
  * @param scope scope in which this resource is defined
91
86
  * @param props dns cname record properties
92
- * @see [CDKTF DNS CNAME Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsCnameRecord.typescript.md}
87
+ * @see [Pulumi Azure Native DNS Record Set]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/network/recordset/}
93
88
  */
94
89
  public createDnsCnameRecord(id: string, scope: CommonAzureConstruct, props: DnsCnameRecordProps) {
95
90
  if (!props) throw `Props undefined for ${id}`
96
91
 
97
- const dnsCnameRecord = new DnsCnameRecord(scope, `${id}-dc`, {
98
- ...props,
99
- ttl: props.ttl ?? 300,
100
- tags: props.tags ?? {
101
- environment: scope.props.stage,
92
+ return new RecordSet(
93
+ `${id}-dc`,
94
+ {
95
+ ...props,
96
+ recordType: 'CNAME',
97
+ ttl: props.ttl ?? 300,
98
+ metadata: props.metadata ?? {
99
+ environment: scope.props.stage,
100
+ },
102
101
  },
103
- })
104
-
105
- createAzureTfOutput(`${id}-dnsCnameRecordName`, scope, dnsCnameRecord.name)
106
- createAzureTfOutput(`${id}-dnsCnameRecordFriendlyUniqueId`, scope, dnsCnameRecord.friendlyUniqueId)
107
- createAzureTfOutput(`${id}-dnsCnameRecordId`, scope, dnsCnameRecord.id)
108
-
109
- return dnsCnameRecord
102
+ { parent: scope }
103
+ )
110
104
  }
111
105
 
112
106
  /**
@@ -114,23 +108,22 @@ export class AzureDnsManager {
114
108
  * @param id scoped id of the resource
115
109
  * @param scope scope in which this resource is defined
116
110
  * @param props dns txt record properties
117
- * @see [CDKTF DNS TXT Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsCnameRecord.typescript.md}
111
+ * @see [Pulumi Azure Native DNS Record Set]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/network/recordset/}
118
112
  */
119
113
  public createDnsTxtRecord(id: string, scope: CommonAzureConstruct, props: DnsTxtRecordProps) {
120
114
  if (!props) throw `Props undefined for ${id}`
121
115
 
122
- const dnsTxtRecord = new DnsTxtRecord(scope, `${id}-dc`, {
123
- ...props,
124
- ttl: props.ttl ?? 300,
125
- tags: props.tags ?? {
126
- environment: scope.props.stage,
116
+ return new RecordSet(
117
+ `${id}-dt`,
118
+ {
119
+ ...props,
120
+ recordType: 'TXT',
121
+ ttl: props.ttl ?? 300,
122
+ metadata: props.metadata ?? {
123
+ environment: scope.props.stage,
124
+ },
127
125
  },
128
- })
129
-
130
- createAzureTfOutput(`${id}-dnsTxtRecordName`, scope, dnsTxtRecord.name)
131
- createAzureTfOutput(`${id}-dnsTxtRecordFriendlyUniqueId`, scope, dnsTxtRecord.friendlyUniqueId)
132
- createAzureTfOutput(`${id}-dnsTxtRecordId`, scope, dnsTxtRecord.id)
133
-
134
- return dnsTxtRecord
126
+ { parent: scope }
127
+ )
135
128
  }
136
129
  }
@@ -1,9 +1,9 @@
1
- import { DnsZoneConfig } from '@cdktf/provider-azurerm/lib/dns-zone/index.js'
2
- import { DnsARecordConfig } from '@cdktf/provider-azurerm/lib/dns-a-record/index.js'
3
- import { DnsCnameRecordConfig } from '@cdktf/provider-azurerm/lib/dns-cname-record/index.js'
4
- import { DnsTxtRecordConfig } from '@cdktf/provider-azurerm/lib/dns-txt-record/index.js'
5
-
6
- export interface DnsZoneProps extends DnsZoneConfig {}
7
- export interface DnsARecordProps extends DnsARecordConfig {}
8
- export interface DnsCnameRecordProps extends DnsCnameRecordConfig {}
9
- export interface DnsTxtRecordProps extends DnsTxtRecordConfig {}
1
+ import { RecordSetArgs, ZoneArgs } from '@pulumi/azure-native/dns/index.js'
2
+
3
+ export interface DnsZoneProps extends ZoneArgs {}
4
+
5
+ export interface DnsARecordProps extends RecordSetArgs {}
6
+
7
+ export interface DnsCnameRecordProps extends RecordSetArgs {}
8
+
9
+ export interface DnsTxtRecordProps extends RecordSetArgs {}
@@ -1,34 +1,35 @@
1
1
  import {
2
- DataAzurermEventgridTopic,
3
- DataAzurermEventgridTopicConfig,
4
- } from '@cdktf/provider-azurerm/lib/data-azurerm-eventgrid-topic/index.js'
5
- import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group/index.js'
6
- import { EventgridEventSubscription } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription/index.js'
7
- import { EventgridSystemTopicEventSubscription } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic-event-subscription/index.js'
8
- import { EventgridSystemTopic } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic/index.js'
9
- import { EventgridTopic } from '@cdktf/provider-azurerm/lib/eventgrid-topic/index.js'
2
+ EventDeliverySchema,
3
+ EventSubscription,
4
+ getTopicOutput,
5
+ GetTopicResult,
6
+ SystemTopic,
7
+ SystemTopicEventSubscription,
8
+ Topic,
9
+ } from '@pulumi/azure-native/eventgrid/index.js'
10
+ import * as pulumi from '@pulumi/pulumi'
10
11
  import { CommonAzureConstruct } from '../../common/index.js'
11
- import { createAzureTfOutput } from '../../utils/index.js'
12
12
  import {
13
13
  EventgridEventSubscriptionProps,
14
14
  EventgridSystemTopicEventSubscriptionProps,
15
15
  EventgridSystemTopicProps,
16
16
  EventgridTopicProps,
17
+ ResolveEventgridTopicProps,
17
18
  } from './types.js'
18
19
 
19
20
  /**
20
- * @classdesc Provides operations on Azure Event Grid
21
+ * @classdesc Provides operations on Azure Event Grid using Pulumi
21
22
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
22
23
  * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
23
24
  * @example
24
- * ```
25
+ * ```typescript
25
26
  * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
26
27
  *
27
28
  * class CustomConstruct extends CommonAzureConstruct {
28
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
29
- * super(parent, id, props)
29
+ * constructor(name: string, props: CommonAzureStackProps) {
30
+ * super(name, props)
30
31
  * this.props = props
31
- * this.EventGridManager.createEventGrid('MyEventGrid', this, props)
32
+ * this.EventGridManager.createEventgridTopic('MyEventGrid', this, props)
32
33
  * }
33
34
  * }
34
35
  * ```
@@ -39,35 +40,34 @@ export class AzureEventgridManager {
39
40
  * @param id scoped id of the resource
40
41
  * @param scope scope in which this resource is defined
41
42
  * @param props eventgrid topic properties
42
- * @see [CDKTF Eventgrid Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridTopic.typescript.md}
43
+ * @see [Pulumi Azure Native Event Grid Topic]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/eventgrid/topic/}
43
44
  */
44
45
  public createEventgridTopic(id: string, scope: CommonAzureConstruct, props: EventgridTopicProps) {
45
46
  if (!props) throw `Props undefined for ${id}`
46
47
 
47
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-et-rg`, {
48
- name: scope.props.resourceGroupName
49
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
50
- : `${props.resourceGroupName}`,
51
- })
52
-
53
- if (!resourceGroup) throw `Resource group undefined for ${id}`
54
-
55
- const eventgridTopic = new EventgridTopic(scope, `${id}-et`, {
56
- ...props,
57
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridTopic),
58
- location: resourceGroup.location,
59
- resourceGroupName: resourceGroup.name,
60
- tags: props.tags ?? {
61
- environment: scope.props.stage,
48
+ // Get resource group name
49
+ const resourceGroupName = scope.props.resourceGroupName
50
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
51
+ : props.resourceGroupName
52
+
53
+ if (!resourceGroupName) throw `Resource group name undefined for ${id}`
54
+
55
+ return new Topic(
56
+ `${id}-et`,
57
+ {
58
+ ...props,
59
+ topicName: scope.resourceNameFormatter.format(
60
+ props.topicName?.toString(),
61
+ scope.props.resourceNameOptions?.eventGridTopic
62
+ ),
63
+ location: props.location ?? scope.props.location,
64
+ resourceGroupName: resourceGroupName,
65
+ tags: props.tags ?? {
66
+ environment: scope.props.stage,
67
+ },
62
68
  },
63
- })
64
-
65
- createAzureTfOutput(`${id}-eventgridTopicName`, scope, eventgridTopic.name)
66
- createAzureTfOutput(`${id}-eventgridTopicFriendlyUniqueId`, scope, eventgridTopic.friendlyUniqueId)
67
- createAzureTfOutput(`${id}-eventgridTopicId`, scope, eventgridTopic.id)
68
- createAzureTfOutput(`${id}-eventgridTopicEndpoint`, scope, eventgridTopic.endpoint)
69
-
70
- return eventgridTopic
69
+ { parent: scope }
70
+ )
71
71
  }
72
72
 
73
73
  /**
@@ -75,53 +75,51 @@ export class AzureEventgridManager {
75
75
  * @param id scoped id of the resource
76
76
  * @param scope scope in which this resource is defined
77
77
  * @param props eventgrid topic properties
78
- * @see [CDKTF Eventgrid Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridTopic.typescript.md}
78
+ * @see [Pulumi Azure Native Event Grid Topic Lookup]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/eventgrid/topic/}
79
79
  */
80
- public resolveEventgridTopic(id: string, scope: CommonAzureConstruct, props: DataAzurermEventgridTopicConfig) {
80
+ public resolveEventgridTopic(id: string, scope: CommonAzureConstruct, props: ResolveEventgridTopicProps) {
81
81
  if (!props) throw `Props undefined for ${id}`
82
82
 
83
- const eventgridTopic = new DataAzurermEventgridTopic(scope, `${id}-et`, {
84
- ...props,
85
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridTopic),
86
- resourceGroupName: scope.props.resourceGroupName
87
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
88
- : `${props.resourceGroupName}`,
89
- })
90
-
91
- createAzureTfOutput(`${id}-eventgridTopicName`, scope, eventgridTopic.name)
92
- createAzureTfOutput(`${id}-eventgridTopicFriendlyUniqueId`, scope, eventgridTopic.friendlyUniqueId)
93
- createAzureTfOutput(`${id}-eventgridTopicId`, scope, eventgridTopic.id)
94
- createAzureTfOutput(`${id}-eventgridTopicEndpoint`, scope, eventgridTopic.endpoint)
95
-
96
- return eventgridTopic
83
+ return getTopicOutput(
84
+ {
85
+ topicName: scope.resourceNameFormatter.format(
86
+ props.topicName?.toString(),
87
+ scope.props.resourceNameOptions?.eventGridTopic
88
+ ),
89
+ resourceGroupName: scope.props.resourceGroupName
90
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
91
+ : props.resourceGroupName,
92
+ },
93
+ { parent: scope }
94
+ )
97
95
  }
98
96
 
99
97
  /**
100
98
  * @summary Method to create a new eventgrid subscription
101
99
  * @param id scoped id of the resource
102
100
  * @param scope scope in which this resource is defined
103
- * @param props eventgrid subsription properties
104
- * @see [CDKTF Eventgrid Subscription Container Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridEventSubscription.typescript.md}
101
+ * @param props eventgrid subscription properties
102
+ * @see [Pulumi Azure Native Event Grid Event Subscription]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/eventgrid/eventsubscription/}
105
103
  */
106
104
  public createEventgridSubscription(id: string, scope: CommonAzureConstruct, props: EventgridEventSubscriptionProps) {
107
105
  if (!props) throw `Props undefined for ${id}`
108
106
 
109
- const eventgridSubscription = new EventgridEventSubscription(scope, `${id}-es`, {
110
- ...props,
111
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridEventSubscription),
112
- eventDeliverySchema: props.eventDeliverySchema ?? 'CloudEventSchemaV1_0',
113
- advancedFilteringOnArraysEnabled: props.advancedFilteringOnArraysEnabled ?? true,
114
- retryPolicy: {
115
- eventTimeToLive: props.retryPolicy?.eventTimeToLive ?? 1440,
116
- maxDeliveryAttempts: props.retryPolicy?.maxDeliveryAttempts ?? 7,
107
+ return new EventSubscription(
108
+ `${id}-es`,
109
+ {
110
+ ...props,
111
+ eventSubscriptionName: scope.resourceNameFormatter.format(
112
+ props.eventSubscriptionName?.toString(),
113
+ scope.props.resourceNameOptions?.eventGridEventSubscription
114
+ ),
115
+ eventDeliverySchema: props.eventDeliverySchema ?? EventDeliverySchema.CloudEventSchemaV1_0,
116
+ retryPolicy: props.retryPolicy ?? {
117
+ eventTimeToLiveInMinutes: 1440,
118
+ maxDeliveryAttempts: 7,
119
+ },
117
120
  },
118
- })
119
-
120
- createAzureTfOutput(`${id}-eventgridSubscriptiontName`, scope, eventgridSubscription.name)
121
- createAzureTfOutput(`${id}-eventgridSubscriptionFriendlyUniqueId`, scope, eventgridSubscription.friendlyUniqueId)
122
- createAzureTfOutput(`${id}-eventgridSubscriptionId`, scope, eventgridSubscription.id)
123
-
124
- return eventgridSubscription
121
+ { parent: scope }
122
+ )
125
123
  }
126
124
 
127
125
  /**
@@ -129,34 +127,34 @@ export class AzureEventgridManager {
129
127
  * @param id scoped id of the resource
130
128
  * @param scope scope in which this resource is defined
131
129
  * @param props eventgrid system topic properties
132
- * @see [CDKTF Eventgrid System Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridSystemTopic.typescript.md}
130
+ * @see [Pulumi Azure Native Event Grid System Topic]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/eventgrid/systemtopic/}
133
131
  */
134
132
  public createEventgridSystemTopic(id: string, scope: CommonAzureConstruct, props: EventgridSystemTopicProps) {
135
133
  if (!props) throw `Props undefined for ${id}`
136
134
 
137
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-est-rg`, {
138
- name: scope.props.resourceGroupName
139
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
140
- : `${props.resourceGroupName}`,
141
- })
142
-
143
- if (!resourceGroup) throw `Resource group undefined for ${id}`
144
-
145
- const eventgridSystemTopic = new EventgridSystemTopic(scope, `${id}-est`, {
146
- ...props,
147
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridSystemTopic),
148
- location: resourceGroup.location,
149
- resourceGroupName: resourceGroup.name,
150
- tags: props.tags ?? {
151
- environment: scope.props.stage,
135
+ // Get resource group name
136
+ const resourceGroupName = scope.props.resourceGroupName
137
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
138
+ : props.resourceGroupName
139
+
140
+ if (!resourceGroupName) throw `Resource group name undefined for ${id}`
141
+
142
+ return new SystemTopic(
143
+ `${id}-est`,
144
+ {
145
+ ...props,
146
+ systemTopicName: scope.resourceNameFormatter.format(
147
+ props.systemTopicName?.toString(),
148
+ scope.props.resourceNameOptions?.eventGridSystemTopic
149
+ ),
150
+ location: props.location ?? scope.props.location,
151
+ resourceGroupName: resourceGroupName,
152
+ tags: props.tags ?? {
153
+ environment: scope.props.stage,
154
+ },
152
155
  },
153
- })
154
-
155
- createAzureTfOutput(`${id}-eventgridSystemTopicName`, scope, eventgridSystemTopic.name)
156
- createAzureTfOutput(`${id}-eventgridSystemTopicFriendlyUniqueId`, scope, eventgridSystemTopic.friendlyUniqueId)
157
- createAzureTfOutput(`${id}-eventgridSystemTopicId`, scope, eventgridSystemTopic.id)
158
-
159
- return eventgridSystemTopic
156
+ { parent: scope }
157
+ )
160
158
  }
161
159
 
162
160
  /**
@@ -164,42 +162,42 @@ export class AzureEventgridManager {
164
162
  * @param id scoped id of the resource
165
163
  * @param scope scope in which this resource is defined
166
164
  * @param props eventgrid system topic subscription properties
167
- * @see [CDKTF Eventgrid System Topic Subscription Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/eventgridSystemTopicEventSubscription.typescript.md}
165
+ * @param systemTopic The system topic to attach this subscription to
166
+ * @see [Pulumi Azure Native Event Grid System Topic Event Subscription]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/eventgrid/systemtopiceventsubscription/}
168
167
  */
169
168
  public createEventgridSystemTopicEventSubscription(
170
169
  id: string,
171
170
  scope: CommonAzureConstruct,
172
171
  props: EventgridSystemTopicEventSubscriptionProps,
173
- systemTopic: EventgridSystemTopic | DataAzurermEventgridTopic
172
+ systemTopic: SystemTopic | pulumi.Output<GetTopicResult>
174
173
  ) {
175
174
  if (!props) throw `Props undefined for ${id}`
176
175
 
177
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-ests-rg`, {
178
- name: scope.props.resourceGroupName
179
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
180
- : `${props.resourceGroupName}`,
181
- })
182
-
183
- if (!resourceGroup) throw `Resource group undefined for ${id}`
184
-
185
- const eventgridSystemTopicSubscription = new EventgridSystemTopicEventSubscription(scope, `${id}-ests`, {
186
- ...props,
187
- name: scope.resourceNameFormatter.format(
188
- props.name,
189
- scope.props.resourceNameOptions?.eventGridSystemTopicEventSubscription
190
- ),
191
- systemTopic: systemTopic.name,
192
- resourceGroupName: resourceGroup.name,
193
- })
194
-
195
- createAzureTfOutput(`${id}-eventgridSystemTopicEventSubscriptionName`, scope, eventgridSystemTopicSubscription.name)
196
- createAzureTfOutput(
197
- `${id}-eventgridSystemTopicEventSubscriptionFriendlyUniqueId`,
198
- scope,
199
- eventgridSystemTopicSubscription.friendlyUniqueId
176
+ // Get resource group name
177
+ const resourceGroupName = scope.props.resourceGroupName
178
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
179
+ : props.resourceGroupName
180
+
181
+ if (!resourceGroupName) throw `Resource group name undefined for ${id}`
182
+
183
+ // Extract system topic name
184
+ const systemTopicName =
185
+ systemTopic instanceof SystemTopic
186
+ ? systemTopic.name
187
+ : (systemTopic as pulumi.Output<GetTopicResult>).apply(t => t.name)
188
+
189
+ return new SystemTopicEventSubscription(
190
+ `${id}-ests`,
191
+ {
192
+ ...props,
193
+ eventSubscriptionName: scope.resourceNameFormatter.format(
194
+ props.eventSubscriptionName?.toString(),
195
+ scope.props.resourceNameOptions?.eventGridSystemTopicEventSubscription
196
+ ),
197
+ systemTopicName: systemTopicName,
198
+ resourceGroupName: resourceGroupName,
199
+ },
200
+ { parent: scope }
200
201
  )
201
- createAzureTfOutput(`${id}-eventgridSystemTopicEventSubscriptionId`, scope, eventgridSystemTopicSubscription.id)
202
-
203
- return eventgridSystemTopicSubscription
204
202
  }
205
203
  }
@@ -1,12 +1,17 @@
1
- import { EventgridEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription/index.js'
2
- import { EventgridSystemTopicEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic-event-subscription/index.js'
3
- import { EventgridSystemTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-system-topic/index.js'
4
- import { EventgridTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-topic/index.js'
1
+ import {
2
+ EventSubscriptionArgs,
3
+ GetTopicOutputArgs,
4
+ SystemTopicArgs,
5
+ SystemTopicEventSubscriptionArgs,
6
+ TopicArgs,
7
+ } from '@pulumi/azure-native/eventgrid/index.js'
5
8
 
6
- export interface EventgridTopicProps extends EventgridTopicConfig {}
9
+ export interface EventgridTopicProps extends TopicArgs {}
7
10
 
8
- export interface EventgridEventSubscriptionProps extends EventgridEventSubscriptionConfig {}
11
+ export interface EventgridEventSubscriptionProps extends EventSubscriptionArgs {}
9
12
 
10
- export interface EventgridSystemTopicProps extends EventgridSystemTopicConfig {}
13
+ export interface EventgridSystemTopicProps extends SystemTopicArgs {}
11
14
 
12
- export interface EventgridSystemTopicEventSubscriptionProps extends EventgridSystemTopicEventSubscriptionConfig {}
15
+ export interface EventgridSystemTopicEventSubscriptionProps extends SystemTopicEventSubscriptionArgs {}
16
+
17
+ export interface ResolveEventgridTopicProps extends GetTopicOutputArgs {}