@gradientedge/cdk-utils 9.41.0 → 9.41.1

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.
@@ -49,7 +49,7 @@ class AzureApiManagementManager {
49
49
  throw `Resource group undefined for ${id}`;
50
50
  const apiManagement = new api_management_1.ApiManagement(scope, `${id}-am`, {
51
51
  ...props,
52
- name: `${props.name}-${scope.props.stage}`,
52
+ name: scope.resourceNameFormatter.format(props.name),
53
53
  resourceGroupName: resourceGroup.name,
54
54
  tags: props.tags ?? {
55
55
  environment: scope.props.stage,
@@ -57,7 +57,7 @@ class AzureApiManagementManager {
57
57
  });
58
58
  if (applicationInsightsKey) {
59
59
  new api_management_logger_1.ApiManagementLogger(scope, `${id}-am-logger`, {
60
- name: `${props.name}-${scope.props.stage}`,
60
+ name: scope.resourceNameFormatter.format(props.name),
61
61
  resourceGroupName: resourceGroup.name,
62
62
  apiManagementName: apiManagement.name,
63
63
  applicationInsights: {
@@ -81,15 +81,13 @@ class AzureApiManagementManager {
81
81
  if (!props)
82
82
  throw `Props undefined for ${id}`;
83
83
  const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-am-rg`, {
84
- name: scope.props.resourceGroupName
85
- ? `${scope.props.resourceGroupName}-${scope.props.stage}`
86
- : `${props.resourceGroupName}`,
84
+ name: scope.resourceNameFormatter.format(scope.props.resourceGroupName || props.resourceGroupName, scope.props.resourceNameOptions?.resourceGroup),
87
85
  });
88
86
  if (!resourceGroup)
89
87
  throw `Resource group undefined for ${id}`;
90
88
  const apiManagement = new data_azurerm_api_management_1.DataAzurermApiManagement(scope, `${id}-am`, {
91
89
  ...props,
92
- name: `${props.name}-${scope.props.stage}`,
90
+ name: scope.resourceNameFormatter.format(props.name),
93
91
  resourceGroupName: scope.props.resourceGroupName
94
92
  ? `${scope.props.resourceGroupName}-${scope.props.stage}`
95
93
  : `${props.resourceGroupName}`,
@@ -108,7 +106,7 @@ class AzureApiManagementManager {
108
106
  throw `Props undefined for ${id}`;
109
107
  const apiManagementBackend = new api_management_backend_1.ApiManagementBackend(scope, `${id}-am-be`, {
110
108
  ...props,
111
- name: `${props.name}-${scope.props.stage}`,
109
+ name: scope.resourceNameFormatter.format(props.name),
112
110
  description: props.description || `Backend for ${props.name}-${scope.props.stage}`,
113
111
  protocol: props.protocol || 'http',
114
112
  });
@@ -129,7 +127,7 @@ class AzureApiManagementManager {
129
127
  throw `Props undefined for ${id}`;
130
128
  const apiManagementApi = new api_management_api_1.ApiManagementApi(scope, `${id}-am-api`, {
131
129
  ...props,
132
- name: `${props.name}-${scope.props.stage}`,
130
+ name: scope.resourceNameFormatter.format(props.name),
133
131
  displayName: props.displayName || props.name,
134
132
  revision: props.revision || '1',
135
133
  protocols: props.protocols || ['https'],
@@ -3,8 +3,7 @@ import { ApiManagementBackendConfig } from '@cdktf/provider-azurerm/lib/api-mana
3
3
  import { ApiManagementApiConfig } from '@cdktf/provider-azurerm/lib/api-management-api';
4
4
  import { ApiManagementApiOperationConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation';
5
5
  import { ApiManagementApiOperationPolicyConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation-policy';
6
- export interface ApiManagementProps extends Omit<ApiManagementConfig, 'name'> {
7
- name?: string | undefined;
6
+ export interface ApiManagementProps extends ApiManagementConfig {
8
7
  }
9
8
  export interface ApiManagementBackendProps extends ApiManagementBackendConfig {
10
9
  }
@@ -1,8 +1,9 @@
1
1
  import { DnsZone } from '@cdktf/provider-azurerm/lib/dns-zone';
2
2
  import { DnsARecord } from '@cdktf/provider-azurerm/lib/dns-a-record';
3
3
  import { DnsCnameRecord } from '@cdktf/provider-azurerm/lib/dns-cname-record';
4
+ import { DnsTxtRecord } from '@cdktf/provider-azurerm/lib/dns-txt-record';
4
5
  import { CommonAzureConstruct } from '../../common';
5
- import { DnsZoneProps, DnsARecordProps, DnsCnameRecordProps } from './types';
6
+ import { DnsZoneProps, DnsARecordProps, DnsCnameRecordProps, DnsTxtRecordProps } from './types';
6
7
  /**
7
8
  * @classdesc Provides operations on Azure DNS
8
9
  * - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
@@ -45,4 +46,12 @@ export declare class AzureDnsManager {
45
46
  * @see [CDKTF DNS CNAME Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsCnameRecord.typescript.md}
46
47
  */
47
48
  createDnsCnameRecord(id: string, scope: CommonAzureConstruct, props: DnsCnameRecordProps): DnsCnameRecord;
49
+ /**
50
+ * @summary Method to create a new DNS TXT Record
51
+ * @param id scoped id of the resource
52
+ * @param scope scope in which this resource is defined
53
+ * @param props dns txt record properties
54
+ * @see [CDKTF DNS TXT Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsCnameRecord.typescript.md}
55
+ */
56
+ createDnsTxtRecord(id: string, scope: CommonAzureConstruct, props: DnsTxtRecordProps): DnsTxtRecord;
48
57
  }
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AzureDnsManager = void 0;
4
4
  const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-resource-group");
5
- const data_azurerm_dns_zone_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-dns-zone");
6
5
  const dns_zone_1 = require("@cdktf/provider-azurerm/lib/dns-zone");
7
6
  const dns_a_record_1 = require("@cdktf/provider-azurerm/lib/dns-a-record");
8
7
  const dns_cname_record_1 = require("@cdktf/provider-azurerm/lib/dns-cname-record");
8
+ const dns_txt_record_1 = require("@cdktf/provider-azurerm/lib/dns-txt-record");
9
9
  const utils_1 = require("../../utils");
10
10
  /**
11
11
  * @classdesc Provides operations on Azure DNS
@@ -63,15 +63,10 @@ class AzureDnsManager {
63
63
  createDnsARecord(id, scope, props) {
64
64
  if (!props)
65
65
  throw `Props undefined for ${id}`;
66
- const dnsZone = new data_azurerm_dns_zone_1.DataAzurermDnsZone(scope, `${id}-da-dz`, {
67
- name: props.zoneName,
68
- resourceGroupName: props.resourceGroupName,
69
- });
70
66
  const dnsARecord = new dns_a_record_1.DnsARecord(scope, `${id}-da`, {
71
67
  ...props,
72
68
  name: scope.resourceNameFormatter.format(props.name),
73
- resourceGroupName: dnsZone.resourceGroupName,
74
- zoneName: dnsZone.name,
69
+ ttl: props.ttl || 300,
75
70
  tags: props.tags ?? {
76
71
  environment: scope.props.stage,
77
72
  },
@@ -91,15 +86,10 @@ class AzureDnsManager {
91
86
  createDnsCnameRecord(id, scope, props) {
92
87
  if (!props)
93
88
  throw `Props undefined for ${id}`;
94
- const dnsZone = new data_azurerm_dns_zone_1.DataAzurermDnsZone(scope, `${id}-dc-dz`, {
95
- name: props.zoneName,
96
- resourceGroupName: props.resourceGroupName,
97
- });
98
89
  const dnsCnameRecord = new dns_cname_record_1.DnsCnameRecord(scope, `${id}-dc`, {
99
90
  ...props,
100
91
  name: scope.resourceNameFormatter.format(props.name),
101
- resourceGroupName: dnsZone.resourceGroupName,
102
- zoneName: dnsZone.name,
92
+ ttl: props.ttl || 300,
103
93
  tags: props.tags ?? {
104
94
  environment: scope.props.stage,
105
95
  },
@@ -109,5 +99,27 @@ class AzureDnsManager {
109
99
  (0, utils_1.createAzureTfOutput)(`${id}-dnsCnameRecordId`, scope, dnsCnameRecord.id);
110
100
  return dnsCnameRecord;
111
101
  }
102
+ /**
103
+ * @summary Method to create a new DNS TXT Record
104
+ * @param id scoped id of the resource
105
+ * @param scope scope in which this resource is defined
106
+ * @param props dns txt record properties
107
+ * @see [CDKTF DNS TXT Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsCnameRecord.typescript.md}
108
+ */
109
+ createDnsTxtRecord(id, scope, props) {
110
+ if (!props)
111
+ throw `Props undefined for ${id}`;
112
+ const dnsTxtRecord = new dns_txt_record_1.DnsTxtRecord(scope, `${id}-dc`, {
113
+ ...props,
114
+ ttl: props.ttl || 300,
115
+ tags: props.tags ?? {
116
+ environment: scope.props.stage,
117
+ },
118
+ });
119
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsTxtRecordName`, scope, dnsTxtRecord.name);
120
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsTxtRecordFriendlyUniqueId`, scope, dnsTxtRecord.friendlyUniqueId);
121
+ (0, utils_1.createAzureTfOutput)(`${id}-dnsTxtRecordId`, scope, dnsTxtRecord.id);
122
+ return dnsTxtRecord;
123
+ }
112
124
  }
113
125
  exports.AzureDnsManager = AzureDnsManager;
@@ -1,9 +1,12 @@
1
1
  import { DnsZoneConfig } from '@cdktf/provider-azurerm/lib/dns-zone';
2
2
  import { DnsARecordConfig } from '@cdktf/provider-azurerm/lib/dns-a-record';
3
3
  import { DnsCnameRecordConfig } from '@cdktf/provider-azurerm/lib/dns-cname-record';
4
+ import { DnsTxtRecordConfig } from '@cdktf/provider-azurerm/lib/dns-txt-record';
4
5
  export interface DnsZoneProps extends DnsZoneConfig {
5
6
  }
6
7
  export interface DnsARecordProps extends DnsARecordConfig {
7
8
  }
8
9
  export interface DnsCnameRecordProps extends DnsCnameRecordConfig {
9
10
  }
11
+ export interface DnsTxtRecordProps extends DnsTxtRecordConfig {
12
+ }
@@ -41,7 +41,7 @@ class AzureEventgridManager {
41
41
  throw `Resource group undefined for ${id}`;
42
42
  const eventgridTopic = new eventgrid_topic_1.EventgridTopic(scope, `${id}-et`, {
43
43
  ...props,
44
- name: `${props.name}-${scope.props.stage}`,
44
+ name: scope.resourceNameFormatter.format(props.name),
45
45
  location: resourceGroup.location,
46
46
  resourceGroupName: resourceGroup.name,
47
47
  tags: props.tags ?? {
@@ -1,7 +1,6 @@
1
1
  import { EventgridTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-topic';
2
2
  import { EventgridEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription';
3
- export interface EventgridTopicProps extends Omit<EventgridTopicConfig, 'name'> {
4
- name?: string | undefined;
3
+ export interface EventgridTopicProps extends EventgridTopicConfig {
5
4
  }
6
5
  export interface EventgridEventSubscriptionProps extends EventgridEventSubscriptionConfig {
7
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "9.41.0",
3
+ "version": "9.41.1",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -61,7 +61,7 @@ export class AzureApiManagementManager {
61
61
 
62
62
  const apiManagement = new ApiManagement(scope, `${id}-am`, {
63
63
  ...props,
64
- name: `${props.name}-${scope.props.stage}`,
64
+ name: scope.resourceNameFormatter.format(props.name),
65
65
  resourceGroupName: resourceGroup.name,
66
66
  tags: props.tags ?? {
67
67
  environment: scope.props.stage,
@@ -70,7 +70,7 @@ export class AzureApiManagementManager {
70
70
 
71
71
  if (applicationInsightsKey) {
72
72
  new ApiManagementLogger(scope, `${id}-am-logger`, {
73
- name: `${props.name}-${scope.props.stage}`,
73
+ name: scope.resourceNameFormatter.format(props.name),
74
74
  resourceGroupName: resourceGroup.name,
75
75
  apiManagementName: apiManagement.name,
76
76
  applicationInsights: {
@@ -97,16 +97,17 @@ export class AzureApiManagementManager {
97
97
  if (!props) throw `Props undefined for ${id}`
98
98
 
99
99
  const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-am-rg`, {
100
- name: scope.props.resourceGroupName
101
- ? `${scope.props.resourceGroupName}-${scope.props.stage}`
102
- : `${props.resourceGroupName}`,
100
+ name: scope.resourceNameFormatter.format(
101
+ scope.props.resourceGroupName || props.resourceGroupName,
102
+ scope.props.resourceNameOptions?.resourceGroup
103
+ ),
103
104
  })
104
105
 
105
106
  if (!resourceGroup) throw `Resource group undefined for ${id}`
106
107
 
107
108
  const apiManagement = new DataAzurermApiManagement(scope, `${id}-am`, {
108
109
  ...props,
109
- name: `${props.name}-${scope.props.stage}`,
110
+ name: scope.resourceNameFormatter.format(props.name),
110
111
  resourceGroupName: scope.props.resourceGroupName
111
112
  ? `${scope.props.resourceGroupName}-${scope.props.stage}`
112
113
  : `${props.resourceGroupName}`,
@@ -127,7 +128,7 @@ export class AzureApiManagementManager {
127
128
 
128
129
  const apiManagementBackend = new ApiManagementBackend(scope, `${id}-am-be`, {
129
130
  ...props,
130
- name: `${props.name}-${scope.props.stage}`,
131
+ name: scope.resourceNameFormatter.format(props.name),
131
132
  description: props.description || `Backend for ${props.name}-${scope.props.stage}`,
132
133
  protocol: props.protocol || 'http',
133
134
  })
@@ -151,7 +152,7 @@ export class AzureApiManagementManager {
151
152
 
152
153
  const apiManagementApi = new ApiManagementApi(scope, `${id}-am-api`, {
153
154
  ...props,
154
- name: `${props.name}-${scope.props.stage}`,
155
+ name: scope.resourceNameFormatter.format(props.name),
155
156
  displayName: props.displayName || props.name,
156
157
  revision: props.revision || '1',
157
158
  protocols: props.protocols || ['https'],
@@ -4,9 +4,7 @@ import { ApiManagementApiConfig } from '@cdktf/provider-azurerm/lib/api-manageme
4
4
  import { ApiManagementApiOperationConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation'
5
5
  import { ApiManagementApiOperationPolicyConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation-policy'
6
6
 
7
- export interface ApiManagementProps extends Omit<ApiManagementConfig, 'name'> {
8
- name?: string | undefined
9
- }
7
+ export interface ApiManagementProps extends ApiManagementConfig {}
10
8
 
11
9
  export interface ApiManagementBackendProps extends ApiManagementBackendConfig {}
12
10
 
@@ -1,11 +1,11 @@
1
1
  import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group'
2
- import { DataAzurermDnsZone } from '@cdktf/provider-azurerm/lib/data-azurerm-dns-zone'
3
2
  import { DnsZone } from '@cdktf/provider-azurerm/lib/dns-zone'
4
3
  import { DnsARecord } from '@cdktf/provider-azurerm/lib/dns-a-record'
5
4
  import { DnsCnameRecord } from '@cdktf/provider-azurerm/lib/dns-cname-record'
5
+ import { DnsTxtRecord } from '@cdktf/provider-azurerm/lib/dns-txt-record'
6
6
  import { CommonAzureConstruct } from '../../common'
7
7
  import { createAzureTfOutput } from '../../utils'
8
- import { DnsZoneProps, DnsARecordProps, DnsCnameRecordProps } from './types'
8
+ import { DnsZoneProps, DnsARecordProps, DnsCnameRecordProps, DnsTxtRecordProps } from './types'
9
9
 
10
10
  /**
11
11
  * @classdesc Provides operations on Azure DNS
@@ -70,16 +70,10 @@ export class AzureDnsManager {
70
70
  public createDnsARecord(id: string, scope: CommonAzureConstruct, props: DnsARecordProps) {
71
71
  if (!props) throw `Props undefined for ${id}`
72
72
 
73
- const dnsZone = new DataAzurermDnsZone(scope, `${id}-da-dz`, {
74
- name: props.zoneName,
75
- resourceGroupName: props.resourceGroupName,
76
- })
77
-
78
73
  const dnsARecord = new DnsARecord(scope, `${id}-da`, {
79
74
  ...props,
80
75
  name: scope.resourceNameFormatter.format(props.name),
81
- resourceGroupName: dnsZone.resourceGroupName,
82
- zoneName: dnsZone.name,
76
+ ttl: props.ttl || 300,
83
77
  tags: props.tags ?? {
84
78
  environment: scope.props.stage,
85
79
  },
@@ -102,16 +96,10 @@ export class AzureDnsManager {
102
96
  public createDnsCnameRecord(id: string, scope: CommonAzureConstruct, props: DnsCnameRecordProps) {
103
97
  if (!props) throw `Props undefined for ${id}`
104
98
 
105
- const dnsZone = new DataAzurermDnsZone(scope, `${id}-dc-dz`, {
106
- name: props.zoneName,
107
- resourceGroupName: props.resourceGroupName,
108
- })
109
-
110
99
  const dnsCnameRecord = new DnsCnameRecord(scope, `${id}-dc`, {
111
100
  ...props,
112
101
  name: scope.resourceNameFormatter.format(props.name),
113
- resourceGroupName: dnsZone.resourceGroupName,
114
- zoneName: dnsZone.name,
102
+ ttl: props.ttl || 300,
115
103
  tags: props.tags ?? {
116
104
  environment: scope.props.stage,
117
105
  },
@@ -123,4 +111,29 @@ export class AzureDnsManager {
123
111
 
124
112
  return dnsCnameRecord
125
113
  }
114
+
115
+ /**
116
+ * @summary Method to create a new DNS TXT Record
117
+ * @param id scoped id of the resource
118
+ * @param scope scope in which this resource is defined
119
+ * @param props dns txt record properties
120
+ * @see [CDKTF DNS TXT Record Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/DnsCnameRecord.typescript.md}
121
+ */
122
+ public createDnsTxtRecord(id: string, scope: CommonAzureConstruct, props: DnsTxtRecordProps) {
123
+ if (!props) throw `Props undefined for ${id}`
124
+
125
+ const dnsTxtRecord = new DnsTxtRecord(scope, `${id}-dc`, {
126
+ ...props,
127
+ ttl: props.ttl || 300,
128
+ tags: props.tags ?? {
129
+ environment: scope.props.stage,
130
+ },
131
+ })
132
+
133
+ createAzureTfOutput(`${id}-dnsTxtRecordName`, scope, dnsTxtRecord.name)
134
+ createAzureTfOutput(`${id}-dnsTxtRecordFriendlyUniqueId`, scope, dnsTxtRecord.friendlyUniqueId)
135
+ createAzureTfOutput(`${id}-dnsTxtRecordId`, scope, dnsTxtRecord.id)
136
+
137
+ return dnsTxtRecord
138
+ }
126
139
  }
@@ -1,7 +1,9 @@
1
1
  import { DnsZoneConfig } from '@cdktf/provider-azurerm/lib/dns-zone'
2
2
  import { DnsARecordConfig } from '@cdktf/provider-azurerm/lib/dns-a-record'
3
3
  import { DnsCnameRecordConfig } from '@cdktf/provider-azurerm/lib/dns-cname-record'
4
+ import { DnsTxtRecordConfig } from '@cdktf/provider-azurerm/lib/dns-txt-record'
4
5
 
5
6
  export interface DnsZoneProps extends DnsZoneConfig {}
6
7
  export interface DnsARecordProps extends DnsARecordConfig {}
7
8
  export interface DnsCnameRecordProps extends DnsCnameRecordConfig {}
9
+ export interface DnsTxtRecordProps extends DnsTxtRecordConfig {}
@@ -48,7 +48,7 @@ export class AzureEventgridManager {
48
48
 
49
49
  const eventgridTopic = new EventgridTopic(scope, `${id}-et`, {
50
50
  ...props,
51
- name: `${props.name}-${scope.props.stage}`,
51
+ name: scope.resourceNameFormatter.format(props.name),
52
52
  location: resourceGroup.location,
53
53
  resourceGroupName: resourceGroup.name,
54
54
  tags: props.tags ?? {
@@ -1,8 +1,6 @@
1
1
  import { EventgridTopicConfig } from '@cdktf/provider-azurerm/lib/eventgrid-topic'
2
2
  import { EventgridEventSubscriptionConfig } from '@cdktf/provider-azurerm/lib/eventgrid-event-subscription'
3
3
 
4
- export interface EventgridTopicProps extends Omit<EventgridTopicConfig, 'name'> {
5
- name?: string | undefined
6
- }
4
+ export interface EventgridTopicProps extends EventgridTopicConfig {}
7
5
 
8
6
  export interface EventgridEventSubscriptionProps extends EventgridEventSubscriptionConfig {}