@gradientedge/cdk-utils-azure 1.0.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/LICENSE +21 -0
- package/dist/src/common/constants.d.ts +83 -0
- package/dist/src/common/constants.js +87 -0
- package/dist/src/common/construct.d.ts +80 -0
- package/dist/src/common/construct.js +128 -0
- package/dist/src/common/index.d.ts +6 -0
- package/dist/src/common/index.js +6 -0
- package/dist/src/common/resource-name-formatter.d.ts +18 -0
- package/dist/src/common/resource-name-formatter.js +34 -0
- package/dist/src/common/stack.d.ts +46 -0
- package/dist/src/common/stack.js +120 -0
- package/dist/src/common/tagging.d.ts +29 -0
- package/dist/src/common/tagging.js +78 -0
- package/dist/src/common/types.d.ts +57 -0
- package/dist/src/common/types.js +1 -0
- package/dist/src/construct/event-handler/index.d.ts +2 -0
- package/dist/src/construct/event-handler/index.js +2 -0
- package/dist/src/construct/event-handler/main.d.ts +61 -0
- package/dist/src/construct/event-handler/main.js +180 -0
- package/dist/src/construct/event-handler/types.d.ts +35 -0
- package/dist/src/construct/event-handler/types.js +1 -0
- package/dist/src/construct/function-app/index.d.ts +2 -0
- package/dist/src/construct/function-app/index.js +2 -0
- package/dist/src/construct/function-app/main.d.ts +128 -0
- package/dist/src/construct/function-app/main.js +374 -0
- package/dist/src/construct/function-app/types.d.ts +33 -0
- package/dist/src/construct/function-app/types.js +1 -0
- package/dist/src/construct/index.d.ts +6 -0
- package/dist/src/construct/index.js +6 -0
- package/dist/src/construct/rest-api/index.d.ts +2 -0
- package/dist/src/construct/rest-api/index.js +2 -0
- package/dist/src/construct/rest-api/main.d.ts +64 -0
- package/dist/src/construct/rest-api/main.js +216 -0
- package/dist/src/construct/rest-api/types.d.ts +25 -0
- package/dist/src/construct/rest-api/types.js +1 -0
- package/dist/src/construct/rest-api-function/index.d.ts +2 -0
- package/dist/src/construct/rest-api-function/index.js +2 -0
- package/dist/src/construct/rest-api-function/main.d.ts +66 -0
- package/dist/src/construct/rest-api-function/main.js +302 -0
- package/dist/src/construct/rest-api-function/types.d.ts +29 -0
- package/dist/src/construct/rest-api-function/types.js +1 -0
- package/dist/src/construct/rest-api-with-cache/index.d.ts +2 -0
- package/dist/src/construct/rest-api-with-cache/index.js +2 -0
- package/dist/src/construct/rest-api-with-cache/main.d.ts +41 -0
- package/dist/src/construct/rest-api-with-cache/main.js +85 -0
- package/dist/src/construct/rest-api-with-cache/types.d.ts +13 -0
- package/dist/src/construct/rest-api-with-cache/types.js +1 -0
- package/dist/src/construct/site-with-webapp/index.d.ts +2 -0
- package/dist/src/construct/site-with-webapp/index.js +2 -0
- package/dist/src/construct/site-with-webapp/main.d.ts +60 -0
- package/dist/src/construct/site-with-webapp/main.js +176 -0
- package/dist/src/construct/site-with-webapp/types.d.ts +30 -0
- package/dist/src/construct/site-with-webapp/types.js +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +4 -0
- package/dist/src/services/api-management/index.d.ts +2 -0
- package/dist/src/services/api-management/index.js +2 -0
- package/dist/src/services/api-management/main.d.ts +143 -0
- package/dist/src/services/api-management/main.js +244 -0
- package/dist/src/services/api-management/types.d.ts +72 -0
- package/dist/src/services/api-management/types.js +1 -0
- package/dist/src/services/app-configuration/index.d.ts +2 -0
- package/dist/src/services/app-configuration/index.js +2 -0
- package/dist/src/services/app-configuration/main.d.ts +41 -0
- package/dist/src/services/app-configuration/main.js +71 -0
- package/dist/src/services/app-configuration/types.d.ts +3 -0
- package/dist/src/services/app-configuration/types.js +1 -0
- package/dist/src/services/app-service/index.d.ts +2 -0
- package/dist/src/services/app-service/index.js +2 -0
- package/dist/src/services/app-service/main.d.ts +40 -0
- package/dist/src/services/app-service/main.js +90 -0
- package/dist/src/services/app-service/types.d.ts +6 -0
- package/dist/src/services/app-service/types.js +1 -0
- package/dist/src/services/application-insights/index.d.ts +2 -0
- package/dist/src/services/application-insights/index.js +2 -0
- package/dist/src/services/application-insights/main.d.ts +40 -0
- package/dist/src/services/application-insights/main.js +68 -0
- package/dist/src/services/application-insights/types.d.ts +6 -0
- package/dist/src/services/application-insights/types.js +1 -0
- package/dist/src/services/authorisation/constants.d.ts +13 -0
- package/dist/src/services/authorisation/constants.js +14 -0
- package/dist/src/services/authorisation/index.d.ts +3 -0
- package/dist/src/services/authorisation/index.js +3 -0
- package/dist/src/services/authorisation/main.d.ts +84 -0
- package/dist/src/services/authorisation/main.js +120 -0
- package/dist/src/services/authorisation/types.d.ts +3 -0
- package/dist/src/services/authorisation/types.js +1 -0
- package/dist/src/services/cosmosdb/constants.d.ts +8 -0
- package/dist/src/services/cosmosdb/constants.js +10 -0
- package/dist/src/services/cosmosdb/index.d.ts +3 -0
- package/dist/src/services/cosmosdb/index.js +3 -0
- package/dist/src/services/cosmosdb/main.d.ts +87 -0
- package/dist/src/services/cosmosdb/main.js +162 -0
- package/dist/src/services/cosmosdb/types.d.ts +9 -0
- package/dist/src/services/cosmosdb/types.js +1 -0
- package/dist/src/services/dns/index.d.ts +2 -0
- package/dist/src/services/dns/index.js +2 -0
- package/dist/src/services/dns/main.d.ts +58 -0
- package/dist/src/services/dns/main.js +107 -0
- package/dist/src/services/dns/types.d.ts +9 -0
- package/dist/src/services/dns/types.js +1 -0
- package/dist/src/services/eventgrid/index.d.ts +2 -0
- package/dist/src/services/eventgrid/index.js +2 -0
- package/dist/src/services/eventgrid/main.d.ts +69 -0
- package/dist/src/services/eventgrid/main.js +136 -0
- package/dist/src/services/eventgrid/types.d.ts +11 -0
- package/dist/src/services/eventgrid/types.js +1 -0
- package/dist/src/services/function/index.d.ts +2 -0
- package/dist/src/services/function/index.js +2 -0
- package/dist/src/services/function/main.d.ts +60 -0
- package/dist/src/services/function/main.js +223 -0
- package/dist/src/services/function/types.d.ts +20 -0
- package/dist/src/services/function/types.js +1 -0
- package/dist/src/services/index.d.ts +18 -0
- package/dist/src/services/index.js +18 -0
- package/dist/src/services/key-vault/index.d.ts +2 -0
- package/dist/src/services/key-vault/index.js +2 -0
- package/dist/src/services/key-vault/main.d.ts +49 -0
- package/dist/src/services/key-vault/main.js +83 -0
- package/dist/src/services/key-vault/types.d.ts +5 -0
- package/dist/src/services/key-vault/types.js +1 -0
- package/dist/src/services/monitor/index.d.ts +2 -0
- package/dist/src/services/monitor/index.js +2 -0
- package/dist/src/services/monitor/main.d.ts +31 -0
- package/dist/src/services/monitor/main.js +36 -0
- package/dist/src/services/monitor/types.d.ts +3 -0
- package/dist/src/services/monitor/types.js +1 -0
- package/dist/src/services/operational-insights/index.d.ts +2 -0
- package/dist/src/services/operational-insights/index.js +2 -0
- package/dist/src/services/operational-insights/main.d.ts +40 -0
- package/dist/src/services/operational-insights/main.js +64 -0
- package/dist/src/services/operational-insights/types.d.ts +5 -0
- package/dist/src/services/operational-insights/types.js +1 -0
- package/dist/src/services/portal/error.d.ts +5 -0
- package/dist/src/services/portal/error.js +10 -0
- package/dist/src/services/portal/index.d.ts +4 -0
- package/dist/src/services/portal/index.js +4 -0
- package/dist/src/services/portal/main.d.ts +33 -0
- package/dist/src/services/portal/main.js +51 -0
- package/dist/src/services/portal/renderer.d.ts +11 -0
- package/dist/src/services/portal/renderer.js +156 -0
- package/dist/src/services/portal/types.d.ts +40 -0
- package/dist/src/services/portal/types.js +1 -0
- package/dist/src/services/redis/index.d.ts +2 -0
- package/dist/src/services/redis/index.js +2 -0
- package/dist/src/services/redis/main.d.ts +31 -0
- package/dist/src/services/redis/main.js +52 -0
- package/dist/src/services/redis/types.d.ts +3 -0
- package/dist/src/services/redis/types.js +1 -0
- package/dist/src/services/resource-group/index.d.ts +2 -0
- package/dist/src/services/resource-group/index.js +2 -0
- package/dist/src/services/resource-group/main.d.ts +38 -0
- package/dist/src/services/resource-group/main.js +53 -0
- package/dist/src/services/resource-group/types.d.ts +3 -0
- package/dist/src/services/resource-group/types.js +1 -0
- package/dist/src/services/security-center/index.d.ts +2 -0
- package/dist/src/services/security-center/index.js +2 -0
- package/dist/src/services/security-center/main.d.ts +31 -0
- package/dist/src/services/security-center/main.js +33 -0
- package/dist/src/services/security-center/types.d.ts +3 -0
- package/dist/src/services/security-center/types.js +1 -0
- package/dist/src/services/servicebus/index.d.ts +2 -0
- package/dist/src/services/servicebus/index.js +2 -0
- package/dist/src/services/servicebus/main.d.ts +67 -0
- package/dist/src/services/servicebus/main.js +127 -0
- package/dist/src/services/servicebus/types.d.ts +11 -0
- package/dist/src/services/servicebus/types.js +1 -0
- package/dist/src/services/storage/index.d.ts +2 -0
- package/dist/src/services/storage/index.js +2 -0
- package/dist/src/services/storage/main.d.ts +88 -0
- package/dist/src/services/storage/main.js +173 -0
- package/dist/src/services/storage/types.d.ts +20 -0
- package/dist/src/services/storage/types.js +1 -0
- package/dist/src/types/index.d.ts +4 -0
- package/dist/src/types/index.js +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ResourceOptions } from '@pulumi/pulumi';
|
|
2
|
+
import { CommonAzureConstruct } from '../../common/index.js';
|
|
3
|
+
import { ResolveServicebusQueueProps, ServiceBusNamespaceProps, ServiceBusQueueProps, ServiceBusSubscriptionProps, ServiceBusTopicProps } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* @classdesc Provides operations on Azure Servicebus using Pulumi
|
|
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
|
+
* ```typescript
|
|
10
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
11
|
+
*
|
|
12
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
13
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
14
|
+
* super(name, props)
|
|
15
|
+
* this.props = props
|
|
16
|
+
* this.ServicebusManager.createServicebusTopic('MyServicebusTopic', this, props)
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class AzureServiceBusManager {
|
|
22
|
+
/**
|
|
23
|
+
* @summary Method to create a new service bus namespace
|
|
24
|
+
* @param id scoped id of the resource
|
|
25
|
+
* @param scope scope in which this resource is defined
|
|
26
|
+
* @param props service bus namespace properties
|
|
27
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
28
|
+
* @see [Pulumi Azure Native Service Bus Namespace]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/namespace/}
|
|
29
|
+
*/
|
|
30
|
+
createServiceBusNamespace(id: string, scope: CommonAzureConstruct, props: ServiceBusNamespaceProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/servicebus/namespace.js").Namespace;
|
|
31
|
+
/**
|
|
32
|
+
* @summary Method to create a new service bus topic
|
|
33
|
+
* @param id scoped id of the resource
|
|
34
|
+
* @param scope scope in which this resource is defined
|
|
35
|
+
* @param props service bus topic properties
|
|
36
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
37
|
+
* @see [Pulumi Azure Native Service Bus Topic]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/topic/}
|
|
38
|
+
*/
|
|
39
|
+
createServiceBusTopic(id: string, scope: CommonAzureConstruct, props: ServiceBusTopicProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/servicebus/topic.js").Topic;
|
|
40
|
+
/**
|
|
41
|
+
* @summary Method to create a new service bus queue
|
|
42
|
+
* @param id scoped id of the resource
|
|
43
|
+
* @param scope scope in which this resource is defined
|
|
44
|
+
* @param props service bus queue properties
|
|
45
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
46
|
+
* @see [Pulumi Azure Native Service Bus Queue]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/queue/}
|
|
47
|
+
*/
|
|
48
|
+
createServiceBusQueue(id: string, scope: CommonAzureConstruct, props: ServiceBusQueueProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/servicebus/queue.js").Queue;
|
|
49
|
+
/**
|
|
50
|
+
* @summary Method to create a new service bus subscription
|
|
51
|
+
* @param id scoped id of the resource
|
|
52
|
+
* @param scope scope in which this resource is defined
|
|
53
|
+
* @param props service bus subscription properties
|
|
54
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
55
|
+
* @see [Pulumi Azure Native Service Bus Subscription]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/subscription/}
|
|
56
|
+
*/
|
|
57
|
+
createServiceBusSubscription(id: string, scope: CommonAzureConstruct, props: ServiceBusSubscriptionProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/servicebus/subscription.js").Subscription;
|
|
58
|
+
/**
|
|
59
|
+
* @summary Method to resolve an existing service bus queue
|
|
60
|
+
* @param id scoped id of the resource
|
|
61
|
+
* @param scope scope in which this resource is defined
|
|
62
|
+
* @param props service bus queue properties for lookup
|
|
63
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
64
|
+
* @see [Pulumi Azure Native Service Bus Queue Lookup]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/queue/}
|
|
65
|
+
*/
|
|
66
|
+
resolveServiceBusQueue(id: string, scope: CommonAzureConstruct, props: ResolveServicebusQueueProps, resourceOptions?: ResourceOptions): import("@pulumi/pulumi").Output<import("@pulumi/azure-native/servicebus/getQueue.js").GetQueueResult>;
|
|
67
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { getQueueOutput, ManagedServiceIdentityType, Namespace, Queue, SkuName, Subscription, Topic, } from '@pulumi/azure-native/servicebus/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* @classdesc Provides operations on Azure Servicebus using Pulumi
|
|
4
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
5
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
9
|
+
*
|
|
10
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
11
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
12
|
+
* super(name, props)
|
|
13
|
+
* this.props = props
|
|
14
|
+
* this.ServicebusManager.createServicebusTopic('MyServicebusTopic', this, props)
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export class AzureServiceBusManager {
|
|
20
|
+
/**
|
|
21
|
+
* @summary Method to create a new service bus namespace
|
|
22
|
+
* @param id scoped id of the resource
|
|
23
|
+
* @param scope scope in which this resource is defined
|
|
24
|
+
* @param props service bus namespace properties
|
|
25
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
26
|
+
* @see [Pulumi Azure Native Service Bus Namespace]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/namespace/}
|
|
27
|
+
*/
|
|
28
|
+
createServiceBusNamespace(id, scope, props, resourceOptions) {
|
|
29
|
+
if (!props)
|
|
30
|
+
throw `Props undefined for ${id}`;
|
|
31
|
+
// Get resource group name
|
|
32
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
33
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
34
|
+
: props.resourceGroupName;
|
|
35
|
+
if (!resourceGroupName)
|
|
36
|
+
throw `Resource group name undefined for ${id}`;
|
|
37
|
+
return new Namespace(`${id}-sn`, {
|
|
38
|
+
...props,
|
|
39
|
+
namespaceName: scope.resourceNameFormatter.format(props.namespaceName?.toString(), scope.props.resourceNameOptions?.serviceBusNamespace),
|
|
40
|
+
resourceGroupName: resourceGroupName,
|
|
41
|
+
location: props.location ?? scope.props.location,
|
|
42
|
+
identity: props.identity ?? {
|
|
43
|
+
type: ManagedServiceIdentityType.SystemAssigned,
|
|
44
|
+
},
|
|
45
|
+
sku: props.sku ?? {
|
|
46
|
+
name: SkuName.Standard,
|
|
47
|
+
},
|
|
48
|
+
tags: props.tags ?? {
|
|
49
|
+
environment: scope.props.stage,
|
|
50
|
+
},
|
|
51
|
+
}, { parent: scope, ...resourceOptions });
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @summary Method to create a new service bus topic
|
|
55
|
+
* @param id scoped id of the resource
|
|
56
|
+
* @param scope scope in which this resource is defined
|
|
57
|
+
* @param props service bus topic properties
|
|
58
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
59
|
+
* @see [Pulumi Azure Native Service Bus Topic]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/topic/}
|
|
60
|
+
*/
|
|
61
|
+
createServiceBusTopic(id, scope, props, resourceOptions) {
|
|
62
|
+
if (!props)
|
|
63
|
+
throw `Props undefined for ${id}`;
|
|
64
|
+
return new Topic(`${id}-st`, {
|
|
65
|
+
...props,
|
|
66
|
+
topicName: scope.resourceNameFormatter.format(props.topicName?.toString(), scope.props.resourceNameOptions?.serviceBusTopic),
|
|
67
|
+
namespaceName: props.namespaceName,
|
|
68
|
+
resourceGroupName: props.resourceGroupName,
|
|
69
|
+
}, { parent: scope, ...resourceOptions });
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @summary Method to create a new service bus queue
|
|
73
|
+
* @param id scoped id of the resource
|
|
74
|
+
* @param scope scope in which this resource is defined
|
|
75
|
+
* @param props service bus queue properties
|
|
76
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
77
|
+
* @see [Pulumi Azure Native Service Bus Queue]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/queue/}
|
|
78
|
+
*/
|
|
79
|
+
createServiceBusQueue(id, scope, props, resourceOptions) {
|
|
80
|
+
if (!props)
|
|
81
|
+
throw `Props undefined for ${id}`;
|
|
82
|
+
return new Queue(`${id}-sq`, {
|
|
83
|
+
...props,
|
|
84
|
+
queueName: scope.resourceNameFormatter.format(props.queueName?.toString(), scope.props.resourceNameOptions?.serviceBusQueue),
|
|
85
|
+
namespaceName: props.namespaceName,
|
|
86
|
+
resourceGroupName: props.resourceGroupName,
|
|
87
|
+
duplicateDetectionHistoryTimeWindow: props.duplicateDetectionHistoryTimeWindow ?? 'PT1M',
|
|
88
|
+
requiresDuplicateDetection: props.requiresDuplicateDetection ?? true,
|
|
89
|
+
deadLetteringOnMessageExpiration: props.deadLetteringOnMessageExpiration ?? true,
|
|
90
|
+
defaultMessageTimeToLive: props.defaultMessageTtl ?? 'P2D',
|
|
91
|
+
}, { parent: scope, ...resourceOptions });
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @summary Method to create a new service bus subscription
|
|
95
|
+
* @param id scoped id of the resource
|
|
96
|
+
* @param scope scope in which this resource is defined
|
|
97
|
+
* @param props service bus subscription properties
|
|
98
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
99
|
+
* @see [Pulumi Azure Native Service Bus Subscription]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/subscription/}
|
|
100
|
+
*/
|
|
101
|
+
createServiceBusSubscription(id, scope, props, resourceOptions) {
|
|
102
|
+
if (!props)
|
|
103
|
+
throw `Props undefined for ${id}`;
|
|
104
|
+
return new Subscription(`${id}-ss`, {
|
|
105
|
+
...props,
|
|
106
|
+
subscriptionName: scope.resourceNameFormatter.format(props.subscriptionName?.toString(), scope.props.resourceNameOptions?.serviceBusSubscription),
|
|
107
|
+
maxDeliveryCount: props.maxDeliveryCount ?? 1,
|
|
108
|
+
}, { parent: scope, ...resourceOptions });
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @summary Method to resolve an existing service bus queue
|
|
112
|
+
* @param id scoped id of the resource
|
|
113
|
+
* @param scope scope in which this resource is defined
|
|
114
|
+
* @param props service bus queue properties for lookup
|
|
115
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
116
|
+
* @see [Pulumi Azure Native Service Bus Queue Lookup]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/service bus/queue/}
|
|
117
|
+
*/
|
|
118
|
+
resolveServiceBusQueue(id, scope, props, resourceOptions) {
|
|
119
|
+
if (!props)
|
|
120
|
+
throw `Props undefined for ${id}`;
|
|
121
|
+
return getQueueOutput({
|
|
122
|
+
queueName: scope.resourceNameFormatter.format(props.queueName?.toString(), scope.props.resourceNameOptions?.serviceBusQueue),
|
|
123
|
+
namespaceName: props.namespaceName,
|
|
124
|
+
resourceGroupName: props.resourceGroupName,
|
|
125
|
+
}, { parent: scope, ...resourceOptions });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GetQueueOutputArgs, NamespaceArgs, QueueArgs, SubscriptionArgs, TopicArgs } from '@pulumi/azure-native/servicebus/index.js';
|
|
2
|
+
export interface ServiceBusNamespaceProps extends NamespaceArgs {
|
|
3
|
+
}
|
|
4
|
+
export interface ServiceBusTopicProps extends TopicArgs {
|
|
5
|
+
}
|
|
6
|
+
export interface ServiceBusQueueProps extends QueueArgs {
|
|
7
|
+
}
|
|
8
|
+
export interface ServiceBusSubscriptionProps extends SubscriptionArgs {
|
|
9
|
+
}
|
|
10
|
+
export interface ResolveServicebusQueueProps extends GetQueueOutputArgs {
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { StorageAccount } from '@pulumi/azure-native/storage/index.js';
|
|
2
|
+
import * as pulumi from '@pulumi/pulumi';
|
|
3
|
+
import { ResourceOptions } from '@pulumi/pulumi';
|
|
4
|
+
import { CommonAzureConstruct } from '../../common/index.js';
|
|
5
|
+
import { ContainerSasTokenProps, ManagementPolicyProps, StorageAccountProps, StorageBlobProps, StorageContainerProps, StorageTableProps } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* @classdesc Provides operations on Azure Storage using Pulumi
|
|
8
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
9
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
13
|
+
*
|
|
14
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
15
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
16
|
+
* super(name, props)
|
|
17
|
+
* this.props = props
|
|
18
|
+
* this.storageManager.createStorageAccount('MyAccount', this, props)
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class AzureStorageManager {
|
|
24
|
+
/**
|
|
25
|
+
* @summary Method to create a new storage account
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param scope scope in which this resource is defined
|
|
28
|
+
* @param props storage account properties
|
|
29
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
30
|
+
* @see [Pulumi Azure Native Storage Account]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/storageaccount/}
|
|
31
|
+
*/
|
|
32
|
+
createStorageAccount(id: string, scope: CommonAzureConstruct, props: StorageAccountProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/storage/storageAccount.js").StorageAccount;
|
|
33
|
+
/**
|
|
34
|
+
* @summary Method to create a new storage container (blob container)
|
|
35
|
+
* @param id scoped id of the resource
|
|
36
|
+
* @param scope scope in which this resource is defined
|
|
37
|
+
* @param props storage container properties
|
|
38
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
39
|
+
* @see [Pulumi Azure Native Blob Container]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blobcontainer/}
|
|
40
|
+
*/
|
|
41
|
+
createStorageContainer(id: string, scope: CommonAzureConstruct, props: StorageContainerProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/storage/blobContainer.js").BlobContainer;
|
|
42
|
+
/**
|
|
43
|
+
* @summary Method to create a new storage blob
|
|
44
|
+
* @param id scoped id of the resource
|
|
45
|
+
* @param scope scope in which this resource is defined
|
|
46
|
+
* @param props storage blob properties
|
|
47
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
48
|
+
* @see [Pulumi Azure Native Blob]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blob/}
|
|
49
|
+
*/
|
|
50
|
+
createStorageBlob(id: string, scope: CommonAzureConstruct, props: StorageBlobProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/storage/blob.js").Blob;
|
|
51
|
+
/**
|
|
52
|
+
* @summary Generates a container-level SAS token for an existing Azure Storage container.
|
|
53
|
+
*
|
|
54
|
+
* @description
|
|
55
|
+
* This method generates a Shared Access Signature (SAS) token for secure container access.
|
|
56
|
+
* The token is generated using Pulumi's listStorageAccountSAS function.
|
|
57
|
+
*
|
|
58
|
+
* @param id - Unique scoped identifier for the SAS token resource
|
|
59
|
+
* @param scope - Pulumi construct scope
|
|
60
|
+
* @param props - SAS options:
|
|
61
|
+
* - start: Optional start date in the format 'YYYY-MM-DD'. Defaults to today's date.
|
|
62
|
+
* - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date.
|
|
63
|
+
* @param storageAccount - The storage account resource
|
|
64
|
+
*
|
|
65
|
+
* @returns A Pulumi Output containing the SAS token
|
|
66
|
+
*
|
|
67
|
+
* @see https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/liststorageaccountsas/
|
|
68
|
+
*/
|
|
69
|
+
generateContainerSasToken(id: string, scope: CommonAzureConstruct, props: ContainerSasTokenProps, storageAccount: StorageAccount): pulumi.Output<string>;
|
|
70
|
+
/**
|
|
71
|
+
* @summary Method to create a new storage management policy
|
|
72
|
+
* @param id scoped id of the resource
|
|
73
|
+
* @param scope scope in which this resource is defined
|
|
74
|
+
* @param props storage management policy properties
|
|
75
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
76
|
+
* @see [Pulumi Azure Native Storage Management Policy]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/managementpolicy/}
|
|
77
|
+
*/
|
|
78
|
+
createManagementPolicy(id: string, scope: CommonAzureConstruct, props: ManagementPolicyProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/storage/managementPolicy.js").ManagementPolicy;
|
|
79
|
+
/**
|
|
80
|
+
* @summary Method to create a new storage table
|
|
81
|
+
* @param id scoped id of the resource
|
|
82
|
+
* @param scope scope in which this resource is defined
|
|
83
|
+
* @param props storage table properties
|
|
84
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
85
|
+
* @see [Pulumi Azure Native Storage Table]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/table/}
|
|
86
|
+
*/
|
|
87
|
+
createTable(id: string, scope: CommonAzureConstruct, props: StorageTableProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/storage/table.js").Table;
|
|
88
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Blob, BlobContainer, BlobServiceProperties, HttpProtocol, Kind, listStorageAccountSAS, ManagementPolicy, Permissions, Services, SignedResourceTypes, SkuName, StorageAccount, Table, } from '@pulumi/azure-native/storage/index.js';
|
|
2
|
+
import * as pulumi from '@pulumi/pulumi';
|
|
3
|
+
/**
|
|
4
|
+
* @classdesc Provides operations on Azure Storage using Pulumi
|
|
5
|
+
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
6
|
+
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
10
|
+
*
|
|
11
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
12
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
13
|
+
* super(name, props)
|
|
14
|
+
* this.props = props
|
|
15
|
+
* this.storageManager.createStorageAccount('MyAccount', this, props)
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export class AzureStorageManager {
|
|
21
|
+
/**
|
|
22
|
+
* @summary Method to create a new storage account
|
|
23
|
+
* @param id scoped id of the resource
|
|
24
|
+
* @param scope scope in which this resource is defined
|
|
25
|
+
* @param props storage account properties
|
|
26
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
27
|
+
* @see [Pulumi Azure Native Storage Account]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/storageaccount/}
|
|
28
|
+
*/
|
|
29
|
+
createStorageAccount(id, scope, props, resourceOptions) {
|
|
30
|
+
if (!props)
|
|
31
|
+
throw `Props undefined for ${id}`;
|
|
32
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
33
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
34
|
+
: `${props.resourceGroupName}`;
|
|
35
|
+
const storageAccount = new StorageAccount(`${id}-sa`, {
|
|
36
|
+
...props,
|
|
37
|
+
accountName: scope.resourceNameFormatter
|
|
38
|
+
.format(props.accountName?.toString(), scope.props.resourceNameOptions?.storageAccount)
|
|
39
|
+
.replace(/\W/g, '')
|
|
40
|
+
.toLowerCase(),
|
|
41
|
+
allowBlobPublicAccess: props.allowBlobPublicAccess ?? false,
|
|
42
|
+
resourceGroupName,
|
|
43
|
+
sku: props.sku ?? {
|
|
44
|
+
name: SkuName.Standard_LRS,
|
|
45
|
+
},
|
|
46
|
+
kind: props.kind ?? Kind.StorageV2,
|
|
47
|
+
location: props.location ?? scope.props.location,
|
|
48
|
+
tags: props.tags ?? {
|
|
49
|
+
environment: scope.props.stage,
|
|
50
|
+
},
|
|
51
|
+
}, { parent: scope, ...resourceOptions });
|
|
52
|
+
new BlobServiceProperties(`${id}-blob-props`, {
|
|
53
|
+
...props.blobProperties,
|
|
54
|
+
accountName: scope.resourceNameFormatter
|
|
55
|
+
.format(props.accountName?.toString(), scope.props.resourceNameOptions?.storageAccount)
|
|
56
|
+
.replace(/\W/g, '')
|
|
57
|
+
.toLowerCase(),
|
|
58
|
+
resourceGroupName,
|
|
59
|
+
deleteRetentionPolicy: props.blobProperties?.deleteRetentionPolicy ?? {
|
|
60
|
+
enabled: true,
|
|
61
|
+
days: 7,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
return storageAccount;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @summary Method to create a new storage container (blob container)
|
|
68
|
+
* @param id scoped id of the resource
|
|
69
|
+
* @param scope scope in which this resource is defined
|
|
70
|
+
* @param props storage container properties
|
|
71
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
72
|
+
* @see [Pulumi Azure Native Blob Container]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blobcontainer/}
|
|
73
|
+
*/
|
|
74
|
+
createStorageContainer(id, scope, props, resourceOptions) {
|
|
75
|
+
if (!props)
|
|
76
|
+
throw `Props undefined for ${id}`;
|
|
77
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
78
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
79
|
+
: `${props.resourceGroupName}`;
|
|
80
|
+
return new BlobContainer(`${id}-sc`, {
|
|
81
|
+
...props,
|
|
82
|
+
containerName: scope.resourceNameFormatter.format(props.containerName?.toString(), scope.props.resourceNameOptions?.storageContainer),
|
|
83
|
+
accountName: props.accountName,
|
|
84
|
+
resourceGroupName,
|
|
85
|
+
}, { parent: scope, ...resourceOptions });
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @summary Method to create a new storage blob
|
|
89
|
+
* @param id scoped id of the resource
|
|
90
|
+
* @param scope scope in which this resource is defined
|
|
91
|
+
* @param props storage blob properties
|
|
92
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
93
|
+
* @see [Pulumi Azure Native Blob]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blob/}
|
|
94
|
+
*/
|
|
95
|
+
createStorageBlob(id, scope, props, resourceOptions) {
|
|
96
|
+
if (!props)
|
|
97
|
+
throw `Props undefined for ${id}`;
|
|
98
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
99
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
100
|
+
: `${props.resourceGroupName}`;
|
|
101
|
+
return new Blob(`${id}-sb`, {
|
|
102
|
+
...props,
|
|
103
|
+
blobName: scope.resourceNameFormatter.format(props.blobName?.toString(), scope.props.resourceNameOptions?.storageBlob),
|
|
104
|
+
accountName: props.accountName,
|
|
105
|
+
containerName: `${props.containerName}-${scope.props.stage}`,
|
|
106
|
+
resourceGroupName,
|
|
107
|
+
}, { parent: scope, ...resourceOptions });
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @summary Generates a container-level SAS token for an existing Azure Storage container.
|
|
111
|
+
*
|
|
112
|
+
* @description
|
|
113
|
+
* This method generates a Shared Access Signature (SAS) token for secure container access.
|
|
114
|
+
* The token is generated using Pulumi's listStorageAccountSAS function.
|
|
115
|
+
*
|
|
116
|
+
* @param id - Unique scoped identifier for the SAS token resource
|
|
117
|
+
* @param scope - Pulumi construct scope
|
|
118
|
+
* @param props - SAS options:
|
|
119
|
+
* - start: Optional start date in the format 'YYYY-MM-DD'. Defaults to today's date.
|
|
120
|
+
* - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date.
|
|
121
|
+
* @param storageAccount - The storage account resource
|
|
122
|
+
*
|
|
123
|
+
* @returns A Pulumi Output containing the SAS token
|
|
124
|
+
*
|
|
125
|
+
* @see https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/liststorageaccountsas/
|
|
126
|
+
*/
|
|
127
|
+
generateContainerSasToken(id, scope, props, storageAccount) {
|
|
128
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
129
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
130
|
+
: `${props.resourceGroupName}`;
|
|
131
|
+
return pulumi
|
|
132
|
+
.all([storageAccount.name])
|
|
133
|
+
.apply(([accountName]) => {
|
|
134
|
+
return listStorageAccountSAS({
|
|
135
|
+
accountName,
|
|
136
|
+
resourceGroupName,
|
|
137
|
+
protocols: props.httpsOnly === false ? HttpProtocol.Https_http : HttpProtocol.Https,
|
|
138
|
+
sharedAccessStartTime: props.start ?? new Date().toISOString().split('T')[0],
|
|
139
|
+
sharedAccessExpiryTime: props.expiry ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
|
|
140
|
+
permissions: props.permissions ?? Permissions.R,
|
|
141
|
+
services: Services.B,
|
|
142
|
+
resourceTypes: SignedResourceTypes.C,
|
|
143
|
+
});
|
|
144
|
+
})
|
|
145
|
+
.apply(result => result.accountSasToken);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* @summary Method to create a new storage management policy
|
|
149
|
+
* @param id scoped id of the resource
|
|
150
|
+
* @param scope scope in which this resource is defined
|
|
151
|
+
* @param props storage management policy properties
|
|
152
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
153
|
+
* @see [Pulumi Azure Native Storage Management Policy]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/managementpolicy/}
|
|
154
|
+
*/
|
|
155
|
+
createManagementPolicy(id, scope, props, resourceOptions) {
|
|
156
|
+
if (!props)
|
|
157
|
+
throw `Props undefined for ${id}`;
|
|
158
|
+
return new ManagementPolicy(`${id}`, props, { parent: scope, ...resourceOptions });
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @summary Method to create a new storage table
|
|
162
|
+
* @param id scoped id of the resource
|
|
163
|
+
* @param scope scope in which this resource is defined
|
|
164
|
+
* @param props storage table properties
|
|
165
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
166
|
+
* @see [Pulumi Azure Native Storage Table]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/table/}
|
|
167
|
+
*/
|
|
168
|
+
createTable(id, scope, props, resourceOptions) {
|
|
169
|
+
if (!props)
|
|
170
|
+
throw `Props undefined for ${id}`;
|
|
171
|
+
return new Table(`${id}`, props, { parent: scope, ...resourceOptions });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BlobArgs, BlobContainerArgs, BlobServicePropertiesArgs, ListStorageAccountSASArgs, ManagementPolicyArgs, StorageAccountArgs, TableArgs } from '@pulumi/azure-native/storage/index.js';
|
|
2
|
+
import { BaseAzureConfigProps } from '../../types/index.js';
|
|
3
|
+
export interface StorageAccountProps extends StorageAccountArgs {
|
|
4
|
+
blobProperties?: BlobServicePropertiesArgs;
|
|
5
|
+
}
|
|
6
|
+
export interface StorageContainerProps extends BlobContainerArgs, BaseAzureConfigProps {
|
|
7
|
+
}
|
|
8
|
+
export interface StorageBlobProps extends BaseAzureConfigProps, BlobArgs {
|
|
9
|
+
}
|
|
10
|
+
export interface ManagementPolicyProps extends ManagementPolicyArgs {
|
|
11
|
+
}
|
|
12
|
+
export interface StorageTableProps extends TableArgs {
|
|
13
|
+
}
|
|
14
|
+
export interface ContainerSasTokenProps extends ListStorageAccountSASArgs {
|
|
15
|
+
resourceGroupName: string;
|
|
16
|
+
containerName?: string;
|
|
17
|
+
httpsOnly?: boolean;
|
|
18
|
+
start?: string;
|
|
19
|
+
expiry?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gradientedge/cdk-utils-azure",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Azure Pulumi utilities for @gradientedge/cdk-utils",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/src/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/src/index.js",
|
|
10
|
+
"types": "./dist/src/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/src/"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@pulumi/archive": "^0.3.7",
|
|
18
|
+
"@pulumi/azure-native": "^3.16.0",
|
|
19
|
+
"@pulumi/pulumi": "^3.228.0",
|
|
20
|
+
"@types/lodash": "^4.17.24",
|
|
21
|
+
"app-root-path": "^3.1.0",
|
|
22
|
+
"lodash": "^4.17.23",
|
|
23
|
+
"yaml": "^2.8.3",
|
|
24
|
+
"@gradientedge/cdk-utils-common": "1.0.0"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/gradientedge/cdk-utils.git",
|
|
33
|
+
"directory": "packages/azure"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc",
|
|
37
|
+
"build:production": "tsc -p tsconfig.prd.json",
|
|
38
|
+
"test": "vitest run --coverage",
|
|
39
|
+
"lint": "eslint src/**/*.ts --cache --max-warnings=0 --no-warn-ignored"
|
|
40
|
+
}
|
|
41
|
+
}
|