@gradientedge/cdk-utils 10.1.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 +2 -1
  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,21 +1,15 @@
1
- import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group/index.js';
2
- import { DataAzurermServicebusQueue } from '@cdktf/provider-azurerm/lib/data-azurerm-servicebus-queue/index.js';
3
- import { ServicebusNamespace } from '@cdktf/provider-azurerm/lib/servicebus-namespace/index.js';
4
- import { ServicebusQueue } from '@cdktf/provider-azurerm/lib/servicebus-queue/index.js';
5
- import { ServicebusSubscription } from '@cdktf/provider-azurerm/lib/servicebus-subscription/index.js';
6
- import { ServicebusTopic } from '@cdktf/provider-azurerm/lib/servicebus-topic/index.js';
7
- import { createAzureTfOutput } from '../../utils/index.js';
1
+ import { getQueueOutput, ManagedServiceIdentityType, Namespace, Queue, SkuName, Subscription, Topic, } from '@pulumi/azure-native/servicebus/index.js';
8
2
  /**
9
- * @classdesc Provides operations on Azure Servicebus
3
+ * @classdesc Provides operations on Azure Servicebus using Pulumi
10
4
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
11
5
  * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
12
6
  * @example
13
- * ```
7
+ * ```typescript
14
8
  * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
15
9
  *
16
10
  * class CustomConstruct extends CommonAzureConstruct {
17
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
18
- * super(parent, id, props)
11
+ * constructor(name: string, props: CommonAzureStackProps) {
12
+ * super(name, props)
19
13
  * this.props = props
20
14
  * this.ServicebusManager.createServicebusTopic('MyServicebusTopic', this, props)
21
15
  * }
@@ -28,118 +22,101 @@ export class AzureServicebusManager {
28
22
  * @param id scoped id of the resource
29
23
  * @param scope scope in which this resource is defined
30
24
  * @param props servicebus namespace properties
31
- * @see [CDKTF Servicebus Namespace Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusNamespace.typescript.md}
25
+ * @see [Pulumi Azure Native Service Bus Namespace]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/servicebus/namespace/}
32
26
  */
33
27
  createServicebusNamespace(id, scope, props) {
34
28
  if (!props)
35
29
  throw `Props undefined for ${id}`;
36
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-sn-rg`, {
37
- name: scope.props.resourceGroupName
38
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
39
- : `${props.resourceGroupName}`,
40
- });
41
- if (!resourceGroup)
42
- throw `Resource group undefined for ${id}`;
43
- const servicebusNamespace = new ServicebusNamespace(scope, `${id}-sn`, {
30
+ // Get resource group name
31
+ const resourceGroupName = scope.props.resourceGroupName
32
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
33
+ : props.resourceGroupName;
34
+ if (!resourceGroupName)
35
+ throw `Resource group name undefined for ${id}`;
36
+ return new Namespace(`${id}-sn`, {
44
37
  ...props,
45
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusNamespace),
46
- resourceGroupName: resourceGroup.name,
47
- location: resourceGroup.location,
48
- identity: {
49
- type: props.identity?.type ?? 'SystemAssigned',
38
+ namespaceName: scope.resourceNameFormatter.format(props.namespaceName?.toString(), scope.props.resourceNameOptions?.serviceBusNamespace),
39
+ resourceGroupName: resourceGroupName,
40
+ location: props.location ?? scope.props.location,
41
+ identity: props.identity ?? {
42
+ type: ManagedServiceIdentityType.SystemAssigned,
43
+ },
44
+ sku: props.sku ?? {
45
+ name: SkuName.Standard,
50
46
  },
51
- sku: props.sku ?? 'Standard',
52
47
  tags: props.tags ?? {
53
48
  environment: scope.props.stage,
54
49
  },
55
- });
56
- createAzureTfOutput(`${id}-servicebusNamespaceName`, scope, servicebusNamespace.name);
57
- createAzureTfOutput(`${id}-servicebusNamespaceFriendlyUniqueId`, scope, servicebusNamespace.friendlyUniqueId);
58
- createAzureTfOutput(`${id}-servicebusNamespaceId`, scope, servicebusNamespace.id);
59
- return servicebusNamespace;
50
+ }, { parent: scope });
60
51
  }
61
52
  /**
62
53
  * @summary Method to create a new servicebus topic
63
54
  * @param id scoped id of the resource
64
55
  * @param scope scope in which this resource is defined
65
56
  * @param props servicebus topic properties
66
- * @see [CDKTF Servicebus Topic Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusTopic.typescript.md}
57
+ * @see [Pulumi Azure Native Service Bus Topic]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/servicebus/topic/}
67
58
  */
68
59
  createServicebusTopic(id, scope, props) {
69
60
  if (!props)
70
61
  throw `Props undefined for ${id}`;
71
- const servicebusTopic = new ServicebusTopic(scope, `${id}-st`, {
62
+ return new Topic(`${id}-st`, {
72
63
  ...props,
73
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusTopic),
74
- namespaceId: props.namespaceId,
75
- });
76
- createAzureTfOutput(`${id}-servicebusTopicName`, scope, servicebusTopic.name);
77
- createAzureTfOutput(`${id}-servicebusTopicFriendlyUniqueId`, scope, servicebusTopic.friendlyUniqueId);
78
- createAzureTfOutput(`${id}-servicebusTopicId`, scope, servicebusTopic.id);
79
- return servicebusTopic;
64
+ topicName: scope.resourceNameFormatter.format(props.topicName?.toString(), scope.props.resourceNameOptions?.serviceBusTopic),
65
+ namespaceName: props.namespaceName,
66
+ resourceGroupName: props.resourceGroupName,
67
+ }, { parent: scope });
80
68
  }
81
69
  /**
82
70
  * @summary Method to create a new servicebus queue
83
71
  * @param id scoped id of the resource
84
72
  * @param scope scope in which this resource is defined
85
73
  * @param props servicebus queue properties
86
- * @see [CDKTF Servicebus Queue Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusQueue.typescript.md}
74
+ * @see [Pulumi Azure Native Service Bus Queue]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/servicebus/queue/}
87
75
  */
88
76
  createServicebusQueue(id, scope, props) {
89
77
  if (!props)
90
78
  throw `Props undefined for ${id}`;
91
- const servicebusQueue = new ServicebusQueue(scope, `${id}-sq`, {
79
+ return new Queue(`${id}-sq`, {
92
80
  ...props,
93
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusQueue),
94
- namespaceId: props.namespaceId,
81
+ queueName: scope.resourceNameFormatter.format(props.queueName?.toString(), scope.props.resourceNameOptions?.serviceBusQueue),
82
+ namespaceName: props.namespaceName,
83
+ resourceGroupName: props.resourceGroupName,
95
84
  duplicateDetectionHistoryTimeWindow: props.duplicateDetectionHistoryTimeWindow ?? 'PT1M',
96
85
  requiresDuplicateDetection: props.requiresDuplicateDetection ?? true,
97
86
  deadLetteringOnMessageExpiration: props.deadLetteringOnMessageExpiration ?? true,
98
- defaultMessageTtl: props.defaultMessageTtl ?? 'P2D',
99
- });
100
- createAzureTfOutput(`${id}-servicebusQueueName`, scope, servicebusQueue.name);
101
- createAzureTfOutput(`${id}-servicebusQueueFriendlyUniqueId`, scope, servicebusQueue.friendlyUniqueId);
102
- createAzureTfOutput(`${id}-servicebusQueueId`, scope, servicebusQueue.id);
103
- return servicebusQueue;
87
+ defaultMessageTimeToLive: props.defaultMessageTtl ?? 'P2D',
88
+ }, { parent: scope });
104
89
  }
105
90
  /**
106
91
  * @summary Method to create a new servicebus subscription
107
92
  * @param id scoped id of the resource
108
93
  * @param scope scope in which this resource is defined
109
94
  * @param props servicebus subscription properties
110
- * @see [CDKTF Servicebus Subscription Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusSubscription.typescript.md}
95
+ * @see [Pulumi Azure Native Service Bus Subscription]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/servicebus/subscription/}
111
96
  */
112
97
  createServicebusSubscription(id, scope, props) {
113
98
  if (!props)
114
99
  throw `Props undefined for ${id}`;
115
- const servicebusSubscription = new ServicebusSubscription(scope, `${id}-ss`, {
100
+ return new Subscription(`${id}-ss`, {
116
101
  ...props,
117
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusSubscription),
102
+ subscriptionName: scope.resourceNameFormatter.format(props.subscriptionName?.toString(), scope.props.resourceNameOptions?.serviceBusSubscription),
118
103
  maxDeliveryCount: props.maxDeliveryCount ?? 1,
119
- });
120
- createAzureTfOutput(`${id}-servicebusSubscriptionName`, scope, servicebusSubscription.name);
121
- createAzureTfOutput(`${id}-servicebusSubscriptionFriendlyUniqueId`, scope, servicebusSubscription.friendlyUniqueId);
122
- createAzureTfOutput(`${id}-servicebusSubscriptionId`, scope, servicebusSubscription.id);
123
- return servicebusSubscription;
104
+ }, { parent: scope });
124
105
  }
125
106
  /**
126
- * @summary Method to resolve a new servicebus queue
107
+ * @summary Method to resolve an existing servicebus queue
127
108
  * @param id scoped id of the resource
128
109
  * @param scope scope in which this resource is defined
129
- * @param props servicebus queue properties
130
- * @see [CDKTF Servicebus Queue Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/servicebusQueue.typescript.md}
110
+ * @param props servicebus queue properties for lookup
111
+ * @see [Pulumi Azure Native Service Bus Queue Lookup]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/servicebus/queue/}
131
112
  */
132
113
  resolveServicebusQueue(id, scope, props) {
133
114
  if (!props)
134
115
  throw `Props undefined for ${id}`;
135
- const servicebusQueue = new DataAzurermServicebusQueue(scope, `${id}-sq`, {
136
- ...props,
137
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusQueue),
138
- namespaceId: props.namespaceId,
139
- });
140
- createAzureTfOutput(`${id}-servicebusQueueName`, scope, servicebusQueue.name);
141
- createAzureTfOutput(`${id}-servicebusQueueFriendlyUniqueId`, scope, servicebusQueue.friendlyUniqueId);
142
- createAzureTfOutput(`${id}-servicebusQueueId`, scope, servicebusQueue.id);
143
- return servicebusQueue;
116
+ return getQueueOutput({
117
+ queueName: scope.resourceNameFormatter.format(props.queueName?.toString(), scope.props.resourceNameOptions?.serviceBusQueue),
118
+ namespaceName: props.namespaceName,
119
+ resourceGroupName: props.resourceGroupName,
120
+ }, { parent: scope });
144
121
  }
145
122
  }
@@ -1,15 +1,11 @@
1
- import { ServicebusNamespaceConfig } from '@cdktf/provider-azurerm/lib/servicebus-namespace/index.js';
2
- import { ServicebusTopicConfig } from '@cdktf/provider-azurerm/lib/servicebus-topic/index.js';
3
- import { ServicebusQueueConfig } from '@cdktf/provider-azurerm/lib/servicebus-queue/index.js';
4
- import { ServicebusSubscriptionConfig } from '@cdktf/provider-azurerm/lib/servicebus-subscription/index.js';
5
- import { DataAzurermServicebusQueueConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-servicebus-queue/index.js';
6
- export interface ServicebusNamespaceProps extends ServicebusNamespaceConfig {
1
+ import { GetQueueOutputArgs, NamespaceArgs, QueueArgs, SubscriptionArgs, TopicArgs } from '@pulumi/azure-native/servicebus/index.js';
2
+ export interface ServicebusNamespaceProps extends NamespaceArgs {
7
3
  }
8
- export interface ServicebusTopicProps extends ServicebusTopicConfig {
4
+ export interface ServicebusTopicProps extends TopicArgs {
9
5
  }
10
- export interface ServicebusQueueProps extends ServicebusQueueConfig {
6
+ export interface ServicebusQueueProps extends QueueArgs {
11
7
  }
12
- export interface ServicebusSubscriptionProps extends ServicebusSubscriptionConfig {
8
+ export interface ServicebusSubscriptionProps extends SubscriptionArgs {
13
9
  }
14
- export interface DataAzurermServicebusQueueProps extends DataAzurermServicebusQueueConfig {
10
+ export interface ResolveServicebusQueueProps extends GetQueueOutputArgs {
15
11
  }
@@ -1,20 +1,18 @@
1
- import { DataAzurermStorageAccountBlobContainerSas } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-account-blob-container-sas/index.js';
2
- import { StorageAccount } from '@cdktf/provider-azurerm/lib/storage-account/index.js';
3
- import { StorageBlob } from '@cdktf/provider-azurerm/lib/storage-blob/index.js';
4
- import { StorageContainer } from '@cdktf/provider-azurerm/lib/storage-container/index.js';
1
+ import { StorageAccount } from '@pulumi/azure-native/storage/index.js';
2
+ import * as pulumi from '@pulumi/pulumi';
5
3
  import { CommonAzureConstruct } from '../../common/index.js';
6
- import { DataAzurermStorageAccountBlobContainerSasProps, StorageAccountProps, StorageBlobProps, StorageContainerProps } from './types.js';
4
+ import { ContainerSasTokenProps, StorageAccountProps, StorageBlobProps, StorageContainerProps } from './types.js';
7
5
  /**
8
- * @classdesc Provides operations on Azure Storage
6
+ * @classdesc Provides operations on Azure Storage 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.storageManager.createStorageAccount('MyAccount', this, props)
20
18
  * }
@@ -27,44 +25,43 @@ export declare class AzureStorageManager {
27
25
  * @param id scoped id of the resource
28
26
  * @param scope scope in which this resource is defined
29
27
  * @param props storage account properties
30
- * @see [CDKTF Storage Account Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageAccount.typescript.md}
28
+ * @see [Pulumi Azure Native Storage Account]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/storageaccount/}
31
29
  */
32
- createStorageAccount(id: string, scope: CommonAzureConstruct, props: StorageAccountProps): StorageAccount;
30
+ createStorageAccount(id: string, scope: CommonAzureConstruct, props: StorageAccountProps): import("@pulumi/azure-native/storage/storageAccount.js").StorageAccount;
33
31
  /**
34
- * @summary Method to create a new storage container
32
+ * @summary Method to create a new storage container (blob container)
35
33
  * @param id scoped id of the resource
36
34
  * @param scope scope in which this resource is defined
37
35
  * @param props storage container properties
38
- * @see [CDKTF Storage Container Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageContainer.typescript.md}
36
+ * @see [Pulumi Azure Native Blob Container]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blobcontainer/}
39
37
  */
40
- createStorageContainer(id: string, scope: CommonAzureConstruct, props: StorageContainerProps): StorageContainer;
38
+ createStorageContainer(id: string, scope: CommonAzureConstruct, props: StorageContainerProps): import("@pulumi/azure-native/storage/blobContainer.js").BlobContainer;
41
39
  /**
42
40
  * @summary Method to create a new storage blob
43
41
  * @param id scoped id of the resource
44
42
  * @param scope scope in which this resource is defined
45
43
  * @param props storage blob properties
46
- * @see [CDKTF Storage Blob Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageBlob.typescript.md}
44
+ * @see [Pulumi Azure Native Blob]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blob/}
47
45
  */
48
- createStorageBlob(id: string, scope: CommonAzureConstruct, props: StorageBlobProps): StorageBlob;
46
+ createStorageBlob(id: string, scope: CommonAzureConstruct, props: StorageBlobProps): import("@pulumi/azure-native/storage/blob.js").Blob;
49
47
  /**
50
48
  * @summary Generates a container-level SAS token for an existing Azure Storage container.
51
49
  *
52
50
  * @description
53
- * This method creates a `DataAzurermStorageAccountBlobContainerSas` resource, allowing secure access
54
- * to a container via a generated Shared Access Signature (SAS) token.
51
+ * This method generates a Shared Access Signature (SAS) token for secure container access.
52
+ * The token is generated using Pulumi's listStorageAccountSAS function.
55
53
  *
56
54
  * @param id - Unique scoped identifier for the SAS token resource
57
- * @param scope - CDKTF construct scope in which the resource will be created
55
+ * @param scope - Pulumi construct scope
58
56
  * @param props - SAS options:
59
- * - start: Optional start date in the format 'YYYY-MM-DD'. If not provided, defaults to todays date.
60
- * To avoid diffs on every deploy, it is recommended to supply a fixed value.
61
- * - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date if not provided.
62
- * @param storageAccount
63
- * @param storageContainer
57
+ * - start: Optional start date in the format 'YYYY-MM-DD'. Defaults to today's date.
58
+ * - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date.
59
+ * @param storageAccount - The storage account resource
60
+ * @param storageContainer - Optional blob container resource
64
61
  *
65
- * @returns A `DataAzurermStorageAccountBlobContainerSas` instance with the generated SAS token
62
+ * @returns A Pulumi Output containing the SAS token
66
63
  *
67
- * @see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account_blob_container_sas
64
+ * @see https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/liststorageaccountsas/
68
65
  */
69
- generateContainerSasToken(id: string, scope: CommonAzureConstruct, props: DataAzurermStorageAccountBlobContainerSasProps, storageAccount: StorageAccount, storageContainer?: StorageContainer): DataAzurermStorageAccountBlobContainerSas;
66
+ generateContainerSasToken(id: string, scope: CommonAzureConstruct, props: ContainerSasTokenProps, storageAccount: StorageAccount): pulumi.Output<string>;
70
67
  }
@@ -1,22 +1,17 @@
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 { createAzureTfOutput } from '../../utils/index.js';
1
+ import * as azure from '@pulumi/azure';
2
+ import { Blob, BlobContainer, HttpProtocol, Kind, listStorageAccountSAS, Permissions, Services, SignedResourceTypes, SkuName, StorageAccount, } from '@pulumi/azure-native/storage/index.js';
3
+ import * as pulumi from '@pulumi/pulumi';
9
4
  /**
10
- * @classdesc Provides operations on Azure Storage
5
+ * @classdesc Provides operations on Azure Storage using Pulumi
11
6
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
12
7
  * - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
13
8
  * @example
14
- * ```
9
+ * ```typescript
15
10
  * import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
16
11
  *
17
12
  * class CustomConstruct extends CommonAzureConstruct {
18
- * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
19
- * super(parent, id, props)
13
+ * constructor(name: string, props: CommonAzureStackProps) {
14
+ * super(name, props)
20
15
  * this.props = props
21
16
  * this.storageManager.createStorageAccount('MyAccount', this, props)
22
17
  * }
@@ -29,129 +24,116 @@ export class AzureStorageManager {
29
24
  * @param id scoped id of the resource
30
25
  * @param scope scope in which this resource is defined
31
26
  * @param props storage account properties
32
- * @see [CDKTF Storage Account Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageAccount.typescript.md}
27
+ * @see [Pulumi Azure Native Storage Account]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/storageaccount/}
33
28
  */
34
29
  createStorageAccount(id, scope, props) {
35
30
  if (!props)
36
31
  throw `Props undefined for ${id}`;
37
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-sa-rg`, {
38
- name: scope.props.resourceGroupName
39
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
40
- : `${props.resourceGroupName}`,
41
- });
42
- if (!resourceGroup)
43
- throw `Resource group undefined for ${id}`;
44
- const storageAccount = new StorageAccount(scope, `${id}-sa`, {
32
+ const resourceGroupName = scope.props.resourceGroupName
33
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
34
+ : `${props.resourceGroupName}`;
35
+ return new StorageAccount(`${id}-sa`, {
45
36
  ...props,
46
- accountTier: props.accountTier ?? 'Standard',
47
- location: props.location ?? resourceGroup.location,
48
- name: scope.resourceNameFormatter
49
- .format(props.name, scope.props.resourceNameOptions?.storageAccount)
37
+ accountName: scope.resourceNameFormatter
38
+ .format(props.accountName?.toString(), scope.props.resourceNameOptions?.storageAccount)
50
39
  .replace(/\W/g, '')
51
40
  .toLowerCase(),
52
- resourceGroupName: resourceGroup.name,
41
+ resourceGroupName,
42
+ sku: props.sku ?? {
43
+ name: SkuName.Standard_LRS,
44
+ },
45
+ kind: props.kind ?? Kind.StorageV2,
46
+ location: props.location ?? scope.props.location,
53
47
  tags: props.tags ?? {
54
48
  environment: scope.props.stage,
55
49
  },
56
- });
57
- createAzureTfOutput(`${id}-storageAccountName`, scope, storageAccount.name);
58
- createAzureTfOutput(`${id}-storageAccountFriendlyUniqueId`, scope, storageAccount.friendlyUniqueId);
59
- createAzureTfOutput(`${id}-storageAccountId`, scope, storageAccount.id);
60
- return storageAccount;
50
+ }, { parent: scope });
61
51
  }
62
52
  /**
63
- * @summary Method to create a new storage container
53
+ * @summary Method to create a new storage container (blob container)
64
54
  * @param id scoped id of the resource
65
55
  * @param scope scope in which this resource is defined
66
56
  * @param props storage container properties
67
- * @see [CDKTF Storage Container Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageContainer.typescript.md}
57
+ * @see [Pulumi Azure Native Blob Container]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blobcontainer/}
68
58
  */
69
59
  createStorageContainer(id, scope, props) {
70
60
  if (!props)
71
61
  throw `Props undefined for ${id}`;
72
- const storageContainer = new StorageContainer(scope, `${id}-sc`, {
62
+ const resourceGroupName = scope.props.resourceGroupName
63
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
64
+ : `${props.resourceGroupName}`;
65
+ return new BlobContainer(`${id}-sc`, {
73
66
  ...props,
74
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.storageContainer),
75
- });
76
- createAzureTfOutput(`${id}-storageContainerName`, scope, storageContainer.name);
77
- createAzureTfOutput(`${id}-storageContainerFriendlyUniqueId`, scope, storageContainer.friendlyUniqueId);
78
- createAzureTfOutput(`${id}-storageContainerId`, scope, storageContainer.id);
79
- return storageContainer;
67
+ containerName: scope.resourceNameFormatter.format(props.containerName?.toString(), scope.props.resourceNameOptions?.storageContainer),
68
+ accountName: props.accountName,
69
+ resourceGroupName,
70
+ }, { parent: scope });
80
71
  }
81
72
  /**
82
73
  * @summary Method to create a new storage blob
83
74
  * @param id scoped id of the resource
84
75
  * @param scope scope in which this resource is defined
85
76
  * @param props storage blob properties
86
- * @see [CDKTF Storage Blob Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageBlob.typescript.md}
77
+ * @see [Pulumi Azure Native Blob]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blob/}
87
78
  */
88
79
  createStorageBlob(id, scope, props) {
89
80
  if (!props)
90
81
  throw `Props undefined for ${id}`;
91
- const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-sb-rg`, {
82
+ const resourceGroup = azure.core.getResourceGroupOutput({
92
83
  name: scope.props.resourceGroupName
93
84
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
94
85
  : `${props.resourceGroupName}`,
95
86
  });
96
87
  if (!resourceGroup)
97
88
  throw `Resource group undefined for ${id}`;
98
- const storageAccount = new DataAzurermStorageAccount(scope, `${id}-sa`, {
99
- name: `${props.storageAccountName}-${scope.props.stage}`,
100
- resourceGroupName: resourceGroup.name,
101
- });
102
- const storageContainer = new DataAzurermStorageContainer(scope, `${id}-sc`, {
103
- name: `${props.storageContainerName}-${scope.props.stage}`,
104
- 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.
105
- storageAccountId: storageAccount.id,
106
- });
107
- const storageBlob = new StorageBlob(scope, `${id}-sb`, {
89
+ const resourceGroupName = scope.props.resourceGroupName
90
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
91
+ : `${props.resourceGroupName}`;
92
+ return new Blob(`${id}-sb`, {
108
93
  ...props,
109
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.storageBlob),
110
- storageAccountName: storageAccount.name,
111
- storageContainerName: storageContainer.name,
112
- });
113
- createAzureTfOutput(`${id}-storageBlobName`, scope, storageBlob.name);
114
- createAzureTfOutput(`${id}-storageBlobFriendlyUniqueId`, scope, storageBlob.friendlyUniqueId);
115
- createAzureTfOutput(`${id}-storageBlobId`, scope, storageBlob.id);
116
- return storageBlob;
94
+ blobName: scope.resourceNameFormatter.format(props.blobName?.toString(), scope.props.resourceNameOptions?.storageBlob),
95
+ accountName: props.accountName,
96
+ containerName: `${props.containerName}-${scope.props.stage}`,
97
+ resourceGroupName,
98
+ }, { parent: scope });
117
99
  }
118
100
  /**
119
101
  * @summary Generates a container-level SAS token for an existing Azure Storage container.
120
102
  *
121
103
  * @description
122
- * This method creates a `DataAzurermStorageAccountBlobContainerSas` resource, allowing secure access
123
- * to a container via a generated Shared Access Signature (SAS) token.
104
+ * This method generates a Shared Access Signature (SAS) token for secure container access.
105
+ * The token is generated using Pulumi's listStorageAccountSAS function.
124
106
  *
125
107
  * @param id - Unique scoped identifier for the SAS token resource
126
- * @param scope - CDKTF construct scope in which the resource will be created
108
+ * @param scope - Pulumi construct scope
127
109
  * @param props - SAS options:
128
- * - start: Optional start date in the format 'YYYY-MM-DD'. If not provided, defaults to todays date.
129
- * To avoid diffs on every deploy, it is recommended to supply a fixed value.
130
- * - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date if not provided.
131
- * @param storageAccount
132
- * @param storageContainer
110
+ * - start: Optional start date in the format 'YYYY-MM-DD'. Defaults to today's date.
111
+ * - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date.
112
+ * @param storageAccount - The storage account resource
113
+ * @param storageContainer - Optional blob container resource
133
114
  *
134
- * @returns A `DataAzurermStorageAccountBlobContainerSas` instance with the generated SAS token
115
+ * @returns A Pulumi Output containing the SAS token
135
116
  *
136
- * @see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account_blob_container_sas
117
+ * @see https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/liststorageaccountsas/
137
118
  */
138
- generateContainerSasToken(id, scope, props, storageAccount, storageContainer) {
139
- const containerSas = new DataAzurermStorageAccountBlobContainerSas(scope, `${id}-sc-sas`, {
140
- connectionString: storageAccount.primaryConnectionString,
141
- containerName: props.containerName ?? storageContainer?.name,
142
- httpsOnly: props.httpsOnly ?? true,
143
- start: props.start ?? new Date().toISOString().split('T')[0],
144
- expiry: props.expiry ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
145
- permissions: props.permissions ?? {
146
- read: true,
147
- add: false,
148
- create: false,
149
- delete: false,
150
- list: false,
151
- write: false,
152
- },
153
- });
154
- createAzureTfOutput(`${id}-sas-token`, scope, containerSas.sas, 'output', true);
155
- return containerSas;
119
+ generateContainerSasToken(id, scope, props, storageAccount) {
120
+ const resourceGroupName = scope.props.resourceGroupName
121
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
122
+ : `${props.resourceGroupName}`;
123
+ return pulumi
124
+ .all([storageAccount.name])
125
+ .apply(([accountName]) => {
126
+ return listStorageAccountSAS({
127
+ accountName,
128
+ resourceGroupName,
129
+ protocols: props.httpsOnly === false ? HttpProtocol.Https_http : HttpProtocol.Https,
130
+ sharedAccessStartTime: props.start ?? new Date().toISOString().split('T')[0],
131
+ sharedAccessExpiryTime: props.expiry ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
132
+ permissions: props.permissions ?? Permissions.R,
133
+ services: Services.B,
134
+ resourceTypes: SignedResourceTypes.C,
135
+ });
136
+ })
137
+ .apply(result => result.accountSasToken);
156
138
  }
157
139
  }
@@ -1,13 +1,15 @@
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 { BlobArgs, BlobContainerArgs, ListStorageAccountSASArgs, StorageAccountArgs } from '@pulumi/azure-native/storage/index.js';
5
2
  import { BaseAzureConfigProps } from '../../types/index.js';
6
- export interface StorageAccountProps extends StorageAccountConfig {
3
+ export interface StorageAccountProps extends StorageAccountArgs {
7
4
  }
8
- export interface StorageContainerProps extends BaseAzureConfigProps, StorageContainerConfig {
5
+ export interface StorageContainerProps extends BaseAzureConfigProps, BlobContainerArgs {
9
6
  }
10
- export interface StorageBlobProps extends BaseAzureConfigProps, StorageBlobConfig {
7
+ export interface StorageBlobProps extends BaseAzureConfigProps, BlobArgs {
11
8
  }
12
- export interface DataAzurermStorageAccountBlobContainerSasProps extends DataAzurermStorageAccountBlobContainerSasConfig {
9
+ export interface ContainerSasTokenProps extends ListStorageAccountSASArgs {
10
+ resourceGroupName: string;
11
+ containerName?: string;
12
+ httpsOnly?: boolean;
13
+ start?: string;
14
+ expiry?: string;
13
15
  }
@@ -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,3 +1,19 @@
1
- import { TerraformOutput } from 'cdktf';
2
- import { CommonAzureConstruct } from '../common/index.js';
3
- export declare const createAzureTfOutput: (id: string, scope: CommonAzureConstruct, value?: string, description?: string, sensitive?: boolean, overrideId?: boolean) => TerraformOutput;
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
+ */
19
+ export {};
@@ -1,13 +1,19 @@
1
- import { TerraformOutput } from 'cdktf';
2
- import _ from 'lodash';
3
- export const createAzureTfOutput = (id, scope, value, description, sensitive, overrideId = true) => {
4
- const output = new TerraformOutput(scope, id, {
5
- description,
6
- sensitive,
7
- value,
8
- });
9
- if (overrideId) {
10
- output.overrideLogicalId(_.camelCase(id));
11
- }
12
- return output;
13
- };
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
+ */
19
+ export {};