internal static SearchIndexer DeserializeSearchIndexer(JsonElement element) { string name = default; Optional <string> description = default; string dataSourceName = default; Optional <string> skillsetName = default; string targetIndexName = default; Optional <IndexingSchedule> schedule = default; Optional <IndexingParameters> parameters = default; Optional <IList <FieldMapping> > fieldMappings = default; Optional <IList <FieldMapping> > outputFieldMappings = default; Optional <bool?> disabled = default; Optional <string> odataEtag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("description")) { description = property.Value.GetString(); continue; } if (property.NameEquals("dataSourceName")) { dataSourceName = property.Value.GetString(); continue; } if (property.NameEquals("skillsetName")) { skillsetName = property.Value.GetString(); continue; } if (property.NameEquals("targetIndexName")) { targetIndexName = property.Value.GetString(); continue; } if (property.NameEquals("schedule")) { if (property.Value.ValueKind == JsonValueKind.Null) { schedule = null; continue; } schedule = IndexingSchedule.DeserializeIndexingSchedule(property.Value); continue; } if (property.NameEquals("parameters")) { if (property.Value.ValueKind == JsonValueKind.Null) { parameters = null; continue; } parameters = IndexingParameters.DeserializeIndexingParameters(property.Value); continue; } if (property.NameEquals("fieldMappings")) { List <FieldMapping> array = new List <FieldMapping>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(FieldMapping.DeserializeFieldMapping(item)); } fieldMappings = array; continue; } if (property.NameEquals("outputFieldMappings")) { List <FieldMapping> array = new List <FieldMapping>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(FieldMapping.DeserializeFieldMapping(item)); } outputFieldMappings = array; continue; } if (property.NameEquals("disabled")) { if (property.Value.ValueKind == JsonValueKind.Null) { disabled = null; continue; } disabled = property.Value.GetBoolean(); continue; } if (property.NameEquals("@odata.etag")) { odataEtag = property.Value.GetString(); continue; } } return(new SearchIndexer(name, description.Value, dataSourceName, skillsetName.Value, targetIndexName, schedule.Value, parameters.Value, Optional.ToList(fieldMappings), Optional.ToList(outputFieldMappings), Optional.ToNullable(disabled), odataEtag.Value)); }
internal static SearchIndexer DeserializeSearchIndexer(JsonElement element) { string name = default; string description = default; string dataSourceName = default; string skillsetName = default; string targetIndexName = default; IndexingSchedule schedule = default; IndexingParameters parameters = default; IList <FieldMapping> fieldMappings = default; IList <FieldMapping> outputFieldMappings = default; bool? disabled = default; string odataEtag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("description")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } description = property.Value.GetString(); continue; } if (property.NameEquals("dataSourceName")) { dataSourceName = property.Value.GetString(); continue; } if (property.NameEquals("skillsetName")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } skillsetName = property.Value.GetString(); continue; } if (property.NameEquals("targetIndexName")) { targetIndexName = property.Value.GetString(); continue; } if (property.NameEquals("schedule")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } schedule = IndexingSchedule.DeserializeIndexingSchedule(property.Value); continue; } if (property.NameEquals("parameters")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } parameters = IndexingParameters.DeserializeIndexingParameters(property.Value); continue; } if (property.NameEquals("fieldMappings")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <FieldMapping> array = new List <FieldMapping>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(FieldMapping.DeserializeFieldMapping(item)); } } fieldMappings = array; continue; } if (property.NameEquals("outputFieldMappings")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <FieldMapping> array = new List <FieldMapping>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(FieldMapping.DeserializeFieldMapping(item)); } } outputFieldMappings = array; continue; } if (property.NameEquals("disabled")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } disabled = property.Value.GetBoolean(); continue; } if (property.NameEquals("@odata.etag")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } odataEtag = property.Value.GetString(); continue; } } return(new SearchIndexer(name, description, dataSourceName, skillsetName, targetIndexName, schedule, parameters, fieldMappings, outputFieldMappings, disabled, odataEtag)); }