< Summary

Class:Azure.ResourceManager.Compute.Models.SshConfiguration
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SshConfiguration.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SshConfiguration.Serialization.cs
Covered lines:25
Uncovered lines:1
Coverable lines:26
Total lines:92
Line coverage:96.1% (25 of 26)
Covered branches:13
Total branches:14
Branch coverage:92.8% (13 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_PublicKeys()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeSshConfiguration(...)-90.91%90%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SshConfiguration.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;
 9
 10namespace Azure.ResourceManager.Compute.Models
 11{
 12    /// <summary> SSH configuration for Linux based VMs running on Azure. </summary>
 13    public partial class SshConfiguration
 14    {
 15        /// <summary> Initializes a new instance of SshConfiguration. </summary>
 416        public SshConfiguration()
 17        {
 418        }
 19
 20        /// <summary> Initializes a new instance of SshConfiguration. </summary>
 21        /// <param name="publicKeys"> The list of SSH public keys used to authenticate with linux based VMs. </param>
 1622        internal SshConfiguration(IList<SshPublicKey> publicKeys)
 23        {
 1624            PublicKeys = publicKeys;
 1625        }
 26
 27        /// <summary> The list of SSH public keys used to authenticate with linux based VMs. </summary>
 6028        public IList<SshPublicKey> PublicKeys { get; set; }
 29    }
 30}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SshConfiguration.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.ResourceManager.Compute.Models
 13{
 14    public partial class SshConfiguration : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 1618            writer.WriteStartObject();
 1619            if (PublicKeys != null)
 20            {
 1621                writer.WritePropertyName("publicKeys");
 1622                writer.WriteStartArray();
 6423                foreach (var item in PublicKeys)
 24                {
 1625                    writer.WriteObjectValue(item);
 26                }
 1627                writer.WriteEndArray();
 28            }
 1629            writer.WriteEndObject();
 1630        }
 31
 32        internal static SshConfiguration DeserializeSshConfiguration(JsonElement element)
 33        {
 1634            IList<SshPublicKey> publicKeys = default;
 6435            foreach (var property in element.EnumerateObject())
 36            {
 1637                if (property.NameEquals("publicKeys"))
 38                {
 1639                    if (property.Value.ValueKind == JsonValueKind.Null)
 40                    {
 41                        continue;
 42                    }
 1643                    List<SshPublicKey> array = new List<SshPublicKey>();
 6444                    foreach (var item in property.Value.EnumerateArray())
 45                    {
 1646                        if (item.ValueKind == JsonValueKind.Null)
 47                        {
 048                            array.Add(null);
 49                        }
 50                        else
 51                        {
 1652                            array.Add(SshPublicKey.DeserializeSshPublicKey(item));
 53                        }
 54                    }
 1655                    publicKeys = array;
 56                    continue;
 57                }
 58            }
 1659            return new SshConfiguration(publicKeys);
 60        }
 61    }
 62}