< Summary

Class:Azure.Search.Documents.Indexes.Models.SearchIndexer
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchIndexer.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchIndexer.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\SearchIndexer.cs
Covered lines:126
Uncovered lines:17
Coverable lines:143
Total lines:315
Line coverage:88.1% (126 of 143)
Covered branches:56
Total branches:70
Branch coverage:80% (56 of 70)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-76.92%50%
.ctor(...)-100%100%
get_Name()-100%100%
get_Description()-100%100%
get_DataSourceName()-100%100%
get_SkillsetName()-100%100%
get_TargetIndexName()-100%100%
get_Schedule()-100%100%
get_Parameters()-100%100%
get_IsDisabled()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-80%73.08%
DeserializeSearchIndexer(...)-93.33%94.12%
get_ETag()-100%100%
set_ETag(...)-0%0%
get_FieldMappings()-100%100%
get_OutputFieldMappings()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchIndexer.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10using Azure.Core;
 11
 12namespace Azure.Search.Documents.Indexes.Models
 13{
 14    /// <summary> Represents an indexer. </summary>
 15    public partial class SearchIndexer
 16    {
 17        /// <summary> Initializes a new instance of SearchIndexer. </summary>
 18        /// <param name="name"> The name of the indexer. </param>
 19        /// <param name="dataSourceName"> The name of the datasource from which this indexer reads data. </param>
 20        /// <param name="targetIndexName"> The name of the index to which this indexer writes data. </param>
 21        /// <exception cref="ArgumentNullException"> <paramref name="name"/>, <paramref name="dataSourceName"/>, or <par
 422        public SearchIndexer(string name, string dataSourceName, string targetIndexName)
 23        {
 424            if (name == null)
 25            {
 026                throw new ArgumentNullException(nameof(name));
 27            }
 428            if (dataSourceName == null)
 29            {
 030                throw new ArgumentNullException(nameof(dataSourceName));
 31            }
 432            if (targetIndexName == null)
 33            {
 034                throw new ArgumentNullException(nameof(targetIndexName));
 35            }
 36
 437            Name = name;
 438            DataSourceName = dataSourceName;
 439            TargetIndexName = targetIndexName;
 440            FieldMappings = new ChangeTrackingList<FieldMapping>();
 441            OutputFieldMappings = new ChangeTrackingList<FieldMapping>();
 442        }
 43
 44        /// <summary> Initializes a new instance of SearchIndexer. </summary>
 45        /// <param name="name"> The name of the indexer. </param>
 46        /// <param name="description"> The description of the indexer. </param>
 47        /// <param name="dataSourceName"> The name of the datasource from which this indexer reads data. </param>
 48        /// <param name="skillsetName"> The name of the skillset executing with this indexer. </param>
 49        /// <param name="targetIndexName"> The name of the index to which this indexer writes data. </param>
 50        /// <param name="schedule"> The schedule for this indexer. </param>
 51        /// <param name="parameters"> Parameters for indexer execution. </param>
 52        /// <param name="fieldMappings"> Defines mappings between fields in the data source and corresponding target fie
 53        /// <param name="outputFieldMappings"> Output field mappings are applied after enrichment and immediately before
 54        /// <param name="isDisabled"> A value indicating whether the indexer is disabled. Default is false. </param>
 55        /// <param name="Etag"> The ETag of the indexer. </param>
 856        internal SearchIndexer(string name, string description, string dataSourceName, string skillsetName, string targe
 57        {
 858            Name = name;
 859            Description = description;
 860            DataSourceName = dataSourceName;
 861            SkillsetName = skillsetName;
 862            TargetIndexName = targetIndexName;
 863            Schedule = schedule;
 864            Parameters = parameters;
 865            FieldMappings = fieldMappings;
 866            OutputFieldMappings = outputFieldMappings;
 867            IsDisabled = isDisabled;
 868            _etag = Etag;
 869        }
 70
 71        /// <summary> The name of the indexer. </summary>
 2572        public string Name { get; set; }
 73        /// <summary> The description of the indexer. </summary>
 1774        public string Description { get; set; }
 75        /// <summary> The name of the datasource from which this indexer reads data. </summary>
 1776        public string DataSourceName { get; set; }
 77        /// <summary> The name of the skillset executing with this indexer. </summary>
 1578        public string SkillsetName { get; set; }
 79        /// <summary> The name of the index to which this indexer writes data. </summary>
 1780        public string TargetIndexName { get; set; }
 81        /// <summary> The schedule for this indexer. </summary>
 1382        public IndexingSchedule Schedule { get; set; }
 83        /// <summary> Parameters for indexer execution. </summary>
 1984        public IndexingParameters Parameters { get; set; }
 85        /// <summary> A value indicating whether the indexer is disabled. Default is false. </summary>
 1386        public bool? IsDisabled { get; set; }
 87    }
 88}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchIndexer.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.Search.Documents.Indexes.Models
 13{
 14    public partial class SearchIndexer : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 518            writer.WriteStartObject();
 519            writer.WritePropertyName("name");
 520            writer.WriteStringValue(Name);
 521            if (Optional.IsDefined(Description))
 22            {
 223                writer.WritePropertyName("description");
 224                writer.WriteStringValue(Description);
 25            }
 526            writer.WritePropertyName("dataSourceName");
 527            writer.WriteStringValue(DataSourceName);
 528            if (Optional.IsDefined(SkillsetName))
 29            {
 130                writer.WritePropertyName("skillsetName");
 131                writer.WriteStringValue(SkillsetName);
 32            }
 533            writer.WritePropertyName("targetIndexName");
 534            writer.WriteStringValue(TargetIndexName);
 535            if (Optional.IsDefined(Schedule))
 36            {
 037                if (Schedule != null)
 38                {
 039                    writer.WritePropertyName("schedule");
 040                    writer.WriteObjectValue(Schedule);
 41                }
 42                else
 43                {
 044                    writer.WriteNull("schedule");
 45                }
 46            }
 547            if (Optional.IsDefined(Parameters))
 48            {
 149                if (Parameters != null)
 50                {
 151                    writer.WritePropertyName("parameters");
 152                    writer.WriteObjectValue(Parameters);
 53                }
 54                else
 55                {
 056                    writer.WriteNull("parameters");
 57                }
 58            }
 559            if (Optional.IsCollectionDefined(FieldMappings))
 60            {
 361                writer.WritePropertyName("fieldMappings");
 362                writer.WriteStartArray();
 1663                foreach (var item in FieldMappings)
 64                {
 565                    writer.WriteObjectValue(item);
 66                }
 367                writer.WriteEndArray();
 68            }
 569            if (Optional.IsCollectionDefined(OutputFieldMappings))
 70            {
 371                writer.WritePropertyName("outputFieldMappings");
 372                writer.WriteStartArray();
 873                foreach (var item in OutputFieldMappings)
 74                {
 175                    writer.WriteObjectValue(item);
 76                }
 377                writer.WriteEndArray();
 78            }
 579            if (Optional.IsDefined(IsDisabled))
 80            {
 081                if (IsDisabled != null)
 82                {
 083                    writer.WritePropertyName("disabled");
 084                    writer.WriteBooleanValue(IsDisabled.Value);
 85                }
 86                else
 87                {
 088                    writer.WriteNull("disabled");
 89                }
 90            }
 591            if (Optional.IsDefined(_etag))
 92            {
 293                writer.WritePropertyName("@odata.etag");
 294                writer.WriteStringValue(_etag);
 95            }
 596            writer.WriteEndObject();
 597        }
 98
 99        internal static SearchIndexer DeserializeSearchIndexer(JsonElement element)
 100        {
 5101            string name = default;
 5102            Optional<string> description = default;
 5103            string dataSourceName = default;
 5104            Optional<string> skillsetName = default;
 5105            string targetIndexName = default;
 5106            Optional<IndexingSchedule> schedule = default;
 5107            Optional<IndexingParameters> parameters = default;
 5108            Optional<IList<FieldMapping>> fieldMappings = default;
 5109            Optional<IList<FieldMapping>> outputFieldMappings = default;
 5110            Optional<bool?> disabled = default;
 5111            Optional<string> odataEtag = default;
 140112            foreach (var property in element.EnumerateObject())
 113            {
 65114                if (property.NameEquals("name"))
 115                {
 5116                    name = property.Value.GetString();
 5117                    continue;
 118                }
 60119                if (property.NameEquals("description"))
 120                {
 5121                    description = property.Value.GetString();
 5122                    continue;
 123                }
 55124                if (property.NameEquals("dataSourceName"))
 125                {
 5126                    dataSourceName = property.Value.GetString();
 5127                    continue;
 128                }
 50129                if (property.NameEquals("skillsetName"))
 130                {
 5131                    skillsetName = property.Value.GetString();
 5132                    continue;
 133                }
 45134                if (property.NameEquals("targetIndexName"))
 135                {
 5136                    targetIndexName = property.Value.GetString();
 5137                    continue;
 138                }
 40139                if (property.NameEquals("schedule"))
 140                {
 5141                    if (property.Value.ValueKind == JsonValueKind.Null)
 142                    {
 5143                        schedule = null;
 5144                        continue;
 145                    }
 0146                    schedule = IndexingSchedule.DeserializeIndexingSchedule(property.Value);
 0147                    continue;
 148                }
 35149                if (property.NameEquals("parameters"))
 150                {
 5151                    if (property.Value.ValueKind == JsonValueKind.Null)
 152                    {
 4153                        parameters = null;
 4154                        continue;
 155                    }
 1156                    parameters = IndexingParameters.DeserializeIndexingParameters(property.Value);
 1157                    continue;
 158                }
 30159                if (property.NameEquals("fieldMappings"))
 160                {
 5161                    List<FieldMapping> array = new List<FieldMapping>();
 20162                    foreach (var item in property.Value.EnumerateArray())
 163                    {
 5164                        array.Add(FieldMapping.DeserializeFieldMapping(item));
 165                    }
 5166                    fieldMappings = array;
 5167                    continue;
 168                }
 25169                if (property.NameEquals("outputFieldMappings"))
 170                {
 5171                    List<FieldMapping> array = new List<FieldMapping>();
 12172                    foreach (var item in property.Value.EnumerateArray())
 173                    {
 1174                        array.Add(FieldMapping.DeserializeFieldMapping(item));
 175                    }
 5176                    outputFieldMappings = array;
 5177                    continue;
 178                }
 20179                if (property.NameEquals("disabled"))
 180                {
 5181                    if (property.Value.ValueKind == JsonValueKind.Null)
 182                    {
 5183                        disabled = null;
 5184                        continue;
 185                    }
 0186                    disabled = property.Value.GetBoolean();
 0187                    continue;
 188                }
 15189                if (property.NameEquals("@odata.etag"))
 190                {
 5191                    odataEtag = property.Value.GetString();
 192                    continue;
 193                }
 194            }
 5195            return new SearchIndexer(name, description.Value, dataSourceName, skillsetName.Value, targetIndexName, sched
 196        }
 197    }
 198}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\SearchIndexer.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using Azure.Core;
 6
 7namespace Azure.Search.Documents.Indexes.Models
 8{
 9    public partial class SearchIndexer
 10    {
 11        [CodeGenMember("etag")]
 12        private string _etag;
 13
 14        /// <summary>
 15        /// The <see cref="Azure.ETag"/> of the <see cref="SearchIndexer"/>.
 16        /// </summary>
 17        public ETag? ETag
 18        {
 519            get => _etag is null ? (ETag?)null : new ETag(_etag);
 020            set => _etag = value?.ToString();
 21        }
 22
 23        /// <summary> Defines mappings between fields in the data source and corresponding target fields in the index. <
 1324        public IList<FieldMapping> FieldMappings { get; }
 25
 26        /// <summary> Output field mappings are applied after enrichment and immediately before indexing. </summary>
 927        public IList<FieldMapping> OutputFieldMappings { get; }
 28    }
 29}