To use this function add it to the class library file named OrchestratorPluginSRMService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: OrchestratorPluginSRMService.ts
Function: SRMProtectionGroupAddVcVirtualMachine
public SRMProtectionGroupAddVcVirtualMachine(objVcVirtualMachine: VcVirtualMachine, strSRMSiteName: string, strSRMRecoveryPlanName: string, strSRMProtectionGroupName: string): boolean {
let objSRMSite: SRMSite = this.SRMSiteGetByName(strSRMSiteName)
let arrSRMRecoveryPlan: SRMRecoveryPlan[] = this.SRMRecoveryPlansGet(objSRMSite);
let objSRMRecoveryPlan: SRMRecoveryPlan = arrSRMRecoveryPlan.find((objSRMRecoveryPlan: SRMRecoveryPlan): boolean => {
return objSRMRecoveryPlan.name === strSRMRecoveryPlanName;
});
let arrSRMProtectionGroup: SRMProtectionGroup[] = objSRMRecoveryPlan.getProtectionGroups();
let objSRMProtectionGroup: SRMProtectionGroup = arrSRMProtectionGroup.find((objSRMProtectionGroup: SRMProtectionGroup): boolean => {
return objSRMProtectionGroup.name === strSRMProtectionGroupName;
});
try {
objSRMProtectionGroup.protectVm(objVcVirtualMachine.id);
return true;
}
catch (objException) {
Utilities.logException(objException, this.objLogger, "SRMProtectVcVirtualMachine");
return false;
}
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
