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
publicSRMProtectionGroupAddVcVirtualMachine(objVcVirtualMachine:VcVirtualMachine,strSRMSiteName:string,strSRMRecoveryPlanName:string,strSRMProtectionGroupName:string):boolean{
letobjSRMSite:SRMSite=this.SRMSiteGetByName(strSRMSiteName)
letarrSRMRecoveryPlan:SRMRecoveryPlan[]=this.SRMRecoveryPlansGet(objSRMSite);
letobjSRMRecoveryPlan:SRMRecoveryPlan=arrSRMRecoveryPlan.find((objSRMRecoveryPlan:SRMRecoveryPlan):boolean=>{
returnobjSRMRecoveryPlan.name===strSRMRecoveryPlanName;
});
letarrSRMProtectionGroup:SRMProtectionGroup[]=objSRMRecoveryPlan.getProtectionGroups();
letobjSRMProtectionGroup:SRMProtectionGroup=arrSRMProtectionGroup.find((objSRMProtectionGroup:SRMProtectionGroup):boolean=>{
returnobjSRMProtectionGroup.name===strSRMProtectionGroupName;
});
try{
objSRMProtectionGroup.protectVm(objVcVirtualMachine.id);
returntrue;
}
catch (objException){
Utilities.logException(objException,this.objLogger,"SRMProtectVcVirtualMachine");
returnfalse;
}
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
