protected override void InternalProcessRecord() { if (this.Organization != null) { if (this.ehfService == null) { this.globalSession = this.CreateGlobalSession(); EhfTargetServerConfig config = Utils.CreateEhfTargetConfig(this.globalSession, this.ConnectorId, this); this.edgeSyncEhfConnector = Utils.GetConnector(this.globalSession, this.ConnectorId, this); this.ehfService = new EhfProvisioningService(config); } ExchangeConfigurationUnit currentOrganization = this.GetCurrentOrganization(this.globalSession); ExchangeTenantRecord exchangeTenantRecord = this.CreateExchangeTenantRecord(currentOrganization); EhfCompanyRecord ehfCompanyRecord = this.CreateEhfCompanyRecord(exchangeTenantRecord.PerimeterConfig); IList <object> list = EhfSyncDiffRecord <object> .Compare(exchangeTenantRecord, ehfCompanyRecord); using (IEnumerator <object> enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { object sendToPipeline = enumerator.Current; base.WriteObject(sendToPipeline); } return; } } base.TestGeneralSyncHealth(); }
internal static IList <object> Compare(ExchangeTenantRecord exchangeTenantRecord, EhfCompanyRecord ehfCompanyRecord) { List <object> list = new List <object>(); if (!exchangeTenantRecord.PerimeterConfig.EhfConfigSyncEnabled && ehfCompanyRecord == null) { return(list); } if (exchangeTenantRecord.PerimeterConfig.EhfConfigSyncEnabled && ehfCompanyRecord == null) { list.Add(new EhfSyncDiffRecord <SyncedPerimeterConfig>(exchangeTenantRecord.Organization.RawIdentity, exchangeTenantRecord.PerimeterConfig.Identity, EhfSyncObjectType.PerimeterConfig, "PerimeterConfig", exchangeTenantRecord.PerimeterConfig, null, null, exchangeTenantRecord.PerimeterConfig.SyncErrors)); list.AddRange(EhfSyncDiffRecord <object> .CompareDomain(exchangeTenantRecord, ehfCompanyRecord)); } if (!exchangeTenantRecord.PerimeterConfig.EhfConfigSyncEnabled && ehfCompanyRecord != null) { list.Add(new EhfSyncDiffRecord <string>(exchangeTenantRecord.Organization.RawIdentity, exchangeTenantRecord.PerimeterConfig.Identity, EhfSyncObjectType.PerimeterConfig, "Company ID", exchangeTenantRecord.CompanyId, ehfCompanyRecord.CompanyId)); foreach (DomainSyncRecord actualObject in ehfCompanyRecord.Domains) { list.Add(new EhfSyncDiffRecord <DomainSyncRecord>(exchangeTenantRecord.Organization.RawIdentity, null, EhfSyncObjectType.AcceptedDomain, string.Empty, null, actualObject)); } } if (ehfCompanyRecord != null && exchangeTenantRecord.PerimeterConfig.EhfConfigSyncEnabled) { EhfSyncDiffRecord <IList <string> > item; if (EhfSyncDiffRecord <IList <string> > .TryGetEdgeSyncDiffRecord(exchangeTenantRecord.Organization, exchangeTenantRecord.PerimeterConfig, exchangeTenantRecord.GatewayIPAddresses, ehfCompanyRecord.GatewayIPAddresses, "GatewayIPAddresses", out item)) { list.Add(item); } EhfSyncDiffRecord <IList <string> > item2; if (EhfSyncDiffRecord <IList <string> > .TryGetEdgeSyncDiffRecord(exchangeTenantRecord.Organization, exchangeTenantRecord.PerimeterConfig, exchangeTenantRecord.InternalIPAddresses, ehfCompanyRecord.InternalIPAddresses, "InternalServerIPAddresses", out item2)) { list.Add(item2); } if (!exchangeTenantRecord.CompanyId.Equals(ehfCompanyRecord.CompanyId)) { list.Add(new EhfSyncDiffRecord <string>(exchangeTenantRecord.Organization.RawIdentity, exchangeTenantRecord.PerimeterConfig.Identity, EhfSyncObjectType.PerimeterConfig, "Company ID", exchangeTenantRecord.CompanyId, ehfCompanyRecord.CompanyId)); } if (!exchangeTenantRecord.Guid.Equals(ehfCompanyRecord.Guid)) { list.Add(new EhfSyncDiffRecord <Guid>(exchangeTenantRecord.Organization.RawIdentity, exchangeTenantRecord.PerimeterConfig.Identity, EhfSyncObjectType.PerimeterConfig, "GUID", exchangeTenantRecord.Guid, ehfCompanyRecord.Guid)); } if (!ehfCompanyRecord.CompanyName.EndsWith(exchangeTenantRecord.CompanyName)) { list.Add(new EhfSyncDiffRecord <string>(exchangeTenantRecord.Organization.RawIdentity, exchangeTenantRecord.PerimeterConfig.Identity, EhfSyncObjectType.PerimeterConfig, "Name", exchangeTenantRecord.CompanyName, ehfCompanyRecord.CompanyName)); } if (exchangeTenantRecord.IPSkiplistingEnabled != ehfCompanyRecord.IPSkiplistingEnabled) { list.Add(new EhfSyncDiffRecord <bool>(exchangeTenantRecord.Organization.RawIdentity, exchangeTenantRecord.PerimeterConfig.Identity, EhfSyncObjectType.PerimeterConfig, "IPSkiplistingEnabled", exchangeTenantRecord.IPSkiplistingEnabled, ehfCompanyRecord.IPSkiplistingEnabled)); } list.AddRange(EhfSyncDiffRecord <object> .CompareDomain(exchangeTenantRecord, ehfCompanyRecord)); } return(list); }
private static bool TryGetEdgeSyncDiffRecord(OrganizationIdParameter organization, SyncedPerimeterConfig perimeterConfig, IList <string> exchangeIpAddresses, IList <string> ehfIpAddresses, string label, out EhfSyncDiffRecord <IList <string> > ehfSyncDiffRecord) { ehfSyncDiffRecord = null; IList <string> list = exchangeIpAddresses.Intersect(ehfIpAddresses).ToList <string>(); if (list.Count != exchangeIpAddresses.Count || exchangeIpAddresses.Count != ehfIpAddresses.Count) { IList <string> expectedObject = exchangeIpAddresses.Except(ehfIpAddresses).ToList <string>(); IList <string> actualObject = ehfIpAddresses.Except(exchangeIpAddresses).ToList <string>(); ehfSyncDiffRecord = new EhfSyncDiffRecord <IList <string> >(organization.RawIdentity, perimeterConfig.Identity, EhfSyncObjectType.PerimeterConfig, label, expectedObject, actualObject, list, perimeterConfig.SyncErrors); return(true); } return(false); }