< Summary

Class:Azure.Search.Documents.Indexes.Models.SearchIndexerDataSourceConnection
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchIndexerDataSourceConnection.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchIndexerDataSourceConnection.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\SearchIndexerDataSourceConnection.cs
Covered lines:81
Uncovered lines:13
Coverable lines:94
Total lines:242
Line coverage:86.1% (81 of 94)
Covered branches:35
Total branches:48
Branch coverage:72.9% (35 of 48)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
get_Name()-100%100%
get_Description()-100%100%
get_Type()-100%100%
get_Container()-100%100%
get_DataChangeDetectionPolicy()-100%100%
get_DataDeletionDetectionPolicy()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-70.37%50%
DeserializeSearchIndexerDataSourceConnection(...)-89.74%90.91%
.ctor(...)-100%50%
get_ETag()-100%100%
set_ETag(...)-0%0%
get_ConnectionString()-100%100%
get_CredentialsInternal()-100%100%
set_CredentialsInternal(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchIndexerDataSourceConnection.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;
 9
 10namespace Azure.Search.Documents.Indexes.Models
 11{
 12    /// <summary> Represents a datasource definition, which can be used to configure an indexer. </summary>
 13    public partial class SearchIndexerDataSourceConnection
 14    {
 15
 16        /// <summary> Initializes a new instance of SearchIndexerDataSourceConnection. </summary>
 17        /// <param name="name"> The name of the datasource. </param>
 18        /// <param name="description"> The description of the datasource. </param>
 19        /// <param name="type"> The type of the datasource. </param>
 20        /// <param name="credentialsInternal"> Credentials for the datasource. </param>
 21        /// <param name="container"> The data container for the datasource. </param>
 22        /// <param name="dataChangeDetectionPolicy"> The data change detection policy for the datasource. </param>
 23        /// <param name="dataDeletionDetectionPolicy"> The data deletion detection policy for the datasource. </param>
 24        /// <param name="Etag"> The ETag of the data source. </param>
 1525        internal SearchIndexerDataSourceConnection(string name, string description, SearchIndexerDataSourceType type, Da
 26        {
 1527            Name = name;
 1528            Description = description;
 1529            Type = type;
 1530            CredentialsInternal = credentialsInternal;
 1531            Container = container;
 1532            DataChangeDetectionPolicy = dataChangeDetectionPolicy;
 1533            DataDeletionDetectionPolicy = dataDeletionDetectionPolicy;
 1534            _etag = Etag;
 1535        }
 36
 37        /// <summary> The name of the datasource. </summary>
 4838        public string Name { get; set; }
 39        /// <summary> The description of the datasource. </summary>
 3840        public string Description { get; set; }
 41        /// <summary> The type of the datasource. </summary>
 3942        public SearchIndexerDataSourceType Type { get; set; }
 43        /// <summary> The data container for the datasource. </summary>
 5144        public SearchIndexerDataContainer Container { get; set; }
 45        /// <summary> The data change detection policy for the datasource. </summary>
 2246        public DataChangeDetectionPolicy DataChangeDetectionPolicy { get; set; }
 47        /// <summary> The data deletion detection policy for the datasource. </summary>
 2248        public DataDeletionDetectionPolicy DataDeletionDetectionPolicy { get; set; }
 49    }
 50}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchIndexerDataSourceConnection.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.Search.Documents.Indexes.Models
 12{
 13    public partial class SearchIndexerDataSourceConnection : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 717            writer.WriteStartObject();
 718            writer.WritePropertyName("name");
 719            writer.WriteStringValue(Name);
 720            if (Optional.IsDefined(Description))
 21            {
 222                writer.WritePropertyName("description");
 223                writer.WriteStringValue(Description);
 24            }
 725            writer.WritePropertyName("type");
 726            writer.WriteStringValue(Type.ToString());
 727            writer.WritePropertyName("credentials");
 728            writer.WriteObjectValue(CredentialsInternal);
 729            writer.WritePropertyName("container");
 730            writer.WriteObjectValue(Container);
 731            if (Optional.IsDefined(DataChangeDetectionPolicy))
 32            {
 033                if (DataChangeDetectionPolicy != null)
 34                {
 035                    writer.WritePropertyName("dataChangeDetectionPolicy");
 036                    writer.WriteObjectValue(DataChangeDetectionPolicy);
 37                }
 38                else
 39                {
 040                    writer.WriteNull("dataChangeDetectionPolicy");
 41                }
 42            }
 743            if (Optional.IsDefined(DataDeletionDetectionPolicy))
 44            {
 045                if (DataDeletionDetectionPolicy != null)
 46                {
 047                    writer.WritePropertyName("dataDeletionDetectionPolicy");
 048                    writer.WriteObjectValue(DataDeletionDetectionPolicy);
 49                }
 50                else
 51                {
 052                    writer.WriteNull("dataDeletionDetectionPolicy");
 53                }
 54            }
 755            if (Optional.IsDefined(_etag))
 56            {
 257                writer.WritePropertyName("@odata.etag");
 258                writer.WriteStringValue(_etag);
 59            }
 760            writer.WriteEndObject();
 761        }
 62
 63        internal static SearchIndexerDataSourceConnection DeserializeSearchIndexerDataSourceConnection(JsonElement eleme
 64        {
 1265            string name = default;
 1266            Optional<string> description = default;
 1267            SearchIndexerDataSourceType type = default;
 1268            DataSourceCredentials credentials = default;
 1269            SearchIndexerDataContainer container = default;
 1270            Optional<DataChangeDetectionPolicy> dataChangeDetectionPolicy = default;
 1271            Optional<DataDeletionDetectionPolicy> dataDeletionDetectionPolicy = default;
 1272            Optional<string> odataEtag = default;
 22873            foreach (var property in element.EnumerateObject())
 74            {
 10275                if (property.NameEquals("name"))
 76                {
 1277                    name = property.Value.GetString();
 1278                    continue;
 79                }
 9080                if (property.NameEquals("description"))
 81                {
 982                    description = property.Value.GetString();
 983                    continue;
 84                }
 8185                if (property.NameEquals("type"))
 86                {
 987                    type = new SearchIndexerDataSourceType(property.Value.GetString());
 988                    continue;
 89                }
 7290                if (property.NameEquals("credentials"))
 91                {
 992                    credentials = DataSourceCredentials.DeserializeDataSourceCredentials(property.Value);
 993                    continue;
 94                }
 6395                if (property.NameEquals("container"))
 96                {
 997                    container = SearchIndexerDataContainer.DeserializeSearchIndexerDataContainer(property.Value);
 998                    continue;
 99                }
 54100                if (property.NameEquals("dataChangeDetectionPolicy"))
 101                {
 9102                    if (property.Value.ValueKind == JsonValueKind.Null)
 103                    {
 9104                        dataChangeDetectionPolicy = null;
 9105                        continue;
 106                    }
 0107                    dataChangeDetectionPolicy = DataChangeDetectionPolicy.DeserializeDataChangeDetectionPolicy(property.
 0108                    continue;
 109                }
 45110                if (property.NameEquals("dataDeletionDetectionPolicy"))
 111                {
 9112                    if (property.Value.ValueKind == JsonValueKind.Null)
 113                    {
 9114                        dataDeletionDetectionPolicy = null;
 9115                        continue;
 116                    }
 0117                    dataDeletionDetectionPolicy = DataDeletionDetectionPolicy.DeserializeDataDeletionDetectionPolicy(pro
 0118                    continue;
 119                }
 36120                if (property.NameEquals("@odata.etag"))
 121                {
 9122                    odataEtag = property.Value.GetString();
 123                    continue;
 124                }
 125            }
 12126            return new SearchIndexerDataSourceConnection(name, description.Value, type, credentials, container, dataChan
 127        }
 128    }
 129}

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using Azure.Core;
 6
 7namespace Azure.Search.Documents.Indexes.Models
 8{
 9    [CodeGenModel("SearchIndexerDataSource")]
 10    [CodeGenSuppress(nameof(SearchIndexerDataSourceConnection), typeof(string), typeof(SearchIndexerDataSourceType), typ
 11    public partial class SearchIndexerDataSourceConnection
 12    {
 13        [CodeGenMember("etag")]
 14        private string _etag;
 15
 16        /// <summary>
 17        /// Creates a new instance of the <see cref="SearchIndexerDataSourceConnection"/> class.
 18        /// </summary>
 19        /// <param name="name">The name of the data source.</param>
 20        /// <param name="type">The type of the data source.</param>
 21        /// <param name="connectionString">The connection string to the data source.</param>
 22        /// <param name="container">The data container for the data source.</param>
 23        /// <exception cref="ArgumentNullException"><paramref name="name"/>, <paramref name="connectionString"/>, or <pa
 524        public SearchIndexerDataSourceConnection(string name, SearchIndexerDataSourceType type, string connectionString,
 25        {
 526            Name = name ?? throw new ArgumentNullException(nameof(name));
 527            ConnectionString = connectionString ?? throw new ArgumentNullException(nameof(connectionString));
 528            Container = container ?? throw new ArgumentNullException(nameof(container));
 529            Type = type;
 530        }
 31
 32        /// <summary>
 33        /// The <see cref="Azure.ETag"/> of the <see cref="SearchIndexerDataSourceConnection"/>.
 34        /// </summary>
 35        public ETag? ETag
 36        {
 1537            get => _etag is null ? (ETag?)null : new ETag(_etag);
 038            set => _etag = value?.ToString();
 39        }
 40
 41        /// <summary>
 42        /// Gets or sets a connection string to the <see cref="Container"/>.
 43        /// </summary>
 3344        public string ConnectionString { get; set; }
 45
 46        /// <summary>
 47        /// Gets or sets an <see cref="DataSourceCredentials"/> for de/serialization purposes only.
 48        /// </summary>
 49        [CodeGenMember("credentials")]
 50        private DataSourceCredentials CredentialsInternal
 51        {
 52            get
 53            {
 754                return new DataSourceCredentials(ConnectionString ?? DataSourceCredentials.UnchangedValue);
 55            }
 56
 57            set
 58            {
 1559                ConnectionString = value?.ConnectionString;
 1560            }
 61        }
 62    }
 63}