in src/Program.cs [661:707]
private IDictionary<string, string> ParseAdditionalPropertiesFromArgs()
{
var additionalProperties = new Dictionary<string, string>();
if (!string.IsNullOrWhiteSpace(m_args.IngestionMappingPath) && !string.IsNullOrWhiteSpace(m_args.IngestionMappingName))
{
throw new UtilsArgumentException("Command line arguments error. At most one of {{IngestionMappingPath, IngestionMappingRef}} arguments can be set.", null);
}
// Ingestion mapping arguments must be accompanied by format argument
if ((!string.IsNullOrWhiteSpace(m_args.IngestionMappingPath) || !string.IsNullOrWhiteSpace(m_args.IngestionMappingName)) &&
m_dataFormat.HasValue == false)
{
throw new UtilsArgumentException(
$"Command line arguments error. Format argument is mandatory when IngestionMappingPath or IngestionMappingRef are set.", null);
}
if (!string.IsNullOrWhiteSpace(m_args.IngestionMappingPath))
{
if (!File.Exists(m_args.IngestionMappingPath))
{
throw new UtilsArgumentException($"Command line arguments error. Ingestion mapping file '{m_args.IngestionMappingPath}' was not found.", null);
}
var mappingObject = File.ReadAllText(m_args.IngestionMappingPath).Replace(Environment.NewLine, " ");
additionalProperties.Add(KustoIngestionProperties.IngestionMappingPropertyName, mappingObject);
additionalProperties.Add(KustoIngestionProperties.IngestionMappingKindPropertyName, m_dataFormat.Value.ToIngestionMappingKind().ToString());
}
if (!string.IsNullOrWhiteSpace(m_args.IngestionMappingName))
{
additionalProperties.Add(KustoIngestionProperties.IngestionMappingReferencePropertyName, m_args.IngestionMappingName);
additionalProperties.Add(KustoIngestionProperties.IngestionMappingKindPropertyName, m_dataFormat.Value.ToIngestionMappingKind().ToString());
}
if (m_args.IgnoreFirstRecord)
{
additionalProperties.Add(Constants.IgnoreFirstRecordPropertyName, true.ToString());
}
if (!string.IsNullOrWhiteSpace(m_args.ZipPattern))
{
additionalProperties.Add(Constants.ZipPatternPropertyName, m_args.ZipPattern);
}
return additionalProperties;
}