PrivateDnsZoneBuilder
Purpose: Initializes the PrivateDnsZoneBuilder
with the provided arguments and sets up the initial state.
Usage:
const builder = new PrivateDnsZoneBuilder({
name: 'example',
group: { resourceGroupName: 'resourceGroup' },
dependsOn: [],
});
linkTo
Purpose: Links the DNS zone to specified virtual networks.
Usage:
builder.linkTo({
vnetIds: ['vnetId1', 'vnetId2'],
subnetIds: ['subnetId1', 'subnetId2'],
});
withARecord
Purpose: Adds an A record to the DNS zone.
Usage:
builder.withARecord({
recordName: 'www',
ipAddresses: ['192.168.1.1'],
});
build
Purpose: Builds the entire DNS zone and its records with the configured properties.
Usage:
const resourceInfo = builder.build();
console.log(resourceInfo);
Here is a complete example that demonstrates how to use the PrivateDnsZoneBuilder
class, ensuring that the build()
method is called at the end:
const builder = new PrivateDnsZoneBuilder({
name: 'example',
group: { resourceGroupName: 'resourceGroup' },
dependsOn: [],
});
builder
.linkTo({
vnetIds: ['vnetId1', 'vnetId2'],
subnetIds: ['subnetId1', 'subnetId2'],
})
.withARecord({
recordName: 'www',
ipAddresses: ['192.168.1.1'],
});
const resourceInfo = builder.build();
console.log(resourceInfo);
Purpose: Initializes the PrivateDnsZoneBuilder
with the provided arguments and sets up the initial state.
Usage:
const builder = new PrivateDnsZoneBuilder({
name: 'example',
group: { resourceGroupName: 'resourceGroup' },
dependsOn: [],
});
linkTo
Purpose: Links the DNS zone to specified virtual networks.
Usage:
builder.linkTo({
vnetIds: ['vnetId1', 'vnetId2'],
subnetIds: ['subnetId1', 'subnetId2'],
});
withARecord
Purpose: Adds an A record to the DNS zone.
Usage:
builder.withARecord({
recordName: 'www',
ipAddresses: ['192.168.1.1'],
});
build
Purpose: Builds the entire DNS zone and its records with the configured properties.
Usage:
const resourceInfo = builder.build();
console.log(resourceInfo);
Here is a complete example that demonstrates how to use the PrivateDnsZoneBuilder
class, ensuring that the build()
method is called at the end:
const builder = new PrivateDnsZoneBuilder({
name: 'example',
group: { resourceGroupName: 'resourceGroup' },
dependsOn: [],
});
builder
.linkTo({
vnetIds: ['vnetId1', 'vnetId2'],
subnetIds: ['subnetId1', 'subnetId2'],
})
.withARecord({
recordName: 'www',
ipAddresses: ['192.168.1.1'],
});
const resourceInfo = builder.build();
console.log(resourceInfo);
This example demonstrates how to create a PrivateDnsZoneBuilder
instance, configure it with various settings, and finally build the DNS zone and its records. The build()
method is called last to ensure the resource is fully constructed.