@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.
Files changed (59) hide show
  1. package/app/api-destined-function/package.json +1 -1
  2. package/dist/src/lib/azure/common/constants.d.ts +4 -0
  3. package/dist/src/lib/azure/common/constants.js +8 -0
  4. package/dist/src/lib/azure/common/construct.d.ts +8 -1
  5. package/dist/src/lib/azure/common/construct.js +36 -0
  6. package/dist/src/lib/azure/common/index.d.ts +1 -0
  7. package/dist/src/lib/azure/common/index.js +1 -0
  8. package/dist/src/lib/azure/common/stack.d.ts +1 -0
  9. package/dist/src/lib/azure/common/stack.js +1 -3
  10. package/dist/src/lib/azure/common/types.d.ts +6 -0
  11. package/dist/src/lib/azure/services/api-management/index.d.ts +2 -0
  12. package/dist/src/lib/azure/services/api-management/index.js +18 -0
  13. package/dist/src/lib/azure/services/api-management/main.d.ts +30 -0
  14. package/dist/src/lib/azure/services/api-management/main.js +56 -0
  15. package/dist/src/lib/azure/services/api-management/types.d.ts +3 -0
  16. package/dist/src/lib/azure/services/api-management/types.js +2 -0
  17. package/dist/src/lib/azure/services/function/index.d.ts +2 -0
  18. package/dist/src/lib/azure/services/function/index.js +18 -0
  19. package/dist/src/lib/azure/services/function/main.d.ts +39 -0
  20. package/dist/src/lib/azure/services/function/main.js +88 -0
  21. package/dist/src/lib/azure/services/function/types.d.ts +8 -0
  22. package/dist/src/lib/azure/services/function/types.js +2 -0
  23. package/dist/src/lib/azure/services/index.d.ts +4 -0
  24. package/dist/src/lib/azure/services/index.js +4 -0
  25. package/dist/src/lib/azure/services/key-vault/index.d.ts +2 -0
  26. package/dist/src/lib/azure/services/key-vault/index.js +18 -0
  27. package/dist/src/lib/azure/services/key-vault/main.d.ts +30 -0
  28. package/dist/src/lib/azure/services/key-vault/main.js +58 -0
  29. package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -0
  30. package/dist/src/lib/azure/services/key-vault/types.js +2 -0
  31. package/dist/src/lib/azure/services/resource-group/index.d.ts +2 -0
  32. package/dist/src/lib/azure/services/resource-group/index.js +18 -0
  33. package/dist/src/lib/azure/services/resource-group/main.d.ts +30 -0
  34. package/dist/src/lib/azure/services/resource-group/main.js +48 -0
  35. package/dist/src/lib/azure/services/resource-group/types.d.ts +3 -0
  36. package/dist/src/lib/azure/services/resource-group/types.js +2 -0
  37. package/dist/src/lib/azure/services/storage/main.d.ts +6 -3
  38. package/dist/src/lib/azure/services/storage/main.js +3 -0
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +24 -24
  41. package/src/lib/azure/common/constants.ts +4 -0
  42. package/src/lib/azure/common/construct.ts +45 -2
  43. package/src/lib/azure/common/index.ts +1 -0
  44. package/src/lib/azure/common/stack.ts +1 -3
  45. package/src/lib/azure/common/types.ts +7 -0
  46. package/src/lib/azure/services/api-management/index.ts +2 -0
  47. package/src/lib/azure/services/api-management/main.ts +58 -0
  48. package/src/lib/azure/services/api-management/types.ts +3 -0
  49. package/src/lib/azure/services/function/index.ts +2 -0
  50. package/src/lib/azure/services/function/main.ts +95 -0
  51. package/src/lib/azure/services/function/types.ts +9 -0
  52. package/src/lib/azure/services/index.ts +4 -0
  53. package/src/lib/azure/services/key-vault/index.ts +2 -0
  54. package/src/lib/azure/services/key-vault/main.ts +60 -0
  55. package/src/lib/azure/services/key-vault/types.ts +3 -0
  56. package/src/lib/azure/services/resource-group/index.ts +2 -0
  57. package/src/lib/azure/services/resource-group/main.ts +49 -0
  58. package/src/lib/azure/services/resource-group/types.ts +3 -0
  59. 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
+ }
@@ -0,0 +1,3 @@
1
+ import { ResourceGroupConfig } from '@cdktf/provider-azurerm/lib/resource-group'
2
+
3
+ export interface ResourceGroupProps extends ResourceGroupConfig {}
@@ -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
  }