Beispiel #1
0
 internal SearchIndexerSkillset(string name, string description, IList <SearchIndexerSkill> skills, CognitiveServicesAccount cognitiveServicesAccount, SearchIndexerKnowledgeStore knowledgeStore, string Etag, SearchResourceEncryptionKey encryptionKey)
 {
     Name        = name;
     Description = description;
     Skills      = skills;
     CognitiveServicesAccount = cognitiveServicesAccount;
     KnowledgeStore           = knowledgeStore;
     _etag         = Etag;
     EncryptionKey = encryptionKey;
 }
Beispiel #2
0
        internal static SearchIndexerSkillset DeserializeSearchIndexerSkillset(JsonElement element)
        {
            string                                 name              = default;
            Optional <string>                      description       = default;
            IList <SearchIndexerSkill>             skills            = default;
            Optional <CognitiveServicesAccount>    cognitiveServices = default;
            Optional <SearchIndexerKnowledgeStore> knowledgeStore    = 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("knowledgeStore"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    knowledgeStore = SearchIndexerKnowledgeStore.DeserializeSearchIndexerKnowledgeStore(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, knowledgeStore.Value, odataEtag.Value, encryptionKey.Value));
        }