@gradientedge/cdk-utils 10.6.0 → 10.8.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 (200) hide show
  1. package/dist/app/api-destined-function/src/lib/lambda.d.ts +1 -0
  2. package/dist/app/api-destined-function/src/lib/lambda.d.ts.map +1 -0
  3. package/dist/app/api-destined-function/src/lib/lambda.js +1 -0
  4. package/dist/app/api-destined-function/src/lib/lambda.js.map +1 -0
  5. package/dist/app/api-destined-function/tsconfig.tsbuildinfo +1 -0
  6. package/dist/src/lib/aws/services/cloudwatch/main.d.ts +11 -11
  7. package/dist/src/lib/azure/common/constants.d.ts +74 -0
  8. package/dist/src/lib/azure/common/constants.js +77 -0
  9. package/dist/src/lib/azure/common/construct.d.ts +15 -3
  10. package/dist/src/lib/azure/common/construct.js +40 -4
  11. package/dist/src/lib/azure/common/stack.d.ts +3 -2
  12. package/dist/src/lib/azure/common/stack.js +25 -42
  13. package/dist/src/lib/azure/common/types.d.ts +13 -2
  14. package/dist/src/lib/azure/construct/event-handler/index.d.ts +2 -0
  15. package/dist/src/lib/azure/construct/event-handler/index.js +2 -0
  16. package/dist/src/lib/azure/construct/event-handler/main.d.ts +20 -0
  17. package/dist/src/lib/azure/construct/event-handler/main.js +139 -0
  18. package/dist/src/lib/azure/construct/event-handler/types.d.ts +35 -0
  19. package/dist/src/lib/azure/construct/event-handler/types.js +1 -0
  20. package/dist/src/lib/azure/construct/function-app/index.d.ts +2 -0
  21. package/dist/src/lib/azure/construct/function-app/index.js +2 -0
  22. package/dist/src/lib/azure/construct/function-app/main.d.ts +51 -0
  23. package/dist/src/lib/azure/construct/function-app/main.js +297 -0
  24. package/dist/src/lib/azure/construct/function-app/types.d.ts +33 -0
  25. package/dist/src/lib/azure/construct/function-app/types.js +1 -0
  26. package/dist/src/lib/azure/construct/index.d.ts +6 -0
  27. package/dist/src/lib/azure/construct/index.js +6 -0
  28. package/dist/src/lib/azure/construct/rest-api/index.d.ts +2 -0
  29. package/dist/src/lib/azure/construct/rest-api/index.js +2 -0
  30. package/dist/src/lib/azure/construct/rest-api/main.d.ts +20 -0
  31. package/dist/src/lib/azure/construct/rest-api/main.js +172 -0
  32. package/dist/src/lib/azure/construct/rest-api/types.d.ts +25 -0
  33. package/dist/src/lib/azure/construct/rest-api/types.js +1 -0
  34. package/dist/src/lib/azure/construct/rest-api-function/index.d.ts +2 -0
  35. package/dist/src/lib/azure/construct/rest-api-function/index.js +2 -0
  36. package/dist/src/lib/azure/construct/rest-api-function/main.d.ts +19 -0
  37. package/dist/src/lib/azure/construct/rest-api-function/main.js +255 -0
  38. package/dist/src/lib/azure/construct/rest-api-function/types.d.ts +29 -0
  39. package/dist/src/lib/azure/construct/rest-api-function/types.js +1 -0
  40. package/dist/src/lib/azure/construct/rest-api-with-cache/index.d.ts +2 -0
  41. package/dist/src/lib/azure/construct/rest-api-with-cache/index.js +2 -0
  42. package/dist/src/lib/azure/construct/rest-api-with-cache/main.d.ts +12 -0
  43. package/dist/src/lib/azure/construct/rest-api-with-cache/main.js +56 -0
  44. package/dist/src/lib/azure/construct/rest-api-with-cache/types.d.ts +13 -0
  45. package/dist/src/lib/azure/construct/rest-api-with-cache/types.js +1 -0
  46. package/dist/src/lib/azure/construct/site-with-webapp/index.d.ts +2 -0
  47. package/dist/src/lib/azure/construct/site-with-webapp/index.js +2 -0
  48. package/dist/src/lib/azure/construct/site-with-webapp/main.d.ts +19 -0
  49. package/dist/src/lib/azure/construct/site-with-webapp/main.js +135 -0
  50. package/dist/src/lib/azure/construct/site-with-webapp/types.d.ts +30 -0
  51. package/dist/src/lib/azure/construct/site-with-webapp/types.js +1 -0
  52. package/dist/src/lib/azure/index.d.ts +1 -0
  53. package/dist/src/lib/azure/index.js +1 -0
  54. package/dist/src/lib/azure/services/api-management/main.d.ts +83 -5
  55. package/dist/src/lib/azure/services/api-management/main.js +114 -148
  56. package/dist/src/lib/azure/services/api-management/types.d.ts +22 -1
  57. package/dist/src/lib/azure/services/app-configuration/main.d.ts +13 -1
  58. package/dist/src/lib/azure/services/app-configuration/main.js +21 -2
  59. package/dist/src/lib/azure/services/app-service/main.d.ts +5 -2
  60. package/dist/src/lib/azure/services/app-service/main.js +12 -4
  61. package/dist/src/lib/azure/services/application-insights/main.d.ts +15 -4
  62. package/dist/src/lib/azure/services/application-insights/main.js +27 -6
  63. package/dist/src/lib/azure/services/application-insights/types.d.ts +4 -1
  64. package/dist/src/lib/azure/services/authorisation/constants.d.ts +13 -0
  65. package/dist/src/lib/azure/services/authorisation/constants.js +14 -0
  66. package/dist/src/lib/azure/services/authorisation/index.d.ts +3 -0
  67. package/dist/src/lib/azure/services/authorisation/index.js +3 -0
  68. package/dist/src/lib/azure/services/authorisation/main.d.ts +84 -0
  69. package/dist/src/lib/azure/services/authorisation/main.js +120 -0
  70. package/dist/src/lib/azure/services/authorisation/types.d.ts +3 -0
  71. package/dist/src/lib/azure/services/authorisation/types.js +1 -0
  72. package/dist/src/lib/azure/services/cosmosdb/constants.d.ts +8 -0
  73. package/dist/src/lib/azure/services/cosmosdb/constants.js +10 -0
  74. package/dist/src/lib/azure/services/cosmosdb/index.d.ts +1 -0
  75. package/dist/src/lib/azure/services/cosmosdb/index.js +1 -0
  76. package/dist/src/lib/azure/services/cosmosdb/main.d.ts +47 -5
  77. package/dist/src/lib/azure/services/cosmosdb/main.js +77 -8
  78. package/dist/src/lib/azure/services/cosmosdb/types.d.ts +3 -1
  79. package/dist/src/lib/azure/services/dns/main.d.ts +9 -4
  80. package/dist/src/lib/azure/services/dns/main.js +12 -8
  81. package/dist/src/lib/azure/services/eventgrid/main.d.ts +12 -7
  82. package/dist/src/lib/azure/services/eventgrid/main.js +18 -19
  83. package/dist/src/lib/azure/services/function/main.d.ts +16 -3
  84. package/dist/src/lib/azure/services/function/main.js +122 -8
  85. package/dist/src/lib/azure/services/function/types.d.ts +3 -4
  86. package/dist/src/lib/azure/services/index.d.ts +3 -0
  87. package/dist/src/lib/azure/services/index.js +3 -0
  88. package/dist/src/lib/azure/services/key-vault/main.d.ts +22 -2
  89. package/dist/src/lib/azure/services/key-vault/main.js +28 -3
  90. package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -2
  91. package/dist/src/lib/azure/services/monitor/main.d.ts +3 -1
  92. package/dist/src/lib/azure/services/monitor/main.js +3 -2
  93. package/dist/src/lib/azure/services/operational-insights/main.d.ts +13 -2
  94. package/dist/src/lib/azure/services/operational-insights/main.js +17 -3
  95. package/dist/src/lib/azure/services/operational-insights/types.d.ts +3 -1
  96. package/dist/src/lib/azure/services/portal/error.d.ts +5 -0
  97. package/dist/src/lib/azure/services/portal/error.js +10 -0
  98. package/dist/src/lib/azure/services/portal/index.d.ts +4 -0
  99. package/dist/src/lib/azure/services/portal/index.js +4 -0
  100. package/dist/src/lib/azure/services/portal/main.d.ts +33 -0
  101. package/dist/src/lib/azure/services/portal/main.js +51 -0
  102. package/dist/src/lib/azure/services/portal/renderer.d.ts +11 -0
  103. package/dist/src/lib/azure/services/portal/renderer.js +156 -0
  104. package/dist/src/lib/azure/services/portal/types.d.ts +40 -0
  105. package/dist/src/lib/azure/services/portal/types.js +1 -0
  106. package/dist/src/lib/azure/services/redis/main.d.ts +4 -2
  107. package/dist/src/lib/azure/services/redis/main.js +3 -2
  108. package/dist/src/lib/azure/services/redis/types.d.ts +1 -1
  109. package/dist/src/lib/azure/services/resource-group/main.d.ts +10 -1
  110. package/dist/src/lib/azure/services/resource-group/main.js +17 -3
  111. package/dist/src/lib/azure/services/security-center/index.d.ts +2 -0
  112. package/dist/src/lib/azure/services/security-center/index.js +2 -0
  113. package/dist/src/lib/azure/services/security-center/main.d.ts +31 -0
  114. package/dist/src/lib/azure/services/security-center/main.js +33 -0
  115. package/dist/src/lib/azure/services/security-center/types.d.ts +3 -0
  116. package/dist/src/lib/azure/services/security-center/types.js +1 -0
  117. package/dist/src/lib/azure/services/servicebus/main.d.ts +28 -22
  118. package/dist/src/lib/azure/services/servicebus/main.js +31 -26
  119. package/dist/src/lib/azure/services/servicebus/types.d.ts +4 -4
  120. package/dist/src/lib/azure/services/storage/main.d.ts +26 -5
  121. package/dist/src/lib/azure/services/storage/main.js +51 -9
  122. package/dist/src/lib/azure/services/storage/types.d.ts +7 -2
  123. package/dist/src/lib/cloudflare/common/construct.js +1 -1
  124. package/dist/src/lib/cloudflare/common/stack.d.ts +2 -2
  125. package/dist/src/lib/cloudflare/common/stack.js +25 -25
  126. package/dist/src/lib/cloudflare/services/worker/main.js +8 -1
  127. package/dist/src/lib/cloudflare/services/worker/types.d.ts +1 -0
  128. package/package.json +26 -23
  129. package/src/lib/azure/common/constants.ts +83 -0
  130. package/src/lib/azure/common/construct.ts +50 -7
  131. package/src/lib/azure/common/stack.ts +26 -43
  132. package/src/lib/azure/common/types.ts +14 -2
  133. package/src/lib/azure/construct/event-handler/index.ts +2 -0
  134. package/src/lib/azure/construct/event-handler/main.ts +183 -0
  135. package/src/lib/azure/construct/event-handler/types.ts +49 -0
  136. package/src/lib/azure/construct/function-app/index.ts +2 -0
  137. package/src/lib/azure/construct/function-app/main.ts +410 -0
  138. package/src/lib/azure/construct/function-app/types.ts +45 -0
  139. package/src/lib/azure/construct/index.ts +6 -0
  140. package/src/lib/azure/construct/rest-api/index.ts +2 -0
  141. package/src/lib/azure/construct/rest-api/main.ts +205 -0
  142. package/src/lib/azure/construct/rest-api/types.ts +33 -0
  143. package/src/lib/azure/construct/rest-api-function/index.ts +2 -0
  144. package/src/lib/azure/construct/rest-api-function/main.ts +297 -0
  145. package/src/lib/azure/construct/rest-api-function/types.ts +39 -0
  146. package/src/lib/azure/construct/rest-api-with-cache/index.ts +2 -0
  147. package/src/lib/azure/construct/rest-api-with-cache/main.ts +75 -0
  148. package/src/lib/azure/construct/rest-api-with-cache/types.ts +15 -0
  149. package/src/lib/azure/construct/site-with-webapp/index.ts +2 -0
  150. package/src/lib/azure/construct/site-with-webapp/main.ts +160 -0
  151. package/src/lib/azure/construct/site-with-webapp/types.ts +33 -0
  152. package/src/lib/azure/index.ts +1 -0
  153. package/src/lib/azure/services/api-management/main.ts +168 -152
  154. package/src/lib/azure/services/api-management/types.ts +30 -1
  155. package/src/lib/azure/services/app-configuration/main.ts +29 -2
  156. package/src/lib/azure/services/app-service/main.ts +23 -4
  157. package/src/lib/azure/services/application-insights/main.ts +46 -7
  158. package/src/lib/azure/services/application-insights/types.ts +6 -2
  159. package/src/lib/azure/services/authorisation/constants.ts +13 -0
  160. package/src/lib/azure/services/authorisation/index.ts +3 -0
  161. package/src/lib/azure/services/authorisation/main.ts +202 -0
  162. package/src/lib/azure/services/authorisation/types.ts +3 -0
  163. package/src/lib/azure/services/cosmosdb/constants.ts +9 -0
  164. package/src/lib/azure/services/cosmosdb/index.ts +1 -0
  165. package/src/lib/azure/services/cosmosdb/main.ts +158 -8
  166. package/src/lib/azure/services/cosmosdb/types.ts +3 -0
  167. package/src/lib/azure/services/dns/main.ts +33 -8
  168. package/src/lib/azure/services/eventgrid/main.ts +41 -23
  169. package/src/lib/azure/services/function/main.ts +155 -9
  170. package/src/lib/azure/services/function/types.ts +3 -4
  171. package/src/lib/azure/services/index.ts +3 -0
  172. package/src/lib/azure/services/key-vault/main.ts +47 -4
  173. package/src/lib/azure/services/key-vault/types.ts +4 -4
  174. package/src/lib/azure/services/monitor/main.ts +5 -2
  175. package/src/lib/azure/services/operational-insights/main.ts +30 -4
  176. package/src/lib/azure/services/operational-insights/types.ts +3 -1
  177. package/src/lib/azure/services/portal/error.ts +12 -0
  178. package/src/lib/azure/services/portal/index.ts +4 -0
  179. package/src/lib/azure/services/portal/main.ts +81 -0
  180. package/src/lib/azure/services/portal/renderer.ts +182 -0
  181. package/src/lib/azure/services/portal/types.ts +45 -0
  182. package/src/lib/azure/services/redis/main.ts +10 -3
  183. package/src/lib/azure/services/redis/types.ts +1 -1
  184. package/src/lib/azure/services/resource-group/main.ts +34 -3
  185. package/src/lib/azure/services/security-center/index.ts +2 -0
  186. package/src/lib/azure/services/security-center/main.ts +42 -0
  187. package/src/lib/azure/services/security-center/types.ts +3 -0
  188. package/src/lib/azure/services/servicebus/main.ts +61 -30
  189. package/src/lib/azure/services/servicebus/types.ts +4 -4
  190. package/src/lib/azure/services/storage/main.ts +91 -9
  191. package/src/lib/azure/services/storage/types.ts +11 -2
  192. package/src/lib/cloudflare/common/construct.ts +1 -1
  193. package/src/lib/cloudflare/common/stack.ts +25 -25
  194. package/src/lib/cloudflare/services/worker/main.ts +10 -1
  195. package/src/lib/cloudflare/services/worker/types.ts +8 -1
  196. package/dist/lib/lambda.d.ts +0 -17
  197. package/dist/lib/lambda.d.ts.map +0 -1
  198. package/dist/lib/lambda.js +0 -28
  199. package/dist/lib/lambda.js.map +0 -1
  200. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,11 +1,21 @@
1
1
  import {
2
2
  DatabaseAccount,
3
+ getDatabaseAccountOutput,
4
+ getSqlResourceSqlRoleDefinitionOutput,
3
5
  ResourceIdentityType,
4
6
  SqlResourceSqlContainer,
5
7
  SqlResourceSqlDatabase,
8
+ SqlResourceSqlRoleAssignment,
6
9
  } from '@pulumi/azure-native/cosmosdb/index.js'
10
+ import { Input, ResourceOptions } from '@pulumi/pulumi'
7
11
  import { CommonAzureConstruct } from '../../common/index.js'
8
- import { CosmosdbAccountProps, CosmosdbSqlContainerProps, CosmosdbSqlDatabaseProps } from './types.js'
12
+ import { CosmosRoleDefinition, CosmosRoleDefinitionId } from './constants.js'
13
+ import {
14
+ CosmosdbAccountProps,
15
+ CosmosdbSqlContainerProps,
16
+ CosmosdbSqlDatabaseProps,
17
+ SqlResourceSqlRoleAssignmentProps,
18
+ } from './types.js'
9
19
 
10
20
  /**
11
21
  * @classdesc Provides operations on Azure CosmosDB using Pulumi
@@ -30,9 +40,15 @@ export class AzureCosmosDbManager {
30
40
  * @param id scoped id of the resource
31
41
  * @param scope scope in which this resource is defined
32
42
  * @param props cosmosdb account properties
33
- * @see [Pulumi Azure Native CosmosDB Account]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/documentdb/databaseaccount/}
43
+ * @param resourceOptions Optional settings to control resource behaviour
44
+ * @see [Pulumi Azure Native CosmosDB Database Account]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/documentdb/databaseaccount/}
34
45
  */
35
- public createCosmosDbAccount(id: string, scope: CommonAzureConstruct, props: CosmosdbAccountProps) {
46
+ public createCosmosDbAccount(
47
+ id: string,
48
+ scope: CommonAzureConstruct,
49
+ props: CosmosdbAccountProps,
50
+ resourceOptions?: ResourceOptions
51
+ ) {
36
52
  if (!props) throw `Props undefined for ${id}`
37
53
 
38
54
  // Get resource group name
@@ -59,7 +75,7 @@ export class AzureCosmosDbManager {
59
75
  type: ResourceIdentityType.SystemAssigned,
60
76
  },
61
77
  },
62
- { parent: scope }
78
+ { parent: scope, ...resourceOptions }
63
79
  )
64
80
  }
65
81
 
@@ -68,9 +84,15 @@ export class AzureCosmosDbManager {
68
84
  * @param id scoped id of the resource
69
85
  * @param scope scope in which this resource is defined
70
86
  * @param props cosmosdb database properties
87
+ * @param resourceOptions Optional settings to control resource behaviour
71
88
  * @see [Pulumi Azure Native CosmosDB SQL Database]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/documentdb/sqlresourcesqldatabase/}
72
89
  */
73
- public createCosmosDbDatabase(id: string, scope: CommonAzureConstruct, props: CosmosdbSqlDatabaseProps) {
90
+ public createCosmosDbDatabase(
91
+ id: string,
92
+ scope: CommonAzureConstruct,
93
+ props: CosmosdbSqlDatabaseProps,
94
+ resourceOptions?: ResourceOptions
95
+ ) {
74
96
  if (!props) throw `Props undefined for ${id}`
75
97
 
76
98
  // Get resource group name
@@ -90,7 +112,7 @@ export class AzureCosmosDbManager {
90
112
  ),
91
113
  resourceGroupName: resourceGroupName,
92
114
  },
93
- { parent: scope }
115
+ { parent: scope, ...resourceOptions }
94
116
  )
95
117
  }
96
118
 
@@ -99,9 +121,15 @@ export class AzureCosmosDbManager {
99
121
  * @param id scoped id of the resource
100
122
  * @param scope scope in which this resource is defined
101
123
  * @param props cosmosdb container properties
124
+ * @param resourceOptions Optional settings to control resource behaviour
102
125
  * @see [Pulumi Azure Native CosmosDB SQL Container]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/documentdb/sqlresourcesqlcontainer/}
103
126
  */
104
- public createCosmosDbContainer(id: string, scope: CommonAzureConstruct, props: CosmosdbSqlContainerProps) {
127
+ public createCosmosDbContainer(
128
+ id: string,
129
+ scope: CommonAzureConstruct,
130
+ props: CosmosdbSqlContainerProps,
131
+ resourceOptions?: ResourceOptions
132
+ ) {
105
133
  if (!props) throw `Props undefined for ${id}`
106
134
 
107
135
  // Get resource group name
@@ -121,7 +149,129 @@ export class AzureCosmosDbManager {
121
149
  ),
122
150
  resourceGroupName: resourceGroupName,
123
151
  },
124
- { parent: scope }
152
+ { parent: scope, ...resourceOptions }
153
+ )
154
+ }
155
+
156
+ /**
157
+ * @summary Method to create a sql role assignment
158
+ * @param id scoped id of the resource
159
+ * @param scope scope in which this resource is defined
160
+ * @param props sql role assignment properties
161
+ * @param resourceOptions Optional settings to control resource behaviour
162
+ * @see [Pulumi Azure Native CosmosDB SQL Role Assignment]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/documentdb/sqlresourcesqlroleassignment/}
163
+ */
164
+ public createSqlResourceSqlRoleAssignment(
165
+ id: string,
166
+ scope: CommonAzureConstruct,
167
+ props: SqlResourceSqlRoleAssignmentProps,
168
+ resourceOptions?: ResourceOptions
169
+ ) {
170
+ return new SqlResourceSqlRoleAssignment(`${id}`, props, { parent: scope, ...resourceOptions })
171
+ }
172
+
173
+ /**
174
+ * @summary Method to resolve an existing cosmosdb account
175
+ * @param scope scope in which this resource is defined
176
+ * @param accountName the account name
177
+ * @param resourceGroupName the resource group name
178
+ * @param resourceOptions Optional settings to control resource behaviour
179
+ */
180
+ public resolveCosmosDbAccount(
181
+ scope: CommonAzureConstruct,
182
+ accountName: string,
183
+ resourceGroupName: string,
184
+ resourceOptions?: ResourceOptions
185
+ ) {
186
+ return getDatabaseAccountOutput({ accountName, resourceGroupName }, { parent: scope, ...resourceOptions })
187
+ }
188
+
189
+ /**
190
+ * @summary Method to resolve an existing sql role definition
191
+ * @param scope scope in which this resource is defined
192
+ * @param accountName the account name
193
+ * @param resourceGroupName the resource group name
194
+ * @param roleDefinitionId the role definition id
195
+ * @param resourceOptions Optional settings to control resource behaviour
196
+ */
197
+ public resolveSqlRoleDefinition(
198
+ scope: CommonAzureConstruct,
199
+ accountName: Input<string>,
200
+ resourceGroupName: string,
201
+ roleDefinitionId: string,
202
+ resourceOptions?: ResourceOptions
203
+ ) {
204
+ return getSqlResourceSqlRoleDefinitionOutput(
205
+ { accountName, resourceGroupName, roleDefinitionId },
206
+ { parent: scope, ...resourceOptions }
125
207
  )
126
208
  }
209
+
210
+ /**
211
+ * @summary Method to assign a sql role assignment
212
+ * @param id scoped id of the resource
213
+ * @param scope scope in which this resource is defined
214
+ * @param accountName the account name
215
+ * @param resourceGroupName the resource group name
216
+ * @param principalId the principal id to which the role is assigned to
217
+ * @param roleDefinitions list of role definitions to
218
+ * @param resourceOptions Optional settings to control resource behaviour
219
+ */
220
+ public grantSqlRoleDefinitionToAccount(
221
+ id: string,
222
+ scope: CommonAzureConstruct,
223
+ accountName: string,
224
+ resourceGroupName: string,
225
+ principalId: Input<string>,
226
+ roleDefinitions: CosmosRoleDefinition[],
227
+ resourceOptions?: ResourceOptions
228
+ ) {
229
+ const cosmosDbAccount = this.resolveCosmosDbAccount(scope, accountName, resourceGroupName, resourceOptions)
230
+
231
+ if (roleDefinitions.includes(CosmosRoleDefinition.CONTRIBUTOR)) {
232
+ const cosmosdbSqlRoleDefinitionContributor = this.resolveSqlRoleDefinition(
233
+ scope,
234
+ cosmosDbAccount.name,
235
+ resourceGroupName,
236
+ CosmosRoleDefinitionId.CONTRIBUTOR,
237
+ resourceOptions
238
+ )
239
+
240
+ this.createSqlResourceSqlRoleAssignment(
241
+ `${id}-cdb-ra-contributor`,
242
+ scope,
243
+ {
244
+ accountName: cosmosDbAccount.name,
245
+ resourceGroupName: resourceGroupName,
246
+ roleDefinitionId: cosmosdbSqlRoleDefinitionContributor.id,
247
+ principalId,
248
+ scope: cosmosDbAccount.id,
249
+ },
250
+ resourceOptions
251
+ )
252
+ }
253
+
254
+ if (roleDefinitions.includes(CosmosRoleDefinition.READER)) {
255
+ const cosmosdbSqlRoleDefinitionReader = this.resolveSqlRoleDefinition(
256
+ scope,
257
+ cosmosDbAccount.name,
258
+ resourceGroupName,
259
+ CosmosRoleDefinitionId.READER,
260
+ resourceOptions
261
+ )
262
+
263
+ this.createSqlResourceSqlRoleAssignment(
264
+ `${id}-cdb-ra-reader`,
265
+ scope,
266
+ {
267
+ accountName: cosmosDbAccount.name,
268
+ resourceGroupName: resourceGroupName,
269
+ roleDefinitionId: cosmosdbSqlRoleDefinitionReader.id,
270
+ principalId,
271
+ scope: cosmosDbAccount.id,
272
+ },
273
+ resourceOptions
274
+ )
275
+ }
276
+ }
127
277
  }
@@ -2,6 +2,7 @@ import {
2
2
  DatabaseAccountArgs,
3
3
  SqlResourceSqlContainerArgs,
4
4
  SqlResourceSqlDatabaseArgs,
5
+ SqlResourceSqlRoleAssignmentArgs,
5
6
  } from '@pulumi/azure-native/cosmosdb/index.js'
6
7
 
7
8
  export interface CosmosdbAccountProps extends DatabaseAccountArgs {}
@@ -9,3 +10,5 @@ export interface CosmosdbAccountProps extends DatabaseAccountArgs {}
9
10
  export interface CosmosdbSqlDatabaseProps extends SqlResourceSqlDatabaseArgs {}
10
11
 
11
12
  export interface CosmosdbSqlContainerProps extends SqlResourceSqlContainerArgs {}
13
+
14
+ export interface SqlResourceSqlRoleAssignmentProps extends SqlResourceSqlRoleAssignmentArgs {}
@@ -1,4 +1,5 @@
1
1
  import { RecordSet, Zone } from '@pulumi/azure-native/dns/index.js'
2
+ import { ResourceOptions } from '@pulumi/pulumi'
2
3
  import { CommonAzureConstruct } from '../../common/index.js'
3
4
  import { DnsARecordProps, DnsCnameRecordProps, DnsTxtRecordProps, DnsZoneProps } from './types.js'
4
5
 
@@ -25,9 +26,15 @@ export class AzureDnsManager {
25
26
  * @param id scoped id of the resource
26
27
  * @param scope scope in which this resource is defined
27
28
  * @param props dns zone properties
29
+ * @param resourceOptions Optional settings to control resource behaviour
28
30
  * @see [Pulumi Azure Native DNS Zone]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/network/zone/}
29
31
  */
30
- public createDnsZone(id: string, scope: CommonAzureConstruct, props: DnsZoneProps) {
32
+ public createDnsZone(
33
+ id: string,
34
+ scope: CommonAzureConstruct,
35
+ props: DnsZoneProps,
36
+ resourceOptions?: ResourceOptions
37
+ ) {
31
38
  if (!props) throw `Props undefined for ${id}`
32
39
 
33
40
  // Get resource group name
@@ -51,7 +58,7 @@ export class AzureDnsManager {
51
58
  environment: scope.props.stage,
52
59
  },
53
60
  },
54
- { parent: scope }
61
+ { parent: scope, ...resourceOptions }
55
62
  )
56
63
  }
57
64
 
@@ -60,9 +67,15 @@ export class AzureDnsManager {
60
67
  * @param id scoped id of the resource
61
68
  * @param scope scope in which this resource is defined
62
69
  * @param props dns a record properties
70
+ * @param resourceOptions Optional settings to control resource behaviour
63
71
  * @see [Pulumi Azure Native DNS Record Set]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/network/recordset/}
64
72
  */
65
- public createDnsARecord(id: string, scope: CommonAzureConstruct, props: DnsARecordProps) {
73
+ public createDnsARecord(
74
+ id: string,
75
+ scope: CommonAzureConstruct,
76
+ props: DnsARecordProps,
77
+ resourceOptions?: ResourceOptions
78
+ ) {
66
79
  if (!props) throw `Props undefined for ${id}`
67
80
 
68
81
  return new RecordSet(
@@ -75,7 +88,7 @@ export class AzureDnsManager {
75
88
  environment: scope.props.stage,
76
89
  },
77
90
  },
78
- { parent: scope }
91
+ { parent: scope, ...resourceOptions }
79
92
  )
80
93
  }
81
94
 
@@ -84,9 +97,15 @@ export class AzureDnsManager {
84
97
  * @param id scoped id of the resource
85
98
  * @param scope scope in which this resource is defined
86
99
  * @param props dns cname record properties
100
+ * @param resourceOptions Optional settings to control resource behaviour
87
101
  * @see [Pulumi Azure Native DNS Record Set]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/network/recordset/}
88
102
  */
89
- public createDnsCnameRecord(id: string, scope: CommonAzureConstruct, props: DnsCnameRecordProps) {
103
+ public createDnsCnameRecord(
104
+ id: string,
105
+ scope: CommonAzureConstruct,
106
+ props: DnsCnameRecordProps,
107
+ resourceOptions?: ResourceOptions
108
+ ) {
90
109
  if (!props) throw `Props undefined for ${id}`
91
110
 
92
111
  return new RecordSet(
@@ -99,7 +118,7 @@ export class AzureDnsManager {
99
118
  environment: scope.props.stage,
100
119
  },
101
120
  },
102
- { parent: scope }
121
+ { parent: scope, ...resourceOptions }
103
122
  )
104
123
  }
105
124
 
@@ -108,9 +127,15 @@ export class AzureDnsManager {
108
127
  * @param id scoped id of the resource
109
128
  * @param scope scope in which this resource is defined
110
129
  * @param props dns txt record properties
130
+ * @param resourceOptions Optional settings to control resource behaviour
111
131
  * @see [Pulumi Azure Native DNS Record Set]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/network/recordset/}
112
132
  */
113
- public createDnsTxtRecord(id: string, scope: CommonAzureConstruct, props: DnsTxtRecordProps) {
133
+ public createDnsTxtRecord(
134
+ id: string,
135
+ scope: CommonAzureConstruct,
136
+ props: DnsTxtRecordProps,
137
+ resourceOptions?: ResourceOptions
138
+ ) {
114
139
  if (!props) throw `Props undefined for ${id}`
115
140
 
116
141
  return new RecordSet(
@@ -123,7 +148,7 @@ export class AzureDnsManager {
123
148
  environment: scope.props.stage,
124
149
  },
125
150
  },
126
- { parent: scope }
151
+ { parent: scope, ...resourceOptions }
127
152
  )
128
153
  }
129
154
  }
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  EventDeliverySchema,
3
3
  EventSubscription,
4
+ GetSystemTopicResult,
4
5
  getTopicOutput,
5
- GetTopicResult,
6
6
  SystemTopic,
7
7
  SystemTopicEventSubscription,
8
8
  Topic,
9
9
  } from '@pulumi/azure-native/eventgrid/index.js'
10
- import * as pulumi from '@pulumi/pulumi'
10
+ import { Output, ResourceOptions } from '@pulumi/pulumi'
11
11
  import { CommonAzureConstruct } from '../../common/index.js'
12
12
  import {
13
13
  EventgridEventSubscriptionProps,
@@ -40,9 +40,15 @@ export class AzureEventgridManager {
40
40
  * @param id scoped id of the resource
41
41
  * @param scope scope in which this resource is defined
42
42
  * @param props eventgrid topic properties
43
+ * @param resourceOptions Optional settings to control resource behaviour
43
44
  * @see [Pulumi Azure Native Event Grid Topic]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/eventgrid/topic/}
44
45
  */
45
- public createEventgridTopic(id: string, scope: CommonAzureConstruct, props: EventgridTopicProps) {
46
+ public createEventgridTopic(
47
+ id: string,
48
+ scope: CommonAzureConstruct,
49
+ props: EventgridTopicProps,
50
+ resourceOptions?: ResourceOptions
51
+ ) {
46
52
  if (!props) throw `Props undefined for ${id}`
47
53
 
48
54
  // Get resource group name
@@ -66,7 +72,7 @@ export class AzureEventgridManager {
66
72
  environment: scope.props.stage,
67
73
  },
68
74
  },
69
- { parent: scope }
75
+ { parent: scope, ...resourceOptions }
70
76
  )
71
77
  }
72
78
 
@@ -75,9 +81,15 @@ export class AzureEventgridManager {
75
81
  * @param id scoped id of the resource
76
82
  * @param scope scope in which this resource is defined
77
83
  * @param props eventgrid topic properties
84
+ * @param resourceOptions Optional settings to control resource behaviour
78
85
  * @see [Pulumi Azure Native Event Grid Topic Lookup]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/eventgrid/topic/}
79
86
  */
80
- public resolveEventgridTopic(id: string, scope: CommonAzureConstruct, props: ResolveEventgridTopicProps) {
87
+ public resolveEventgridTopic(
88
+ id: string,
89
+ scope: CommonAzureConstruct,
90
+ props: ResolveEventgridTopicProps,
91
+ resourceOptions?: ResourceOptions
92
+ ) {
81
93
  if (!props) throw `Props undefined for ${id}`
82
94
 
83
95
  return getTopicOutput(
@@ -90,7 +102,7 @@ export class AzureEventgridManager {
90
102
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
91
103
  : props.resourceGroupName,
92
104
  },
93
- { parent: scope }
105
+ { parent: scope, ...resourceOptions }
94
106
  )
95
107
  }
96
108
 
@@ -99,9 +111,15 @@ export class AzureEventgridManager {
99
111
  * @param id scoped id of the resource
100
112
  * @param scope scope in which this resource is defined
101
113
  * @param props eventgrid subscription properties
114
+ * @param resourceOptions Optional settings to control resource behaviour
102
115
  * @see [Pulumi Azure Native Event Grid Event Subscription]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/eventgrid/eventsubscription/}
103
116
  */
104
- public createEventgridSubscription(id: string, scope: CommonAzureConstruct, props: EventgridEventSubscriptionProps) {
117
+ public createEventgridSubscription(
118
+ id: string,
119
+ scope: CommonAzureConstruct,
120
+ props: EventgridEventSubscriptionProps,
121
+ resourceOptions?: ResourceOptions
122
+ ) {
105
123
  if (!props) throw `Props undefined for ${id}`
106
124
 
107
125
  return new EventSubscription(
@@ -118,7 +136,7 @@ export class AzureEventgridManager {
118
136
  maxDeliveryAttempts: 7,
119
137
  },
120
138
  },
121
- { parent: scope }
139
+ { parent: scope, ...resourceOptions }
122
140
  )
123
141
  }
124
142
 
@@ -127,12 +145,17 @@ export class AzureEventgridManager {
127
145
  * @param id scoped id of the resource
128
146
  * @param scope scope in which this resource is defined
129
147
  * @param props eventgrid system topic properties
148
+ * @param resourceOptions Optional settings to control resource behaviour
130
149
  * @see [Pulumi Azure Native Event Grid System Topic]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/eventgrid/systemtopic/}
131
150
  */
132
- public createEventgridSystemTopic(id: string, scope: CommonAzureConstruct, props: EventgridSystemTopicProps) {
151
+ public createEventgridSystemTopic(
152
+ id: string,
153
+ scope: CommonAzureConstruct,
154
+ props: EventgridSystemTopicProps,
155
+ resourceOptions?: ResourceOptions
156
+ ) {
133
157
  if (!props) throw `Props undefined for ${id}`
134
158
 
135
- // Get resource group name
136
159
  const resourceGroupName = scope.props.resourceGroupName
137
160
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
138
161
  : props.resourceGroupName
@@ -153,7 +176,7 @@ export class AzureEventgridManager {
153
176
  environment: scope.props.stage,
154
177
  },
155
178
  },
156
- { parent: scope }
179
+ { parent: scope, ...resourceOptions }
157
180
  )
158
181
  }
159
182
 
@@ -163,29 +186,24 @@ export class AzureEventgridManager {
163
186
  * @param scope scope in which this resource is defined
164
187
  * @param props eventgrid system topic subscription properties
165
188
  * @param systemTopic The system topic to attach this subscription to
189
+ * @param resourceOptions Optional settings to control resource behaviour
166
190
  * @see [Pulumi Azure Native Event Grid System Topic Event Subscription]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/eventgrid/systemtopiceventsubscription/}
167
191
  */
168
192
  public createEventgridSystemTopicEventSubscription(
169
193
  id: string,
170
194
  scope: CommonAzureConstruct,
171
195
  props: EventgridSystemTopicEventSubscriptionProps,
172
- systemTopic: SystemTopic | pulumi.Output<GetTopicResult>
196
+ systemTopic: SystemTopic | Output<GetSystemTopicResult>,
197
+ resourceOptions?: ResourceOptions
173
198
  ) {
174
199
  if (!props) throw `Props undefined for ${id}`
175
200
 
176
- // Get resource group name
177
- const resourceGroupName = scope.props.resourceGroupName
201
+ let resourceGroupName = scope.props.resourceGroupName
178
202
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
179
203
  : props.resourceGroupName
180
204
 
181
205
  if (!resourceGroupName) throw `Resource group name undefined for ${id}`
182
206
 
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
207
  return new SystemTopicEventSubscription(
190
208
  `${id}-ests`,
191
209
  {
@@ -194,10 +212,10 @@ export class AzureEventgridManager {
194
212
  props.eventSubscriptionName?.toString(),
195
213
  scope.props.resourceNameOptions?.eventGridSystemTopicEventSubscription
196
214
  ),
197
- systemTopicName: systemTopicName,
198
- resourceGroupName: resourceGroupName,
215
+ systemTopicName: systemTopic.name,
216
+ resourceGroupName: props.resourceGroupName ?? resourceGroupName,
199
217
  },
200
- { parent: scope }
218
+ { parent: scope, ...resourceOptions }
201
219
  )
202
220
  }
203
221
  }