@gradientedge/cdk-utils-azure 1.0.0 → 2.0.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.
@@ -74,7 +74,7 @@ export class CommonAzureConstruct extends ComponentResource {
74
74
  }
75
75
  resolveStack(stackName) {
76
76
  if (!stackName)
77
- throw 'Stack name undefined';
77
+ throw new Error('Stack name undefined');
78
78
  return new pulumi.StackReference(stackName);
79
79
  }
80
80
  createResourceGroup() {
@@ -91,7 +91,7 @@ export class CommonAzureConstruct extends ComponentResource {
91
91
  }
92
92
  resolveCommonLogAnalyticsWorkspace() {
93
93
  if (!this.props.commonLogAnalyticsWorkspace || !this.props.commonLogAnalyticsWorkspace.workspaceName)
94
- throw 'Props undefined for commonLogAnalyticsWorkspace';
94
+ throw new Error('Props undefined for commonLogAnalyticsWorkspace');
95
95
  this.commonLogAnalyticsWorkspace = getWorkspaceOutput({
96
96
  workspaceName: this.props.commonLogAnalyticsWorkspace.workspaceName,
97
97
  resourceGroupName: this.props.commonLogAnalyticsWorkspace.resourceGroupName,
@@ -28,7 +28,7 @@ export class AzureResourceNameFormatter {
28
28
  }
29
29
  azureResourceNameElements.push(this.props.stage);
30
30
  return azureResourceNameElements
31
- .filter(azureResourceNameElements => azureResourceNameElements != undefined)
31
+ .filter(azureResourceNameElements => azureResourceNameElements !== undefined)
32
32
  .join('-');
33
33
  }
34
34
  }
@@ -1,8 +1,8 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
1
3
  import { ComponentResource, Config } from '@pulumi/pulumi';
2
4
  import appRoot from 'app-root-path';
3
- import fs from 'fs';
4
5
  import _ from 'lodash';
5
- import path from 'path';
6
6
  import { isDevStage } from '@gradientedge/cdk-utils-common';
7
7
  import { registerTagTransformation } from './tagging.js';
8
8
  /**
@@ -67,7 +67,7 @@ export class CommonAzureStack extends ComponentResource {
67
67
  const extraContextPath = path.join(appRoot.path, context);
68
68
  /* scenario where extra context is configured but absent in file system */
69
69
  if (!fs.existsSync(extraContextPath))
70
- throw `Extra context properties unavailable in path:${extraContextPath}`;
70
+ throw new Error(`Extra context properties unavailable in path:${extraContextPath}`);
71
71
  /* read the extra properties */
72
72
  const extraContextPropsBuffer = fs.readFileSync(extraContextPath);
73
73
  if (debug)
@@ -1,3 +1,5 @@
1
+ import fs from 'fs';
2
+ import * as path from 'path';
1
3
  import * as archive from '@pulumi/archive';
2
4
  import { getConfigurationStoreOutput, } from '@pulumi/azure-native/appconfiguration/index.js';
3
5
  import { getComponentOutput } from '@pulumi/azure-native/applicationinsights/index.js';
@@ -5,9 +7,7 @@ import { SkuFamily, SkuName } from '@pulumi/azure-native/keyvault/index.js';
5
7
  import { listStorageAccountKeysOutput } from '@pulumi/azure-native/storage/index.js';
6
8
  import { AuthenticationType, FunctionsDeploymentStorageType, } from '@pulumi/azure-native/web/index.js';
7
9
  import * as pulumi from '@pulumi/pulumi';
8
- import fs from 'fs';
9
10
  import _ from 'lodash';
10
- import * as path from 'path';
11
11
  import { CommonAzureConstruct } from '../../common/index.js';
12
12
  import { CosmosRoleDefinition } from '../../services/cosmosdb/constants.js';
13
13
  import { AzureAppConfigurationManager, RoleDefinitionId } from '../../services/index.js';
@@ -1,8 +1,8 @@
1
+ import { writeFileSync } from 'fs';
2
+ import * as path from 'path';
1
3
  import * as archive from '@pulumi/archive';
2
4
  import { getComponentOutput } from '@pulumi/azure-native/applicationinsights/index.js';
3
- import { writeFileSync } from 'fs';
4
5
  import _ from 'lodash';
5
- import * as path from 'path';
6
6
  import { CommonAzureConstruct } from '../../common/index.js';
7
7
  /**
8
8
  * @classdesc Provides a construct to create and deploy a site hosted with an Azure Linux Web App
@@ -1,7 +1,7 @@
1
1
  import * as redis from '@pulumi/azure-native/redis/index.js';
2
2
  import { ResourceOptions } from '@pulumi/pulumi';
3
3
  import { CommonAzureConstruct } from '../../common/index.js';
4
- import { ApiDiagnosticProps, ApiManagementApiProps, ApiManagementBackendProps, ApiManagementCustomDomainProps, ApiManagementProps, ApiOperationPolicyProps, ApiOperationProps, ApiPolicyProps, ApiSubscriptionProps, CacheProps, LoggerProps, NamedValueProps, ResolveApiManagementProps } from './types.js';
4
+ import { ApiDiagnosticProps, ApiManagementApiProps, ApiManagementBackendProps, ApiManagementProps, ApiOperationPolicyProps, ApiOperationProps, ApiPolicyProps, ApiSubscriptionProps, CacheProps, LoggerProps, NamedValueProps, ResolveApiManagementProps } from './types.js';
5
5
  /**
6
6
  * @classdesc Provides operations on Azure API Management using Pulumi
7
7
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
@@ -132,12 +132,8 @@ export declare class AzureApiManagementManager {
132
132
  createPolicy(id: string, scope: CommonAzureConstruct, props: ApiPolicyProps, resourceOptions?: ResourceOptions): import("@pulumi/azure-native/apimanagement/apiPolicy.js").ApiPolicy;
133
133
  /**
134
134
  * @summary Method to create a new API Management custom domain
135
- * @param id scoped id of the resource
136
- * @param scope scope in which this resource is defined
137
- * @param props API Management custom domain properties
138
- * @param resourceOptions Optional settings to control resource behaviour
139
135
  * @note In Pulumi Azure Native, custom domains are configured as part of the API Management service resource,
140
136
  * not as a separate resource. Use the hostnameConfigurations property when creating the service.
141
137
  */
142
- createApiManagementCustomDomain(id: string, scope: CommonAzureConstruct, props: ApiManagementCustomDomainProps): void;
138
+ createApiManagementCustomDomain(): void;
143
139
  }
@@ -29,13 +29,13 @@ export class AzureApiManagementManager {
29
29
  */
30
30
  createApiManagementService(id, scope, props, applicationInsightsKey, externalRedisCache, resourceOptions) {
31
31
  if (!props)
32
- throw `Props undefined for ${id}`;
32
+ throw new Error(`Props undefined for ${id}`);
33
33
  // Get resource group name
34
34
  const resourceGroupName = scope.props.resourceGroupName
35
35
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
36
36
  : props.resourceGroupName;
37
37
  if (!resourceGroupName)
38
- throw `Resource group name undefined for ${id}`;
38
+ throw new Error(`Resource group name undefined for ${id}`);
39
39
  const apiManagementService = new ApiManagementService(`${id}-am`, {
40
40
  ...props,
41
41
  serviceName: scope.resourceNameFormatter.format(props.serviceName?.toString(), scope.props.resourceNameOptions?.apiManagement),
@@ -82,7 +82,7 @@ export class AzureApiManagementManager {
82
82
  */
83
83
  resolveApiManagementService(id, scope, props, resourceOptions) {
84
84
  if (!props)
85
- throw `Props undefined for ${id}`;
85
+ throw new Error(`Props undefined for ${id}`);
86
86
  return getApiManagementServiceOutput({
87
87
  serviceName: scope.resourceNameFormatter.format(props.serviceName?.toString(), scope.props.resourceNameOptions?.dataAzurermApiManagement),
88
88
  resourceGroupName: scope.props.resourceGroupName
@@ -100,7 +100,7 @@ export class AzureApiManagementManager {
100
100
  */
101
101
  createBackend(id, scope, props, resourceOptions) {
102
102
  if (!props)
103
- throw `Props undefined for ${id}`;
103
+ throw new Error(`Props undefined for ${id}`);
104
104
  return new Backend(`${id}-am-be`, {
105
105
  ...props,
106
106
  backendId: scope.resourceNameFormatter.format(props.backendId?.toString(), scope.props.resourceNameOptions?.apiManagementBackend),
@@ -118,7 +118,7 @@ export class AzureApiManagementManager {
118
118
  */
119
119
  createApi(id, scope, props, resourceOptions) {
120
120
  if (!props)
121
- throw `Props undefined for ${id}`;
121
+ throw new Error(`Props undefined for ${id}`);
122
122
  const api = new Api(`${id}-am-api`, {
123
123
  ...props,
124
124
  apiId: scope.resourceNameFormatter.format(props.apiId?.toString(), scope.props.resourceNameOptions?.apiManagementApi),
@@ -138,7 +138,7 @@ export class AzureApiManagementManager {
138
138
  */
139
139
  createApiDiagnostic(id, scope, props, resourceOptions) {
140
140
  if (!props)
141
- throw `Props undefined for ${id}`;
141
+ throw new Error(`Props undefined for ${id}`);
142
142
  return new ApiDiagnostic(`${id}`, props, { parent: scope, ...resourceOptions });
143
143
  }
144
144
  /**
@@ -151,7 +151,7 @@ export class AzureApiManagementManager {
151
151
  */
152
152
  createLogger(id, scope, props, resourceOptions) {
153
153
  if (!props)
154
- throw `Props undefined for ${id}`;
154
+ throw new Error(`Props undefined for ${id}`);
155
155
  return new Logger(`${id}`, props, { parent: scope, ...resourceOptions });
156
156
  }
157
157
  /**
@@ -164,7 +164,7 @@ export class AzureApiManagementManager {
164
164
  */
165
165
  createNamedValue(id, scope, props, resourceOptions) {
166
166
  if (!props)
167
- throw `Props undefined for ${id}`;
167
+ throw new Error(`Props undefined for ${id}`);
168
168
  return new NamedValue(`${id}`, props, { parent: scope, ...resourceOptions });
169
169
  }
170
170
  /**
@@ -177,7 +177,7 @@ export class AzureApiManagementManager {
177
177
  */
178
178
  createSubscription(id, scope, props, resourceOptions) {
179
179
  if (!props)
180
- throw `Props undefined for ${id}`;
180
+ throw new Error(`Props undefined for ${id}`);
181
181
  return new Subscription(`${id}`, props, { parent: scope, ...resourceOptions });
182
182
  }
183
183
  /**
@@ -190,7 +190,7 @@ export class AzureApiManagementManager {
190
190
  */
191
191
  createCache(id, scope, props, resourceOptions) {
192
192
  if (!props)
193
- throw `Props undefined for ${id}`;
193
+ throw new Error(`Props undefined for ${id}`);
194
194
  return new Cache(`${id}`, props, { parent: scope, ...resourceOptions });
195
195
  }
196
196
  /**
@@ -228,14 +228,10 @@ export class AzureApiManagementManager {
228
228
  }
229
229
  /**
230
230
  * @summary Method to create a new API Management custom domain
231
- * @param id scoped id of the resource
232
- * @param scope scope in which this resource is defined
233
- * @param props API Management custom domain properties
234
- * @param resourceOptions Optional settings to control resource behaviour
235
231
  * @note In Pulumi Azure Native, custom domains are configured as part of the API Management service resource,
236
232
  * not as a separate resource. Use the hostnameConfigurations property when creating the service.
237
233
  */
238
- createApiManagementCustomDomain(id, scope, props) {
234
+ createApiManagementCustomDomain() {
239
235
  // Note: In Pulumi Azure Native, custom domains are part of the ApiManagementService
240
236
  // This method is provided for API compatibility but should be configured
241
237
  // via the hostnameConfigurations property of ApiManagementService instead
@@ -27,13 +27,13 @@ export class AzureAppConfigurationManager {
27
27
  */
28
28
  createConfigurationStore(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  // Get resource group name
32
32
  const resourceGroupName = scope.props.resourceGroupName
33
33
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
34
34
  : props.resourceGroupName;
35
35
  if (!resourceGroupName)
36
- throw `Resource group name undefined for ${id}`;
36
+ throw new Error(`Resource group name undefined for ${id}`);
37
37
  return new ConfigurationStore(`${id}-ac`, {
38
38
  ...props,
39
39
  configStoreName: scope.resourceNameFormatter.format(props.configStoreName?.toString(), scope.props.resourceNameOptions?.appConfiguration),
@@ -27,13 +27,13 @@ export class AzureAppServiceManager {
27
27
  */
28
28
  createAppServicePlan(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  // Get resource group name
32
32
  const resourceGroupName = scope.props.resourceGroupName
33
33
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
34
34
  : props.resourceGroupName;
35
35
  if (!resourceGroupName)
36
- throw `Resource group name undefined for ${id}`;
36
+ throw new Error(`Resource group name undefined for ${id}`);
37
37
  return new AppServicePlan(`${id}-as`, {
38
38
  ...props,
39
39
  name: scope.resourceNameFormatter.format(props.name?.toString(), scope.props.resourceNameOptions?.appServicePlan),
@@ -60,13 +60,13 @@ export class AzureAppServiceManager {
60
60
  */
61
61
  createLinuxWebApp(id, scope, props, resourceOptions) {
62
62
  if (!props)
63
- throw `Props undefined for ${id}`;
63
+ throw new Error(`Props undefined for ${id}`);
64
64
  // Get resource group name
65
65
  const resourceGroupName = scope.props.resourceGroupName
66
66
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
67
67
  : props.resourceGroupName;
68
68
  if (!resourceGroupName)
69
- throw `Resource group name undefined for ${id}`;
69
+ throw new Error(`Resource group name undefined for ${id}`);
70
70
  return new WebApp(`${id}-lwa`, {
71
71
  ...props,
72
72
  name: scope.resourceNameFormatter.format(props.name?.toString(), scope.props.resourceNameOptions?.linuxWebApp),
@@ -1,5 +1,4 @@
1
- import { AppServicePlanArgs } from '@pulumi/azure-native/web/index.js';
2
- import { WebAppArgs } from '@pulumi/azure-native/web/index.js';
1
+ import { AppServicePlanArgs, WebAppArgs } from '@pulumi/azure-native/web/index.js';
3
2
  export interface ServicePlanProps extends AppServicePlanArgs {
4
3
  }
5
4
  export interface LinuxWebAppProps extends WebAppArgs {
@@ -27,13 +27,13 @@ export class AzureApplicationInsightsManager {
27
27
  */
28
28
  createComponent(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  // Get resource group name
32
32
  const resourceGroupName = scope.props.resourceGroupName
33
33
  ? `${scope.props.resourceGroupName}-${scope.props.stage}`
34
34
  : props.resourceGroupName;
35
35
  if (!resourceGroupName)
36
- throw `Resource group name undefined for ${id}`;
36
+ throw new Error(`Resource group name undefined for ${id}`);
37
37
  const component = new Component(`${id}-ai`, {
38
38
  ...props,
39
39
  resourceName: scope.resourceNameFormatter.format(props.resourceName?.toString(), scope.props.resourceNameOptions?.applicationInsights),
@@ -62,7 +62,7 @@ export class AzureApplicationInsightsManager {
62
62
  */
63
63
  createComponentCurrentBillingFeature(id, scope, props, resourceOptions) {
64
64
  if (!props)
65
- throw `Props undefined for ${id}`;
65
+ throw new Error(`Props undefined for ${id}`);
66
66
  return new ComponentCurrentBillingFeature(`${id}`, props, { parent: scope, ...resourceOptions });
67
67
  }
68
68
  }
@@ -27,7 +27,7 @@ export class AzureAuthorisationManager {
27
27
  */
28
28
  createRoleAssignment(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  return new RoleAssignment(`${id}`, props, { parent: scope, ...resourceOptions });
32
32
  }
33
33
  /**
@@ -28,13 +28,13 @@ export class AzureCosmosDbManager {
28
28
  */
29
29
  createCosmosDbAccount(id, scope, props, resourceOptions) {
30
30
  if (!props)
31
- throw `Props undefined for ${id}`;
31
+ throw new Error(`Props undefined for ${id}`);
32
32
  // Get resource group name
33
33
  const resourceGroupName = scope.props.resourceGroupName
34
34
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
35
35
  : props.resourceGroupName;
36
36
  if (!resourceGroupName)
37
- throw `Resource group name undefined for ${id}`;
37
+ throw new Error(`Resource group name undefined for ${id}`);
38
38
  return new DatabaseAccount(`${id}-ca`, {
39
39
  ...props,
40
40
  accountName: scope.resourceNameFormatter.format(props.accountName?.toString(), scope.props.resourceNameOptions?.cosmosDbAccount),
@@ -58,13 +58,13 @@ export class AzureCosmosDbManager {
58
58
  */
59
59
  createCosmosDbDatabase(id, scope, props, resourceOptions) {
60
60
  if (!props)
61
- throw `Props undefined for ${id}`;
61
+ throw new Error(`Props undefined for ${id}`);
62
62
  // Get resource group name
63
63
  const resourceGroupName = scope.props.resourceGroupName
64
64
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
65
65
  : props.resourceGroupName;
66
66
  if (!resourceGroupName)
67
- throw `Resource group name undefined for ${id}`;
67
+ throw new Error(`Resource group name undefined for ${id}`);
68
68
  return new SqlResourceSqlDatabase(`${id}-cd`, {
69
69
  ...props,
70
70
  databaseName: scope.resourceNameFormatter.format(props.databaseName?.toString(), scope.props.resourceNameOptions?.cosmosDbSqlDatabase),
@@ -81,13 +81,13 @@ export class AzureCosmosDbManager {
81
81
  */
82
82
  createCosmosDbContainer(id, scope, props, resourceOptions) {
83
83
  if (!props)
84
- throw `Props undefined for ${id}`;
84
+ throw new Error(`Props undefined for ${id}`);
85
85
  // Get resource group name
86
86
  const resourceGroupName = scope.props.resourceGroupName
87
87
  ? `${scope.props.resourceGroupName}-${scope.props.stage}`
88
88
  : props.resourceGroupName;
89
89
  if (!resourceGroupName)
90
- throw `Resource group name undefined for ${id}`;
90
+ throw new Error(`Resource group name undefined for ${id}`);
91
91
  return new SqlResourceSqlContainer(`${id}-cc`, {
92
92
  ...props,
93
93
  containerName: scope.resourceNameFormatter.format(props.containerName?.toString(), scope.props.resourceNameOptions?.cosmosDbSqlContainer),
@@ -27,13 +27,13 @@ export class AzureDnsManager {
27
27
  */
28
28
  createDnsZone(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  // Get resource group name
32
32
  const resourceGroupName = scope.props.resourceGroupName
33
33
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
34
34
  : props.resourceGroupName;
35
35
  if (!resourceGroupName)
36
- throw `Resource group name undefined for ${id}`;
36
+ throw new Error(`Resource group name undefined for ${id}`);
37
37
  return new Zone(`${id}-dz`, {
38
38
  ...props,
39
39
  zoneName: scope.resourceNameFormatter.format(props.zoneName?.toString(), scope.props.resourceNameOptions?.dnsZone),
@@ -54,7 +54,7 @@ export class AzureDnsManager {
54
54
  */
55
55
  createDnsARecord(id, scope, props, resourceOptions) {
56
56
  if (!props)
57
- throw `Props undefined for ${id}`;
57
+ throw new Error(`Props undefined for ${id}`);
58
58
  return new RecordSet(`${id}-da`, {
59
59
  ...props,
60
60
  recordType: 'A',
@@ -74,7 +74,7 @@ export class AzureDnsManager {
74
74
  */
75
75
  createDnsCnameRecord(id, scope, props, resourceOptions) {
76
76
  if (!props)
77
- throw `Props undefined for ${id}`;
77
+ throw new Error(`Props undefined for ${id}`);
78
78
  return new RecordSet(`${id}-dc`, {
79
79
  ...props,
80
80
  recordType: 'CNAME',
@@ -94,7 +94,7 @@ export class AzureDnsManager {
94
94
  */
95
95
  createDnsTxtRecord(id, scope, props, resourceOptions) {
96
96
  if (!props)
97
- throw `Props undefined for ${id}`;
97
+ throw new Error(`Props undefined for ${id}`);
98
98
  return new RecordSet(`${id}-dt`, {
99
99
  ...props,
100
100
  recordType: 'TXT',
@@ -27,13 +27,13 @@ export class AzureEventgridManager {
27
27
  */
28
28
  createEventgridTopic(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  // Get resource group name
32
32
  const resourceGroupName = scope.props.resourceGroupName
33
33
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
34
34
  : props.resourceGroupName;
35
35
  if (!resourceGroupName)
36
- throw `Resource group name undefined for ${id}`;
36
+ throw new Error(`Resource group name undefined for ${id}`);
37
37
  return new Topic(`${id}-et`, {
38
38
  ...props,
39
39
  topicName: scope.resourceNameFormatter.format(props.topicName?.toString(), scope.props.resourceNameOptions?.eventGridTopic),
@@ -54,7 +54,7 @@ export class AzureEventgridManager {
54
54
  */
55
55
  resolveEventgridTopic(id, scope, props, resourceOptions) {
56
56
  if (!props)
57
- throw `Props undefined for ${id}`;
57
+ throw new Error(`Props undefined for ${id}`);
58
58
  return getTopicOutput({
59
59
  topicName: scope.resourceNameFormatter.format(props.topicName?.toString(), scope.props.resourceNameOptions?.eventGridTopic),
60
60
  resourceGroupName: scope.props.resourceGroupName
@@ -72,7 +72,7 @@ export class AzureEventgridManager {
72
72
  */
73
73
  createEventgridSubscription(id, scope, props, resourceOptions) {
74
74
  if (!props)
75
- throw `Props undefined for ${id}`;
75
+ throw new Error(`Props undefined for ${id}`);
76
76
  return new EventSubscription(`${id}-es`, {
77
77
  ...props,
78
78
  eventSubscriptionName: scope.resourceNameFormatter.format(props.eventSubscriptionName?.toString(), scope.props.resourceNameOptions?.eventGridEventSubscription),
@@ -93,12 +93,12 @@ export class AzureEventgridManager {
93
93
  */
94
94
  createEventgridSystemTopic(id, scope, props, resourceOptions) {
95
95
  if (!props)
96
- throw `Props undefined for ${id}`;
96
+ throw new Error(`Props undefined for ${id}`);
97
97
  const resourceGroupName = scope.props.resourceGroupName
98
98
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
99
99
  : props.resourceGroupName;
100
100
  if (!resourceGroupName)
101
- throw `Resource group name undefined for ${id}`;
101
+ throw new Error(`Resource group name undefined for ${id}`);
102
102
  return new SystemTopic(`${id}-est`, {
103
103
  ...props,
104
104
  systemTopicName: scope.resourceNameFormatter.format(props.systemTopicName?.toString(), scope.props.resourceNameOptions?.eventGridSystemTopic),
@@ -120,12 +120,12 @@ export class AzureEventgridManager {
120
120
  */
121
121
  createEventgridSystemTopicEventSubscription(id, scope, props, systemTopic, resourceOptions) {
122
122
  if (!props)
123
- throw `Props undefined for ${id}`;
124
- let resourceGroupName = scope.props.resourceGroupName
123
+ throw new Error(`Props undefined for ${id}`);
124
+ const resourceGroupName = scope.props.resourceGroupName
125
125
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
126
126
  : props.resourceGroupName;
127
127
  if (!resourceGroupName)
128
- throw `Resource group name undefined for ${id}`;
128
+ throw new Error(`Resource group name undefined for ${id}`);
129
129
  return new SystemTopicEventSubscription(`${id}-ests`, {
130
130
  ...props,
131
131
  eventSubscriptionName: scope.resourceNameFormatter.format(props.eventSubscriptionName?.toString(), scope.props.resourceNameOptions?.eventGridSystemTopicEventSubscription),
@@ -29,13 +29,13 @@ export class AzureFunctionManager {
29
29
  */
30
30
  createFunctionApp(id, scope, props, resourceOptions) {
31
31
  if (!props)
32
- throw `Props undefined for ${id}`;
32
+ throw new Error(`Props undefined for ${id}`);
33
33
  // Get resource group name
34
34
  const resourceGroupName = scope.props.resourceGroupName
35
35
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
36
36
  : props.resourceGroupName;
37
37
  if (!resourceGroupName)
38
- throw `Resource group name undefined for ${id}`;
38
+ throw new Error(`Resource group name undefined for ${id}`);
39
39
  return new WebApp(`${id}-fa`, {
40
40
  ...props,
41
41
  name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.linuxFunctionApp),
@@ -62,7 +62,7 @@ export class AzureFunctionManager {
62
62
  */
63
63
  createFunction(id, scope, props, resourceOptions) {
64
64
  if (!props)
65
- throw `Props undefined for ${id}`;
65
+ throw new Error(`Props undefined for ${id}`);
66
66
  // Get resource group name
67
67
  const resourceGroupName = scope.props.resourceGroupName
68
68
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
@@ -86,13 +86,13 @@ export class AzureFunctionManager {
86
86
  */
87
87
  createFunctionAppFlexConsumption(id, scope, props, resourceOptions) {
88
88
  if (!props)
89
- throw `Props undefined for ${id}`;
89
+ throw new Error(`Props undefined for ${id}`);
90
90
  // Get resource group name
91
91
  const resourceGroupName = scope.props.resourceGroupName
92
92
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
93
93
  : props.resourceGroupName;
94
94
  if (!resourceGroupName)
95
- throw `Resource group name undefined for ${id}`;
95
+ throw new Error(`Resource group name undefined for ${id}`);
96
96
  const functionApp = new WebApp(`${id}-fc`, {
97
97
  ...props,
98
98
  name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionApp),
@@ -178,13 +178,13 @@ export class AzureFunctionManager {
178
178
  */
179
179
  createFunctionAppFlexConsumptionResource(id, scope, props, resourceOptions) {
180
180
  if (!props)
181
- throw `Props undefined for ${id}`;
181
+ throw new Error(`Props undefined for ${id}`);
182
182
  // Get resource group name
183
183
  const resourceGroupName = scope.props.resourceGroupName
184
184
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
185
185
  : props.resourceGroupName;
186
186
  if (!resourceGroupName)
187
- throw `Resource group name undefined for ${id}`;
187
+ throw new Error(`Resource group name undefined for ${id}`);
188
188
  return new Resource(`${id}-fc`, {
189
189
  apiVersion: '2024-04-01',
190
190
  identity: {
@@ -27,13 +27,13 @@ export class AzureKeyVaultManager {
27
27
  */
28
28
  createKeyVault(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  // Get resource group name
32
32
  const resourceGroupName = scope.props.resourceGroupName
33
33
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
34
34
  : props.resourceGroupName;
35
35
  if (!resourceGroupName)
36
- throw `Resource group name undefined for ${id}`;
36
+ throw new Error(`Resource group name undefined for ${id}`);
37
37
  return new Vault(`${id}-kv`, {
38
38
  ...props,
39
39
  vaultName: scope.resourceNameFormatter.format(props.vaultName?.toString(), scope.props.resourceNameOptions?.keyVault),
@@ -67,7 +67,7 @@ export class AzureKeyVaultManager {
67
67
  */
68
68
  createKeyVaultSecret(id, scope, props, resourceOptions) {
69
69
  if (!props)
70
- throw `Props undefined for ${id}`;
70
+ throw new Error(`Props undefined for ${id}`);
71
71
  return new Secret(`${id}`, props, { parent: scope, ...resourceOptions });
72
72
  }
73
73
  /**
@@ -27,7 +27,7 @@ export class AzureMonitorManager {
27
27
  */
28
28
  createMonitorDiagnosticSettings(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  return new DiagnosticSetting(`${id}-ds`, {
32
32
  ...props,
33
33
  name: scope.resourceNameFormatter.format(props.name?.toString(), scope.props.resourceNameOptions?.monitorDiagnosticSetting),
@@ -27,13 +27,13 @@ export class AzureOperationalInsightsManager {
27
27
  */
28
28
  createWorkspace(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  // Get resource group name
32
32
  const resourceGroupName = scope.props.resourceGroupName
33
33
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
34
34
  : props.resourceGroupName;
35
35
  if (!resourceGroupName)
36
- throw `Resource group name undefined for ${id}`;
36
+ throw new Error(`Resource group name undefined for ${id}`);
37
37
  return new Workspace(`${id}-lw`, {
38
38
  ...props,
39
39
  workspaceName: scope.resourceNameFormatter.format(props.workspaceName?.toString(), scope.props.resourceNameOptions?.logAnalyticsWorkspace),
@@ -58,7 +58,7 @@ export class AzureOperationalInsightsManager {
58
58
  */
59
59
  createTable(id, scope, props, resourceOptions) {
60
60
  if (!props)
61
- throw `Props undefined for ${id}`;
61
+ throw new Error(`Props undefined for ${id}`);
62
62
  return new Table(`${id}`, props, { parent: scope, ...resourceOptions });
63
63
  }
64
64
  }
@@ -1,5 +1,5 @@
1
- import { Dashboard } from '@pulumi/azure-native/portal/index.js';
2
1
  import fs from 'fs';
2
+ import { Dashboard } from '@pulumi/azure-native/portal/index.js';
3
3
  import { AzureDashboardRenderer } from './renderer.js';
4
4
  /**
5
5
  * @classdesc Provides operations on Azure Portal Dashboards using Pulumi
@@ -30,7 +30,7 @@ export class AzurePortalManager {
30
30
  */
31
31
  createDashBoard(id, scope, props, renderer, resourceOptions) {
32
32
  if (!props)
33
- throw `Props undefined for ${id}`;
33
+ throw new Error(`Props undefined for ${id}`);
34
34
  const resourceGroup = scope.resourceGroupManager.resolveResourceGroup(scope, props.resourceGroupName.toString() ?? scope.props.resourceGroupName, resourceOptions);
35
35
  const dashboardName = scope.resourceNameFormatter.format(props.dashboardName?.toString(), scope.props.resourceNameOptions?.portalDashboard);
36
36
  const dashboardRenderer = renderer ?? new AzureDashboardRenderer();
@@ -1,7 +1,7 @@
1
- import appRoot from 'app-root-path';
2
1
  import fs from 'fs';
3
- import _ from 'lodash';
4
2
  import path from 'path';
3
+ import appRoot from 'app-root-path';
4
+ import _ from 'lodash';
5
5
  import { parse } from 'yaml';
6
6
  import { TemplateError } from './error.js';
7
7
  export class AzureDashboardRenderer {
@@ -27,13 +27,13 @@ export class AzureRedisManager {
27
27
  */
28
28
  createManagedRedis(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  // Get resource group name
32
32
  const resourceGroupName = scope.props.resourceGroupName
33
33
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
34
34
  : props.resourceGroupName;
35
35
  if (!resourceGroupName)
36
- throw `Resource group name undefined for ${id}`;
36
+ throw new Error(`Resource group name undefined for ${id}`);
37
37
  return new Redis(`${id}-rc`, {
38
38
  ...props,
39
39
  name: scope.resourceNameFormatter.format(props.name?.toString(), scope.props.resourceNameOptions?.managedRedis),
@@ -27,7 +27,7 @@ export class AzureResourceGroupManager {
27
27
  */
28
28
  createResourceGroup(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  return new ResourceGroup(`${id}-rg`, {
32
32
  ...props,
33
33
  resourceGroupName: scope.resourceNameFormatter.format(props.resourceGroupName?.toString(), scope.props.resourceNameOptions?.resourceGroup),
@@ -45,7 +45,7 @@ export class AzureResourceGroupManager {
45
45
  */
46
46
  resolveResourceGroup(scope, resourceGroupName, resourceOptions) {
47
47
  if (!resourceGroupName)
48
- throw `Resource Group Name undefined`;
48
+ throw new Error(`Resource Group Name undefined`);
49
49
  return getResourceGroupOutput({
50
50
  resourceGroupName: scope.resourceNameFormatter.format(resourceGroupName?.toString(), scope.props.resourceNameOptions?.resourceGroup),
51
51
  }, { parent: scope, ...resourceOptions });
@@ -27,7 +27,7 @@ export class AzureSecurityCentermanager {
27
27
  */
28
28
  createDefenderForStorage(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  return new DefenderForStorage(`${id}`, props, { parent: scope, ...resourceOptions });
32
32
  }
33
33
  }
@@ -27,13 +27,13 @@ export class AzureServiceBusManager {
27
27
  */
28
28
  createServiceBusNamespace(id, scope, props, resourceOptions) {
29
29
  if (!props)
30
- throw `Props undefined for ${id}`;
30
+ throw new Error(`Props undefined for ${id}`);
31
31
  // Get resource group name
32
32
  const resourceGroupName = scope.props.resourceGroupName
33
33
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
34
34
  : props.resourceGroupName;
35
35
  if (!resourceGroupName)
36
- throw `Resource group name undefined for ${id}`;
36
+ throw new Error(`Resource group name undefined for ${id}`);
37
37
  return new Namespace(`${id}-sn`, {
38
38
  ...props,
39
39
  namespaceName: scope.resourceNameFormatter.format(props.namespaceName?.toString(), scope.props.resourceNameOptions?.serviceBusNamespace),
@@ -60,7 +60,7 @@ export class AzureServiceBusManager {
60
60
  */
61
61
  createServiceBusTopic(id, scope, props, resourceOptions) {
62
62
  if (!props)
63
- throw `Props undefined for ${id}`;
63
+ throw new Error(`Props undefined for ${id}`);
64
64
  return new Topic(`${id}-st`, {
65
65
  ...props,
66
66
  topicName: scope.resourceNameFormatter.format(props.topicName?.toString(), scope.props.resourceNameOptions?.serviceBusTopic),
@@ -78,7 +78,7 @@ export class AzureServiceBusManager {
78
78
  */
79
79
  createServiceBusQueue(id, scope, props, resourceOptions) {
80
80
  if (!props)
81
- throw `Props undefined for ${id}`;
81
+ throw new Error(`Props undefined for ${id}`);
82
82
  return new Queue(`${id}-sq`, {
83
83
  ...props,
84
84
  queueName: scope.resourceNameFormatter.format(props.queueName?.toString(), scope.props.resourceNameOptions?.serviceBusQueue),
@@ -100,7 +100,7 @@ export class AzureServiceBusManager {
100
100
  */
101
101
  createServiceBusSubscription(id, scope, props, resourceOptions) {
102
102
  if (!props)
103
- throw `Props undefined for ${id}`;
103
+ throw new Error(`Props undefined for ${id}`);
104
104
  return new Subscription(`${id}-ss`, {
105
105
  ...props,
106
106
  subscriptionName: scope.resourceNameFormatter.format(props.subscriptionName?.toString(), scope.props.resourceNameOptions?.serviceBusSubscription),
@@ -117,7 +117,7 @@ export class AzureServiceBusManager {
117
117
  */
118
118
  resolveServiceBusQueue(id, scope, props, resourceOptions) {
119
119
  if (!props)
120
- throw `Props undefined for ${id}`;
120
+ throw new Error(`Props undefined for ${id}`);
121
121
  return getQueueOutput({
122
122
  queueName: scope.resourceNameFormatter.format(props.queueName?.toString(), scope.props.resourceNameOptions?.serviceBusQueue),
123
123
  namespaceName: props.namespaceName,
@@ -28,7 +28,7 @@ export class AzureStorageManager {
28
28
  */
29
29
  createStorageAccount(id, scope, props, resourceOptions) {
30
30
  if (!props)
31
- throw `Props undefined for ${id}`;
31
+ throw new Error(`Props undefined for ${id}`);
32
32
  const resourceGroupName = scope.props.resourceGroupName
33
33
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
34
34
  : `${props.resourceGroupName}`;
@@ -73,7 +73,7 @@ export class AzureStorageManager {
73
73
  */
74
74
  createStorageContainer(id, scope, props, resourceOptions) {
75
75
  if (!props)
76
- throw `Props undefined for ${id}`;
76
+ throw new Error(`Props undefined for ${id}`);
77
77
  const resourceGroupName = scope.props.resourceGroupName
78
78
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
79
79
  : `${props.resourceGroupName}`;
@@ -94,7 +94,7 @@ export class AzureStorageManager {
94
94
  */
95
95
  createStorageBlob(id, scope, props, resourceOptions) {
96
96
  if (!props)
97
- throw `Props undefined for ${id}`;
97
+ throw new Error(`Props undefined for ${id}`);
98
98
  const resourceGroupName = scope.props.resourceGroupName
99
99
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
100
100
  : `${props.resourceGroupName}`;
@@ -154,7 +154,7 @@ export class AzureStorageManager {
154
154
  */
155
155
  createManagementPolicy(id, scope, props, resourceOptions) {
156
156
  if (!props)
157
- throw `Props undefined for ${id}`;
157
+ throw new Error(`Props undefined for ${id}`);
158
158
  return new ManagementPolicy(`${id}`, props, { parent: scope, ...resourceOptions });
159
159
  }
160
160
  /**
@@ -167,7 +167,7 @@ export class AzureStorageManager {
167
167
  */
168
168
  createTable(id, scope, props, resourceOptions) {
169
169
  if (!props)
170
- throw `Props undefined for ${id}`;
170
+ throw new Error(`Props undefined for ${id}`);
171
171
  return new Table(`${id}`, props, { parent: scope, ...resourceOptions });
172
172
  }
173
173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils-azure",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Azure Pulumi utilities for @gradientedge/cdk-utils",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -14,14 +14,14 @@
14
14
  "dist/src/"
15
15
  ],
16
16
  "dependencies": {
17
- "@pulumi/archive": "^0.3.7",
18
- "@pulumi/azure-native": "^3.16.0",
19
- "@pulumi/pulumi": "^3.228.0",
20
- "@types/lodash": "^4.17.24",
21
- "app-root-path": "^3.1.0",
22
- "lodash": "^4.17.23",
23
- "yaml": "^2.8.3",
24
- "@gradientedge/cdk-utils-common": "1.0.0"
17
+ "@pulumi/archive": "0.3.7",
18
+ "@pulumi/azure-native": "3.16.0",
19
+ "@pulumi/pulumi": "3.228.0",
20
+ "@types/lodash": "4.17.24",
21
+ "app-root-path": "3.1.0",
22
+ "lodash": "4.18.1",
23
+ "yaml": "2.8.3",
24
+ "@gradientedge/cdk-utils-common": "2.0.0"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"