@gradientedge/cdk-utils 10.1.0 → 10.3.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 (133) 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/dist/src/lib/cloudflare/services/access/main.js +23 -23
  64. package/dist/src/lib/cloudflare/services/api-shield/main.js +11 -11
  65. package/dist/src/lib/cloudflare/services/argo/main.js +5 -5
  66. package/dist/src/lib/cloudflare/services/filter/main.js +3 -3
  67. package/dist/src/lib/cloudflare/services/firewall/main.js +3 -3
  68. package/dist/src/lib/cloudflare/services/page/main.js +7 -7
  69. package/dist/src/lib/cloudflare/services/record/main.js +3 -3
  70. package/dist/src/lib/cloudflare/services/rule-set/main.d.ts +1 -1
  71. package/dist/src/lib/cloudflare/services/rule-set/main.js +4 -5
  72. package/dist/src/lib/cloudflare/services/worker/main.js +13 -13
  73. package/dist/src/lib/cloudflare/services/zone/main.js +18 -18
  74. package/package.json +2 -1
  75. package/src/lib/azure/common/constants.ts +2 -1
  76. package/src/lib/azure/common/construct.ts +32 -48
  77. package/src/lib/azure/common/resource-name-formatter.ts +10 -6
  78. package/src/lib/azure/common/stack.ts +78 -78
  79. package/src/lib/azure/common/tagging.ts +78 -29
  80. package/src/lib/azure/common/types.ts +21 -4
  81. package/src/lib/azure/services/api-management/main.ts +172 -169
  82. package/src/lib/azure/services/api-management/types.ts +39 -16
  83. package/src/lib/azure/services/app-configuration/main.ts +33 -31
  84. package/src/lib/azure/services/app-configuration/types.ts +2 -2
  85. package/src/lib/azure/services/app-service/main.ts +61 -62
  86. package/src/lib/azure/services/app-service/types.ts +4 -4
  87. package/src/lib/azure/services/application-insights/main.ts +29 -30
  88. package/src/lib/azure/services/application-insights/types.ts +2 -5
  89. package/src/lib/azure/services/cosmosdb/main.ts +78 -77
  90. package/src/lib/azure/services/cosmosdb/types.ts +10 -6
  91. package/src/lib/azure/services/dns/main.ts +65 -72
  92. package/src/lib/azure/services/dns/types.ts +9 -9
  93. package/src/lib/azure/services/eventgrid/main.ts +120 -122
  94. package/src/lib/azure/services/eventgrid/types.ts +13 -8
  95. package/src/lib/azure/services/function/main.ts +75 -72
  96. package/src/lib/azure/services/function/types.ts +21 -6
  97. package/src/lib/azure/services/index.ts +1 -1
  98. package/src/lib/azure/services/key-vault/main.ts +38 -32
  99. package/src/lib/azure/services/key-vault/types.ts +4 -2
  100. package/src/lib/azure/services/monitor/main.ts +17 -21
  101. package/src/lib/azure/services/monitor/types.ts +2 -2
  102. package/src/lib/azure/services/operational-insights/main.ts +61 -0
  103. package/src/lib/azure/services/operational-insights/types.ts +3 -0
  104. package/src/lib/azure/services/redis/main.ts +30 -30
  105. package/src/lib/azure/services/redis/types.ts +2 -2
  106. package/src/lib/azure/services/resource-group/main.ts +20 -20
  107. package/src/lib/azure/services/resource-group/types.ts +2 -2
  108. package/src/lib/azure/services/servicebus/main.ts +103 -94
  109. package/src/lib/azure/services/servicebus/types.ts +17 -11
  110. package/src/lib/azure/services/storage/main.ts +113 -114
  111. package/src/lib/azure/services/storage/types.ts +16 -8
  112. package/src/lib/azure/types/index.ts +2 -1
  113. package/src/lib/azure/utils/index.ts +20 -22
  114. package/src/lib/cloudflare/common/stack.ts +1 -1
  115. package/src/lib/cloudflare/services/access/main.ts +114 -58
  116. package/src/lib/cloudflare/services/api-shield/main.ts +48 -22
  117. package/src/lib/cloudflare/services/argo/main.ts +17 -9
  118. package/src/lib/cloudflare/services/filter/main.ts +9 -5
  119. package/src/lib/cloudflare/services/firewall/main.ts +9 -5
  120. package/src/lib/cloudflare/services/page/main.ts +27 -15
  121. package/src/lib/cloudflare/services/record/main.ts +9 -5
  122. package/src/lib/cloudflare/services/rule-set/main.ts +10 -8
  123. package/src/lib/cloudflare/services/worker/main.ts +60 -29
  124. package/src/lib/cloudflare/services/zone/main.ts +75 -35
  125. package/dist/src/lib/azure/services/log-analytics-workspace/main.d.ts +0 -30
  126. package/dist/src/lib/azure/services/log-analytics-workspace/main.js +0 -55
  127. package/dist/src/lib/azure/services/log-analytics-workspace/types.d.ts +0 -3
  128. package/src/lib/azure/services/log-analytics-workspace/main.ts +0 -61
  129. package/src/lib/azure/services/log-analytics-workspace/types.ts +0 -3
  130. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.d.ts +0 -0
  131. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.js +0 -0
  132. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/types.js +0 -0
  133. /package/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.ts +0 -0
@@ -1,23 +1,19 @@
1
- import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group/index.js'
2
- import { FunctionAppFlexConsumption } from '@cdktf/provider-azurerm/lib/function-app-flex-consumption/index.js'
3
- import { FunctionAppFunction } from '@cdktf/provider-azurerm/lib/function-app-function/index.js'
4
- import { LinuxFunctionApp } from '@cdktf/provider-azurerm/lib/linux-function-app/index.js'
1
+ import { ManagedServiceIdentityType, WebApp, WebAppFunction } from '@pulumi/azure-native/web/index.js'
5
2
  import { CommonAzureConstruct } from '../../common/index.js'
6
- import { createAzureTfOutput } from '../../utils/index.js'
7
3
  import { FunctionAppFlexConsumptionProps, FunctionAppProps, FunctionProps } from './types.js'
8
4
 
9
5
  /**
10
- * @classdesc Provides operations on Azure Functions
6
+ * @classdesc Provides operations on Azure Functions using Pulumi
11
7
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
12
8
  * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
13
9
  * @example
14
- * ```
10
+ * ```typescript
15
11
  * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
16
12
  *
17
13
  * class CustomConstruct extends CommonAzureConstruct {
18
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
19
- * super(parent, id, props)
20
- * this.props: props
14
+ * constructor(name: string, props: CommonAzureStackProps) {
15
+ * super(name, props)
16
+ * this.props = props
21
17
  * this.functionManager.createFunctionApp('MyFunctionApp', this, props)
22
18
  * }
23
19
  * }
@@ -25,60 +21,70 @@ import { FunctionAppFlexConsumptionProps, FunctionAppProps, FunctionProps } from
25
21
  */
26
22
  export class AzureFunctionManager {
27
23
  /**
28
- * @summary Method to create a new function app
24
+ * @summary Method to create a new Linux function app
29
25
  * @param id scoped id of the resource
30
26
  * @param scope scope in which this resource is defined
31
27
  * @param props function app properties
32
- * @see [CDKTF Function App Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/functionApp.typescript.md}
28
+ * @see [Pulumi Azure Native Function App]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webapp/}
33
29
  */
34
30
  public createFunctionApp(id: string, scope: CommonAzureConstruct, props: FunctionAppProps) {
35
31
  if (!props) throw `Props undefined for ${id}`
36
32
 
37
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-fa-rg`, {
38
- name: scope.props.resourceGroupName
39
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
40
- : `${props.resourceGroupName}`,
41
- })
33
+ // Get resource group name
34
+ const resourceGroupName = scope.props.resourceGroupName
35
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
36
+ : props.resourceGroupName
42
37
 
43
- if (!resourceGroup) throw `Resource group undefined for ${id}`
38
+ if (!resourceGroupName) throw `Resource group name undefined for ${id}`
44
39
 
45
- const functionApp = new LinuxFunctionApp(scope, `${id}-fa`, {
46
- ...props,
47
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.linuxFunctionApp),
48
- resourceGroupName: resourceGroup.name,
49
- tags: props.tags ?? {
50
- environment: scope.props.stage,
40
+ return new WebApp(
41
+ `${id}-fa`,
42
+ {
43
+ ...props,
44
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.linuxFunctionApp),
45
+ resourceGroupName: resourceGroupName,
46
+ location: props.location ?? scope.props.location,
47
+ kind: props.kind ?? 'functionapp,linux',
48
+ identity: props.identity ?? {
49
+ type: ManagedServiceIdentityType.SystemAssigned,
50
+ },
51
+ tags: props.tags ?? {
52
+ environment: scope.props.stage,
53
+ },
51
54
  },
52
- })
53
-
54
- createAzureTfOutput(`${id}-functionAppName`, scope, functionApp.name)
55
- createAzureTfOutput(`${id}-functionAppFriendlyUniqueId`, scope, functionApp.friendlyUniqueId)
56
- createAzureTfOutput(`${id}-functionAppId`, scope, functionApp.id)
57
-
58
- return functionApp
55
+ { parent: scope }
56
+ )
59
57
  }
60
58
 
61
59
  /**
62
- * @summary Method to create a new function
60
+ * @summary Method to create a new function within a function app
63
61
  * @param id scoped id of the resource
64
62
  * @param scope scope in which this resource is defined
65
63
  * @param props function properties
66
- * @see [CDKTF Function Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/functionAppFunction.typescript.md}
64
+ * @see [Pulumi Azure Native Function Envelope]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webappfunction/}
65
+ * @note In Pulumi, individual functions are typically deployed via code deployment rather than as separate infrastructure resources.
66
+ * This method is provided for API compatibility but may require additional setup.
67
67
  */
68
68
  public createFunction(id: string, scope: CommonAzureConstruct, props: FunctionProps) {
69
69
  if (!props) throw `Props undefined for ${id}`
70
70
 
71
- const functionAppFunction = new FunctionAppFunction(scope, `${id}-fc`, {
72
- ...props,
73
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionAppFunction),
74
- configJson: JSON.stringify(props.configJson ?? {}),
75
- })
76
-
77
- createAzureTfOutput(`${id}-functionName`, scope, functionAppFunction.name)
78
- createAzureTfOutput(`${id}-functionFriendlyUniqueId`, scope, functionAppFunction.friendlyUniqueId)
79
- createAzureTfOutput(`${id}-functionId`, scope, functionAppFunction.id)
71
+ // Get resource group name
72
+ const resourceGroupName = scope.props.resourceGroupName
73
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
74
+ : ''
80
75
 
81
- return functionAppFunction
76
+ return new WebAppFunction(
77
+ `${id}-fc`,
78
+ {
79
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionAppFunction),
80
+ resourceGroupName: resourceGroupName,
81
+ functionAppId: props.functionAppId,
82
+ config: props.configJson,
83
+ isDisabled: props.enabled !== undefined ? !props.enabled : false,
84
+ testData: props.testData,
85
+ } as any,
86
+ { parent: scope }
87
+ )
82
88
  }
83
89
 
84
90
  /**
@@ -86,6 +92,7 @@ export class AzureFunctionManager {
86
92
  * @param id scoped id of the resource
87
93
  * @param scope scope in which this resource is defined
88
94
  * @param props flex consumption function app properties
95
+ * @see [Pulumi Azure Native Function App (Flex Consumption)]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/web/webapp/}
89
96
  */
90
97
  public createFunctionAppFlexConsumption(
91
98
  id: string,
@@ -94,37 +101,33 @@ export class AzureFunctionManager {
94
101
  ) {
95
102
  if (!props) throw `Props undefined for ${id}`
96
103
 
97
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-fa-rg`, {
98
- name: scope.props.resourceGroupName
99
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
100
- : `${props.resourceGroupName}`,
101
- })
104
+ // Get resource group name
105
+ const resourceGroupName = scope.props.resourceGroupName
106
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
107
+ : props.resourceGroupName
102
108
 
103
- if (!resourceGroup) throw `Resource group undefined for ${id}`
109
+ if (!resourceGroupName) throw `Resource group name undefined for ${id}`
104
110
 
105
- const functionApp = new FunctionAppFlexConsumption(scope, `${id}-fc`, {
106
- ...props,
107
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionApp),
108
- location: resourceGroup.location,
109
- resourceGroupName: resourceGroup.name,
110
- runtimeName: props.runtimeName ?? 'node',
111
- runtimeVersion: props.runtimeVersion ?? '22',
112
- storageAuthenticationType: props.storageAuthenticationType ?? 'StorageAccountConnectionString',
113
- storageContainerType: props.storageContainerType ?? 'blobContainer',
114
- maximumInstanceCount: props.maximumInstanceCount ?? 40,
115
- instanceMemoryInMb: props.instanceMemoryInMb ?? 2048,
116
- siteConfig: {
117
- http2Enabled: props.siteConfig.http2Enabled ?? true,
118
- ...props.siteConfig,
111
+ return new WebApp(
112
+ `${id}-fc`,
113
+ {
114
+ ...props,
115
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionApp),
116
+ location: props.location ?? scope.props.location,
117
+ resourceGroupName: resourceGroupName,
118
+ kind: props.kind ?? 'functionapp,linux',
119
+ identity: props.identity ?? {
120
+ type: ManagedServiceIdentityType.SystemAssigned,
121
+ },
122
+ siteConfig: props.siteConfig ?? {
123
+ http20Enabled: true,
124
+ linuxFxVersion: `${props.runtimeName ?? 'node'}|${props.runtimeVersion ?? '22'}`,
125
+ },
126
+ tags: props.tags ?? {
127
+ environment: scope.props.stage,
128
+ },
119
129
  },
120
- identity: props.identity ?? {
121
- type: 'SystemAssigned',
122
- },
123
- tags: props.tags ?? {
124
- environment: scope.props.stage,
125
- },
126
- })
127
-
128
- return functionApp
130
+ { parent: scope }
131
+ )
129
132
  }
130
133
  }
@@ -1,9 +1,24 @@
1
- import { LinuxFunctionAppConfig } from '@cdktf/provider-azurerm/lib/linux-function-app/index.js'
2
- import { FunctionAppFunctionConfig } from '@cdktf/provider-azurerm/lib/function-app-function/index.js'
3
- import { FunctionAppFlexConsumptionConfig } from '@cdktf/provider-azurerm/lib/function-app-flex-consumption/index.js'
1
+ import { WebAppArgs } from '@pulumi/azure-native/web/index.js'
4
2
 
5
- export interface FunctionAppProps extends LinuxFunctionAppConfig {}
3
+ export interface FunctionAppProps extends WebAppArgs {
4
+ name?: string
5
+ }
6
6
 
7
- export interface FunctionProps extends FunctionAppFunctionConfig {}
7
+ export interface FunctionProps {
8
+ name: string
9
+ functionAppId: string
10
+ language?: string
11
+ configJson?: any
12
+ testData?: string
13
+ enabled?: boolean
14
+ }
8
15
 
9
- export interface FunctionAppFlexConsumptionProps extends FunctionAppFlexConsumptionConfig {}
16
+ export interface FunctionAppFlexConsumptionProps extends WebAppArgs {
17
+ name?: string
18
+ runtimeName?: string
19
+ runtimeVersion?: string
20
+ storageAuthenticationType?: string
21
+ storageContainerType?: string
22
+ maximumInstanceCount?: number
23
+ instanceMemoryInMb?: number
24
+ }
@@ -7,7 +7,7 @@ export * from './dns/index.js'
7
7
  export * from './eventgrid/index.js'
8
8
  export * from './function/index.js'
9
9
  export * from './key-vault/index.js'
10
- export * from './log-analytics-workspace/index.js'
10
+ export * from './operational-insights/index.js'
11
11
  export * from './monitor/index.js'
12
12
  export * from './redis/index.js'
13
13
  export * from './resource-group/index.js'
@@ -1,20 +1,18 @@
1
- import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group/index.js'
2
- import { KeyVault } from '@cdktf/provider-azurerm/lib/key-vault/index.js'
1
+ import { SkuFamily, SkuName, Vault } from '@pulumi/azure-native/keyvault/index.js'
3
2
  import { CommonAzureConstruct } from '../../common/index.js'
4
- import { createAzureTfOutput } from '../../utils/index.js'
5
3
  import { KeyVaultProps } from './types.js'
6
4
 
7
5
  /**
8
- * @classdesc Provides operations on Azure Key Vault
6
+ * @classdesc Provides operations on Azure Key Vault using Pulumi
9
7
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
10
8
  * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
11
9
  * @example
12
- * ```
10
+ * ```typescript
13
11
  * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
14
12
  *
15
13
  * class CustomConstruct extends CommonAzureConstruct {
16
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
17
- * super(parent, id, props)
14
+ * constructor(name: string, props: CommonAzureStackProps) {
15
+ * super(name, props)
18
16
  * this.props = props
19
17
  * this.keyVaultManager.createKeyVault('MyKeyVault', this, props)
20
18
  * }
@@ -27,37 +25,45 @@ export class AzureKeyVaultManager {
27
25
  * @param id scoped id of the resource
28
26
  * @param scope scope in which this resource is defined
29
27
  * @param props key vault properties
30
- * @see [CDKTF Key Vault Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/keyVault.typescript.md}
28
+ * @see [Pulumi Azure Native Key Vault]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/keyvault/vault/}
31
29
  */
32
30
  public createKeyVault(id: string, scope: CommonAzureConstruct, props: KeyVaultProps) {
33
31
  if (!props) throw `Props undefined for ${id}`
34
32
 
35
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-kv-rg`, {
36
- name: scope.props.resourceGroupName
37
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
38
- : `${props.resourceGroupName}`,
39
- })
33
+ // Get resource group name
34
+ const resourceGroupName = scope.props.resourceGroupName
35
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
36
+ : props.resourceGroupName
40
37
 
41
- if (!resourceGroup) throw `Resource group undefined for ${id}`
38
+ if (!resourceGroupName) throw `Resource group name undefined for ${id}`
42
39
 
43
- const keyVault = new KeyVault(scope, `${id}-kv`, {
44
- ...props,
45
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.keyVault),
46
- location: resourceGroup.location,
47
- resourceGroupName: resourceGroup.name,
48
- skuName: props.skuName ?? 'standard',
49
- rbacAuthorizationEnabled: props.rbacAuthorizationEnabled ?? true,
50
- softDeleteRetentionDays: props.softDeleteRetentionDays ?? 90,
51
- purgeProtectionEnabled: props.purgeProtectionEnabled ?? true,
52
- tags: props.tags ?? {
53
- environment: scope.props.stage,
40
+ return new Vault(
41
+ `${id}-kv`,
42
+ {
43
+ ...props,
44
+ vaultName: scope.resourceNameFormatter.format(
45
+ props.vaultName?.toString(),
46
+ scope.props.resourceNameOptions?.keyVault
47
+ ),
48
+ location: props.location ?? scope.props.location,
49
+ resourceGroupName: resourceGroupName,
50
+ properties: {
51
+ ...(props.properties as any),
52
+ sku: (props.properties as any)?.sku ?? {
53
+ family: SkuFamily.A,
54
+ name: SkuName.Standard,
55
+ },
56
+ tenantId: (props.properties as any)?.tenantId ?? scope.props.tenantId ?? '',
57
+ enableRbacAuthorization: (props.properties as any)?.enableRbacAuthorization ?? true,
58
+ enableSoftDelete: (props.properties as any)?.enableSoftDelete ?? true,
59
+ softDeleteRetentionInDays: (props.properties as any)?.softDeleteRetentionInDays ?? 90,
60
+ enablePurgeProtection: (props.properties as any)?.enablePurgeProtection ?? true,
61
+ },
62
+ tags: props.tags ?? {
63
+ environment: scope.props.stage,
64
+ },
54
65
  },
55
- })
56
-
57
- createAzureTfOutput(`${id}-keyVaultName`, scope, keyVault.name)
58
- createAzureTfOutput(`${id}-keyVaultFriendlyUniqueId`, scope, keyVault.friendlyUniqueId)
59
- createAzureTfOutput(`${id}-keyVaultId`, scope, keyVault.id)
60
-
61
- return keyVault
66
+ { parent: scope }
67
+ )
62
68
  }
63
69
  }
@@ -1,3 +1,5 @@
1
- import { KeyVaultConfig } from '@cdktf/provider-azurerm/lib/key-vault/index.js'
1
+ import { VaultArgs } from '@pulumi/azure-native/keyvault/index.js'
2
2
 
3
- export interface KeyVaultProps extends KeyVaultConfig {}
3
+ export interface KeyVaultProps extends VaultArgs {
4
+ name?: string
5
+ }
@@ -1,21 +1,20 @@
1
- import { MonitorDiagnosticSetting } from '@cdktf/provider-azurerm/lib/monitor-diagnostic-setting/index.js'
1
+ import { DiagnosticSetting } from '@pulumi/azure-native/monitor/index.js'
2
2
  import { CommonAzureConstruct } from '../../common/index.js'
3
- import { createAzureTfOutput } from '../../utils/index.js'
4
3
  import { MonitorDiagnosticSettingProps } from './types.js'
5
4
 
6
5
  /**
7
- * @classdesc Provides operations on Azure Key Vault
6
+ * @classdesc Provides operations on Azure Monitor using Pulumi
8
7
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
9
8
  * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
10
9
  * @example
11
- * ```
10
+ * ```typescript
12
11
  * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
13
12
  *
14
13
  * class CustomConstruct extends CommonAzureConstruct {
15
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
16
- * super(parent, id, props)
14
+ * constructor(name: string, props: CommonAzureStackProps) {
15
+ * super(name, props)
17
16
  * this.props = props
18
- * this.monitorManager.createMonitor('MyMonitor', this, props)
17
+ * this.monitorManager.createMonitorDiagnosticSettings('MyMonitor', this, props)
19
18
  * }
20
19
  * }
21
20
  * ```
@@ -26,7 +25,7 @@ export class AzureMonitorManager {
26
25
  * @param id scoped id of the resource
27
26
  * @param scope scope in which this resource is defined
28
27
  * @param props monitor diagnostics settings properties
29
- * @see [CDKTF Monitor Diagnostics Settings Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/monitorDiagnosticSetting.typescript.md}
28
+ * @see [Pulumi Azure Native Monitor Diagnostic Settings]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/insights/diagnosticsetting/}
30
29
  */
31
30
  public createMonitorDiagnosticSettings(
32
31
  id: string,
@@ -35,19 +34,16 @@ export class AzureMonitorManager {
35
34
  ) {
36
35
  if (!props) throw `Props undefined for ${id}`
37
36
 
38
- const monitorDiagnosticSetting = new MonitorDiagnosticSetting(scope, `${id}-ds`, {
39
- ...props,
40
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.monitorDiagnosticSetting),
41
- })
42
-
43
- createAzureTfOutput(`${id}-monitorDiagnosticSettingName`, scope, monitorDiagnosticSetting.name)
44
- createAzureTfOutput(
45
- `${id}-monitorDiagnosticSettingFriendlyUniqueId`,
46
- scope,
47
- monitorDiagnosticSetting.friendlyUniqueId
37
+ return new DiagnosticSetting(
38
+ `${id}-ds`,
39
+ {
40
+ ...props,
41
+ name: scope.resourceNameFormatter.format(
42
+ props.name?.toString(),
43
+ scope.props.resourceNameOptions?.monitorDiagnosticSetting
44
+ ),
45
+ },
46
+ { parent: scope }
48
47
  )
49
- createAzureTfOutput(`${id}-monitorDiagnosticSettingId`, scope, monitorDiagnosticSetting.id)
50
-
51
- return monitorDiagnosticSetting
52
48
  }
53
49
  }
@@ -1,3 +1,3 @@
1
- import { MonitorDiagnosticSettingConfig } from '@cdktf/provider-azurerm/lib/monitor-diagnostic-setting/index.js'
1
+ import { DiagnosticSettingArgs } from '@pulumi/azure-native/monitor/index.js'
2
2
 
3
- export interface MonitorDiagnosticSettingProps extends MonitorDiagnosticSettingConfig {}
3
+ export interface MonitorDiagnosticSettingProps extends DiagnosticSettingArgs {}
@@ -0,0 +1,61 @@
1
+ import { Workspace, WorkspaceSkuNameEnum } from '@pulumi/azure-native/operationalinsights/index.js'
2
+ import { CommonAzureConstruct } from '../../common/index.js'
3
+ import { WorkspaceProps } from './types.js'
4
+
5
+ /**
6
+ * @classdesc Provides operations on Azure Log Analytics Workspace using Pulumi
7
+ * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
8
+ * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
9
+ * @example
10
+ * ```typescript
11
+ * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
12
+ *
13
+ * class CustomConstruct extends CommonAzureConstruct {
14
+ * constructor(name: string, props: CommonAzureStackProps) {
15
+ * super(name, props)
16
+ * this.props = props
17
+ * this.logAnalyticsWorkspaceManager.createLogAnalyticsWorkspace('MyLogAnalyticsWorkspace', this, props)
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
+ export class AzureOperationalInsightsManager {
23
+ /**
24
+ * @summary Method to create a new log analytics workspace
25
+ * @param id scoped id of the resource
26
+ * @param scope scope in which this resource is defined
27
+ * @param props log analytics workspace properties
28
+ * @see [Pulumi Azure Native Operational Insights Workspace]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/operationalinsights/workspace/}
29
+ */
30
+ public createWorkspace(id: string, scope: CommonAzureConstruct, props: WorkspaceProps) {
31
+ if (!props) throw `Props undefined for ${id}`
32
+
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 Workspace(
41
+ `${id}-lw`,
42
+ {
43
+ ...props,
44
+ workspaceName: scope.resourceNameFormatter.format(
45
+ props.workspaceName?.toString(),
46
+ scope.props.resourceNameOptions?.logAnalyticsWorkspace
47
+ ),
48
+ location: props.location ?? scope.props.location,
49
+ resourceGroupName: resourceGroupName,
50
+ sku: props.sku ?? {
51
+ name: WorkspaceSkuNameEnum.PerGB2018,
52
+ },
53
+ retentionInDays: props.retentionInDays ?? 30,
54
+ tags: props.tags ?? {
55
+ environment: scope.props.stage,
56
+ },
57
+ },
58
+ { parent: scope }
59
+ )
60
+ }
61
+ }
@@ -0,0 +1,3 @@
1
+ import { WorkspaceArgs } from '@pulumi/azure-native/operationalinsights/index.js'
2
+
3
+ export interface WorkspaceProps extends WorkspaceArgs {}
@@ -1,59 +1,59 @@
1
- import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group/index.js'
2
- import { ManagedRedis } from '@cdktf/provider-azurerm/lib/managed-redis/index.js'
1
+ import { Redis, SkuFamily, SkuName } from '@pulumi/azure-native/redis/index.js'
3
2
  import { CommonAzureConstruct } from '../../common/index.js'
4
- import { createAzureTfOutput } from '../../utils/index.js'
5
3
  import { ManagedRedisProps } from './types.js'
6
4
 
7
5
  /**
8
- * @classdesc Provides operations on Azure Redis
6
+ * @classdesc Provides operations on Azure Redis using Pulumi
9
7
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
10
8
  * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
11
9
  * @example
12
- * ```
10
+ * ```typescript
13
11
  * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
14
12
  *
15
13
  * class CustomConstruct extends CommonAzureConstruct {
16
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
17
- * super(parent, id, props)
14
+ * constructor(name: string, props: CommonAzureStackProps) {
15
+ * super(name, props)
18
16
  * this.props = props
19
- * this.redisManager.createRedis('MyManagedRedis', this, props)
17
+ * this.redisManager.createManagedRedis('MyManagedRedis', this, props)
20
18
  * }
21
19
  * }
22
20
  * ```
23
21
  */
24
22
  export class AzureRedisManager {
25
23
  /**
26
- * @summary Method to create a new redis cache
24
+ * @summary Method to create a new managed redis cache
27
25
  * @param id scoped id of the resource
28
26
  * @param scope scope in which this resource is defined
29
27
  * @param props redis cache properties
30
- * @see [CDKTF Redis Cache Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/managedRedis.typescript.md}
28
+ * @see [Pulumi Azure Native Redis]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/cache/redis/}
31
29
  */
32
30
  public createManagedRedis(id: string, scope: CommonAzureConstruct, props: ManagedRedisProps) {
33
31
  if (!props) throw `Props undefined for ${id}`
34
32
 
35
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-rc-rg`, {
36
- name: scope.props.resourceGroupName
37
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
38
- : `${props.resourceGroupName}`,
39
- })
33
+ // Get resource group name
34
+ const resourceGroupName = scope.props.resourceGroupName
35
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
36
+ : props.resourceGroupName
40
37
 
41
- if (!resourceGroup) throw `Resource group undefined for ${id}`
38
+ if (!resourceGroupName) throw `Resource group name undefined for ${id}`
42
39
 
43
- const managedRedis = new ManagedRedis(scope, `${id}-rc`, {
44
- ...props,
45
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.managedRedis),
46
- location: resourceGroup.location,
47
- resourceGroupName: resourceGroup.name,
48
- tags: props.tags ?? {
49
- environment: scope.props.stage,
40
+ return new Redis(
41
+ `${id}-rc`,
42
+ {
43
+ ...props,
44
+ name: scope.resourceNameFormatter.format(props.name?.toString(), scope.props.resourceNameOptions?.managedRedis),
45
+ location: props.location ?? scope.props.location,
46
+ resourceGroupName: resourceGroupName,
47
+ sku: props.sku ?? {
48
+ name: SkuName.Basic,
49
+ family: SkuFamily.C,
50
+ capacity: 0,
51
+ },
52
+ tags: props.tags ?? {
53
+ environment: scope.props.stage,
54
+ },
50
55
  },
51
- })
52
-
53
- createAzureTfOutput(`${id}-managedRedisName`, scope, managedRedis.name)
54
- createAzureTfOutput(`${id}-managedRedisFriendlyUniqueId`, scope, managedRedis.friendlyUniqueId)
55
- createAzureTfOutput(`${id}-managedRedisId`, scope, managedRedis.id)
56
-
57
- return managedRedis
56
+ { parent: scope }
57
+ )
58
58
  }
59
59
  }
@@ -1,3 +1,3 @@
1
- import { ManagedRedisConfig } from '@cdktf/provider-azurerm/lib/managed-redis/index.js'
1
+ import { RedisArgs } from '@pulumi/azure-native/redis/index.js'
2
2
 
3
- export interface ManagedRedisProps extends ManagedRedisConfig {}
3
+ export interface ManagedRedisProps extends RedisArgs {}