Function: vCenter Cluster Compute Resource DRS Rule Delete

by Simon Sparks · 5 April 2026

To use this function add it to the class library file named PluginVCClusterComputeResourceService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: PluginVCClusterComputeResourceService.ts

Description: Orchestrator Function to Delete a DRS Rule from a vCenter Cluster Compute Resource.

Private Function: VcClusterRuleDelete

private VcClusterRuleDelete(objVcClusterComputeResource: VcClusterComputeResource, strVcClusterRuleName: string): boolean {

    let objVcClusterRuleInfo: VcClusterRuleInfo = this.VcClusterRuleGetByName(objVcClusterComputeResource, strVcClusterRuleName);

    let objVcClusterRuleSpec: VcClusterRuleSpec = new VcClusterRuleSpec();
    objVcClusterRuleSpec.operation = VcArrayUpdateOperation.remove;
    objVcClusterRuleSpec.removeKey_AnyValue = objVcClusterRuleInfo.key;

    let arrVcClusterRuleSpec: VcClusterRuleSpec[] = [];
    arrVcClusterRuleSpec.push(objVcClusterRuleSpec);

    let objVcClusterConfigSpec: VcClusterConfigSpec = new VcClusterConfigSpec();
    objVcClusterConfigSpec.rulesSpec = arrVcClusterRuleSpec;

    let blnResult: boolean = this.Reconfigure(objVcClusterComputeResource, null, null, arrVcClusterRuleSpec);

    return blnResult;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like