//********************************************************************* /// /// <summary> /// Sync the CMP VM list with the CmpWap VM list /// </summary> /// //********************************************************************* public void SynchWithCmp() { var cmp = new CmpApiClient(_eventLog); var cwdb = new CmpWapDb(); //*** Fetch the CMP resource group list *** var cmpResGroupList = cmp.FetchAzureResourceGroups(); //*** Fetch the CmpWap app list *** var cmpWapAppList = cwdb.FetchAppList(); //*** Fold *** foreach (var cmpResGroup in cmpResGroupList.Where(cmpResGroup => !cmpWapAppList.Any(cmpWapApp => cmpResGroup.Name.Equals( cmpWapApp.Name, StringComparison.InvariantCultureIgnoreCase)))) { ImportApp(cmpResGroup, cwdb); } //*** Fetch the CMP VM list *** var cmpVmList = cmp.FetchCmpRequests(); //*** Fetch the CmpWap VM list *** var cmpWapVmList = cwdb.FetchVmDepRequests(null, true); //*** Fold *** foreach (var cmpVm in cmpVmList.Where(cmpVm => !cmpWapVmList.Any(cmpWapVm => cmpVm.TargetVmName.Equals( cmpWapVm.TargetVmName, StringComparison.InvariantCultureIgnoreCase)))) { ImportVm(cmpVm, cwdb); } }
//********************************************************************* /// /// <summary> /// Fetch list of applications from WAP DB /// </summary> /// //********************************************************************* private void FetchAppListFromDb() { var cwdb = new CmpWapDb(); var list = cwdb.FetchAppList(); appList.Clear(); appList.AddRange(list); }