To use this function add it to the class library file named vCenterServerService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: vCenterServerService.ts
Public Function:
publicVcHostSystemFirewallRulesetEnable(objVcHostSystem:VcHostSystem,strRulesetName:string):void{
this.VcHostSystemFirewallRulesetToggle(objVcHostSystem,strRulesetName,"Enable");
}Public Function:
publicVcHostSystemFirewallRulesetDisable(objVcHostSystem:VcHostSystem,strRulesetName:string):void{
this.VcHostSystemFirewallRulesetToggle(objVcHostSystem,strRulesetName,"Disable");
}Private Function: VcHostSystemFirewallRulesetToggle
privateVcHostSystemFirewallRulesetToggle(objVcHostSystem:VcHostSystem,strRulesetName:string,strAction:"Enable"|"Disable"):void{
letobjVcHostConfigManager:VcHostConfigManager=objVcHostSystem.configManager;
letobjVcHostFirewallSystem:VcHostFirewallSystem=objVcHostConfigManager.firewallSystem;
this.objLogger.info(`Attempting to${strAction} Firewall Ruleset on vCenter Host: '${objVcHostSystem.name}'...`);
if (strAction==="Enable")
{
objVcHostFirewallSystem.enableRuleset(strRulesetName);
}
elseif (strAction==="Disable")
{
objVcHostFirewallSystem.disableRuleset(strRulesetName);
}
this.objLogger.info(`Succesfully${strAction}d Firewall Ruleset on vCenter Host: '${objVcHostSystem.name}'.`);
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
