internal static SearchIndexerSkillset DeserializeSearchIndexerSkillset(JsonElement element) { string name = default; Optional <string> description = default; IList <SearchIndexerSkill> skills = default; Optional <CognitiveServicesAccount> cognitiveServices = default; Optional <string> odataEtag = default; Optional <SearchResourceEncryptionKey> encryptionKey = 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("skills")) { List <SearchIndexerSkill> array = new List <SearchIndexerSkill>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(SearchIndexerSkill.DeserializeSearchIndexerSkill(item)); } skills = array; continue; } if (property.NameEquals("cognitiveServices")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } cognitiveServices = CognitiveServicesAccount.DeserializeCognitiveServicesAccount(property.Value); continue; } if (property.NameEquals("@odata.etag")) { odataEtag = property.Value.GetString(); continue; } if (property.NameEquals("encryptionKey")) { if (property.Value.ValueKind == JsonValueKind.Null) { encryptionKey = null; continue; } encryptionKey = SearchResourceEncryptionKey.DeserializeSearchResourceEncryptionKey(property.Value); continue; } } return(new SearchIndexerSkillset(name, description.Value, skills, cognitiveServices.Value, odataEtag.Value, encryptionKey.Value)); }
internal static SynonymMap DeserializeSynonymMap(JsonElement element) { string name = default; string format = default; string synonyms = default; SearchResourceEncryptionKey encryptionKey = default; string odataEtag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("format")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } format = property.Value.GetString(); continue; } if (property.NameEquals("synonyms")) { synonyms = property.Value.GetString(); continue; } if (property.NameEquals("encryptionKey")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } encryptionKey = SearchResourceEncryptionKey.DeserializeSearchResourceEncryptionKey(property.Value); continue; } if (property.NameEquals("@odata.etag")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } odataEtag = property.Value.GetString(); continue; } } return(new SynonymMap(name, format, synonyms, encryptionKey, odataEtag)); }
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; Optional <SearchResourceEncryptionKey> encryptionKey = 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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } 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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } 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; } if (property.NameEquals("encryptionKey")) { if (property.Value.ValueKind == JsonValueKind.Null) { encryptionKey = null; continue; } encryptionKey = SearchResourceEncryptionKey.DeserializeSearchResourceEncryptionKey(property.Value); 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, encryptionKey.Value)); }
internal static SearchIndex DeserializeSearchIndex(JsonElement element) { string name = default; IList <SearchField> fields = default; IList <ScoringProfile> scoringProfiles = default; string defaultScoringProfile = default; CorsOptions corsOptions = default; IList <SearchSuggester> suggesters = default; IList <LexicalAnalyzer> analyzers = default; IList <LexicalTokenizer> tokenizers = default; IList <TokenFilter> tokenFilters = default; IList <CharFilter> charFilters = default; SearchResourceEncryptionKey encryptionKey = default; SimilarityAlgorithm similarity = default; string odataEtag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("fields")) { List <SearchField> array = new List <SearchField>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(SearchField.DeserializeSearchField(item)); } } fields = array; continue; } if (property.NameEquals("scoringProfiles")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <ScoringProfile> array = new List <ScoringProfile>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(ScoringProfile.DeserializeScoringProfile(item)); } } scoringProfiles = array; continue; } if (property.NameEquals("defaultScoringProfile")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } defaultScoringProfile = property.Value.GetString(); continue; } if (property.NameEquals("corsOptions")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } corsOptions = CorsOptions.DeserializeCorsOptions(property.Value); continue; } if (property.NameEquals("suggesters")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <SearchSuggester> array = new List <SearchSuggester>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(SearchSuggester.DeserializeSearchSuggester(item)); } } suggesters = array; continue; } if (property.NameEquals("analyzers")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <LexicalAnalyzer> array = new List <LexicalAnalyzer>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(LexicalAnalyzer.DeserializeLexicalAnalyzer(item)); } } analyzers = array; continue; } if (property.NameEquals("tokenizers")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <LexicalTokenizer> array = new List <LexicalTokenizer>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(LexicalTokenizer.DeserializeLexicalTokenizer(item)); } } tokenizers = array; continue; } if (property.NameEquals("tokenFilters")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <TokenFilter> array = new List <TokenFilter>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(TokenFilter.DeserializeTokenFilter(item)); } } tokenFilters = array; continue; } if (property.NameEquals("charFilters")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } List <CharFilter> array = new List <CharFilter>(); foreach (var item in property.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) { array.Add(null); } else { array.Add(CharFilter.DeserializeCharFilter(item)); } } charFilters = array; continue; } if (property.NameEquals("encryptionKey")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } encryptionKey = SearchResourceEncryptionKey.DeserializeSearchResourceEncryptionKey(property.Value); continue; } if (property.NameEquals("similarity")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } similarity = SimilarityAlgorithm.DeserializeSimilarityAlgorithm(property.Value); continue; } if (property.NameEquals("@odata.etag")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } odataEtag = property.Value.GetString(); continue; } } return(new SearchIndex(name, fields, scoringProfiles, defaultScoringProfile, corsOptions, suggesters, analyzers, tokenizers, tokenFilters, charFilters, encryptionKey, similarity, odataEtag)); }
internal static SearchIndexerDataSourceConnection DeserializeSearchIndexerDataSourceConnection(JsonElement element) { string name = default; Optional <string> description = default; SearchIndexerDataSourceType type = default; DataSourceCredentials credentials = default; SearchIndexerDataContainer container = default; Optional <SearchIndexerDataIdentity> identity = default; Optional <DataChangeDetectionPolicy> dataChangeDetectionPolicy = default; Optional <DataDeletionDetectionPolicy> dataDeletionDetectionPolicy = default; Optional <string> odataEtag = default; Optional <SearchResourceEncryptionKey> encryptionKey = 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("type")) { type = new SearchIndexerDataSourceType(property.Value.GetString()); continue; } if (property.NameEquals("credentials")) { credentials = DataSourceCredentials.DeserializeDataSourceCredentials(property.Value); continue; } if (property.NameEquals("container")) { container = SearchIndexerDataContainer.DeserializeSearchIndexerDataContainer(property.Value); continue; } if (property.NameEquals("identity")) { if (property.Value.ValueKind == JsonValueKind.Null) { identity = null; continue; } identity = SearchIndexerDataIdentity.DeserializeSearchIndexerDataIdentity(property.Value); continue; } if (property.NameEquals("dataChangeDetectionPolicy")) { if (property.Value.ValueKind == JsonValueKind.Null) { dataChangeDetectionPolicy = null; continue; } dataChangeDetectionPolicy = DataChangeDetectionPolicy.DeserializeDataChangeDetectionPolicy(property.Value); continue; } if (property.NameEquals("dataDeletionDetectionPolicy")) { if (property.Value.ValueKind == JsonValueKind.Null) { dataDeletionDetectionPolicy = null; continue; } dataDeletionDetectionPolicy = DataDeletionDetectionPolicy.DeserializeDataDeletionDetectionPolicy(property.Value); continue; } if (property.NameEquals("@odata.etag")) { odataEtag = property.Value.GetString(); continue; } if (property.NameEquals("encryptionKey")) { if (property.Value.ValueKind == JsonValueKind.Null) { encryptionKey = null; continue; } encryptionKey = SearchResourceEncryptionKey.DeserializeSearchResourceEncryptionKey(property.Value); continue; } } return(new SearchIndexerDataSourceConnection(name, description.Value, type, credentials, container, identity.Value, dataChangeDetectionPolicy.Value, dataDeletionDetectionPolicy.Value, odataEtag.Value, encryptionKey.Value)); }
internal static SearchIndex DeserializeSearchIndex(JsonElement element) { string name = default; IList <SearchField> fields = default; Optional <IList <ScoringProfile> > scoringProfiles = default; Optional <string> defaultScoringProfile = default; Optional <CorsOptions> corsOptions = default; Optional <IList <SearchSuggester> > suggesters = default; Optional <IList <LexicalAnalyzer> > analyzers = default; Optional <IList <LexicalTokenizer> > tokenizers = default; Optional <IList <TokenFilter> > tokenFilters = default; Optional <IList <CharFilter> > charFilters = default; Optional <IList <LexicalNormalizer> > normalizers = default; Optional <SearchResourceEncryptionKey> encryptionKey = default; Optional <SimilarityAlgorithm> similarity = default; Optional <SemanticSettings> semantic = default; Optional <string> odataEtag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("fields")) { List <SearchField> array = new List <SearchField>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(SearchField.DeserializeSearchField(item)); } fields = array; continue; } if (property.NameEquals("scoringProfiles")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <ScoringProfile> array = new List <ScoringProfile>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(ScoringProfile.DeserializeScoringProfile(item)); } scoringProfiles = array; continue; } if (property.NameEquals("defaultScoringProfile")) { defaultScoringProfile = property.Value.GetString(); continue; } if (property.NameEquals("corsOptions")) { if (property.Value.ValueKind == JsonValueKind.Null) { corsOptions = null; continue; } corsOptions = CorsOptions.DeserializeCorsOptions(property.Value); continue; } if (property.NameEquals("suggesters")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <SearchSuggester> array = new List <SearchSuggester>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(SearchSuggester.DeserializeSearchSuggester(item)); } suggesters = array; continue; } if (property.NameEquals("analyzers")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <LexicalAnalyzer> array = new List <LexicalAnalyzer>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(LexicalAnalyzer.DeserializeLexicalAnalyzer(item)); } analyzers = array; continue; } if (property.NameEquals("tokenizers")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <LexicalTokenizer> array = new List <LexicalTokenizer>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(LexicalTokenizer.DeserializeLexicalTokenizer(item)); } tokenizers = array; continue; } if (property.NameEquals("tokenFilters")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <TokenFilter> array = new List <TokenFilter>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TokenFilter.DeserializeTokenFilter(item)); } tokenFilters = array; continue; } if (property.NameEquals("charFilters")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <CharFilter> array = new List <CharFilter>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(CharFilter.DeserializeCharFilter(item)); } charFilters = array; continue; } if (property.NameEquals("normalizers")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <LexicalNormalizer> array = new List <LexicalNormalizer>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(LexicalNormalizer.DeserializeLexicalNormalizer(item)); } normalizers = array; continue; } if (property.NameEquals("encryptionKey")) { if (property.Value.ValueKind == JsonValueKind.Null) { encryptionKey = null; continue; } encryptionKey = SearchResourceEncryptionKey.DeserializeSearchResourceEncryptionKey(property.Value); continue; } if (property.NameEquals("similarity")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } similarity = SimilarityAlgorithm.DeserializeSimilarityAlgorithm(property.Value); continue; } if (property.NameEquals("semantic")) { if (property.Value.ValueKind == JsonValueKind.Null) { semantic = null; continue; } semantic = SemanticSettings.DeserializeSemanticSettings(property.Value); continue; } if (property.NameEquals("@odata.etag")) { odataEtag = property.Value.GetString(); continue; } } return(new SearchIndex(name, fields, Optional.ToList(scoringProfiles), defaultScoringProfile.Value, corsOptions.Value, Optional.ToList(suggesters), Optional.ToList(analyzers), Optional.ToList(tokenizers), Optional.ToList(tokenFilters), Optional.ToList(charFilters), Optional.ToList(normalizers), encryptionKey.Value, similarity.Value, semantic.Value, odataEtag.Value)); }