@gradientedge/cdk-utils 10.0.0 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/src/lib/azure/common/constants.d.ts +3 -2
  2. package/dist/src/lib/azure/common/constants.js +2 -1
  3. package/dist/src/lib/azure/common/construct.d.ts +26 -12
  4. package/dist/src/lib/azure/common/construct.js +31 -45
  5. package/dist/src/lib/azure/common/resource-name-formatter.d.ts +9 -4
  6. package/dist/src/lib/azure/common/resource-name-formatter.js +9 -5
  7. package/dist/src/lib/azure/common/stack.d.ts +18 -32
  8. package/dist/src/lib/azure/common/stack.js +77 -74
  9. package/dist/src/lib/azure/common/tagging.d.ts +29 -8
  10. package/dist/src/lib/azure/common/tagging.js +72 -26
  11. package/dist/src/lib/azure/common/types.d.ts +19 -4
  12. package/dist/src/lib/azure/services/api-management/main.d.ts +29 -32
  13. package/dist/src/lib/azure/services/api-management/main.js +100 -121
  14. package/dist/src/lib/azure/services/api-management/types.d.ts +33 -18
  15. package/dist/src/lib/azure/services/app-configuration/main.d.ts +6 -7
  16. package/dist/src/lib/azure/services/app-configuration/main.js +23 -26
  17. package/dist/src/lib/azure/services/app-configuration/types.d.ts +2 -2
  18. package/dist/src/lib/azure/services/app-service/main.d.ts +10 -12
  19. package/dist/src/lib/azure/services/app-service/main.js +37 -49
  20. package/dist/src/lib/azure/services/app-service/types.d.ts +4 -4
  21. package/dist/src/lib/azure/services/application-insights/main.d.ts +7 -8
  22. package/dist/src/lib/azure/services/application-insights/main.js +20 -26
  23. package/dist/src/lib/azure/services/application-insights/types.d.ts +2 -4
  24. package/dist/src/lib/azure/services/cosmosdb/main.d.ts +12 -15
  25. package/dist/src/lib/azure/services/cosmosdb/main.js +42 -61
  26. package/dist/src/lib/azure/services/cosmosdb/types.d.ts +4 -6
  27. package/dist/src/lib/azure/services/dns/main.d.ts +13 -17
  28. package/dist/src/lib/azure/services/dns/main.js +33 -51
  29. package/dist/src/lib/azure/services/dns/types.d.ts +5 -8
  30. package/dist/src/lib/azure/services/eventgrid/main.d.ts +20 -22
  31. package/dist/src/lib/azure/services/eventgrid/main.js +61 -89
  32. package/dist/src/lib/azure/services/eventgrid/types.d.ts +7 -8
  33. package/dist/src/lib/azure/services/function/main.d.ts +15 -15
  34. package/dist/src/lib/azure/services/function/main.js +54 -59
  35. package/dist/src/lib/azure/services/function/types.d.ts +18 -6
  36. package/dist/src/lib/azure/services/index.d.ts +1 -1
  37. package/dist/src/lib/azure/services/index.js +1 -1
  38. package/dist/src/lib/azure/services/key-vault/main.d.ts +6 -7
  39. package/dist/src/lib/azure/services/key-vault/main.js +29 -28
  40. package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -2
  41. package/dist/src/lib/azure/services/monitor/main.d.ts +7 -8
  42. package/dist/src/lib/azure/services/monitor/main.js +10 -15
  43. package/dist/src/lib/azure/services/monitor/types.d.ts +2 -2
  44. package/dist/src/lib/azure/services/operational-insights/main.d.ts +29 -0
  45. package/dist/src/lib/azure/services/operational-insights/main.js +50 -0
  46. package/dist/src/lib/azure/services/operational-insights/types.d.ts +3 -0
  47. package/dist/src/lib/azure/services/redis/main.d.ts +8 -9
  48. package/dist/src/lib/azure/services/redis/main.js +24 -26
  49. package/dist/src/lib/azure/services/redis/types.d.ts +2 -2
  50. package/dist/src/lib/azure/services/resource-group/main.d.ts +6 -7
  51. package/dist/src/lib/azure/services/resource-group/main.js +9 -14
  52. package/dist/src/lib/azure/services/resource-group/types.d.ts +2 -2
  53. package/dist/src/lib/azure/services/servicebus/main.d.ts +17 -22
  54. package/dist/src/lib/azure/services/servicebus/main.js +47 -70
  55. package/dist/src/lib/azure/services/servicebus/types.d.ts +6 -10
  56. package/dist/src/lib/azure/services/storage/main.d.ts +24 -27
  57. package/dist/src/lib/azure/services/storage/main.js +70 -88
  58. package/dist/src/lib/azure/services/storage/types.d.ts +10 -8
  59. package/dist/src/lib/azure/types/index.d.ts +2 -1
  60. package/dist/src/lib/azure/utils/index.d.ts +19 -3
  61. package/dist/src/lib/azure/utils/index.js +19 -13
  62. package/dist/src/lib/cloudflare/common/stack.js +1 -1
  63. package/package.json +28 -27
  64. package/src/lib/azure/common/constants.ts +2 -1
  65. package/src/lib/azure/common/construct.ts +32 -48
  66. package/src/lib/azure/common/resource-name-formatter.ts +10 -6
  67. package/src/lib/azure/common/stack.ts +78 -78
  68. package/src/lib/azure/common/tagging.ts +78 -29
  69. package/src/lib/azure/common/types.ts +21 -4
  70. package/src/lib/azure/services/api-management/main.ts +172 -169
  71. package/src/lib/azure/services/api-management/types.ts +39 -16
  72. package/src/lib/azure/services/app-configuration/main.ts +33 -31
  73. package/src/lib/azure/services/app-configuration/types.ts +2 -2
  74. package/src/lib/azure/services/app-service/main.ts +61 -62
  75. package/src/lib/azure/services/app-service/types.ts +4 -4
  76. package/src/lib/azure/services/application-insights/main.ts +29 -30
  77. package/src/lib/azure/services/application-insights/types.ts +2 -5
  78. package/src/lib/azure/services/cosmosdb/main.ts +78 -77
  79. package/src/lib/azure/services/cosmosdb/types.ts +10 -6
  80. package/src/lib/azure/services/dns/main.ts +65 -72
  81. package/src/lib/azure/services/dns/types.ts +9 -9
  82. package/src/lib/azure/services/eventgrid/main.ts +120 -122
  83. package/src/lib/azure/services/eventgrid/types.ts +13 -8
  84. package/src/lib/azure/services/function/main.ts +75 -72
  85. package/src/lib/azure/services/function/types.ts +21 -6
  86. package/src/lib/azure/services/index.ts +1 -1
  87. package/src/lib/azure/services/key-vault/main.ts +38 -32
  88. package/src/lib/azure/services/key-vault/types.ts +4 -2
  89. package/src/lib/azure/services/monitor/main.ts +17 -21
  90. package/src/lib/azure/services/monitor/types.ts +2 -2
  91. package/src/lib/azure/services/operational-insights/main.ts +61 -0
  92. package/src/lib/azure/services/operational-insights/types.ts +3 -0
  93. package/src/lib/azure/services/redis/main.ts +30 -30
  94. package/src/lib/azure/services/redis/types.ts +2 -2
  95. package/src/lib/azure/services/resource-group/main.ts +20 -20
  96. package/src/lib/azure/services/resource-group/types.ts +2 -2
  97. package/src/lib/azure/services/servicebus/main.ts +103 -94
  98. package/src/lib/azure/services/servicebus/types.ts +17 -11
  99. package/src/lib/azure/services/storage/main.ts +113 -114
  100. package/src/lib/azure/services/storage/types.ts +16 -8
  101. package/src/lib/azure/types/index.ts +2 -1
  102. package/src/lib/azure/utils/index.ts +20 -22
  103. package/src/lib/cloudflare/common/stack.ts +1 -1
  104. package/dist/src/lib/azure/services/log-analytics-workspace/main.d.ts +0 -30
  105. package/dist/src/lib/azure/services/log-analytics-workspace/main.js +0 -55
  106. package/dist/src/lib/azure/services/log-analytics-workspace/types.d.ts +0 -3
  107. package/src/lib/azure/services/log-analytics-workspace/main.ts +0 -61
  108. package/src/lib/azure/services/log-analytics-workspace/types.ts +0 -3
  109. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.d.ts +0 -0
  110. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.js +0 -0
  111. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/types.js +0 -0
  112. /package/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.ts +0 -0
@@ -1,30 +1,31 @@
1
- import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group/index.js'
2
- import { DataAzurermStorageAccountBlobContainerSas } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-account-blob-container-sas/index.js'
3
- import { DataAzurermStorageAccount } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-account/index.js'
4
- import { DataAzurermStorageContainer } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-container/index.js'
5
- import { StorageAccount } from '@cdktf/provider-azurerm/lib/storage-account/index.js'
6
- import { StorageBlob } from '@cdktf/provider-azurerm/lib/storage-blob/index.js'
7
- import { StorageContainer } from '@cdktf/provider-azurerm/lib/storage-container/index.js'
8
- import { CommonAzureConstruct } from '../../common/index.js'
9
- import { createAzureTfOutput } from '../../utils/index.js'
1
+ import * as azure from '@pulumi/azure'
10
2
  import {
11
- DataAzurermStorageAccountBlobContainerSasProps,
12
- StorageAccountProps,
13
- StorageBlobProps,
14
- StorageContainerProps,
15
- } from './types.js'
3
+ Blob,
4
+ BlobContainer,
5
+ HttpProtocol,
6
+ Kind,
7
+ listStorageAccountSAS,
8
+ Permissions,
9
+ Services,
10
+ SignedResourceTypes,
11
+ SkuName,
12
+ StorageAccount,
13
+ } from '@pulumi/azure-native/storage/index.js'
14
+ import * as pulumi from '@pulumi/pulumi'
15
+ import { CommonAzureConstruct } from '../../common/index.js'
16
+ import { ContainerSasTokenProps, StorageAccountProps, StorageBlobProps, StorageContainerProps } from './types.js'
16
17
 
17
18
  /**
18
- * @classdesc Provides operations on Azure Storage
19
+ * @classdesc Provides operations on Azure Storage using Pulumi
19
20
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
20
21
  * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
21
22
  * @example
22
- * ```
23
+ * ```typescript
23
24
  * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
24
25
  *
25
26
  * class CustomConstruct extends CommonAzureConstruct {
26
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
27
- * super(parent, id, props)
27
+ * constructor(name: string, props: CommonAzureStackProps) {
28
+ * super(name, props)
28
29
  * this.props = props
29
30
  * this.storageManager.createStorageAccount('MyAccount', this, props)
30
31
  * }
@@ -37,60 +38,64 @@ export class AzureStorageManager {
37
38
  * @param id scoped id of the resource
38
39
  * @param scope scope in which this resource is defined
39
40
  * @param props storage account properties
40
- * @see [CDKTF Storage Account Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageAccount.typescript.md}
41
+ * @see [Pulumi Azure Native Storage Account]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/storageaccount/}
41
42
  */
42
43
  public createStorageAccount(id: string, scope: CommonAzureConstruct, props: StorageAccountProps) {
43
44
  if (!props) throw `Props undefined for ${id}`
44
45
 
45
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-sa-rg`, {
46
- name: scope.props.resourceGroupName
47
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
48
- : `${props.resourceGroupName}`,
49
- })
50
-
51
- if (!resourceGroup) throw `Resource group undefined for ${id}`
52
-
53
- const storageAccount = new StorageAccount(scope, `${id}-sa`, {
54
- ...props,
55
- accountTier: props.accountTier ?? 'Standard',
56
- location: props.location ?? resourceGroup.location,
57
- name: scope.resourceNameFormatter
58
- .format(props.name, scope.props.resourceNameOptions?.storageAccount)
59
- .replace(/\W/g, '')
60
- .toLowerCase(),
61
- resourceGroupName: resourceGroup.name,
62
- tags: props.tags ?? {
63
- environment: scope.props.stage,
46
+ const resourceGroupName = scope.props.resourceGroupName
47
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
48
+ : `${props.resourceGroupName}`
49
+
50
+ return new StorageAccount(
51
+ `${id}-sa`,
52
+ {
53
+ ...props,
54
+ accountName: scope.resourceNameFormatter
55
+ .format(props.accountName?.toString(), scope.props.resourceNameOptions?.storageAccount)
56
+ .replace(/\W/g, '')
57
+ .toLowerCase(),
58
+ resourceGroupName,
59
+ sku: props.sku ?? {
60
+ name: SkuName.Standard_LRS,
61
+ },
62
+ kind: props.kind ?? Kind.StorageV2,
63
+ location: props.location ?? scope.props.location,
64
+ tags: props.tags ?? {
65
+ environment: scope.props.stage,
66
+ },
64
67
  },
65
- })
66
-
67
- createAzureTfOutput(`${id}-storageAccountName`, scope, storageAccount.name)
68
- createAzureTfOutput(`${id}-storageAccountFriendlyUniqueId`, scope, storageAccount.friendlyUniqueId)
69
- createAzureTfOutput(`${id}-storageAccountId`, scope, storageAccount.id)
70
-
71
- return storageAccount
68
+ { parent: scope }
69
+ )
72
70
  }
73
71
 
74
72
  /**
75
- * @summary Method to create a new storage container
73
+ * @summary Method to create a new storage container (blob container)
76
74
  * @param id scoped id of the resource
77
75
  * @param scope scope in which this resource is defined
78
76
  * @param props storage container properties
79
- * @see [CDKTF Storage Container Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageContainer.typescript.md}
77
+ * @see [Pulumi Azure Native Blob Container]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blobcontainer/}
80
78
  */
81
79
  public createStorageContainer(id: string, scope: CommonAzureConstruct, props: StorageContainerProps) {
82
80
  if (!props) throw `Props undefined for ${id}`
83
81
 
84
- const storageContainer = new StorageContainer(scope, `${id}-sc`, {
85
- ...props,
86
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.storageContainer),
87
- })
88
-
89
- createAzureTfOutput(`${id}-storageContainerName`, scope, storageContainer.name)
90
- createAzureTfOutput(`${id}-storageContainerFriendlyUniqueId`, scope, storageContainer.friendlyUniqueId)
91
- createAzureTfOutput(`${id}-storageContainerId`, scope, storageContainer.id)
92
-
93
- return storageContainer
82
+ const resourceGroupName = scope.props.resourceGroupName
83
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
84
+ : `${props.resourceGroupName}`
85
+
86
+ return new BlobContainer(
87
+ `${id}-sc`,
88
+ {
89
+ ...props,
90
+ containerName: scope.resourceNameFormatter.format(
91
+ props.containerName?.toString(),
92
+ scope.props.resourceNameOptions?.storageContainer
93
+ ),
94
+ accountName: props.accountName,
95
+ resourceGroupName,
96
+ },
97
+ { parent: scope }
98
+ )
94
99
  }
95
100
 
96
101
  /**
@@ -98,12 +103,12 @@ export class AzureStorageManager {
98
103
  * @param id scoped id of the resource
99
104
  * @param scope scope in which this resource is defined
100
105
  * @param props storage blob properties
101
- * @see [CDKTF Storage Blob Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageBlob.typescript.md}
106
+ * @see [Pulumi Azure Native Blob]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blob/}
102
107
  */
103
108
  public createStorageBlob(id: string, scope: CommonAzureConstruct, props: StorageBlobProps) {
104
109
  if (!props) throw `Props undefined for ${id}`
105
110
 
106
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-sb-rg`, {
111
+ const resourceGroup = azure.core.getResourceGroupOutput({
107
112
  name: scope.props.resourceGroupName
108
113
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
109
114
  : `${props.resourceGroupName}`,
@@ -111,76 +116,70 @@ export class AzureStorageManager {
111
116
 
112
117
  if (!resourceGroup) throw `Resource group undefined for ${id}`
113
118
 
114
- const storageAccount = new DataAzurermStorageAccount(scope, `${id}-sa`, {
115
- name: `${props.storageAccountName}-${scope.props.stage}`,
116
- resourceGroupName: resourceGroup.name,
117
- })
118
-
119
- const storageContainer = new DataAzurermStorageContainer(scope, `${id}-sc`, {
120
- name: `${props.storageContainerName}-${scope.props.stage}`,
121
- storageAccountName: undefined, // the `storage_account_name` property has been deprecated in favour of `storage_account_id` and will be removed in version 5.0 of the Provider.
122
- storageAccountId: storageAccount.id,
123
- })
124
-
125
- const storageBlob = new StorageBlob(scope, `${id}-sb`, {
126
- ...props,
127
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.storageBlob),
128
- storageAccountName: storageAccount.name,
129
- storageContainerName: storageContainer.name,
130
- })
131
-
132
- createAzureTfOutput(`${id}-storageBlobName`, scope, storageBlob.name)
133
- createAzureTfOutput(`${id}-storageBlobFriendlyUniqueId`, scope, storageBlob.friendlyUniqueId)
134
- createAzureTfOutput(`${id}-storageBlobId`, scope, storageBlob.id)
135
-
136
- return storageBlob
119
+ const resourceGroupName = scope.props.resourceGroupName
120
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
121
+ : `${props.resourceGroupName}`
122
+
123
+ return new Blob(
124
+ `${id}-sb`,
125
+ {
126
+ ...props,
127
+ blobName: scope.resourceNameFormatter.format(
128
+ props.blobName?.toString(),
129
+ scope.props.resourceNameOptions?.storageBlob
130
+ ),
131
+ accountName: props.accountName,
132
+ containerName: `${props.containerName}-${scope.props.stage}`,
133
+ resourceGroupName,
134
+ },
135
+ { parent: scope }
136
+ )
137
137
  }
138
138
 
139
139
  /**
140
140
  * @summary Generates a container-level SAS token for an existing Azure Storage container.
141
141
  *
142
142
  * @description
143
- * This method creates a `DataAzurermStorageAccountBlobContainerSas` resource, allowing secure access
144
- * to a container via a generated Shared Access Signature (SAS) token.
143
+ * This method generates a Shared Access Signature (SAS) token for secure container access.
144
+ * The token is generated using Pulumi's listStorageAccountSAS function.
145
145
  *
146
146
  * @param id - Unique scoped identifier for the SAS token resource
147
- * @param scope - CDKTF construct scope in which the resource will be created
147
+ * @param scope - Pulumi construct scope
148
148
  * @param props - SAS options:
149
- * - start: Optional start date in the format 'YYYY-MM-DD'. If not provided, defaults to todays date.
150
- * To avoid diffs on every deploy, it is recommended to supply a fixed value.
151
- * - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date if not provided.
152
- * @param storageAccount
153
- * @param storageContainer
149
+ * - start: Optional start date in the format 'YYYY-MM-DD'. Defaults to today's date.
150
+ * - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date.
151
+ * @param storageAccount - The storage account resource
152
+ * @param storageContainer - Optional blob container resource
154
153
  *
155
- * @returns A `DataAzurermStorageAccountBlobContainerSas` instance with the generated SAS token
154
+ * @returns A Pulumi Output containing the SAS token
156
155
  *
157
- * @see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account_blob_container_sas
156
+ * @see https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/liststorageaccountsas/
158
157
  */
159
158
  public generateContainerSasToken(
160
159
  id: string,
161
160
  scope: CommonAzureConstruct,
162
- props: DataAzurermStorageAccountBlobContainerSasProps,
163
- storageAccount: StorageAccount,
164
- storageContainer?: StorageContainer
161
+ props: ContainerSasTokenProps,
162
+ storageAccount: StorageAccount
165
163
  ) {
166
- const containerSas = new DataAzurermStorageAccountBlobContainerSas(scope, `${id}-sc-sas`, {
167
- connectionString: storageAccount.primaryConnectionString,
168
- containerName: props.containerName ?? storageContainer?.name,
169
- httpsOnly: props.httpsOnly ?? true,
170
- start: props.start ?? new Date().toISOString().split('T')[0],
171
- expiry: props.expiry ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
172
- permissions: props.permissions ?? {
173
- read: true,
174
- add: false,
175
- create: false,
176
- delete: false,
177
- list: false,
178
- write: false,
179
- },
180
- })
181
-
182
- createAzureTfOutput(`${id}-sas-token`, scope, containerSas.sas, 'output', true)
183
-
184
- return containerSas
164
+ const resourceGroupName = scope.props.resourceGroupName
165
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
166
+ : `${props.resourceGroupName}`
167
+
168
+ return pulumi
169
+ .all([storageAccount.name])
170
+ .apply(([accountName]) => {
171
+ return listStorageAccountSAS({
172
+ accountName,
173
+ resourceGroupName,
174
+ protocols: props.httpsOnly === false ? HttpProtocol.Https_http : HttpProtocol.Https,
175
+ sharedAccessStartTime: props.start ?? new Date().toISOString().split('T')[0],
176
+ sharedAccessExpiryTime:
177
+ props.expiry ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
178
+ permissions: props.permissions ?? Permissions.R,
179
+ services: Services.B,
180
+ resourceTypes: SignedResourceTypes.C,
181
+ })
182
+ })
183
+ .apply(result => result.accountSasToken)
185
184
  }
186
185
  }
@@ -1,13 +1,21 @@
1
- import { DataAzurermStorageAccountBlobContainerSasConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-account-blob-container-sas/index.js'
2
- import { StorageAccountConfig } from '@cdktf/provider-azurerm/lib/storage-account/index.js'
3
- import { StorageBlobConfig } from '@cdktf/provider-azurerm/lib/storage-blob/index.js'
4
- import { StorageContainerConfig } from '@cdktf/provider-azurerm/lib/storage-container/index.js'
1
+ import {
2
+ BlobArgs,
3
+ BlobContainerArgs,
4
+ ListStorageAccountSASArgs,
5
+ StorageAccountArgs,
6
+ } from '@pulumi/azure-native/storage/index.js'
5
7
  import { BaseAzureConfigProps } from '../../types/index.js'
6
8
 
7
- export interface StorageAccountProps extends StorageAccountConfig {}
9
+ export interface StorageAccountProps extends StorageAccountArgs {}
8
10
 
9
- export interface StorageContainerProps extends BaseAzureConfigProps, StorageContainerConfig {}
11
+ export interface StorageContainerProps extends BaseAzureConfigProps, BlobContainerArgs {}
10
12
 
11
- export interface StorageBlobProps extends BaseAzureConfigProps, StorageBlobConfig {}
13
+ export interface StorageBlobProps extends BaseAzureConfigProps, BlobArgs {}
12
14
 
13
- export interface DataAzurermStorageAccountBlobContainerSasProps extends DataAzurermStorageAccountBlobContainerSasConfig {}
15
+ export interface ContainerSasTokenProps extends ListStorageAccountSASArgs {
16
+ resourceGroupName: string
17
+ containerName?: string
18
+ httpsOnly?: boolean
19
+ start?: string
20
+ expiry?: string
21
+ }
@@ -1,3 +1,4 @@
1
+ import * as pulumi from '@pulumi/pulumi'
1
2
  export interface BaseAzureConfigProps {
2
- resourceGroupName: string
3
+ resourceGroupName: pulumi.Input<string>
3
4
  }
@@ -1,23 +1,21 @@
1
- import { TerraformOutput } from 'cdktf'
2
- import _ from 'lodash'
3
- import { CommonAzureConstruct } from '../common/index.js'
1
+ /**
2
+ * @fileoverview Azure utility functions for Pulumi
3
+ *
4
+ * Note: Pulumi automatically exposes resource properties as outputs.
5
+ * Unlike CDKTF, explicit output creation is not required.
6
+ * Resource properties are already pulumi.Output<T> types and can be
7
+ * exported directly or used with .apply() for transformations.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * // In CDKTF (old):
12
+ * createAzureTfOutput('resourceGroupName', scope, resourceGroup.name)
13
+ *
14
+ * // In Pulumi (new):
15
+ * // No explicit output creation needed - resourceGroup.name is already an output
16
+ * export const resourceGroupName = resourceGroup.name
17
+ * ```
18
+ */
4
19
 
5
- export const createAzureTfOutput = (
6
- id: string,
7
- scope: CommonAzureConstruct,
8
- value?: string,
9
- description?: string,
10
- sensitive?: boolean,
11
- overrideId = true
12
- ) => {
13
- const output = new TerraformOutput(scope, id, {
14
- description,
15
- sensitive,
16
- value,
17
- })
18
-
19
- if (overrideId) {
20
- output.overrideLogicalId(_.camelCase(id))
21
- }
22
- return output
23
- }
20
+ // Utility functions can be added here as needed for Pulumi Azure operations
21
+ export {}
@@ -99,7 +99,7 @@ export class CommonCloudflareStack extends ComponentResource {
99
99
  * - Primary use is to have layered config for each environment which is injected into the context
100
100
  */
101
101
  protected determineStageContexts(props: CommonCloudflareStackProps) {
102
- const stageContextFilePath = path.join(appRoot.path, props.stageContextPath ?? 'cdkEnv', `${props.stage}.json`)
102
+ const stageContextFilePath = path.join(appRoot.path, props.stageContextPath ?? 'env', `${props.stage}.json`)
103
103
 
104
104
  if (isDevStage(props.stage)) {
105
105
  if (props.debug) console.debug(`Development stage. Using default stage context properties`)
@@ -1,30 +0,0 @@
1
- import { LogAnalyticsWorkspace } from '@cdktf/provider-azurerm/lib/log-analytics-workspace/index.js';
2
- import { CommonAzureConstruct } from '../../common/index.js';
3
- import { LogAnalyticsWorkspaceProps } from './types.js';
4
- /**
5
- * @classdesc Provides operations on Azure Log Analytics Workspace
6
- * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
7
- * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
8
- * @example
9
- * ```
10
- * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
11
- *
12
- * class CustomConstruct extends CommonAzureConstruct {
13
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
14
- * super(parent, id, props)
15
- * this.props = props
16
- * this.LogAnalyticWorkspaceManager.createLogAnalyticsWorkspace('MyLogAnalyticsWorkspace', this, props)
17
- * }
18
- * }
19
- * ```
20
- */
21
- export declare class AzureLogAnalyticsWorkspaceManager {
22
- /**
23
- * @summary Method to create a new cosmosdb account
24
- * @param id scoped id of the resource
25
- * @param scope scope in which this resource is defined
26
- * @param props cosmosdb account properties
27
- * @see [CDKTF CosmosDb Account Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/logAnalyticsWorkspace.typescript.md}
28
- */
29
- createLogAnalyticsWorkspace(id: string, scope: CommonAzureConstruct, props: LogAnalyticsWorkspaceProps): LogAnalyticsWorkspace;
30
- }
@@ -1,55 +0,0 @@
1
- import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group/index.js';
2
- import { LogAnalyticsWorkspace } from '@cdktf/provider-azurerm/lib/log-analytics-workspace/index.js';
3
- import { createAzureTfOutput } from '../../utils/index.js';
4
- /**
5
- * @classdesc Provides operations on Azure Log Analytics Workspace
6
- * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
7
- * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
8
- * @example
9
- * ```
10
- * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
11
- *
12
- * class CustomConstruct extends CommonAzureConstruct {
13
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
14
- * super(parent, id, props)
15
- * this.props = props
16
- * this.LogAnalyticWorkspaceManager.createLogAnalyticsWorkspace('MyLogAnalyticsWorkspace', this, props)
17
- * }
18
- * }
19
- * ```
20
- */
21
- export class AzureLogAnalyticsWorkspaceManager {
22
- /**
23
- * @summary Method to create a new cosmosdb account
24
- * @param id scoped id of the resource
25
- * @param scope scope in which this resource is defined
26
- * @param props cosmosdb account properties
27
- * @see [CDKTF CosmosDb Account Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/logAnalyticsWorkspace.typescript.md}
28
- */
29
- createLogAnalyticsWorkspace(id, scope, props) {
30
- if (!props)
31
- throw `Props undefined for ${id}`;
32
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-lw-rg`, {
33
- name: scope.props.resourceGroupName
34
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
35
- : `${props.resourceGroupName}`,
36
- });
37
- if (!resourceGroup)
38
- throw `Resource group undefined for ${id}`;
39
- const logAnalyticsWorkspace = new LogAnalyticsWorkspace(scope, `${id}-lw`, {
40
- ...props,
41
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.logAnalyticsWorkspace),
42
- location: resourceGroup.location,
43
- resourceGroupName: resourceGroup.name,
44
- sku: props.sku ?? 'PerGB2018',
45
- retentionInDays: props.retentionInDays ?? 30,
46
- tags: props.tags ?? {
47
- environment: scope.props.stage,
48
- },
49
- });
50
- createAzureTfOutput(`${id}-logAnalyticsWorkspaceName`, scope, logAnalyticsWorkspace.name);
51
- createAzureTfOutput(`${id}-logAnalyticsWorkspaceFriendlyUniqueId`, scope, logAnalyticsWorkspace.friendlyUniqueId);
52
- createAzureTfOutput(`${id}-logAnalyticsWorkspaceId`, scope, logAnalyticsWorkspace.id);
53
- return logAnalyticsWorkspace;
54
- }
55
- }
@@ -1,3 +0,0 @@
1
- import { LogAnalyticsWorkspaceConfig } from '@cdktf/provider-azurerm/lib/log-analytics-workspace/index.js';
2
- export interface LogAnalyticsWorkspaceProps extends LogAnalyticsWorkspaceConfig {
3
- }
@@ -1,61 +0,0 @@
1
- import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group/index.js'
2
- import { LogAnalyticsWorkspace } from '@cdktf/provider-azurerm/lib/log-analytics-workspace/index.js'
3
- import { CommonAzureConstruct } from '../../common/index.js'
4
- import { createAzureTfOutput } from '../../utils/index.js'
5
- import { LogAnalyticsWorkspaceProps } from './types.js'
6
-
7
- /**
8
- * @classdesc Provides operations on Azure Log Analytics Workspace
9
- * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
10
- * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
11
- * @example
12
- * ```
13
- * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
14
- *
15
- * class CustomConstruct extends CommonAzureConstruct {
16
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
17
- * super(parent, id, props)
18
- * this.props = props
19
- * this.LogAnalyticWorkspaceManager.createLogAnalyticsWorkspace('MyLogAnalyticsWorkspace', this, props)
20
- * }
21
- * }
22
- * ```
23
- */
24
- export class AzureLogAnalyticsWorkspaceManager {
25
- /**
26
- * @summary Method to create a new cosmosdb account
27
- * @param id scoped id of the resource
28
- * @param scope scope in which this resource is defined
29
- * @param props cosmosdb account properties
30
- * @see [CDKTF CosmosDb Account Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/logAnalyticsWorkspace.typescript.md}
31
- */
32
- public createLogAnalyticsWorkspace(id: string, scope: CommonAzureConstruct, props: LogAnalyticsWorkspaceProps) {
33
- if (!props) throw `Props undefined for ${id}`
34
-
35
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-lw-rg`, {
36
- name: scope.props.resourceGroupName
37
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
38
- : `${props.resourceGroupName}`,
39
- })
40
-
41
- if (!resourceGroup) throw `Resource group undefined for ${id}`
42
-
43
- const logAnalyticsWorkspace = new LogAnalyticsWorkspace(scope, `${id}-lw`, {
44
- ...props,
45
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.logAnalyticsWorkspace),
46
- location: resourceGroup.location,
47
- resourceGroupName: resourceGroup.name,
48
- sku: props.sku ?? 'PerGB2018',
49
- retentionInDays: props.retentionInDays ?? 30,
50
- tags: props.tags ?? {
51
- environment: scope.props.stage,
52
- },
53
- })
54
-
55
- createAzureTfOutput(`${id}-logAnalyticsWorkspaceName`, scope, logAnalyticsWorkspace.name)
56
- createAzureTfOutput(`${id}-logAnalyticsWorkspaceFriendlyUniqueId`, scope, logAnalyticsWorkspace.friendlyUniqueId)
57
- createAzureTfOutput(`${id}-logAnalyticsWorkspaceId`, scope, logAnalyticsWorkspace.id)
58
-
59
- return logAnalyticsWorkspace
60
- }
61
- }
@@ -1,3 +0,0 @@
1
- import { LogAnalyticsWorkspaceConfig } from '@cdktf/provider-azurerm/lib/log-analytics-workspace/index.js'
2
-
3
- export interface LogAnalyticsWorkspaceProps extends LogAnalyticsWorkspaceConfig {}