@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.
- package/dist/src/lib/azure/common/constants.d.ts +3 -2
- package/dist/src/lib/azure/common/constants.js +2 -1
- package/dist/src/lib/azure/common/construct.d.ts +26 -12
- package/dist/src/lib/azure/common/construct.js +31 -45
- package/dist/src/lib/azure/common/resource-name-formatter.d.ts +9 -4
- package/dist/src/lib/azure/common/resource-name-formatter.js +9 -5
- package/dist/src/lib/azure/common/stack.d.ts +18 -32
- package/dist/src/lib/azure/common/stack.js +77 -74
- package/dist/src/lib/azure/common/tagging.d.ts +29 -8
- package/dist/src/lib/azure/common/tagging.js +72 -26
- package/dist/src/lib/azure/common/types.d.ts +19 -4
- package/dist/src/lib/azure/services/api-management/main.d.ts +29 -32
- package/dist/src/lib/azure/services/api-management/main.js +100 -121
- package/dist/src/lib/azure/services/api-management/types.d.ts +33 -18
- package/dist/src/lib/azure/services/app-configuration/main.d.ts +6 -7
- package/dist/src/lib/azure/services/app-configuration/main.js +23 -26
- package/dist/src/lib/azure/services/app-configuration/types.d.ts +2 -2
- package/dist/src/lib/azure/services/app-service/main.d.ts +10 -12
- package/dist/src/lib/azure/services/app-service/main.js +37 -49
- package/dist/src/lib/azure/services/app-service/types.d.ts +4 -4
- package/dist/src/lib/azure/services/application-insights/main.d.ts +7 -8
- package/dist/src/lib/azure/services/application-insights/main.js +20 -26
- package/dist/src/lib/azure/services/application-insights/types.d.ts +2 -4
- package/dist/src/lib/azure/services/cosmosdb/main.d.ts +12 -15
- package/dist/src/lib/azure/services/cosmosdb/main.js +42 -61
- package/dist/src/lib/azure/services/cosmosdb/types.d.ts +4 -6
- package/dist/src/lib/azure/services/dns/main.d.ts +13 -17
- package/dist/src/lib/azure/services/dns/main.js +33 -51
- package/dist/src/lib/azure/services/dns/types.d.ts +5 -8
- package/dist/src/lib/azure/services/eventgrid/main.d.ts +20 -22
- package/dist/src/lib/azure/services/eventgrid/main.js +61 -89
- package/dist/src/lib/azure/services/eventgrid/types.d.ts +7 -8
- package/dist/src/lib/azure/services/function/main.d.ts +15 -15
- package/dist/src/lib/azure/services/function/main.js +54 -59
- package/dist/src/lib/azure/services/function/types.d.ts +18 -6
- package/dist/src/lib/azure/services/index.d.ts +1 -1
- package/dist/src/lib/azure/services/index.js +1 -1
- package/dist/src/lib/azure/services/key-vault/main.d.ts +6 -7
- package/dist/src/lib/azure/services/key-vault/main.js +29 -28
- package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -2
- package/dist/src/lib/azure/services/monitor/main.d.ts +7 -8
- package/dist/src/lib/azure/services/monitor/main.js +10 -15
- package/dist/src/lib/azure/services/monitor/types.d.ts +2 -2
- package/dist/src/lib/azure/services/operational-insights/main.d.ts +29 -0
- package/dist/src/lib/azure/services/operational-insights/main.js +50 -0
- package/dist/src/lib/azure/services/operational-insights/types.d.ts +3 -0
- package/dist/src/lib/azure/services/redis/main.d.ts +8 -9
- package/dist/src/lib/azure/services/redis/main.js +24 -26
- package/dist/src/lib/azure/services/redis/types.d.ts +2 -2
- package/dist/src/lib/azure/services/resource-group/main.d.ts +6 -7
- package/dist/src/lib/azure/services/resource-group/main.js +9 -14
- package/dist/src/lib/azure/services/resource-group/types.d.ts +2 -2
- package/dist/src/lib/azure/services/servicebus/main.d.ts +17 -22
- package/dist/src/lib/azure/services/servicebus/main.js +47 -70
- package/dist/src/lib/azure/services/servicebus/types.d.ts +6 -10
- package/dist/src/lib/azure/services/storage/main.d.ts +24 -27
- package/dist/src/lib/azure/services/storage/main.js +70 -88
- package/dist/src/lib/azure/services/storage/types.d.ts +10 -8
- package/dist/src/lib/azure/types/index.d.ts +2 -1
- package/dist/src/lib/azure/utils/index.d.ts +19 -3
- package/dist/src/lib/azure/utils/index.js +19 -13
- package/dist/src/lib/cloudflare/common/stack.js +1 -1
- package/package.json +2 -1
- package/src/lib/azure/common/constants.ts +2 -1
- package/src/lib/azure/common/construct.ts +32 -48
- package/src/lib/azure/common/resource-name-formatter.ts +10 -6
- package/src/lib/azure/common/stack.ts +78 -78
- package/src/lib/azure/common/tagging.ts +78 -29
- package/src/lib/azure/common/types.ts +21 -4
- package/src/lib/azure/services/api-management/main.ts +172 -169
- package/src/lib/azure/services/api-management/types.ts +39 -16
- package/src/lib/azure/services/app-configuration/main.ts +33 -31
- package/src/lib/azure/services/app-configuration/types.ts +2 -2
- package/src/lib/azure/services/app-service/main.ts +61 -62
- package/src/lib/azure/services/app-service/types.ts +4 -4
- package/src/lib/azure/services/application-insights/main.ts +29 -30
- package/src/lib/azure/services/application-insights/types.ts +2 -5
- package/src/lib/azure/services/cosmosdb/main.ts +78 -77
- package/src/lib/azure/services/cosmosdb/types.ts +10 -6
- package/src/lib/azure/services/dns/main.ts +65 -72
- package/src/lib/azure/services/dns/types.ts +9 -9
- package/src/lib/azure/services/eventgrid/main.ts +120 -122
- package/src/lib/azure/services/eventgrid/types.ts +13 -8
- package/src/lib/azure/services/function/main.ts +75 -72
- package/src/lib/azure/services/function/types.ts +21 -6
- package/src/lib/azure/services/index.ts +1 -1
- package/src/lib/azure/services/key-vault/main.ts +38 -32
- package/src/lib/azure/services/key-vault/types.ts +4 -2
- package/src/lib/azure/services/monitor/main.ts +17 -21
- package/src/lib/azure/services/monitor/types.ts +2 -2
- package/src/lib/azure/services/operational-insights/main.ts +61 -0
- package/src/lib/azure/services/operational-insights/types.ts +3 -0
- package/src/lib/azure/services/redis/main.ts +30 -30
- package/src/lib/azure/services/redis/types.ts +2 -2
- package/src/lib/azure/services/resource-group/main.ts +20 -20
- package/src/lib/azure/services/resource-group/types.ts +2 -2
- package/src/lib/azure/services/servicebus/main.ts +103 -94
- package/src/lib/azure/services/servicebus/types.ts +17 -11
- package/src/lib/azure/services/storage/main.ts +113 -114
- package/src/lib/azure/services/storage/types.ts +16 -8
- package/src/lib/azure/types/index.ts +2 -1
- package/src/lib/azure/utils/index.ts +20 -22
- package/src/lib/cloudflare/common/stack.ts +1 -1
- package/dist/src/lib/azure/services/log-analytics-workspace/main.d.ts +0 -30
- package/dist/src/lib/azure/services/log-analytics-workspace/main.js +0 -55
- package/dist/src/lib/azure/services/log-analytics-workspace/types.d.ts +0 -3
- package/src/lib/azure/services/log-analytics-workspace/main.ts +0 -61
- package/src/lib/azure/services/log-analytics-workspace/types.ts +0 -3
- /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.d.ts +0 -0
- /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.js +0 -0
- /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/types.js +0 -0
- /package/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.ts +0 -0
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import {
|
|
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(
|
|
18
|
-
* super(
|
|
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 [
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
46
|
-
resourceGroupName:
|
|
47
|
-
location:
|
|
48
|
-
identity: {
|
|
49
|
-
type:
|
|
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 [
|
|
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
|
-
|
|
62
|
+
return new Topic(`${id}-st`, {
|
|
72
63
|
...props,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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 [
|
|
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
|
-
|
|
79
|
+
return new Queue(`${id}-sq`, {
|
|
92
80
|
...props,
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
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 [
|
|
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
|
-
|
|
100
|
+
return new Subscription(`${id}-ss`, {
|
|
116
101
|
...props,
|
|
117
|
-
|
|
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
|
|
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 [
|
|
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
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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 {
|
|
2
|
-
|
|
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
|
|
4
|
+
export interface ServicebusTopicProps extends TopicArgs {
|
|
9
5
|
}
|
|
10
|
-
export interface ServicebusQueueProps extends
|
|
6
|
+
export interface ServicebusQueueProps extends QueueArgs {
|
|
11
7
|
}
|
|
12
|
-
export interface ServicebusSubscriptionProps extends
|
|
8
|
+
export interface ServicebusSubscriptionProps extends SubscriptionArgs {
|
|
13
9
|
}
|
|
14
|
-
export interface
|
|
10
|
+
export interface ResolveServicebusQueueProps extends GetQueueOutputArgs {
|
|
15
11
|
}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
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 {
|
|
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(
|
|
17
|
-
* super(
|
|
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 [
|
|
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 [
|
|
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):
|
|
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 [
|
|
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):
|
|
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
|
|
54
|
-
*
|
|
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 -
|
|
55
|
+
* @param scope - Pulumi construct scope
|
|
58
56
|
* @param props - SAS options:
|
|
59
|
-
* - start: Optional start date in the format 'YYYY-MM-DD'.
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* @param
|
|
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
|
|
62
|
+
* @returns A Pulumi Output containing the SAS token
|
|
66
63
|
*
|
|
67
|
-
* @see https://
|
|
64
|
+
* @see https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/liststorageaccountsas/
|
|
68
65
|
*/
|
|
69
|
-
generateContainerSasToken(id: string, scope: CommonAzureConstruct, props:
|
|
66
|
+
generateContainerSasToken(id: string, scope: CommonAzureConstruct, props: ContainerSasTokenProps, storageAccount: StorageAccount): pulumi.Output<string>;
|
|
70
67
|
}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
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(
|
|
19
|
-
* super(
|
|
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 [
|
|
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
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
47
|
-
|
|
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
|
|
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 [
|
|
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
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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 [
|
|
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 =
|
|
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
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
|
123
|
-
*
|
|
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 -
|
|
108
|
+
* @param scope - Pulumi construct scope
|
|
127
109
|
* @param props - SAS options:
|
|
128
|
-
* - start: Optional start date in the format 'YYYY-MM-DD'.
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* @param
|
|
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
|
|
115
|
+
* @returns A Pulumi Output containing the SAS token
|
|
135
116
|
*
|
|
136
|
-
* @see https://
|
|
117
|
+
* @see https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/liststorageaccountsas/
|
|
137
118
|
*/
|
|
138
|
-
generateContainerSasToken(id, scope, props, storageAccount
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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 {
|
|
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
|
|
3
|
+
export interface StorageAccountProps extends StorageAccountArgs {
|
|
7
4
|
}
|
|
8
|
-
export interface StorageContainerProps extends BaseAzureConfigProps,
|
|
5
|
+
export interface StorageContainerProps extends BaseAzureConfigProps, BlobContainerArgs {
|
|
9
6
|
}
|
|
10
|
-
export interface StorageBlobProps extends BaseAzureConfigProps,
|
|
7
|
+
export interface StorageBlobProps extends BaseAzureConfigProps, BlobArgs {
|
|
11
8
|
}
|
|
12
|
-
export interface
|
|
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,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 {};
|