private string GetTargetServiceType()

in src/Program.cs [574:598]


        private string GetTargetServiceType(ICslAdminProvider adminClient)
        {
            string serviceType = null;

            try
            {
                var cmd = CslCommandGenerator.GenerateVersionShowCommand();
                var result = adminClient.ExecuteControlCommand<VersionShowCommandResult>(cmd);

                serviceType = result.First().ServiceType;
            }
            catch (Exception ex)
            {
                m_logger.LogWarning($"LightIngest failed to receive response from endpoint at '{m_kcsb.DataSource}'. Error: '{ex.MessageEx(true)}'");
            }

            if (!string.IsNullOrWhiteSpace(serviceType) &&
                (string.Equals(serviceType, KustoIngestionConstants.DmClusterServiceType, StringComparison.OrdinalIgnoreCase) ||
                 string.Equals(serviceType, KustoIngestionConstants.EngineClusterServiceType, StringComparison.OrdinalIgnoreCase)))
            {
                return serviceType;
            }

            throw new UtilsArgumentException($"Failed to connect. See above error for more details.", null);
        }