VdiBuilder Class OverviewThe VdiBuilder class is designed to build and configure an Azure Virtual Desktop (VDI) instance with specific configurations such as application groups, options, and network settings.
Initializes the VdiBuilder with the provided arguments and sets the host pool name.
const vdiBuilder = new VdiBuilder({
name: 'myVdiInstance',
group: { resourceGroupName: 'myResourceGroup' },
// other necessary arguments
});
withAppGroupAdds an application group to the VDI instance.
vdiBuilder.withAppGroup({
applicationGroupType: 'Desktop',
// other VdiBuilderAppGroupType properties
});
withOptionsSets additional options for the VDI instance.
vdiBuilder.withOptions({
sku: 'Standard',
plan: 'Basic',
// other VdiBuilderOptionsType properties
});
withNetworkSets the network properties for the VDI instance.
vdiBuilder.withNetwork({
subnetId: 'subnet-id',
// other VdiBuilderNetworkType properties
});
buildHostCreates the host pool for the VDI instance with the specified configurations.
This method is called internally by the build method and is not typically called directly.
buildAppGroupsCreates the application groups for the VDI instance.
This method is called internally by the build method and is not typically called directly.
buildBuilds the VDI instance, including the host pool and application groups, and returns the resource information.
const resourceInfo = vdiBuilder.build();
console.log(resourceInfo);
Here is a full example demonstrating how to use the VdiBuilder class:
import VdiBuilder from './Builder/VdiBuilder';
import { BuilderProps } from './types';
const props: BuilderProps = {
name: 'myVdiInstance',
group: { resourceGroupName: 'myResourceGroup' },
// other necessary arguments
};
const vdiBuilder = new VdiBuilder(props);
vdiBuilder
.withAppGroup({
applicationGroupType: 'Desktop',
// other VdiBuilderAppGroupType properties
})
.withOptions({
sku: 'Standard',
plan: 'Basic',
// other VdiBuilderOptionsType properties
})
.withNetwork({
subnetId: 'subnet-id',
// other VdiBuilderNetworkType properties
});
const resourceInfo = vdiBuilder.build();
console.log(resourceInfo);
This guideline should help developers understand and reuse the methods in the VdiBuilder class effectively.