< Summary

Class:Azure.ResourceManager.AppConfiguration.Models.ApiKey
Assembly:Azure.ResourceManager.AppConfiguration
File(s):C:\Git\azure-sdk-for-net\sdk\appconfiguration\Azure.ResourceManager.AppConfiguration\src\Generated\Models\ApiKey.cs
C:\Git\azure-sdk-for-net\sdk\appconfiguration\Azure.ResourceManager.AppConfiguration\src\Generated\Models\ApiKey.Serialization.cs
Covered lines:40
Uncovered lines:7
Coverable lines:47
Total lines:134
Line coverage:85.1% (40 of 47)
Covered branches:26
Total branches:26
Branch coverage:100% (26 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Id()-100%100%
get_Name()-0%100%
get_Value()-0%100%
get_ConnectionString()-0%100%
get_LastModified()-0%100%
get_ReadOnly()-0%100%
DeserializeApiKey(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\appconfiguration\Azure.ResourceManager.AppConfiguration\src\Generated\Models\ApiKey.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.ResourceManager.AppConfiguration.Models
 11{
 12    /// <summary> An API key used for authenticating with a configuration store endpoint. </summary>
 13    public partial class ApiKey
 14    {
 15        /// <summary> Initializes a new instance of ApiKey. </summary>
 016        internal ApiKey()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of ApiKey. </summary>
 21        /// <param name="id"> The key ID. </param>
 22        /// <param name="name"> A name for the key describing its usage. </param>
 23        /// <param name="value"> The value of the key that is used for authentication purposes. </param>
 24        /// <param name="connectionString"> A connection string that can be used by supporting clients for authenticatio
 25        /// <param name="lastModified"> The last time any of the key&apos;s properties were modified. </param>
 26        /// <param name="readOnly"> Whether this key can only be used for read operations. </param>
 2027        internal ApiKey(string id, string name, string value, string connectionString, DateTimeOffset? lastModified, boo
 28        {
 2029            Id = id;
 2030            Name = name;
 2031            Value = value;
 2032            ConnectionString = connectionString;
 2033            LastModified = lastModified;
 2034            ReadOnly = readOnly;
 2035        }
 36
 37        /// <summary> The key ID. </summary>
 438        public string Id { get; }
 39        /// <summary> A name for the key describing its usage. </summary>
 040        public string Name { get; }
 41        /// <summary> The value of the key that is used for authentication purposes. </summary>
 042        public string Value { get; }
 43        /// <summary> A connection string that can be used by supporting clients for authentication. </summary>
 044        public string ConnectionString { get; }
 45        /// <summary> The last time any of the key&apos;s properties were modified. </summary>
 046        public DateTimeOffset? LastModified { get; }
 47        /// <summary> Whether this key can only be used for read operations. </summary>
 048        public bool? ReadOnly { get; }
 49    }
 50}

C:\Git\azure-sdk-for-net\sdk\appconfiguration\Azure.ResourceManager.AppConfiguration\src\Generated\Models\ApiKey.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;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.AppConfiguration.Models
 13{
 14    public partial class ApiKey
 15    {
 16        internal static ApiKey DeserializeApiKey(JsonElement element)
 17        {
 2018            string id = default;
 2019            string name = default;
 2020            string value = default;
 2021            string connectionString = default;
 2022            DateTimeOffset? lastModified = default;
 2023            bool? readOnly = default;
 28024            foreach (var property in element.EnumerateObject())
 25            {
 12026                if (property.NameEquals("id"))
 27                {
 2028                    if (property.Value.ValueKind == JsonValueKind.Null)
 29                    {
 30                        continue;
 31                    }
 2032                    id = property.Value.GetString();
 2033                    continue;
 34                }
 10035                if (property.NameEquals("name"))
 36                {
 2037                    if (property.Value.ValueKind == JsonValueKind.Null)
 38                    {
 39                        continue;
 40                    }
 2041                    name = property.Value.GetString();
 2042                    continue;
 43                }
 8044                if (property.NameEquals("value"))
 45                {
 2046                    if (property.Value.ValueKind == JsonValueKind.Null)
 47                    {
 48                        continue;
 49                    }
 2050                    value = property.Value.GetString();
 2051                    continue;
 52                }
 6053                if (property.NameEquals("connectionString"))
 54                {
 2055                    if (property.Value.ValueKind == JsonValueKind.Null)
 56                    {
 57                        continue;
 58                    }
 2059                    connectionString = property.Value.GetString();
 2060                    continue;
 61                }
 4062                if (property.NameEquals("lastModified"))
 63                {
 2064                    if (property.Value.ValueKind == JsonValueKind.Null)
 65                    {
 66                        continue;
 67                    }
 2068                    lastModified = property.Value.GetDateTimeOffset("O");
 2069                    continue;
 70                }
 2071                if (property.NameEquals("readOnly"))
 72                {
 2073                    if (property.Value.ValueKind == JsonValueKind.Null)
 74                    {
 75                        continue;
 76                    }
 2077                    readOnly = property.Value.GetBoolean();
 78                    continue;
 79                }
 80            }
 2081            return new ApiKey(id, name, value, connectionString, lastModified, readOnly);
 82        }
 83    }
 84}