internal SearchServiceCounters(SearchResourceCounter documentCounter, SearchResourceCounter indexCounter, SearchResourceCounter indexerCounter, SearchResourceCounter dataSourceCounter, SearchResourceCounter storageSizeCounter, SearchResourceCounter synonymMapCounter)
        {
            if (documentCounter == null)
            {
                throw new ArgumentNullException(nameof(documentCounter));
            }
            if (indexCounter == null)
            {
                throw new ArgumentNullException(nameof(indexCounter));
            }
            if (indexerCounter == null)
            {
                throw new ArgumentNullException(nameof(indexerCounter));
            }
            if (dataSourceCounter == null)
            {
                throw new ArgumentNullException(nameof(dataSourceCounter));
            }
            if (storageSizeCounter == null)
            {
                throw new ArgumentNullException(nameof(storageSizeCounter));
            }
            if (synonymMapCounter == null)
            {
                throw new ArgumentNullException(nameof(synonymMapCounter));
            }

            DocumentCounter    = documentCounter;
            IndexCounter       = indexCounter;
            IndexerCounter     = indexerCounter;
            DataSourceCounter  = dataSourceCounter;
            StorageSizeCounter = storageSizeCounter;
            SynonymMapCounter  = synonymMapCounter;
        }
Пример #2
0
        internal static SearchServiceCounters DeserializeSearchServiceCounters(JsonElement element)
        {
            SearchResourceCounter            documentCount    = default;
            SearchResourceCounter            indexesCount     = default;
            SearchResourceCounter            indexersCount    = default;
            SearchResourceCounter            dataSourcesCount = default;
            SearchResourceCounter            storageSize      = default;
            SearchResourceCounter            synonymMaps      = default;
            Optional <SearchResourceCounter> skillsetCount    = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("documentCount"))
                {
                    documentCount = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
                if (property.NameEquals("indexesCount"))
                {
                    indexesCount = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
                if (property.NameEquals("indexersCount"))
                {
                    indexersCount = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
                if (property.NameEquals("dataSourcesCount"))
                {
                    dataSourcesCount = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
                if (property.NameEquals("storageSize"))
                {
                    storageSize = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
                if (property.NameEquals("synonymMaps"))
                {
                    synonymMaps = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
                if (property.NameEquals("skillsetCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    skillsetCount = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
            }
            return(new SearchServiceCounters(documentCount, indexesCount, indexersCount, dataSourcesCount, storageSize, synonymMaps, skillsetCount.Value));
        }
 /// <summary> Initializes a new instance of SearchServiceCounters. </summary>
 /// <param name="documentCounter"> Total number of documents across all indexes in the service. </param>
 /// <param name="indexCounter"> Total number of indexes. </param>
 /// <param name="indexerCounter"> Total number of indexers. </param>
 /// <param name="dataSourceCounter"> Total number of data sources. </param>
 /// <param name="storageSizeCounter"> Total size of used storage in bytes. </param>
 /// <param name="synonymMapCounter"> Total number of synonym maps. </param>
 /// <param name="skillsetCounter"> Total number of skillsets. </param>
 /// <exception cref="ArgumentNullException"> <paramref name="documentCounter"/>, <paramref name="indexCounter"/>, <paramref name="indexerCounter"/>, <paramref name="dataSourceCounter"/>, <paramref name="storageSizeCounter"/>, or <paramref name="synonymMapCounter"/> is null. </exception>
 internal SearchServiceCounters(
     SearchResourceCounter documentCounter,
     SearchResourceCounter indexCounter,
     SearchResourceCounter indexerCounter,
     SearchResourceCounter dataSourceCounter,
     SearchResourceCounter storageSizeCounter,
     SearchResourceCounter synonymMapCounter,
     SearchResourceCounter skillsetCounter)
 {
     DocumentCounter    = documentCounter ?? throw new ArgumentNullException(nameof(documentCounter));
     IndexCounter       = indexCounter ?? throw new ArgumentNullException(nameof(indexCounter));
     IndexerCounter     = indexerCounter ?? throw new ArgumentNullException(nameof(indexerCounter));
     DataSourceCounter  = dataSourceCounter ?? throw new ArgumentNullException(nameof(dataSourceCounter));
     StorageSizeCounter = storageSizeCounter ?? throw new ArgumentNullException(nameof(storageSizeCounter));
     SynonymMapCounter  = synonymMapCounter ?? throw new ArgumentNullException(nameof(synonymMapCounter));
     SkillsetCounter    = skillsetCounter;
 }
Пример #4
0
        internal static SearchServiceCounters DeserializeSearchServiceCounters(JsonElement element)
        {
            SearchResourceCounter documentCount    = default;
            SearchResourceCounter indexesCount     = default;
            SearchResourceCounter indexersCount    = default;
            SearchResourceCounter dataSourcesCount = default;
            SearchResourceCounter storageSize      = default;
            SearchResourceCounter synonymMaps      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("documentCount"))
                {
                    documentCount = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
                if (property.NameEquals("indexesCount"))
                {
                    indexesCount = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
                if (property.NameEquals("indexersCount"))
                {
                    indexersCount = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
                if (property.NameEquals("dataSourcesCount"))
                {
                    dataSourcesCount = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
                if (property.NameEquals("storageSize"))
                {
                    storageSize = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
                if (property.NameEquals("synonymMaps"))
                {
                    synonymMaps = SearchResourceCounter.DeserializeSearchResourceCounter(property.Value);
                    continue;
                }
            }
            return(new SearchServiceCounters(documentCount, indexesCount, indexersCount, dataSourcesCount, storageSize, synonymMaps));
        }