@gradientedge/cdk-utils 9.45.0 → 9.46.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.
@@ -1,6 +1,7 @@
1
1
  import { ServicePlan } from '@cdktf/provider-azurerm/lib/service-plan';
2
+ import { LinuxWebApp } from '@cdktf/provider-azurerm/lib/linux-web-app';
2
3
  import { CommonAzureConstruct } from '../../common';
3
- import { ServicePlanProps } from './types';
4
+ import { ServicePlanProps, LinuxWebAppProps } from './types';
4
5
  /**
5
6
  * @classdesc Provides operations on Azure App Service
6
7
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
@@ -27,4 +28,12 @@ export declare class AzureAppServiceManager {
27
28
  * @see [CDKTF App service plan Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/appServicePlan.typescript.md}
28
29
  */
29
30
  createAppServicePlan(id: string, scope: CommonAzureConstruct, props: ServicePlanProps): ServicePlan;
31
+ /**
32
+ * @summary Method to create a new web app
33
+ * @param id scoped id of the resource
34
+ * @param scope scope in which this resource is defined
35
+ * @param props web app properties
36
+ * @see [CDKTF Web App Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/linuxWebApp.typescript.md}
37
+ */
38
+ createLinuxWebApp(id: string, scope: CommonAzureConstruct, props: LinuxWebAppProps): LinuxWebApp;
30
39
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AzureAppServiceManager = void 0;
4
4
  const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-resource-group");
5
5
  const service_plan_1 = require("@cdktf/provider-azurerm/lib/service-plan");
6
+ const linux_web_app_1 = require("@cdktf/provider-azurerm/lib/linux-web-app");
6
7
  const utils_1 = require("../../utils");
7
8
  /**
8
9
  * @classdesc Provides operations on Azure App Service
@@ -52,5 +53,44 @@ class AzureAppServiceManager {
52
53
  (0, utils_1.createAzureTfOutput)(`${id}-appServicePlanId`, scope, appServicePlan.id);
53
54
  return appServicePlan;
54
55
  }
56
+ /**
57
+ * @summary Method to create a new web app
58
+ * @param id scoped id of the resource
59
+ * @param scope scope in which this resource is defined
60
+ * @param props web app properties
61
+ * @see [CDKTF Web App Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/linuxWebApp.typescript.md}
62
+ */
63
+ createLinuxWebApp(id, scope, props) {
64
+ if (!props)
65
+ throw `Props undefined for ${id}`;
66
+ const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-as-rg`, {
67
+ name: scope.props.resourceGroupName
68
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
69
+ : `${props.resourceGroupName}`,
70
+ });
71
+ if (!resourceGroup)
72
+ throw `Resource group undefined for ${id}`;
73
+ const linuxWebApp = new linux_web_app_1.LinuxWebApp(scope, `${id}-lwa`, {
74
+ ...props,
75
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.linuxWebApp),
76
+ resourceGroupName: resourceGroup.name,
77
+ httpsOnly: props.httpsOnly || true,
78
+ identity: props.identity || {
79
+ type: 'SystemAssigned',
80
+ },
81
+ siteConfig: {
82
+ ...props.siteConfig,
83
+ alwaysOn: props.siteConfig.alwaysOn || true,
84
+ applicationStack: props.siteConfig.applicationStack || { nodeVersion: '22-lts' },
85
+ },
86
+ tags: props.tags ?? {
87
+ environment: scope.props.stage,
88
+ },
89
+ });
90
+ (0, utils_1.createAzureTfOutput)(`${id}-linuxWebAppName`, scope, linuxWebApp.name);
91
+ (0, utils_1.createAzureTfOutput)(`${id}-linuxWebAppFriendlyUniqueId`, scope, linuxWebApp.friendlyUniqueId);
92
+ (0, utils_1.createAzureTfOutput)(`${id}-linuxWebAppId`, scope, linuxWebApp.id);
93
+ return linuxWebApp;
94
+ }
55
95
  }
56
96
  exports.AzureAppServiceManager = AzureAppServiceManager;
@@ -1,3 +1,6 @@
1
1
  import { ServicePlanConfig } from '@cdktf/provider-azurerm/lib/service-plan';
2
+ import { LinuxWebAppConfig } from '@cdktf/provider-azurerm/lib/linux-web-app';
2
3
  export interface ServicePlanProps extends ServicePlanConfig {
3
4
  }
5
+ export interface LinuxWebAppProps extends LinuxWebAppConfig {
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "9.45.0",
3
+ "version": "9.46.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -1,8 +1,9 @@
1
1
  import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group'
2
2
  import { ServicePlan } from '@cdktf/provider-azurerm/lib/service-plan'
3
+ import { LinuxWebApp } from '@cdktf/provider-azurerm/lib/linux-web-app'
3
4
  import { CommonAzureConstruct } from '../../common'
4
5
  import { createAzureTfOutput } from '../../utils'
5
- import { ServicePlanProps } from './types'
6
+ import { ServicePlanProps, LinuxWebAppProps } from './types'
6
7
 
7
8
  /**
8
9
  * @classdesc Provides operations on Azure App Service
@@ -55,4 +56,48 @@ export class AzureAppServiceManager {
55
56
 
56
57
  return appServicePlan
57
58
  }
59
+
60
+ /**
61
+ * @summary Method to create a new web app
62
+ * @param id scoped id of the resource
63
+ * @param scope scope in which this resource is defined
64
+ * @param props web app properties
65
+ * @see [CDKTF Web App Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/linuxWebApp.typescript.md}
66
+ */
67
+ public createLinuxWebApp(id: string, scope: CommonAzureConstruct, props: LinuxWebAppProps) {
68
+ if (!props) throw `Props undefined for ${id}`
69
+
70
+ const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-as-rg`, {
71
+ name: scope.props.resourceGroupName
72
+ ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
73
+ : `${props.resourceGroupName}`,
74
+ })
75
+
76
+ if (!resourceGroup) throw `Resource group undefined for ${id}`
77
+
78
+ const linuxWebApp = new LinuxWebApp(scope, `${id}-lwa`, {
79
+ ...props,
80
+ name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.linuxWebApp),
81
+ resourceGroupName: resourceGroup.name,
82
+ httpsOnly: props.httpsOnly || true,
83
+
84
+ identity: props.identity || {
85
+ type: 'SystemAssigned',
86
+ },
87
+ siteConfig: {
88
+ ...props.siteConfig,
89
+ alwaysOn: props.siteConfig.alwaysOn || true,
90
+ applicationStack: props.siteConfig.applicationStack || { nodeVersion: '22-lts' },
91
+ },
92
+ tags: props.tags ?? {
93
+ environment: scope.props.stage,
94
+ },
95
+ })
96
+
97
+ createAzureTfOutput(`${id}-linuxWebAppName`, scope, linuxWebApp.name)
98
+ createAzureTfOutput(`${id}-linuxWebAppFriendlyUniqueId`, scope, linuxWebApp.friendlyUniqueId)
99
+ createAzureTfOutput(`${id}-linuxWebAppId`, scope, linuxWebApp.id)
100
+
101
+ return linuxWebApp
102
+ }
58
103
  }
@@ -1,3 +1,6 @@
1
1
  import { ServicePlanConfig } from '@cdktf/provider-azurerm/lib/service-plan'
2
+ import { LinuxWebAppConfig } from '@cdktf/provider-azurerm/lib/linux-web-app'
2
3
 
3
4
  export interface ServicePlanProps extends ServicePlanConfig {}
5
+
6
+ export interface LinuxWebAppProps extends LinuxWebAppConfig {}