@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,18 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Blob,
|
|
3
3
|
BlobContainer,
|
|
4
|
+
BlobServiceProperties,
|
|
4
5
|
HttpProtocol,
|
|
5
6
|
Kind,
|
|
6
7
|
listStorageAccountSAS,
|
|
8
|
+
ManagementPolicy,
|
|
7
9
|
Permissions,
|
|
8
10
|
Services,
|
|
9
11
|
SignedResourceTypes,
|
|
10
12
|
SkuName,
|
|
11
13
|
StorageAccount,
|
|
14
|
+
Table,
|
|
12
15
|
} from '@pulumi/azure-native/storage/index.js'
|
|
13
16
|
import * as pulumi from '@pulumi/pulumi'
|
|
17
|
+
import { ResourceOptions } from '@pulumi/pulumi'
|
|
14
18
|
import { CommonAzureConstruct } from '../../common/index.js'
|
|
15
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
ContainerSasTokenProps,
|
|
21
|
+
ManagementPolicyProps,
|
|
22
|
+
StorageAccountProps,
|
|
23
|
+
StorageBlobProps,
|
|
24
|
+
StorageContainerProps,
|
|
25
|
+
StorageTableProps,
|
|
26
|
+
} from './types.js'
|
|
16
27
|
|
|
17
28
|
/**
|
|
18
29
|
* @classdesc Provides operations on Azure Storage using Pulumi
|
|
@@ -37,16 +48,22 @@ export class AzureStorageManager {
|
|
|
37
48
|
* @param id scoped id of the resource
|
|
38
49
|
* @param scope scope in which this resource is defined
|
|
39
50
|
* @param props storage account properties
|
|
51
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
40
52
|
* @see [Pulumi Azure Native Storage Account]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/storageaccount/}
|
|
41
53
|
*/
|
|
42
|
-
public createStorageAccount(
|
|
54
|
+
public createStorageAccount(
|
|
55
|
+
id: string,
|
|
56
|
+
scope: CommonAzureConstruct,
|
|
57
|
+
props: StorageAccountProps,
|
|
58
|
+
resourceOptions?: ResourceOptions
|
|
59
|
+
) {
|
|
43
60
|
if (!props) throw `Props undefined for ${id}`
|
|
44
61
|
|
|
45
62
|
const resourceGroupName = scope.props.resourceGroupName
|
|
46
63
|
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
47
64
|
: `${props.resourceGroupName}`
|
|
48
65
|
|
|
49
|
-
|
|
66
|
+
const storageAccount = new StorageAccount(
|
|
50
67
|
`${id}-sa`,
|
|
51
68
|
{
|
|
52
69
|
...props,
|
|
@@ -54,6 +71,7 @@ export class AzureStorageManager {
|
|
|
54
71
|
.format(props.accountName?.toString(), scope.props.resourceNameOptions?.storageAccount)
|
|
55
72
|
.replace(/\W/g, '')
|
|
56
73
|
.toLowerCase(),
|
|
74
|
+
allowBlobPublicAccess: props.allowBlobPublicAccess ?? false,
|
|
57
75
|
resourceGroupName,
|
|
58
76
|
sku: props.sku ?? {
|
|
59
77
|
name: SkuName.Standard_LRS,
|
|
@@ -64,8 +82,23 @@ export class AzureStorageManager {
|
|
|
64
82
|
environment: scope.props.stage,
|
|
65
83
|
},
|
|
66
84
|
},
|
|
67
|
-
{ parent: scope }
|
|
85
|
+
{ parent: scope, ...resourceOptions }
|
|
68
86
|
)
|
|
87
|
+
|
|
88
|
+
new BlobServiceProperties(`${id}-blob-props`, {
|
|
89
|
+
...props.blobProperties,
|
|
90
|
+
accountName: scope.resourceNameFormatter
|
|
91
|
+
.format(props.accountName?.toString(), scope.props.resourceNameOptions?.storageAccount)
|
|
92
|
+
.replace(/\W/g, '')
|
|
93
|
+
.toLowerCase(),
|
|
94
|
+
resourceGroupName,
|
|
95
|
+
deleteRetentionPolicy: props.blobProperties?.deleteRetentionPolicy ?? {
|
|
96
|
+
enabled: true,
|
|
97
|
+
days: 7,
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
return storageAccount
|
|
69
102
|
}
|
|
70
103
|
|
|
71
104
|
/**
|
|
@@ -73,9 +106,15 @@ export class AzureStorageManager {
|
|
|
73
106
|
* @param id scoped id of the resource
|
|
74
107
|
* @param scope scope in which this resource is defined
|
|
75
108
|
* @param props storage container properties
|
|
109
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
76
110
|
* @see [Pulumi Azure Native Blob Container]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blobcontainer/}
|
|
77
111
|
*/
|
|
78
|
-
public createStorageContainer(
|
|
112
|
+
public createStorageContainer(
|
|
113
|
+
id: string,
|
|
114
|
+
scope: CommonAzureConstruct,
|
|
115
|
+
props: StorageContainerProps,
|
|
116
|
+
resourceOptions?: ResourceOptions
|
|
117
|
+
) {
|
|
79
118
|
if (!props) throw `Props undefined for ${id}`
|
|
80
119
|
|
|
81
120
|
const resourceGroupName = scope.props.resourceGroupName
|
|
@@ -93,7 +132,7 @@ export class AzureStorageManager {
|
|
|
93
132
|
accountName: props.accountName,
|
|
94
133
|
resourceGroupName,
|
|
95
134
|
},
|
|
96
|
-
{ parent: scope }
|
|
135
|
+
{ parent: scope, ...resourceOptions }
|
|
97
136
|
)
|
|
98
137
|
}
|
|
99
138
|
|
|
@@ -102,9 +141,15 @@ export class AzureStorageManager {
|
|
|
102
141
|
* @param id scoped id of the resource
|
|
103
142
|
* @param scope scope in which this resource is defined
|
|
104
143
|
* @param props storage blob properties
|
|
144
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
105
145
|
* @see [Pulumi Azure Native Blob]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blob/}
|
|
106
146
|
*/
|
|
107
|
-
public createStorageBlob(
|
|
147
|
+
public createStorageBlob(
|
|
148
|
+
id: string,
|
|
149
|
+
scope: CommonAzureConstruct,
|
|
150
|
+
props: StorageBlobProps,
|
|
151
|
+
resourceOptions?: ResourceOptions
|
|
152
|
+
) {
|
|
108
153
|
if (!props) throw `Props undefined for ${id}`
|
|
109
154
|
|
|
110
155
|
const resourceGroupName = scope.props.resourceGroupName
|
|
@@ -123,7 +168,7 @@ export class AzureStorageManager {
|
|
|
123
168
|
containerName: `${props.containerName}-${scope.props.stage}`,
|
|
124
169
|
resourceGroupName,
|
|
125
170
|
},
|
|
126
|
-
{ parent: scope }
|
|
171
|
+
{ parent: scope, ...resourceOptions }
|
|
127
172
|
)
|
|
128
173
|
}
|
|
129
174
|
|
|
@@ -140,7 +185,6 @@ export class AzureStorageManager {
|
|
|
140
185
|
* - start: Optional start date in the format 'YYYY-MM-DD'. Defaults to today's date.
|
|
141
186
|
* - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date.
|
|
142
187
|
* @param storageAccount - The storage account resource
|
|
143
|
-
* @param storageContainer - Optional blob container resource
|
|
144
188
|
*
|
|
145
189
|
* @returns A Pulumi Output containing the SAS token
|
|
146
190
|
*
|
|
@@ -173,4 +217,42 @@ export class AzureStorageManager {
|
|
|
173
217
|
})
|
|
174
218
|
.apply(result => result.accountSasToken)
|
|
175
219
|
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @summary Method to create a new storage management policy
|
|
223
|
+
* @param id scoped id of the resource
|
|
224
|
+
* @param scope scope in which this resource is defined
|
|
225
|
+
* @param props storage management policy properties
|
|
226
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
227
|
+
* @see [Pulumi Azure Native Storage Management Policy]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/managementpolicy/}
|
|
228
|
+
*/
|
|
229
|
+
public createManagementPolicy(
|
|
230
|
+
id: string,
|
|
231
|
+
scope: CommonAzureConstruct,
|
|
232
|
+
props: ManagementPolicyProps,
|
|
233
|
+
resourceOptions?: ResourceOptions
|
|
234
|
+
) {
|
|
235
|
+
if (!props) throw `Props undefined for ${id}`
|
|
236
|
+
|
|
237
|
+
return new ManagementPolicy(`${id}`, props, { parent: scope, ...resourceOptions })
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @summary Method to create a new storage table
|
|
242
|
+
* @param id scoped id of the resource
|
|
243
|
+
* @param scope scope in which this resource is defined
|
|
244
|
+
* @param props storage table properties
|
|
245
|
+
* @param resourceOptions Optional settings to control resource behaviour
|
|
246
|
+
* @see [Pulumi Azure Native Storage Table]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/table/}
|
|
247
|
+
*/
|
|
248
|
+
public createTable(
|
|
249
|
+
id: string,
|
|
250
|
+
scope: CommonAzureConstruct,
|
|
251
|
+
props: StorageTableProps,
|
|
252
|
+
resourceOptions?: ResourceOptions
|
|
253
|
+
) {
|
|
254
|
+
if (!props) throw `Props undefined for ${id}`
|
|
255
|
+
|
|
256
|
+
return new Table(`${id}`, props, { parent: scope, ...resourceOptions })
|
|
257
|
+
}
|
|
176
258
|
}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BlobArgs,
|
|
3
3
|
BlobContainerArgs,
|
|
4
|
+
BlobServicePropertiesArgs,
|
|
4
5
|
ListStorageAccountSASArgs,
|
|
6
|
+
ManagementPolicyArgs,
|
|
5
7
|
StorageAccountArgs,
|
|
8
|
+
TableArgs,
|
|
6
9
|
} from '@pulumi/azure-native/storage/index.js'
|
|
7
10
|
import { BaseAzureConfigProps } from '../../types/index.js'
|
|
8
11
|
|
|
9
|
-
export interface StorageAccountProps extends StorageAccountArgs {
|
|
12
|
+
export interface StorageAccountProps extends StorageAccountArgs {
|
|
13
|
+
blobProperties?: BlobServicePropertiesArgs
|
|
14
|
+
}
|
|
10
15
|
|
|
11
|
-
export interface StorageContainerProps extends
|
|
16
|
+
export interface StorageContainerProps extends BlobContainerArgs, BaseAzureConfigProps {}
|
|
12
17
|
|
|
13
18
|
export interface StorageBlobProps extends BaseAzureConfigProps, BlobArgs {}
|
|
14
19
|
|
|
20
|
+
export interface ManagementPolicyProps extends ManagementPolicyArgs {}
|
|
21
|
+
|
|
22
|
+
export interface StorageTableProps extends TableArgs {}
|
|
23
|
+
|
|
15
24
|
export interface ContainerSasTokenProps extends ListStorageAccountSASArgs {
|
|
16
25
|
resourceGroupName: string
|
|
17
26
|
containerName?: string
|
|
@@ -34,7 +34,7 @@ export class CommonCloudflareConstruct extends ComponentResource {
|
|
|
34
34
|
provider: CloudflareProvider
|
|
35
35
|
|
|
36
36
|
constructor(name: string, props: CommonCloudflareStackProps, options?: ComponentResourceOptions) {
|
|
37
|
-
super(`
|
|
37
|
+
super(`cloudflare:${name}`, name, props, options)
|
|
38
38
|
this.props = props
|
|
39
39
|
this.options = options
|
|
40
40
|
this.id = name
|
|
@@ -48,17 +48,12 @@ export class CommonCloudflareStack extends ComponentResource {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
return {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
stage: projectProps.stage,
|
|
58
|
-
stageContextPath: projectProps.stageContextPath,
|
|
59
|
-
subDomain: projectProps.subDomain,
|
|
60
|
-
...this.determineExtraContexts(props),
|
|
61
|
-
...this.determineStageContexts(props),
|
|
51
|
+
...props,
|
|
52
|
+
extraContexts: this.config.getObject('extraContexts'),
|
|
53
|
+
stage: this.config.require('stage'),
|
|
54
|
+
stageContextPath: this.config.require('stageContextPath'),
|
|
55
|
+
...this.determineExtraContexts(),
|
|
56
|
+
...this.determineStageContexts(),
|
|
62
57
|
}
|
|
63
58
|
}
|
|
64
59
|
|
|
@@ -67,22 +62,24 @@ export class CommonCloudflareStack extends ComponentResource {
|
|
|
67
62
|
* - Sets the properties from the extra contexts into cdk node context
|
|
68
63
|
* - Primary use is to have layered config in separate files to enable easier maintenance and readability
|
|
69
64
|
*/
|
|
70
|
-
protected determineExtraContexts(
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
protected determineExtraContexts() {
|
|
66
|
+
const extraContexts = this.config.getObject('extraContexts')
|
|
67
|
+
const debug = this.config.getBoolean('debug')
|
|
68
|
+
if (!extraContexts) {
|
|
69
|
+
if (debug) console.debug(`No additional contexts provided. Using default context properties`)
|
|
73
70
|
return {}
|
|
74
71
|
}
|
|
75
72
|
|
|
76
73
|
let extraContextProps: Record<string, any> = {}
|
|
77
|
-
_.forEach(
|
|
74
|
+
_.forEach(extraContexts, (context: string) => {
|
|
78
75
|
const extraContextPath = path.join(appRoot.path, context)
|
|
79
76
|
|
|
80
|
-
/* scenario where extra context is configured
|
|
77
|
+
/* scenario where extra context is configured but absent in file system */
|
|
81
78
|
if (!fs.existsSync(extraContextPath)) throw `Extra context properties unavailable in path:${extraContextPath}`
|
|
82
79
|
|
|
83
80
|
/* read the extra properties */
|
|
84
81
|
const extraContextPropsBuffer = fs.readFileSync(extraContextPath)
|
|
85
|
-
if (
|
|
82
|
+
if (debug) console.debug(`Adding additional contexts provided in ${extraContextPath}`)
|
|
86
83
|
|
|
87
84
|
/* parse as JSON properties */
|
|
88
85
|
extraContextProps = {
|
|
@@ -98,23 +95,26 @@ export class CommonCloudflareStack extends ComponentResource {
|
|
|
98
95
|
* - Sets the properties from the extra stage contexts into cdk node context
|
|
99
96
|
* - Primary use is to have layered config for each environment which is injected into the context
|
|
100
97
|
*/
|
|
101
|
-
protected determineStageContexts(
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
protected determineStageContexts() {
|
|
99
|
+
const debug = this.config.getBoolean('debug')
|
|
100
|
+
const stage = this.config.require('stage')
|
|
101
|
+
const stageContextPath = this.config.get('stageContextPath')
|
|
102
|
+
const stageContextFilePath = path.join(appRoot.path, stageContextPath ?? 'env', `${stage}.json`)
|
|
103
|
+
|
|
104
|
+
if (isDevStage(stage)) {
|
|
105
|
+
if (debug) console.debug(`Development stage. Using default stage context properties`)
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/* alert default context usage when extra stage config is missing */
|
|
109
109
|
if (!fs.existsSync(stageContextFilePath)) {
|
|
110
|
-
if (
|
|
111
|
-
if (
|
|
110
|
+
if (debug) console.debug(`Stage specific context properties unavailable in path:${stageContextFilePath}`)
|
|
111
|
+
if (debug) console.debug(`Using default stage context properties for ${stage} stage`)
|
|
112
112
|
return {}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
/* read the extra properties */
|
|
116
116
|
const stageContextPropsBuffer = fs.readFileSync(stageContextFilePath)
|
|
117
|
-
if (
|
|
117
|
+
if (debug) console.debug(`Adding additional stage contexts provided in ${stageContextFilePath}`)
|
|
118
118
|
|
|
119
119
|
/* parse as JSON properties */
|
|
120
120
|
return JSON.parse(stageContextPropsBuffer.toString('utf-8'))
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
WorkersRoute,
|
|
7
7
|
WorkersScript,
|
|
8
8
|
} from '@pulumi/cloudflare'
|
|
9
|
+
import _ from 'lodash'
|
|
9
10
|
import { CommonCloudflareConstruct } from '../../common/index.js'
|
|
10
11
|
import {
|
|
11
12
|
WorkerCronTriggerProps,
|
|
@@ -93,7 +94,7 @@ export class CloudflareWorkerManager {
|
|
|
93
94
|
public createWorkerScript(id: string, scope: CommonCloudflareConstruct, props: WorkerScriptProps) {
|
|
94
95
|
if (!props) throw `Props undefined for ${id}`
|
|
95
96
|
|
|
96
|
-
|
|
97
|
+
const script = new WorkersScript(
|
|
97
98
|
id,
|
|
98
99
|
{
|
|
99
100
|
...props,
|
|
@@ -102,6 +103,14 @@ export class CloudflareWorkerManager {
|
|
|
102
103
|
},
|
|
103
104
|
{ parent: scope }
|
|
104
105
|
)
|
|
106
|
+
|
|
107
|
+
if (props.routes) {
|
|
108
|
+
_.forEach(props.routes, (route: WorkerRouteProps) => {
|
|
109
|
+
this.createWorkerRoute(`${id}-route-${route.pattern}`, scope, route)
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return script
|
|
105
114
|
}
|
|
106
115
|
|
|
107
116
|
/**
|
|
@@ -8,8 +8,15 @@ import {
|
|
|
8
8
|
} from '@pulumi/cloudflare'
|
|
9
9
|
|
|
10
10
|
export interface WorkerDomainProps extends WorkersCustomDomainArgs {}
|
|
11
|
+
|
|
11
12
|
export interface WorkerRouteProps extends WorkersRouteArgs {}
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
export interface WorkerScriptProps extends WorkersScriptArgs {
|
|
15
|
+
routes?: WorkerRouteProps[]
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
export interface WorkersKvNamespaceProps extends WorkersKvNamespaceArgs {}
|
|
19
|
+
|
|
14
20
|
export interface WorkersKvProps extends WorkersKvArgs {}
|
|
21
|
+
|
|
15
22
|
export interface WorkerCronTriggerProps extends WorkersCronTriggerArgs {}
|
package/dist/lib/lambda.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const processEvent: (event: any) => {
|
|
2
|
-
body: {
|
|
3
|
-
event: any;
|
|
4
|
-
};
|
|
5
|
-
httpMethod: any;
|
|
6
|
-
id: string;
|
|
7
|
-
message: string;
|
|
8
|
-
origin: any;
|
|
9
|
-
path: any;
|
|
10
|
-
referer: any;
|
|
11
|
-
resource: any;
|
|
12
|
-
source: string;
|
|
13
|
-
sourceId: string | undefined;
|
|
14
|
-
statusCode: number;
|
|
15
|
-
success: boolean;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=lambda.d.ts.map
|
package/dist/lib/lambda.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lambda.d.ts","sourceRoot":"","sources":["../../app/api-destined-function/src/lib/lambda.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,GAAI,OAAO,GAAG;;;;;;;;;;;;;;;CAmBtC,CAAA"}
|
package/dist/lib/lambda.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
-
export const processEvent = (event) => {
|
|
3
|
-
if (!event)
|
|
4
|
-
throw new Error('Invalid Event');
|
|
5
|
-
return {
|
|
6
|
-
body: {
|
|
7
|
-
event: event,
|
|
8
|
-
},
|
|
9
|
-
httpMethod: event.httpMethod,
|
|
10
|
-
id: uuidv4(),
|
|
11
|
-
message: 'Webhook call successful',
|
|
12
|
-
origin: event.headers?.origin,
|
|
13
|
-
path: event.path,
|
|
14
|
-
referer: event.headers?.referer,
|
|
15
|
-
resource: event.resource,
|
|
16
|
-
source: 'custom:api-destined-lambda',
|
|
17
|
-
sourceId: process.env.SOURCE_ID,
|
|
18
|
-
statusCode: 200,
|
|
19
|
-
success: true,
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
exports.handler = async (event, context, callback) => {
|
|
23
|
-
console.log('Event:', JSON.stringify(event));
|
|
24
|
-
console.log('Context:', JSON.stringify(context));
|
|
25
|
-
console.log('Event Records:', JSON.stringify(event.Records));
|
|
26
|
-
return callback(null, processEvent(event));
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=lambda.js.map
|
package/dist/lib/lambda.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lambda.js","sourceRoot":"","sources":["../../app/api-destined-function/src/lib/lambda.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AAEnC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAU,EAAE,EAAE;IACzC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;IAE5C,OAAO;QACL,IAAI,EAAE;YACJ,KAAK,EAAE,KAAK;SACb;QACD,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,EAAE,EAAE,MAAM,EAAE;QACZ,OAAO,EAAE,yBAAyB;QAClC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM;QAC7B,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO;QAC/B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,4BAA4B;QACpC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;QAC/B,UAAU,EAAE,GAAG;QACf,OAAO,EAAE,IAAI;KACd,CAAA;AACH,CAAC,CAAA;AAED,OAAO,CAAC,OAAO,GAAG,KAAK,EAAE,KAAU,EAAE,OAAY,EAAE,QAAa,EAAE,EAAE;IAClE,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;IAC5C,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAChD,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5D,OAAO,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;AAC5C,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["../app/api-destined-function/src/lib/lambda.ts","../app/api-destined-function/src/test/lambda.test.ts"],"version":"5.9.3"}
|