@gradientedge/cdk-utils 10.7.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 (198) 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 +39 -3
  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/stack.d.ts +2 -2
  124. package/dist/src/lib/cloudflare/common/stack.js +25 -25
  125. package/dist/src/lib/cloudflare/services/worker/main.js +8 -1
  126. package/dist/src/lib/cloudflare/services/worker/types.d.ts +1 -0
  127. package/package.json +26 -23
  128. package/src/lib/azure/common/constants.ts +83 -0
  129. package/src/lib/azure/common/construct.ts +49 -6
  130. package/src/lib/azure/common/stack.ts +26 -43
  131. package/src/lib/azure/common/types.ts +14 -2
  132. package/src/lib/azure/construct/event-handler/index.ts +2 -0
  133. package/src/lib/azure/construct/event-handler/main.ts +183 -0
  134. package/src/lib/azure/construct/event-handler/types.ts +49 -0
  135. package/src/lib/azure/construct/function-app/index.ts +2 -0
  136. package/src/lib/azure/construct/function-app/main.ts +410 -0
  137. package/src/lib/azure/construct/function-app/types.ts +45 -0
  138. package/src/lib/azure/construct/index.ts +6 -0
  139. package/src/lib/azure/construct/rest-api/index.ts +2 -0
  140. package/src/lib/azure/construct/rest-api/main.ts +205 -0
  141. package/src/lib/azure/construct/rest-api/types.ts +33 -0
  142. package/src/lib/azure/construct/rest-api-function/index.ts +2 -0
  143. package/src/lib/azure/construct/rest-api-function/main.ts +297 -0
  144. package/src/lib/azure/construct/rest-api-function/types.ts +39 -0
  145. package/src/lib/azure/construct/rest-api-with-cache/index.ts +2 -0
  146. package/src/lib/azure/construct/rest-api-with-cache/main.ts +75 -0
  147. package/src/lib/azure/construct/rest-api-with-cache/types.ts +15 -0
  148. package/src/lib/azure/construct/site-with-webapp/index.ts +2 -0
  149. package/src/lib/azure/construct/site-with-webapp/main.ts +160 -0
  150. package/src/lib/azure/construct/site-with-webapp/types.ts +33 -0
  151. package/src/lib/azure/index.ts +1 -0
  152. package/src/lib/azure/services/api-management/main.ts +168 -152
  153. package/src/lib/azure/services/api-management/types.ts +30 -1
  154. package/src/lib/azure/services/app-configuration/main.ts +29 -2
  155. package/src/lib/azure/services/app-service/main.ts +23 -4
  156. package/src/lib/azure/services/application-insights/main.ts +46 -7
  157. package/src/lib/azure/services/application-insights/types.ts +6 -2
  158. package/src/lib/azure/services/authorisation/constants.ts +13 -0
  159. package/src/lib/azure/services/authorisation/index.ts +3 -0
  160. package/src/lib/azure/services/authorisation/main.ts +202 -0
  161. package/src/lib/azure/services/authorisation/types.ts +3 -0
  162. package/src/lib/azure/services/cosmosdb/constants.ts +9 -0
  163. package/src/lib/azure/services/cosmosdb/index.ts +1 -0
  164. package/src/lib/azure/services/cosmosdb/main.ts +158 -8
  165. package/src/lib/azure/services/cosmosdb/types.ts +3 -0
  166. package/src/lib/azure/services/dns/main.ts +33 -8
  167. package/src/lib/azure/services/eventgrid/main.ts +41 -23
  168. package/src/lib/azure/services/function/main.ts +155 -9
  169. package/src/lib/azure/services/function/types.ts +3 -4
  170. package/src/lib/azure/services/index.ts +3 -0
  171. package/src/lib/azure/services/key-vault/main.ts +47 -4
  172. package/src/lib/azure/services/key-vault/types.ts +4 -4
  173. package/src/lib/azure/services/monitor/main.ts +5 -2
  174. package/src/lib/azure/services/operational-insights/main.ts +30 -4
  175. package/src/lib/azure/services/operational-insights/types.ts +3 -1
  176. package/src/lib/azure/services/portal/error.ts +12 -0
  177. package/src/lib/azure/services/portal/index.ts +4 -0
  178. package/src/lib/azure/services/portal/main.ts +81 -0
  179. package/src/lib/azure/services/portal/renderer.ts +182 -0
  180. package/src/lib/azure/services/portal/types.ts +45 -0
  181. package/src/lib/azure/services/redis/main.ts +10 -3
  182. package/src/lib/azure/services/redis/types.ts +1 -1
  183. package/src/lib/azure/services/resource-group/main.ts +34 -3
  184. package/src/lib/azure/services/security-center/index.ts +2 -0
  185. package/src/lib/azure/services/security-center/main.ts +42 -0
  186. package/src/lib/azure/services/security-center/types.ts +3 -0
  187. package/src/lib/azure/services/servicebus/main.ts +61 -30
  188. package/src/lib/azure/services/servicebus/types.ts +4 -4
  189. package/src/lib/azure/services/storage/main.ts +91 -9
  190. package/src/lib/azure/services/storage/types.ts +11 -2
  191. package/src/lib/cloudflare/common/stack.ts +25 -25
  192. package/src/lib/cloudflare/services/worker/main.ts +10 -1
  193. package/src/lib/cloudflare/services/worker/types.ts +8 -1
  194. package/dist/lib/lambda.d.ts +0 -17
  195. package/dist/lib/lambda.d.ts.map +0 -1
  196. package/dist/lib/lambda.js +0 -28
  197. package/dist/lib/lambda.js.map +0 -1
  198. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,12 +1,23 @@
1
1
  import {
2
2
  ApiArgs,
3
+ ApiDiagnosticArgs,
3
4
  ApiManagementServiceArgs,
4
5
  ApiOperationArgs,
6
+ ApiOperationPolicyArgs,
7
+ ApiPolicyArgs,
5
8
  BackendArgs,
9
+ CacheArgs,
6
10
  GetApiManagementServiceOutputArgs,
11
+ LoggerArgs,
12
+ NamedValueArgs,
13
+ SubscriptionArgs,
7
14
  } from '@pulumi/azure-native/apimanagement/index.js'
8
15
 
9
- export interface ApiManagementProps extends ApiManagementServiceArgs {}
16
+ export interface ApiManagementProps extends ApiManagementServiceArgs {
17
+ certificateKeyVaultId?: string
18
+ apiStackName?: string
19
+ useExistingApiManagement?: boolean
20
+ }
10
21
 
11
22
  export interface ApiManagementBackendProps extends BackendArgs {
12
23
  backendUrlPath?: string
@@ -14,6 +25,16 @@ export interface ApiManagementBackendProps extends BackendArgs {
14
25
  circuitBreaker?: any
15
26
  }
16
27
 
28
+ export interface ApiDiagnosticProps extends ApiDiagnosticArgs {}
29
+
30
+ export interface LoggerProps extends LoggerArgs {}
31
+
32
+ export interface NamedValueProps extends NamedValueArgs {}
33
+
34
+ export interface ApiSubscriptionProps extends SubscriptionArgs {}
35
+
36
+ export interface CacheProps extends CacheArgs {}
37
+
17
38
  export interface ApiManagementCustomDomainProps {
18
39
  apiManagementId: string
19
40
  gateway?: Array<{
@@ -35,6 +56,8 @@ export interface ApiManagementApiProps extends ApiArgs {
35
56
  operations: ApiManagementApiOperationProps[]
36
57
  commonInboundPolicyXml?: string
37
58
  commonOutboundPolicyXml?: string
59
+ cacheSetInboundPolicy?: string
60
+ cacheSetOutboundPolicy?: string
38
61
  rateLimit?: ApiManagementApiRateLimit
39
62
  }
40
63
 
@@ -62,3 +85,9 @@ export interface ApiManagementRedisCacheProps {
62
85
  }
63
86
 
64
87
  export interface ResolveApiManagementProps extends GetApiManagementServiceOutputArgs {}
88
+
89
+ export interface ApiOperationProps extends ApiOperationArgs {}
90
+
91
+ export interface ApiOperationPolicyProps extends ApiOperationPolicyArgs {}
92
+
93
+ export interface ApiPolicyProps extends ApiPolicyArgs {}
@@ -1,4 +1,5 @@
1
1
  import { ConfigurationStore, IdentityType } from '@pulumi/azure-native/appconfiguration/index.js'
2
+ import { ResourceOptions } from '@pulumi/pulumi'
2
3
  import { CommonAzureConstruct } from '../../common/index.js'
3
4
  import { AppConfigurationProps } from './types.js'
4
5
 
@@ -25,9 +26,15 @@ export class AzureAppConfigurationManager {
25
26
  * @param id scoped id of the resource
26
27
  * @param scope scope in which this resource is defined
27
28
  * @param props app configuration properties
29
+ * @param resourceOptions Optional settings to control resource behaviour
28
30
  * @see [Pulumi Azure Native App Configuration]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/appconfiguration/configurationstore/}
29
31
  */
30
- public createConfigurationStore(id: string, scope: CommonAzureConstruct, props: AppConfigurationProps) {
32
+ public createConfigurationStore(
33
+ id: string,
34
+ scope: CommonAzureConstruct,
35
+ props: AppConfigurationProps,
36
+ resourceOptions?: ResourceOptions
37
+ ) {
31
38
  if (!props) throw `Props undefined for ${id}`
32
39
 
33
40
  // Get resource group name
@@ -57,7 +64,27 @@ export class AzureAppConfigurationManager {
57
64
  environment: scope.props.stage,
58
65
  },
59
66
  },
60
- { parent: scope }
67
+ { parent: scope, ...resourceOptions }
68
+ )
69
+ }
70
+
71
+ /**
72
+ * @summary Determine if the config object has cosmosdb dependencies
73
+ * @param obj the config object value
74
+ */
75
+ static hasCosmosDependencies = (obj: any): boolean => {
76
+ if (!obj || typeof obj !== 'object') return false
77
+ if ('databaseName' in obj || 'tableName' in obj) return true
78
+ return Object.values(obj).some(val => this.hasCosmosDependencies(val))
79
+ }
80
+
81
+ /**
82
+ * @summary Determine if the config object has eventgrid target dependencies
83
+ * @param obj the config object value
84
+ */
85
+ static hasEventGridTargets(obj: any): boolean {
86
+ return (
87
+ obj && typeof obj === 'object' && ('eventGridTargets' in obj || Object.values(obj).some(this.hasEventGridTargets))
61
88
  )
62
89
  }
63
90
  }
@@ -4,6 +4,7 @@ import {
4
4
  SupportedTlsVersions,
5
5
  WebApp,
6
6
  } from '@pulumi/azure-native/web/index.js'
7
+ import { ResourceOptions } from '@pulumi/pulumi'
7
8
  import { CommonAzureConstruct } from '../../common/index.js'
8
9
  import { LinuxWebAppProps, ServicePlanProps } from './types.js'
9
10
 
@@ -30,9 +31,15 @@ export class AzureAppServiceManager {
30
31
  * @param id scoped id of the resource
31
32
  * @param scope scope in which this resource is defined
32
33
  * @param props app service plan properties
34
+ * @param resourceOptions Optional settings to control resource behaviour
33
35
  * @see [Pulumi Azure Native App Service Plan]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/appserviceplan/}
34
36
  */
35
- public createAppServicePlan(id: string, scope: CommonAzureConstruct, props: ServicePlanProps) {
37
+ public createAppServicePlan(
38
+ id: string,
39
+ scope: CommonAzureConstruct,
40
+ props: ServicePlanProps,
41
+ resourceOptions?: ResourceOptions
42
+ ) {
36
43
  if (!props) throw `Props undefined for ${id}`
37
44
 
38
45
  // Get resource group name
@@ -52,11 +59,17 @@ export class AzureAppServiceManager {
52
59
  ),
53
60
  resourceGroupName: resourceGroupName,
54
61
  location: props.location ?? scope.props.location,
62
+ sku: props.sku ?? {
63
+ name: 'FC1',
64
+ tier: 'FlexConsumption',
65
+ },
66
+ reserved: props.reserved ?? true,
67
+ zoneRedundant: props.zoneRedundant ?? true,
55
68
  tags: props.tags ?? {
56
69
  environment: scope.props.stage,
57
70
  },
58
71
  },
59
- { parent: scope }
72
+ { parent: scope, ...resourceOptions }
60
73
  )
61
74
  }
62
75
 
@@ -65,9 +78,15 @@ export class AzureAppServiceManager {
65
78
  * @param id scoped id of the resource
66
79
  * @param scope scope in which this resource is defined
67
80
  * @param props web app properties
81
+ * @param resourceOptions Optional settings to control resource behaviour
68
82
  * @see [Pulumi Azure Native Web App]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webapp/}
69
83
  */
70
- public createLinuxWebApp(id: string, scope: CommonAzureConstruct, props: LinuxWebAppProps) {
84
+ public createLinuxWebApp(
85
+ id: string,
86
+ scope: CommonAzureConstruct,
87
+ props: LinuxWebAppProps,
88
+ resourceOptions?: ResourceOptions
89
+ ) {
71
90
  if (!props) throw `Props undefined for ${id}`
72
91
 
73
92
  // Get resource group name
@@ -98,7 +117,7 @@ export class AzureAppServiceManager {
98
117
  environment: scope.props.stage,
99
118
  },
100
119
  },
101
- { parent: scope }
120
+ { parent: scope, ...resourceOptions }
102
121
  )
103
122
  }
104
123
  }
@@ -1,6 +1,11 @@
1
- import { ApplicationType, Component } from '@pulumi/azure-native/applicationinsights/index.js'
1
+ import {
2
+ ApplicationType,
3
+ Component,
4
+ ComponentCurrentBillingFeature,
5
+ } from '@pulumi/azure-native/applicationinsights/index.js'
6
+ import { ResourceOptions } from '@pulumi/pulumi'
2
7
  import { CommonAzureConstruct } from '../../common/index.js'
3
- import { ApplicationInsightsProps } from './types.js'
8
+ import { ApplicationInsightsProps, ComponentCurrentBillingFeatureProps } from './types.js'
4
9
 
5
10
  /**
6
11
  * @classdesc Provides operations on Azure Application Insights using Pulumi
@@ -21,13 +26,19 @@ import { ApplicationInsightsProps } from './types.js'
21
26
  */
22
27
  export class AzureApplicationInsightsManager {
23
28
  /**
24
- * @summary Method to create a new application insights
29
+ * @summary Method to create a new application insights component
25
30
  * @param id scoped id of the resource
26
31
  * @param scope scope in which this resource is defined
27
- * @param props application insights properties
32
+ * @param props application insights component properties
33
+ * @param resourceOptions Optional settings to control resource behaviour
28
34
  * @see [Pulumi Azure Native Application Insights Component]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/insights/component/}
29
35
  */
30
- public createComponent(id: string, scope: CommonAzureConstruct, props: ApplicationInsightsProps) {
36
+ public createComponent(
37
+ id: string,
38
+ scope: CommonAzureConstruct,
39
+ props: ApplicationInsightsProps,
40
+ resourceOptions?: ResourceOptions
41
+ ) {
31
42
  if (!props) throw `Props undefined for ${id}`
32
43
 
33
44
  // Get resource group name
@@ -37,7 +48,7 @@ export class AzureApplicationInsightsManager {
37
48
 
38
49
  if (!resourceGroupName) throw `Resource group name undefined for ${id}`
39
50
 
40
- return new Component(
51
+ const component = new Component(
41
52
  `${id}-ai`,
42
53
  {
43
54
  ...props,
@@ -52,7 +63,35 @@ export class AzureApplicationInsightsManager {
52
63
  environment: scope.props.stage,
53
64
  },
54
65
  },
55
- { parent: scope }
66
+ { parent: scope, ...resourceOptions }
56
67
  )
68
+
69
+ if (props.billingFeatures) {
70
+ this.createComponentCurrentBillingFeature(`${id}-billing`, scope, props.billingFeatures, {
71
+ parent: scope,
72
+ ...resourceOptions,
73
+ })
74
+ }
75
+
76
+ return component
77
+ }
78
+
79
+ /**
80
+ * @summary Method to create a new application insights component billing feature
81
+ * @param id scoped id of the resource
82
+ * @param scope scope in which this resource is defined
83
+ * @param props application insights properties component billing featureø
84
+ * @param resourceOptions Optional settings to control resource behaviour
85
+ * @see [Pulumi Azure Native Application Insights Billing Feature]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/insights/componentcurrentbillingfeature/}
86
+ */
87
+ public createComponentCurrentBillingFeature(
88
+ id: string,
89
+ scope: CommonAzureConstruct,
90
+ props: ComponentCurrentBillingFeatureProps,
91
+ resourceOptions?: ResourceOptions
92
+ ) {
93
+ if (!props) throw `Props undefined for ${id}`
94
+
95
+ return new ComponentCurrentBillingFeature(`${id}`, props, { parent: scope, ...resourceOptions })
57
96
  }
58
97
  }
@@ -1,3 +1,7 @@
1
- import { ComponentArgs } from '@pulumi/azure-native/applicationinsights/index.js'
1
+ import { ComponentArgs, ComponentCurrentBillingFeatureArgs } from '@pulumi/azure-native/applicationinsights/index.js'
2
2
 
3
- export interface ApplicationInsightsProps extends ComponentArgs {}
3
+ export interface ComponentCurrentBillingFeatureProps extends ComponentCurrentBillingFeatureArgs {}
4
+
5
+ export interface ApplicationInsightsProps extends ComponentArgs {
6
+ billingFeatures?: ComponentCurrentBillingFeatureProps
7
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @summary Enumerations for publicly available built in RBAC roles
3
+ * @see https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles
4
+ */
5
+ export enum RoleDefinitionId {
6
+ APP_CONFIGURATION_DATA_READER = '/providers/Microsoft.Authorization/roleDefinitions/516239f1-63e1-4d78-a4de-a74fb236a071',
7
+ APP_CONFIGURATION_DATA_OWNER = '/providers/Microsoft.Authorization/roleDefinitions/5ae67dd6-50cb-40e7-96ff-dc2bfa4b606b',
8
+ EVENTGRID_DATA_SENDER = '/providers/Microsoft.Authorization/roleDefinitions/d5a91429-5739-47e2-a06b-3470a27159e7',
9
+ KEY_VAULT_CERTIFICATE_USER = '/providers/Microsoft.Authorization/roleDefinitions/db79e9a7-68ee-4b58-9aeb-b90e7c24fcba',
10
+ KEY_VAULT_SECRETS_USER = '/providers/Microsoft.Authorization/roleDefinitions/4633458b-17de-408a-b874-0445c86b69e6',
11
+ STORAGE_BLOB_DATA_CONTRIBUTOR = '/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe',
12
+ STORAGE_TABLE_DATA_CONTRIBUTOR = '/providers/Microsoft.Authorization/roleDefinitions/0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3',
13
+ }
@@ -0,0 +1,3 @@
1
+ export * from './constants.js'
2
+ export * from './main.js'
3
+ export * from './types.js'
@@ -0,0 +1,202 @@
1
+ import { RoleAssignment } from '@pulumi/azure-native/authorization/index.js'
2
+ import { Input, ResourceOptions } from '@pulumi/pulumi'
3
+ import { CommonAzureConstruct } from '../../common/index.js'
4
+ import { RoleDefinitionId } from './constants.js'
5
+ import { RoleAssignmentProps } from './types.js'
6
+
7
+ /**
8
+ * @classdesc Provides operations on Azure Authorisation using Pulumi
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
+ * ```typescript
13
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
14
+ *
15
+ * class CustomConstruct extends CommonAzureConstruct {
16
+ * constructor(name: string, props: CommonAzureStackProps) {
17
+ * super(name, props)
18
+ * this.props = props
19
+ * this.authorisationManager.createRoleAssignment('MyRoleAssignment', this, props)
20
+ * }
21
+ * }
22
+ * ```
23
+ */
24
+ export class AzureAuthorisationManager {
25
+ /**
26
+ * @summary Method to create a new role assignment
27
+ * @param id scoped id of the resource
28
+ * @param scope scope in which this resource is defined
29
+ * @param props Role assignment properties
30
+ * @param resourceOptions Optional settings to control resource behaviour
31
+ * @see [Pulumi Azure Native Role Assignment]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/authorization/roleassignment/}
32
+ */
33
+ public createRoleAssignment(
34
+ id: string,
35
+ scope: CommonAzureConstruct,
36
+ props: RoleAssignmentProps,
37
+ resourceOptions?: ResourceOptions
38
+ ) {
39
+ if (!props) throw `Props undefined for ${id}`
40
+
41
+ return new RoleAssignment(`${id}`, props, { parent: scope, ...resourceOptions })
42
+ }
43
+
44
+ /**
45
+ * @summary Method to grant a role assignment to key vault
46
+ * @param id scoped id of the resource
47
+ * @param scope scope in which this resource is defined
48
+ * @param vaultName the key vault name
49
+ * @param resourceGroupName the resource group name
50
+ * @param principalId the principal id to which the role is assigned to
51
+ * @param roleDefinitionId the role definition id
52
+ * @param resourceOptions Optional settings to control resource behaviour
53
+ */
54
+ public grantRoleAssignmentToKeyVault(
55
+ id: string,
56
+ scope: CommonAzureConstruct,
57
+ vaultName: string,
58
+ resourceGroupName: string,
59
+ principalId: Input<string>,
60
+ roleDefinitionId: RoleDefinitionId,
61
+ resourceOptions?: ResourceOptions
62
+ ) {
63
+ const keyVault = scope.keyVaultManager.resolveKeyVault(scope, vaultName, resourceGroupName, resourceOptions)
64
+ return this.createRoleAssignment(
65
+ `${id}-kv-role-${vaultName}`,
66
+ scope,
67
+ {
68
+ principalId,
69
+ roleDefinitionId,
70
+ scope: keyVault.id,
71
+ },
72
+ resourceOptions
73
+ )
74
+ }
75
+
76
+ /**
77
+ * @summary Method to grant a role assignment to event grid topic
78
+ * @param id scoped id of the resource
79
+ * @param scope scope in which this resource is defined
80
+ * @param topicName the topic name
81
+ * @param resourceGroupName the resource group name
82
+ * @param principalId the principal id to which the role is assigned to
83
+ * @param roleDefinitionId the role definition id
84
+ * @param resourceOptions Optional settings to control resource behaviour
85
+ */
86
+ public grantRoleAssignmentToEventgridTopic(
87
+ id: string,
88
+ scope: CommonAzureConstruct,
89
+ topicName: string,
90
+ resourceGroupName: string,
91
+ principalId: Input<string>,
92
+ roleDefinitionId: RoleDefinitionId,
93
+ resourceOptions?: ResourceOptions
94
+ ) {
95
+ const topic = scope.eventgridManager.resolveEventgridTopic(
96
+ `${id}-egt-role-${topicName}`,
97
+ scope,
98
+ {
99
+ topicName,
100
+ resourceGroupName,
101
+ },
102
+ resourceOptions
103
+ )
104
+ return this.createRoleAssignment(
105
+ `${id}-egt-role-${topicName}`,
106
+ scope,
107
+ {
108
+ principalId,
109
+ roleDefinitionId,
110
+ scope: topic.id,
111
+ },
112
+ resourceOptions
113
+ )
114
+ }
115
+
116
+ /**
117
+ * @summary Method to grant a role assignment to application configuration
118
+ * @param id scoped id of the resource
119
+ * @param scope scope in which this resource is defined
120
+ * @param appConfigId the application configuration id
121
+ * @param principalId the principal id to which the role is assigned to
122
+ * @param roleDefinitionId the role definition id
123
+ * @param resourceOptions Optional settings to control resource behaviour
124
+ */
125
+ public grantRoleAssignmentToApplicationConfiguration(
126
+ id: string,
127
+ scope: CommonAzureConstruct,
128
+ appConfigId: Input<string>,
129
+ principalId: Input<string>,
130
+ roleDefinitionId: RoleDefinitionId,
131
+ resourceOptions?: ResourceOptions
132
+ ) {
133
+ return this.createRoleAssignment(
134
+ `${id}-ac-role`,
135
+ scope,
136
+ {
137
+ principalId,
138
+ roleDefinitionId,
139
+ scope: appConfigId,
140
+ },
141
+ resourceOptions
142
+ )
143
+ }
144
+
145
+ /**
146
+ * @summary Method to grant a role assignment to storage account
147
+ * @param id scoped id of the resource
148
+ * @param scope scope in which this resource is defined
149
+ * @param accountId the storage account id
150
+ * @param principalId the principal id to which the role is assigned to
151
+ * @param roleDefinitionId the role definition id
152
+ * @param resourceOptions Optional settings to control resource behaviour
153
+ */
154
+ public grantRoleAssignmentToStorageAccount(
155
+ id: string,
156
+ scope: CommonAzureConstruct,
157
+ accountId: Input<string>,
158
+ principalId: Input<string>,
159
+ roleDefinitionId: RoleDefinitionId,
160
+ resourceOptions?: ResourceOptions
161
+ ) {
162
+ return this.createRoleAssignment(
163
+ `${id}-sa-role`,
164
+ scope,
165
+ {
166
+ principalId,
167
+ roleDefinitionId,
168
+ scope: accountId,
169
+ },
170
+ resourceOptions
171
+ )
172
+ }
173
+
174
+ /**
175
+ * @summary Method to grant a role assignment to storage table
176
+ * @param id scoped id of the resource
177
+ * @param scope scope in which this resource is defined
178
+ * @param tableId the storage table id
179
+ * @param principalId the principal id to which the role is assigned to
180
+ * @param roleDefinitionId the role definition id
181
+ * @param resourceOptions Optional settings to control resource behaviour
182
+ */
183
+ public grantRoleAssignmentToStorageTable(
184
+ id: string,
185
+ scope: CommonAzureConstruct,
186
+ tableId: Input<string>,
187
+ principalId: Input<string>,
188
+ roleDefinitionId: RoleDefinitionId,
189
+ resourceOptions?: ResourceOptions
190
+ ) {
191
+ return this.createRoleAssignment(
192
+ `${id}-st-role`,
193
+ scope,
194
+ {
195
+ principalId,
196
+ roleDefinitionId,
197
+ scope: tableId,
198
+ },
199
+ resourceOptions
200
+ )
201
+ }
202
+ }
@@ -0,0 +1,3 @@
1
+ import { RoleAssignmentArgs } from '@pulumi/azure-native/authorization/index.js'
2
+
3
+ export interface RoleAssignmentProps extends RoleAssignmentArgs {}
@@ -0,0 +1,9 @@
1
+ export enum CosmosRoleDefinition {
2
+ CONTRIBUTOR = 'CONTRIBUTOR',
3
+ READER = 'READER',
4
+ }
5
+
6
+ export enum CosmosRoleDefinitionId {
7
+ CONTRIBUTOR = '00000000-0000-0000-0000-000000000001',
8
+ READER = '00000000-0000-0000-0000-000000000002',
9
+ }
@@ -1,2 +1,3 @@
1
+ export * from './constants.js'
1
2
  export * from './main.js'
2
3
  export * from './types.js'