@gradientedge/cdk-utils 10.6.0 → 10.8.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/app/api-destined-function/src/lib/lambda.d.ts +1 -0
- package/dist/app/api-destined-function/src/lib/lambda.d.ts.map +1 -0
- package/dist/app/api-destined-function/src/lib/lambda.js +1 -0
- package/dist/app/api-destined-function/src/lib/lambda.js.map +1 -0
- package/dist/app/api-destined-function/tsconfig.tsbuildinfo +1 -0
- package/dist/src/lib/aws/services/cloudwatch/main.d.ts +11 -11
- package/dist/src/lib/azure/common/constants.d.ts +74 -0
- package/dist/src/lib/azure/common/constants.js +77 -0
- package/dist/src/lib/azure/common/construct.d.ts +15 -3
- package/dist/src/lib/azure/common/construct.js +40 -4
- package/dist/src/lib/azure/common/stack.d.ts +3 -2
- package/dist/src/lib/azure/common/stack.js +25 -42
- package/dist/src/lib/azure/common/types.d.ts +13 -2
- package/dist/src/lib/azure/construct/event-handler/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/event-handler/index.js +2 -0
- package/dist/src/lib/azure/construct/event-handler/main.d.ts +20 -0
- package/dist/src/lib/azure/construct/event-handler/main.js +139 -0
- package/dist/src/lib/azure/construct/event-handler/types.d.ts +35 -0
- package/dist/src/lib/azure/construct/event-handler/types.js +1 -0
- package/dist/src/lib/azure/construct/function-app/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/function-app/index.js +2 -0
- package/dist/src/lib/azure/construct/function-app/main.d.ts +51 -0
- package/dist/src/lib/azure/construct/function-app/main.js +297 -0
- package/dist/src/lib/azure/construct/function-app/types.d.ts +33 -0
- package/dist/src/lib/azure/construct/function-app/types.js +1 -0
- package/dist/src/lib/azure/construct/index.d.ts +6 -0
- package/dist/src/lib/azure/construct/index.js +6 -0
- package/dist/src/lib/azure/construct/rest-api/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/rest-api/index.js +2 -0
- package/dist/src/lib/azure/construct/rest-api/main.d.ts +20 -0
- package/dist/src/lib/azure/construct/rest-api/main.js +172 -0
- package/dist/src/lib/azure/construct/rest-api/types.d.ts +25 -0
- package/dist/src/lib/azure/construct/rest-api/types.js +1 -0
- package/dist/src/lib/azure/construct/rest-api-function/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/rest-api-function/index.js +2 -0
- package/dist/src/lib/azure/construct/rest-api-function/main.d.ts +19 -0
- package/dist/src/lib/azure/construct/rest-api-function/main.js +255 -0
- package/dist/src/lib/azure/construct/rest-api-function/types.d.ts +29 -0
- package/dist/src/lib/azure/construct/rest-api-function/types.js +1 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/index.js +2 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/main.d.ts +12 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/main.js +56 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/types.d.ts +13 -0
- package/dist/src/lib/azure/construct/rest-api-with-cache/types.js +1 -0
- package/dist/src/lib/azure/construct/site-with-webapp/index.d.ts +2 -0
- package/dist/src/lib/azure/construct/site-with-webapp/index.js +2 -0
- package/dist/src/lib/azure/construct/site-with-webapp/main.d.ts +19 -0
- package/dist/src/lib/azure/construct/site-with-webapp/main.js +135 -0
- package/dist/src/lib/azure/construct/site-with-webapp/types.d.ts +30 -0
- package/dist/src/lib/azure/construct/site-with-webapp/types.js +1 -0
- package/dist/src/lib/azure/index.d.ts +1 -0
- package/dist/src/lib/azure/index.js +1 -0
- package/dist/src/lib/azure/services/api-management/main.d.ts +83 -5
- package/dist/src/lib/azure/services/api-management/main.js +114 -148
- package/dist/src/lib/azure/services/api-management/types.d.ts +22 -1
- package/dist/src/lib/azure/services/app-configuration/main.d.ts +13 -1
- package/dist/src/lib/azure/services/app-configuration/main.js +21 -2
- package/dist/src/lib/azure/services/app-service/main.d.ts +5 -2
- package/dist/src/lib/azure/services/app-service/main.js +12 -4
- package/dist/src/lib/azure/services/application-insights/main.d.ts +15 -4
- package/dist/src/lib/azure/services/application-insights/main.js +27 -6
- package/dist/src/lib/azure/services/application-insights/types.d.ts +4 -1
- package/dist/src/lib/azure/services/authorisation/constants.d.ts +13 -0
- package/dist/src/lib/azure/services/authorisation/constants.js +14 -0
- package/dist/src/lib/azure/services/authorisation/index.d.ts +3 -0
- package/dist/src/lib/azure/services/authorisation/index.js +3 -0
- package/dist/src/lib/azure/services/authorisation/main.d.ts +84 -0
- package/dist/src/lib/azure/services/authorisation/main.js +120 -0
- package/dist/src/lib/azure/services/authorisation/types.d.ts +3 -0
- package/dist/src/lib/azure/services/authorisation/types.js +1 -0
- package/dist/src/lib/azure/services/cosmosdb/constants.d.ts +8 -0
- package/dist/src/lib/azure/services/cosmosdb/constants.js +10 -0
- package/dist/src/lib/azure/services/cosmosdb/index.d.ts +1 -0
- package/dist/src/lib/azure/services/cosmosdb/index.js +1 -0
- package/dist/src/lib/azure/services/cosmosdb/main.d.ts +47 -5
- package/dist/src/lib/azure/services/cosmosdb/main.js +77 -8
- package/dist/src/lib/azure/services/cosmosdb/types.d.ts +3 -1
- package/dist/src/lib/azure/services/dns/main.d.ts +9 -4
- package/dist/src/lib/azure/services/dns/main.js +12 -8
- package/dist/src/lib/azure/services/eventgrid/main.d.ts +12 -7
- package/dist/src/lib/azure/services/eventgrid/main.js +18 -19
- package/dist/src/lib/azure/services/function/main.d.ts +16 -3
- package/dist/src/lib/azure/services/function/main.js +122 -8
- package/dist/src/lib/azure/services/function/types.d.ts +3 -4
- package/dist/src/lib/azure/services/index.d.ts +3 -0
- package/dist/src/lib/azure/services/index.js +3 -0
- package/dist/src/lib/azure/services/key-vault/main.d.ts +22 -2
- package/dist/src/lib/azure/services/key-vault/main.js +28 -3
- package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -2
- package/dist/src/lib/azure/services/monitor/main.d.ts +3 -1
- package/dist/src/lib/azure/services/monitor/main.js +3 -2
- package/dist/src/lib/azure/services/operational-insights/main.d.ts +13 -2
- package/dist/src/lib/azure/services/operational-insights/main.js +17 -3
- package/dist/src/lib/azure/services/operational-insights/types.d.ts +3 -1
- package/dist/src/lib/azure/services/portal/error.d.ts +5 -0
- package/dist/src/lib/azure/services/portal/error.js +10 -0
- package/dist/src/lib/azure/services/portal/index.d.ts +4 -0
- package/dist/src/lib/azure/services/portal/index.js +4 -0
- package/dist/src/lib/azure/services/portal/main.d.ts +33 -0
- package/dist/src/lib/azure/services/portal/main.js +51 -0
- package/dist/src/lib/azure/services/portal/renderer.d.ts +11 -0
- package/dist/src/lib/azure/services/portal/renderer.js +156 -0
- package/dist/src/lib/azure/services/portal/types.d.ts +40 -0
- package/dist/src/lib/azure/services/portal/types.js +1 -0
- package/dist/src/lib/azure/services/redis/main.d.ts +4 -2
- package/dist/src/lib/azure/services/redis/main.js +3 -2
- package/dist/src/lib/azure/services/redis/types.d.ts +1 -1
- package/dist/src/lib/azure/services/resource-group/main.d.ts +10 -1
- package/dist/src/lib/azure/services/resource-group/main.js +17 -3
- package/dist/src/lib/azure/services/security-center/index.d.ts +2 -0
- package/dist/src/lib/azure/services/security-center/index.js +2 -0
- package/dist/src/lib/azure/services/security-center/main.d.ts +31 -0
- package/dist/src/lib/azure/services/security-center/main.js +33 -0
- package/dist/src/lib/azure/services/security-center/types.d.ts +3 -0
- package/dist/src/lib/azure/services/security-center/types.js +1 -0
- package/dist/src/lib/azure/services/servicebus/main.d.ts +28 -22
- package/dist/src/lib/azure/services/servicebus/main.js +31 -26
- package/dist/src/lib/azure/services/servicebus/types.d.ts +4 -4
- package/dist/src/lib/azure/services/storage/main.d.ts +26 -5
- package/dist/src/lib/azure/services/storage/main.js +51 -9
- package/dist/src/lib/azure/services/storage/types.d.ts +7 -2
- package/dist/src/lib/cloudflare/common/construct.js +1 -1
- package/dist/src/lib/cloudflare/common/stack.d.ts +2 -2
- package/dist/src/lib/cloudflare/common/stack.js +25 -25
- package/dist/src/lib/cloudflare/services/worker/main.js +8 -1
- package/dist/src/lib/cloudflare/services/worker/types.d.ts +1 -0
- package/package.json +26 -23
- package/src/lib/azure/common/constants.ts +83 -0
- package/src/lib/azure/common/construct.ts +50 -7
- package/src/lib/azure/common/stack.ts +26 -43
- package/src/lib/azure/common/types.ts +14 -2
- package/src/lib/azure/construct/event-handler/index.ts +2 -0
- package/src/lib/azure/construct/event-handler/main.ts +183 -0
- package/src/lib/azure/construct/event-handler/types.ts +49 -0
- package/src/lib/azure/construct/function-app/index.ts +2 -0
- package/src/lib/azure/construct/function-app/main.ts +410 -0
- package/src/lib/azure/construct/function-app/types.ts +45 -0
- package/src/lib/azure/construct/index.ts +6 -0
- package/src/lib/azure/construct/rest-api/index.ts +2 -0
- package/src/lib/azure/construct/rest-api/main.ts +205 -0
- package/src/lib/azure/construct/rest-api/types.ts +33 -0
- package/src/lib/azure/construct/rest-api-function/index.ts +2 -0
- package/src/lib/azure/construct/rest-api-function/main.ts +297 -0
- package/src/lib/azure/construct/rest-api-function/types.ts +39 -0
- package/src/lib/azure/construct/rest-api-with-cache/index.ts +2 -0
- package/src/lib/azure/construct/rest-api-with-cache/main.ts +75 -0
- package/src/lib/azure/construct/rest-api-with-cache/types.ts +15 -0
- package/src/lib/azure/construct/site-with-webapp/index.ts +2 -0
- package/src/lib/azure/construct/site-with-webapp/main.ts +160 -0
- package/src/lib/azure/construct/site-with-webapp/types.ts +33 -0
- package/src/lib/azure/index.ts +1 -0
- package/src/lib/azure/services/api-management/main.ts +168 -152
- package/src/lib/azure/services/api-management/types.ts +30 -1
- package/src/lib/azure/services/app-configuration/main.ts +29 -2
- package/src/lib/azure/services/app-service/main.ts +23 -4
- package/src/lib/azure/services/application-insights/main.ts +46 -7
- package/src/lib/azure/services/application-insights/types.ts +6 -2
- package/src/lib/azure/services/authorisation/constants.ts +13 -0
- package/src/lib/azure/services/authorisation/index.ts +3 -0
- package/src/lib/azure/services/authorisation/main.ts +202 -0
- package/src/lib/azure/services/authorisation/types.ts +3 -0
- package/src/lib/azure/services/cosmosdb/constants.ts +9 -0
- package/src/lib/azure/services/cosmosdb/index.ts +1 -0
- package/src/lib/azure/services/cosmosdb/main.ts +158 -8
- package/src/lib/azure/services/cosmosdb/types.ts +3 -0
- package/src/lib/azure/services/dns/main.ts +33 -8
- package/src/lib/azure/services/eventgrid/main.ts +41 -23
- package/src/lib/azure/services/function/main.ts +155 -9
- package/src/lib/azure/services/function/types.ts +3 -4
- package/src/lib/azure/services/index.ts +3 -0
- package/src/lib/azure/services/key-vault/main.ts +47 -4
- package/src/lib/azure/services/key-vault/types.ts +4 -4
- package/src/lib/azure/services/monitor/main.ts +5 -2
- package/src/lib/azure/services/operational-insights/main.ts +30 -4
- package/src/lib/azure/services/operational-insights/types.ts +3 -1
- package/src/lib/azure/services/portal/error.ts +12 -0
- package/src/lib/azure/services/portal/index.ts +4 -0
- package/src/lib/azure/services/portal/main.ts +81 -0
- package/src/lib/azure/services/portal/renderer.ts +182 -0
- package/src/lib/azure/services/portal/types.ts +45 -0
- package/src/lib/azure/services/redis/main.ts +10 -3
- package/src/lib/azure/services/redis/types.ts +1 -1
- package/src/lib/azure/services/resource-group/main.ts +34 -3
- package/src/lib/azure/services/security-center/index.ts +2 -0
- package/src/lib/azure/services/security-center/main.ts +42 -0
- package/src/lib/azure/services/security-center/types.ts +3 -0
- package/src/lib/azure/services/servicebus/main.ts +61 -30
- package/src/lib/azure/services/servicebus/types.ts +4 -4
- package/src/lib/azure/services/storage/main.ts +91 -9
- package/src/lib/azure/services/storage/types.ts +11 -2
- package/src/lib/cloudflare/common/construct.ts +1 -1
- package/src/lib/cloudflare/common/stack.ts +25 -25
- package/src/lib/cloudflare/services/worker/main.ts +10 -1
- package/src/lib/cloudflare/services/worker/types.ts +8 -1
- package/dist/lib/lambda.d.ts +0 -17
- package/dist/lib/lambda.d.ts.map +0 -1
- package/dist/lib/lambda.js +0 -28
- package/dist/lib/lambda.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ResourceOptions } from '@pulumi/pulumi';
|
|
1
2
|
import { CommonAzureConstruct } from '../../common/index.js';
|
|
2
|
-
import { ResolveServicebusQueueProps,
|
|
3
|
+
import { ResolveServicebusQueueProps, ServiceBusNamespaceProps, ServiceBusQueueProps, ServiceBusSubscriptionProps, ServiceBusTopicProps } from './types.js';
|
|
3
4
|
/**
|
|
4
5
|
* @classdesc Provides operations on Azure Servicebus using Pulumi
|
|
5
6
|
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
@@ -17,45 +18,50 @@ import { ResolveServicebusQueueProps, ServicebusNamespaceProps, ServicebusQueueP
|
|
|
17
18
|
* }
|
|
18
19
|
* ```
|
|
19
20
|
*/
|
|
20
|
-
export declare class
|
|
21
|
+
export declare class AzureServiceBusManager {
|
|
21
22
|
/**
|
|
22
|
-
* @summary Method to create a new
|
|
23
|
+
* @summary Method to create a new service bus namespace
|
|
23
24
|
* @param id scoped id of the resource
|
|
24
25
|
* @param scope scope in which this resource is defined
|
|
25
|
-
* @param props
|
|
26
|
-
* @
|
|
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/}
|
|
27
29
|
*/
|
|
28
|
-
|
|
30
|
+
createServiceBusNamespace(id: string, scope: CommonAzureConstruct, props: ServiceBusNamespaceProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/servicebus/namespace.js").Namespace;
|
|
29
31
|
/**
|
|
30
|
-
* @summary Method to create a new
|
|
32
|
+
* @summary Method to create a new service bus topic
|
|
31
33
|
* @param id scoped id of the resource
|
|
32
34
|
* @param scope scope in which this resource is defined
|
|
33
|
-
* @param props
|
|
34
|
-
* @
|
|
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/}
|
|
35
38
|
*/
|
|
36
|
-
|
|
39
|
+
createServiceBusTopic(id: string, scope: CommonAzureConstruct, props: ServiceBusTopicProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/servicebus/topic.js").Topic;
|
|
37
40
|
/**
|
|
38
|
-
* @summary Method to create a new
|
|
41
|
+
* @summary Method to create a new service bus queue
|
|
39
42
|
* @param id scoped id of the resource
|
|
40
43
|
* @param scope scope in which this resource is defined
|
|
41
|
-
* @param props
|
|
42
|
-
* @
|
|
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/}
|
|
43
47
|
*/
|
|
44
|
-
|
|
48
|
+
createServiceBusQueue(id: string, scope: CommonAzureConstruct, props: ServiceBusQueueProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/servicebus/queue.js").Queue;
|
|
45
49
|
/**
|
|
46
|
-
* @summary Method to create a new
|
|
50
|
+
* @summary Method to create a new service bus subscription
|
|
47
51
|
* @param id scoped id of the resource
|
|
48
52
|
* @param scope scope in which this resource is defined
|
|
49
|
-
* @param props
|
|
50
|
-
* @
|
|
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/}
|
|
51
56
|
*/
|
|
52
|
-
|
|
57
|
+
createServiceBusSubscription(id: string, scope: CommonAzureConstruct, props: ServiceBusSubscriptionProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/servicebus/subscription.js").Subscription;
|
|
53
58
|
/**
|
|
54
|
-
* @summary Method to resolve an existing
|
|
59
|
+
* @summary Method to resolve an existing service bus queue
|
|
55
60
|
* @param id scoped id of the resource
|
|
56
61
|
* @param scope scope in which this resource is defined
|
|
57
|
-
* @param props
|
|
58
|
-
* @
|
|
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/}
|
|
59
65
|
*/
|
|
60
|
-
|
|
66
|
+
resolveServiceBusQueue(id: string, scope: CommonAzureConstruct, props: ResolveServicebusQueueProps, resourceOptions?: ResourceOptions): import("@pulumi/pulumi").Output<import("@pulumi/azure-native/servicebus/getQueue.js").GetQueueResult>;
|
|
61
67
|
}
|
|
@@ -16,15 +16,16 @@ import { getQueueOutput, ManagedServiceIdentityType, Namespace, Queue, SkuName,
|
|
|
16
16
|
* }
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export class
|
|
19
|
+
export class AzureServiceBusManager {
|
|
20
20
|
/**
|
|
21
|
-
* @summary Method to create a new
|
|
21
|
+
* @summary Method to create a new service bus namespace
|
|
22
22
|
* @param id scoped id of the resource
|
|
23
23
|
* @param scope scope in which this resource is defined
|
|
24
|
-
* @param props
|
|
25
|
-
* @
|
|
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/}
|
|
26
27
|
*/
|
|
27
|
-
|
|
28
|
+
createServiceBusNamespace(id, scope, props, resourceOptions) {
|
|
28
29
|
if (!props)
|
|
29
30
|
throw `Props undefined for ${id}`;
|
|
30
31
|
// Get resource group name
|
|
@@ -47,16 +48,17 @@ export class AzureServicebusManager {
|
|
|
47
48
|
tags: props.tags ?? {
|
|
48
49
|
environment: scope.props.stage,
|
|
49
50
|
},
|
|
50
|
-
}, { parent: scope });
|
|
51
|
+
}, { parent: scope, ...resourceOptions });
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
53
|
-
* @summary Method to create a new
|
|
54
|
+
* @summary Method to create a new service bus topic
|
|
54
55
|
* @param id scoped id of the resource
|
|
55
56
|
* @param scope scope in which this resource is defined
|
|
56
|
-
* @param props
|
|
57
|
-
* @
|
|
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/}
|
|
58
60
|
*/
|
|
59
|
-
|
|
61
|
+
createServiceBusTopic(id, scope, props, resourceOptions) {
|
|
60
62
|
if (!props)
|
|
61
63
|
throw `Props undefined for ${id}`;
|
|
62
64
|
return new Topic(`${id}-st`, {
|
|
@@ -64,16 +66,17 @@ export class AzureServicebusManager {
|
|
|
64
66
|
topicName: scope.resourceNameFormatter.format(props.topicName?.toString(), scope.props.resourceNameOptions?.serviceBusTopic),
|
|
65
67
|
namespaceName: props.namespaceName,
|
|
66
68
|
resourceGroupName: props.resourceGroupName,
|
|
67
|
-
}, { parent: scope });
|
|
69
|
+
}, { parent: scope, ...resourceOptions });
|
|
68
70
|
}
|
|
69
71
|
/**
|
|
70
|
-
* @summary Method to create a new
|
|
72
|
+
* @summary Method to create a new service bus queue
|
|
71
73
|
* @param id scoped id of the resource
|
|
72
74
|
* @param scope scope in which this resource is defined
|
|
73
|
-
* @param props
|
|
74
|
-
* @
|
|
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/}
|
|
75
78
|
*/
|
|
76
|
-
|
|
79
|
+
createServiceBusQueue(id, scope, props, resourceOptions) {
|
|
77
80
|
if (!props)
|
|
78
81
|
throw `Props undefined for ${id}`;
|
|
79
82
|
return new Queue(`${id}-sq`, {
|
|
@@ -85,38 +88,40 @@ export class AzureServicebusManager {
|
|
|
85
88
|
requiresDuplicateDetection: props.requiresDuplicateDetection ?? true,
|
|
86
89
|
deadLetteringOnMessageExpiration: props.deadLetteringOnMessageExpiration ?? true,
|
|
87
90
|
defaultMessageTimeToLive: props.defaultMessageTtl ?? 'P2D',
|
|
88
|
-
}, { parent: scope });
|
|
91
|
+
}, { parent: scope, ...resourceOptions });
|
|
89
92
|
}
|
|
90
93
|
/**
|
|
91
|
-
* @summary Method to create a new
|
|
94
|
+
* @summary Method to create a new service bus subscription
|
|
92
95
|
* @param id scoped id of the resource
|
|
93
96
|
* @param scope scope in which this resource is defined
|
|
94
|
-
* @param props
|
|
95
|
-
* @
|
|
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/}
|
|
96
100
|
*/
|
|
97
|
-
|
|
101
|
+
createServiceBusSubscription(id, scope, props, resourceOptions) {
|
|
98
102
|
if (!props)
|
|
99
103
|
throw `Props undefined for ${id}`;
|
|
100
104
|
return new Subscription(`${id}-ss`, {
|
|
101
105
|
...props,
|
|
102
106
|
subscriptionName: scope.resourceNameFormatter.format(props.subscriptionName?.toString(), scope.props.resourceNameOptions?.serviceBusSubscription),
|
|
103
107
|
maxDeliveryCount: props.maxDeliveryCount ?? 1,
|
|
104
|
-
}, { parent: scope });
|
|
108
|
+
}, { parent: scope, ...resourceOptions });
|
|
105
109
|
}
|
|
106
110
|
/**
|
|
107
|
-
* @summary Method to resolve an existing
|
|
111
|
+
* @summary Method to resolve an existing service bus queue
|
|
108
112
|
* @param id scoped id of the resource
|
|
109
113
|
* @param scope scope in which this resource is defined
|
|
110
|
-
* @param props
|
|
111
|
-
* @
|
|
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/}
|
|
112
117
|
*/
|
|
113
|
-
|
|
118
|
+
resolveServiceBusQueue(id, scope, props, resourceOptions) {
|
|
114
119
|
if (!props)
|
|
115
120
|
throw `Props undefined for ${id}`;
|
|
116
121
|
return getQueueOutput({
|
|
117
122
|
queueName: scope.resourceNameFormatter.format(props.queueName?.toString(), scope.props.resourceNameOptions?.serviceBusQueue),
|
|
118
123
|
namespaceName: props.namespaceName,
|
|
119
124
|
resourceGroupName: props.resourceGroupName,
|
|
120
|
-
}, { parent: scope });
|
|
125
|
+
}, { parent: scope, ...resourceOptions });
|
|
121
126
|
}
|
|
122
127
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { GetQueueOutputArgs, NamespaceArgs, QueueArgs, SubscriptionArgs, TopicArgs } from '@pulumi/azure-native/servicebus/index.js';
|
|
2
|
-
export interface
|
|
2
|
+
export interface ServiceBusNamespaceProps extends NamespaceArgs {
|
|
3
3
|
}
|
|
4
|
-
export interface
|
|
4
|
+
export interface ServiceBusTopicProps extends TopicArgs {
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface ServiceBusQueueProps extends QueueArgs {
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface ServiceBusSubscriptionProps extends SubscriptionArgs {
|
|
9
9
|
}
|
|
10
10
|
export interface ResolveServicebusQueueProps extends GetQueueOutputArgs {
|
|
11
11
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { StorageAccount } from '@pulumi/azure-native/storage/index.js';
|
|
2
2
|
import * as pulumi from '@pulumi/pulumi';
|
|
3
|
+
import { ResourceOptions } from '@pulumi/pulumi';
|
|
3
4
|
import { CommonAzureConstruct } from '../../common/index.js';
|
|
4
|
-
import { ContainerSasTokenProps, StorageAccountProps, StorageBlobProps, StorageContainerProps } from './types.js';
|
|
5
|
+
import { ContainerSasTokenProps, ManagementPolicyProps, StorageAccountProps, StorageBlobProps, StorageContainerProps, StorageTableProps } from './types.js';
|
|
5
6
|
/**
|
|
6
7
|
* @classdesc Provides operations on Azure Storage using Pulumi
|
|
7
8
|
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
@@ -25,25 +26,28 @@ export declare class AzureStorageManager {
|
|
|
25
26
|
* @param id scoped id of the resource
|
|
26
27
|
* @param scope scope in which this resource is defined
|
|
27
28
|
* @param props storage account properties
|
|
29
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
28
30
|
* @see [Pulumi Azure Native Storage Account]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/storageaccount/}
|
|
29
31
|
*/
|
|
30
|
-
createStorageAccount(id: string, scope: CommonAzureConstruct, props: StorageAccountProps): import("@pulumi/azure-native/storage/storageAccount.js").StorageAccount;
|
|
32
|
+
createStorageAccount(id: string, scope: CommonAzureConstruct, props: StorageAccountProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/storage/storageAccount.js").StorageAccount;
|
|
31
33
|
/**
|
|
32
34
|
* @summary Method to create a new storage container (blob container)
|
|
33
35
|
* @param id scoped id of the resource
|
|
34
36
|
* @param scope scope in which this resource is defined
|
|
35
37
|
* @param props storage container properties
|
|
38
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
36
39
|
* @see [Pulumi Azure Native Blob Container]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blobcontainer/}
|
|
37
40
|
*/
|
|
38
|
-
createStorageContainer(id: string, scope: CommonAzureConstruct, props: StorageContainerProps): import("@pulumi/azure-native/storage/blobContainer.js").BlobContainer;
|
|
41
|
+
createStorageContainer(id: string, scope: CommonAzureConstruct, props: StorageContainerProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/storage/blobContainer.js").BlobContainer;
|
|
39
42
|
/**
|
|
40
43
|
* @summary Method to create a new storage blob
|
|
41
44
|
* @param id scoped id of the resource
|
|
42
45
|
* @param scope scope in which this resource is defined
|
|
43
46
|
* @param props storage blob properties
|
|
47
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
44
48
|
* @see [Pulumi Azure Native Blob]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blob/}
|
|
45
49
|
*/
|
|
46
|
-
createStorageBlob(id: string, scope: CommonAzureConstruct, props: StorageBlobProps): import("@pulumi/azure-native/storage/blob.js").Blob;
|
|
50
|
+
createStorageBlob(id: string, scope: CommonAzureConstruct, props: StorageBlobProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/storage/blob.js").Blob;
|
|
47
51
|
/**
|
|
48
52
|
* @summary Generates a container-level SAS token for an existing Azure Storage container.
|
|
49
53
|
*
|
|
@@ -57,11 +61,28 @@ export declare class AzureStorageManager {
|
|
|
57
61
|
* - start: Optional start date in the format 'YYYY-MM-DD'. Defaults to today's date.
|
|
58
62
|
* - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date.
|
|
59
63
|
* @param storageAccount - The storage account resource
|
|
60
|
-
* @param storageContainer - Optional blob container resource
|
|
61
64
|
*
|
|
62
65
|
* @returns A Pulumi Output containing the SAS token
|
|
63
66
|
*
|
|
64
67
|
* @see https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/liststorageaccountsas/
|
|
65
68
|
*/
|
|
66
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;
|
|
67
88
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Blob, BlobContainer, HttpProtocol, Kind, listStorageAccountSAS, Permissions, Services, SignedResourceTypes, SkuName, StorageAccount, } from '@pulumi/azure-native/storage/index.js';
|
|
1
|
+
import { Blob, BlobContainer, BlobServiceProperties, HttpProtocol, Kind, listStorageAccountSAS, ManagementPolicy, Permissions, Services, SignedResourceTypes, SkuName, StorageAccount, Table, } from '@pulumi/azure-native/storage/index.js';
|
|
2
2
|
import * as pulumi from '@pulumi/pulumi';
|
|
3
3
|
/**
|
|
4
4
|
* @classdesc Provides operations on Azure Storage using Pulumi
|
|
@@ -23,20 +23,22 @@ export class AzureStorageManager {
|
|
|
23
23
|
* @param id scoped id of the resource
|
|
24
24
|
* @param scope scope in which this resource is defined
|
|
25
25
|
* @param props storage account properties
|
|
26
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
26
27
|
* @see [Pulumi Azure Native Storage Account]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/storageaccount/}
|
|
27
28
|
*/
|
|
28
|
-
createStorageAccount(id, scope, props) {
|
|
29
|
+
createStorageAccount(id, scope, props, resourceOptions) {
|
|
29
30
|
if (!props)
|
|
30
31
|
throw `Props undefined for ${id}`;
|
|
31
32
|
const resourceGroupName = scope.props.resourceGroupName
|
|
32
33
|
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
33
34
|
: `${props.resourceGroupName}`;
|
|
34
|
-
|
|
35
|
+
const storageAccount = new StorageAccount(`${id}-sa`, {
|
|
35
36
|
...props,
|
|
36
37
|
accountName: scope.resourceNameFormatter
|
|
37
38
|
.format(props.accountName?.toString(), scope.props.resourceNameOptions?.storageAccount)
|
|
38
39
|
.replace(/\W/g, '')
|
|
39
40
|
.toLowerCase(),
|
|
41
|
+
allowBlobPublicAccess: props.allowBlobPublicAccess ?? false,
|
|
40
42
|
resourceGroupName,
|
|
41
43
|
sku: props.sku ?? {
|
|
42
44
|
name: SkuName.Standard_LRS,
|
|
@@ -46,16 +48,30 @@ export class AzureStorageManager {
|
|
|
46
48
|
tags: props.tags ?? {
|
|
47
49
|
environment: scope.props.stage,
|
|
48
50
|
},
|
|
49
|
-
}, { parent: scope });
|
|
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;
|
|
50
65
|
}
|
|
51
66
|
/**
|
|
52
67
|
* @summary Method to create a new storage container (blob container)
|
|
53
68
|
* @param id scoped id of the resource
|
|
54
69
|
* @param scope scope in which this resource is defined
|
|
55
70
|
* @param props storage container properties
|
|
71
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
56
72
|
* @see [Pulumi Azure Native Blob Container]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blobcontainer/}
|
|
57
73
|
*/
|
|
58
|
-
createStorageContainer(id, scope, props) {
|
|
74
|
+
createStorageContainer(id, scope, props, resourceOptions) {
|
|
59
75
|
if (!props)
|
|
60
76
|
throw `Props undefined for ${id}`;
|
|
61
77
|
const resourceGroupName = scope.props.resourceGroupName
|
|
@@ -66,16 +82,17 @@ export class AzureStorageManager {
|
|
|
66
82
|
containerName: scope.resourceNameFormatter.format(props.containerName?.toString(), scope.props.resourceNameOptions?.storageContainer),
|
|
67
83
|
accountName: props.accountName,
|
|
68
84
|
resourceGroupName,
|
|
69
|
-
}, { parent: scope });
|
|
85
|
+
}, { parent: scope, ...resourceOptions });
|
|
70
86
|
}
|
|
71
87
|
/**
|
|
72
88
|
* @summary Method to create a new storage blob
|
|
73
89
|
* @param id scoped id of the resource
|
|
74
90
|
* @param scope scope in which this resource is defined
|
|
75
91
|
* @param props storage blob properties
|
|
92
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
76
93
|
* @see [Pulumi Azure Native Blob]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blob/}
|
|
77
94
|
*/
|
|
78
|
-
createStorageBlob(id, scope, props) {
|
|
95
|
+
createStorageBlob(id, scope, props, resourceOptions) {
|
|
79
96
|
if (!props)
|
|
80
97
|
throw `Props undefined for ${id}`;
|
|
81
98
|
const resourceGroupName = scope.props.resourceGroupName
|
|
@@ -87,7 +104,7 @@ export class AzureStorageManager {
|
|
|
87
104
|
accountName: props.accountName,
|
|
88
105
|
containerName: `${props.containerName}-${scope.props.stage}`,
|
|
89
106
|
resourceGroupName,
|
|
90
|
-
}, { parent: scope });
|
|
107
|
+
}, { parent: scope, ...resourceOptions });
|
|
91
108
|
}
|
|
92
109
|
/**
|
|
93
110
|
* @summary Generates a container-level SAS token for an existing Azure Storage container.
|
|
@@ -102,7 +119,6 @@ export class AzureStorageManager {
|
|
|
102
119
|
* - start: Optional start date in the format 'YYYY-MM-DD'. Defaults to today's date.
|
|
103
120
|
* - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date.
|
|
104
121
|
* @param storageAccount - The storage account resource
|
|
105
|
-
* @param storageContainer - Optional blob container resource
|
|
106
122
|
*
|
|
107
123
|
* @returns A Pulumi Output containing the SAS token
|
|
108
124
|
*
|
|
@@ -128,4 +144,30 @@ export class AzureStorageManager {
|
|
|
128
144
|
})
|
|
129
145
|
.apply(result => result.accountSasToken);
|
|
130
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
|
+
}
|
|
131
173
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { BlobArgs, BlobContainerArgs, ListStorageAccountSASArgs, StorageAccountArgs } from '@pulumi/azure-native/storage/index.js';
|
|
1
|
+
import { BlobArgs, BlobContainerArgs, BlobServicePropertiesArgs, ListStorageAccountSASArgs, ManagementPolicyArgs, StorageAccountArgs, TableArgs } from '@pulumi/azure-native/storage/index.js';
|
|
2
2
|
import { BaseAzureConfigProps } from '../../types/index.js';
|
|
3
3
|
export interface StorageAccountProps extends StorageAccountArgs {
|
|
4
|
+
blobProperties?: BlobServicePropertiesArgs;
|
|
4
5
|
}
|
|
5
|
-
export interface StorageContainerProps extends
|
|
6
|
+
export interface StorageContainerProps extends BlobContainerArgs, BaseAzureConfigProps {
|
|
6
7
|
}
|
|
7
8
|
export interface StorageBlobProps extends BaseAzureConfigProps, BlobArgs {
|
|
8
9
|
}
|
|
10
|
+
export interface ManagementPolicyProps extends ManagementPolicyArgs {
|
|
11
|
+
}
|
|
12
|
+
export interface StorageTableProps extends TableArgs {
|
|
13
|
+
}
|
|
9
14
|
export interface ContainerSasTokenProps extends ListStorageAccountSASArgs {
|
|
10
15
|
resourceGroupName: string;
|
|
11
16
|
containerName?: string;
|
|
@@ -18,7 +18,7 @@ export class CommonCloudflareConstruct extends ComponentResource {
|
|
|
18
18
|
zoneManager;
|
|
19
19
|
provider;
|
|
20
20
|
constructor(name, props, options) {
|
|
21
|
-
super(`
|
|
21
|
+
super(`cloudflare:${name}`, name, props, options);
|
|
22
22
|
this.props = props;
|
|
23
23
|
this.options = options;
|
|
24
24
|
this.id = name;
|
|
@@ -29,13 +29,13 @@ export declare class CommonCloudflareStack extends ComponentResource {
|
|
|
29
29
|
* - Sets the properties from the extra contexts into cdk node context
|
|
30
30
|
* - Primary use is to have layered config in separate files to enable easier maintenance and readability
|
|
31
31
|
*/
|
|
32
|
-
protected determineExtraContexts(
|
|
32
|
+
protected determineExtraContexts(): Record<string, any>;
|
|
33
33
|
/**
|
|
34
34
|
* @summary Method to determine extra cdk stage contexts apart from the main context
|
|
35
35
|
* - Sets the properties from the extra stage contexts into cdk node context
|
|
36
36
|
* - Primary use is to have layered config for each environment which is injected into the context
|
|
37
37
|
*/
|
|
38
|
-
protected determineStageContexts(
|
|
38
|
+
protected determineStageContexts(): any;
|
|
39
39
|
/**
|
|
40
40
|
* @summary Determine the fully qualified domain name based on domainName & subDomain
|
|
41
41
|
*/
|
|
@@ -41,17 +41,12 @@ export class CommonCloudflareStack extends ComponentResource {
|
|
|
41
41
|
projectProps = JSON.parse(projectPropsBuffer.toString('utf-8'));
|
|
42
42
|
}
|
|
43
43
|
return {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
stage: projectProps.stage,
|
|
51
|
-
stageContextPath: projectProps.stageContextPath,
|
|
52
|
-
subDomain: projectProps.subDomain,
|
|
53
|
-
...this.determineExtraContexts(props),
|
|
54
|
-
...this.determineStageContexts(props),
|
|
44
|
+
...props,
|
|
45
|
+
extraContexts: this.config.getObject('extraContexts'),
|
|
46
|
+
stage: this.config.require('stage'),
|
|
47
|
+
stageContextPath: this.config.require('stageContextPath'),
|
|
48
|
+
...this.determineExtraContexts(),
|
|
49
|
+
...this.determineStageContexts(),
|
|
55
50
|
};
|
|
56
51
|
}
|
|
57
52
|
/**
|
|
@@ -59,21 +54,23 @@ export class CommonCloudflareStack extends ComponentResource {
|
|
|
59
54
|
* - Sets the properties from the extra contexts into cdk node context
|
|
60
55
|
* - Primary use is to have layered config in separate files to enable easier maintenance and readability
|
|
61
56
|
*/
|
|
62
|
-
determineExtraContexts(
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
determineExtraContexts() {
|
|
58
|
+
const extraContexts = this.config.getObject('extraContexts');
|
|
59
|
+
const debug = this.config.getBoolean('debug');
|
|
60
|
+
if (!extraContexts) {
|
|
61
|
+
if (debug)
|
|
65
62
|
console.debug(`No additional contexts provided. Using default context properties`);
|
|
66
63
|
return {};
|
|
67
64
|
}
|
|
68
65
|
let extraContextProps = {};
|
|
69
|
-
_.forEach(
|
|
66
|
+
_.forEach(extraContexts, (context) => {
|
|
70
67
|
const extraContextPath = path.join(appRoot.path, context);
|
|
71
|
-
/* scenario where extra context is configured
|
|
68
|
+
/* scenario where extra context is configured but absent in file system */
|
|
72
69
|
if (!fs.existsSync(extraContextPath))
|
|
73
70
|
throw `Extra context properties unavailable in path:${extraContextPath}`;
|
|
74
71
|
/* read the extra properties */
|
|
75
72
|
const extraContextPropsBuffer = fs.readFileSync(extraContextPath);
|
|
76
|
-
if (
|
|
73
|
+
if (debug)
|
|
77
74
|
console.debug(`Adding additional contexts provided in ${extraContextPath}`);
|
|
78
75
|
/* parse as JSON properties */
|
|
79
76
|
extraContextProps = {
|
|
@@ -88,23 +85,26 @@ export class CommonCloudflareStack extends ComponentResource {
|
|
|
88
85
|
* - Sets the properties from the extra stage contexts into cdk node context
|
|
89
86
|
* - Primary use is to have layered config for each environment which is injected into the context
|
|
90
87
|
*/
|
|
91
|
-
determineStageContexts(
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
determineStageContexts() {
|
|
89
|
+
const debug = this.config.getBoolean('debug');
|
|
90
|
+
const stage = this.config.require('stage');
|
|
91
|
+
const stageContextPath = this.config.get('stageContextPath');
|
|
92
|
+
const stageContextFilePath = path.join(appRoot.path, stageContextPath ?? 'env', `${stage}.json`);
|
|
93
|
+
if (isDevStage(stage)) {
|
|
94
|
+
if (debug)
|
|
95
95
|
console.debug(`Development stage. Using default stage context properties`);
|
|
96
96
|
}
|
|
97
97
|
/* alert default context usage when extra stage config is missing */
|
|
98
98
|
if (!fs.existsSync(stageContextFilePath)) {
|
|
99
|
-
if (
|
|
99
|
+
if (debug)
|
|
100
100
|
console.debug(`Stage specific context properties unavailable in path:${stageContextFilePath}`);
|
|
101
|
-
if (
|
|
102
|
-
console.debug(`Using default stage context properties for ${
|
|
101
|
+
if (debug)
|
|
102
|
+
console.debug(`Using default stage context properties for ${stage} stage`);
|
|
103
103
|
return {};
|
|
104
104
|
}
|
|
105
105
|
/* read the extra properties */
|
|
106
106
|
const stageContextPropsBuffer = fs.readFileSync(stageContextFilePath);
|
|
107
|
-
if (
|
|
107
|
+
if (debug)
|
|
108
108
|
console.debug(`Adding additional stage contexts provided in ${stageContextFilePath}`);
|
|
109
109
|
/* parse as JSON properties */
|
|
110
110
|
return JSON.parse(stageContextPropsBuffer.toString('utf-8'));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WorkersCronTrigger, WorkersCustomDomain, WorkersKv, WorkersKvNamespace, WorkersRoute, WorkersScript, } from '@pulumi/cloudflare';
|
|
2
|
+
import _ from 'lodash';
|
|
2
3
|
/**
|
|
3
4
|
* @classdesc Provides operations on Cloudflare Worker
|
|
4
5
|
* - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
|
|
@@ -65,11 +66,17 @@ export class CloudflareWorkerManager {
|
|
|
65
66
|
createWorkerScript(id, scope, props) {
|
|
66
67
|
if (!props)
|
|
67
68
|
throw `Props undefined for ${id}`;
|
|
68
|
-
|
|
69
|
+
const script = new WorkersScript(id, {
|
|
69
70
|
...props,
|
|
70
71
|
accountId: props.accountId ?? scope.props.accountId,
|
|
71
72
|
scriptName: `${props.scriptName}-${scope.props.stage}`,
|
|
72
73
|
}, { parent: scope });
|
|
74
|
+
if (props.routes) {
|
|
75
|
+
_.forEach(props.routes, (route) => {
|
|
76
|
+
this.createWorkerRoute(`${id}-route-${route.pattern}`, scope, route);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return script;
|
|
73
80
|
}
|
|
74
81
|
/**
|
|
75
82
|
* @summary Method to create a new Cloudflare Workers KV Namespace
|
|
@@ -4,6 +4,7 @@ export interface WorkerDomainProps extends WorkersCustomDomainArgs {
|
|
|
4
4
|
export interface WorkerRouteProps extends WorkersRouteArgs {
|
|
5
5
|
}
|
|
6
6
|
export interface WorkerScriptProps extends WorkersScriptArgs {
|
|
7
|
+
routes?: WorkerRouteProps[];
|
|
7
8
|
}
|
|
8
9
|
export interface WorkersKvNamespaceProps extends WorkersKvNamespaceArgs {
|
|
9
10
|
}
|