@gradientedge/cdk-utils 9.30.0 → 9.32.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/app/api-destined-function/package.json +1 -1
- package/dist/src/lib/azure/common/constants.d.ts +4 -0
- package/dist/src/lib/azure/common/constants.js +8 -0
- package/dist/src/lib/azure/common/construct.d.ts +8 -1
- package/dist/src/lib/azure/common/construct.js +36 -0
- package/dist/src/lib/azure/common/index.d.ts +1 -0
- package/dist/src/lib/azure/common/index.js +1 -0
- package/dist/src/lib/azure/common/stack.d.ts +1 -0
- package/dist/src/lib/azure/common/stack.js +1 -3
- package/dist/src/lib/azure/common/types.d.ts +6 -0
- package/dist/src/lib/azure/services/api-management/index.d.ts +2 -0
- package/dist/src/lib/azure/services/api-management/index.js +18 -0
- package/dist/src/lib/azure/services/api-management/main.d.ts +30 -0
- package/dist/src/lib/azure/services/api-management/main.js +56 -0
- package/dist/src/lib/azure/services/api-management/types.d.ts +3 -0
- package/dist/src/lib/azure/services/api-management/types.js +2 -0
- package/dist/src/lib/azure/services/function/index.d.ts +2 -0
- package/dist/src/lib/azure/services/function/index.js +18 -0
- package/dist/src/lib/azure/services/function/main.d.ts +39 -0
- package/dist/src/lib/azure/services/function/main.js +88 -0
- package/dist/src/lib/azure/services/function/types.d.ts +8 -0
- package/dist/src/lib/azure/services/function/types.js +2 -0
- package/dist/src/lib/azure/services/index.d.ts +4 -0
- package/dist/src/lib/azure/services/index.js +4 -0
- package/dist/src/lib/azure/services/key-vault/index.d.ts +2 -0
- package/dist/src/lib/azure/services/key-vault/index.js +18 -0
- package/dist/src/lib/azure/services/key-vault/main.d.ts +30 -0
- package/dist/src/lib/azure/services/key-vault/main.js +58 -0
- package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -0
- package/dist/src/lib/azure/services/key-vault/types.js +2 -0
- package/dist/src/lib/azure/services/resource-group/index.d.ts +2 -0
- package/dist/src/lib/azure/services/resource-group/index.js +18 -0
- package/dist/src/lib/azure/services/resource-group/main.d.ts +30 -0
- package/dist/src/lib/azure/services/resource-group/main.js +48 -0
- package/dist/src/lib/azure/services/resource-group/types.d.ts +3 -0
- package/dist/src/lib/azure/services/resource-group/types.js +2 -0
- package/dist/src/lib/azure/services/storage/main.d.ts +6 -3
- package/dist/src/lib/azure/services/storage/main.js +3 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -24
- package/src/lib/azure/common/constants.ts +4 -0
- package/src/lib/azure/common/construct.ts +45 -2
- package/src/lib/azure/common/index.ts +1 -0
- package/src/lib/azure/common/stack.ts +1 -3
- package/src/lib/azure/common/types.ts +7 -0
- package/src/lib/azure/services/api-management/index.ts +2 -0
- package/src/lib/azure/services/api-management/main.ts +58 -0
- package/src/lib/azure/services/api-management/types.ts +3 -0
- package/src/lib/azure/services/function/index.ts +2 -0
- package/src/lib/azure/services/function/main.ts +95 -0
- package/src/lib/azure/services/function/types.ts +9 -0
- package/src/lib/azure/services/index.ts +4 -0
- package/src/lib/azure/services/key-vault/index.ts +2 -0
- package/src/lib/azure/services/key-vault/main.ts +60 -0
- package/src/lib/azure/services/key-vault/types.ts +3 -0
- package/src/lib/azure/services/resource-group/index.ts +2 -0
- package/src/lib/azure/services/resource-group/main.ts +49 -0
- package/src/lib/azure/services/resource-group/types.ts +3 -0
- package/src/lib/azure/services/storage/main.ts +6 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ResourceGroup } from '@cdktf/provider-azurerm/lib/resource-group'
|
|
2
|
+
import { CommonAzureConstruct } from '../../common'
|
|
3
|
+
import { createAzureTfOutput } from '../../utils'
|
|
4
|
+
import { ResourceGroupProps } from './types'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @classdesc Provides operations on Azure Resource Group
|
|
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
|
+
* ```
|
|
12
|
+
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
13
|
+
*
|
|
14
|
+
* class CustomConstruct extends CommonAzureConstruct {
|
|
15
|
+
* constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
|
|
16
|
+
* super(parent, id, props)
|
|
17
|
+
* this.props = props
|
|
18
|
+
* this.resourceGroupManager.createResourceGroup('MyResourceGroup', this, props)
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export class AzureResourceGroupManager {
|
|
24
|
+
/**
|
|
25
|
+
* @summary Method to create a new resource group
|
|
26
|
+
* @param id scoped id of the resource
|
|
27
|
+
* @param scope scope in which this resource is defined
|
|
28
|
+
* @param props resource group properties
|
|
29
|
+
* @see [CDKTF Resource Group Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/resourceGroup.typescript.md}
|
|
30
|
+
*/
|
|
31
|
+
public createResourceGroup(id: string, scope: CommonAzureConstruct, props: ResourceGroupProps) {
|
|
32
|
+
if (!props) throw `Props undefined for ${id}`
|
|
33
|
+
|
|
34
|
+
const resourceGroup = new ResourceGroup(scope, `${id}-rg`, {
|
|
35
|
+
...props,
|
|
36
|
+
name: props.name,
|
|
37
|
+
location: props.location,
|
|
38
|
+
tags: props.tags ?? {
|
|
39
|
+
environment: scope.props.stage,
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
createAzureTfOutput(`${id}-resourceGroupName`, scope, resourceGroup.name)
|
|
44
|
+
createAzureTfOutput(`${id}-resourceGroupFriendlyUniqueId`, scope, resourceGroup.friendlyUniqueId)
|
|
45
|
+
createAzureTfOutput(`${id}-resourceGroupId`, scope, resourceGroup.id)
|
|
46
|
+
|
|
47
|
+
return resourceGroup
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -58,6 +58,8 @@ export class AzureStorageManager {
|
|
|
58
58
|
createAzureTfOutput(`${id}-storageAccountName`, scope, storageAccount.name)
|
|
59
59
|
createAzureTfOutput(`${id}-storageAccountFriendlyUniqueId`, scope, storageAccount.friendlyUniqueId)
|
|
60
60
|
createAzureTfOutput(`${id}-storageAccountId`, scope, storageAccount.id)
|
|
61
|
+
|
|
62
|
+
return storageAccount
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
/**
|
|
@@ -92,6 +94,8 @@ export class AzureStorageManager {
|
|
|
92
94
|
createAzureTfOutput(`${id}-storageContainerName`, scope, storageContainer.name)
|
|
93
95
|
createAzureTfOutput(`${id}-storageContainerFriendlyUniqueId`, scope, storageContainer.friendlyUniqueId)
|
|
94
96
|
createAzureTfOutput(`${id}-storageContainerId`, scope, storageContainer.id)
|
|
97
|
+
|
|
98
|
+
return storageContainer
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
/**
|
|
@@ -132,5 +136,7 @@ export class AzureStorageManager {
|
|
|
132
136
|
createAzureTfOutput(`${id}-storageBlobName`, scope, storageBlob.name)
|
|
133
137
|
createAzureTfOutput(`${id}-storageBlobFriendlyUniqueId`, scope, storageBlob.friendlyUniqueId)
|
|
134
138
|
createAzureTfOutput(`${id}-storageBlobId`, scope, storageBlob.id)
|
|
139
|
+
|
|
140
|
+
return storageBlob
|
|
135
141
|
}
|
|
136
142
|
}
|