< Summary

Class:Azure.ResourceManager.Compute.Models.SshPublicKey
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SshPublicKey.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SshPublicKey.Serialization.cs
Covered lines:28
Uncovered lines:0
Coverable lines:28
Total lines:91
Line coverage:100% (28 of 28)
Covered branches:14
Total branches:14
Branch coverage:100% (14 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Path()-100%100%
get_KeyData()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeSshPublicKey(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SshPublicKey.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
 8namespace Azure.ResourceManager.Compute.Models
 9{
 10    /// <summary> Contains information about SSH certificate public key and the path on the Linux VM where the public ke
 11    public partial class SshPublicKey
 12    {
 13        /// <summary> Initializes a new instance of SshPublicKey. </summary>
 414        public SshPublicKey()
 15        {
 416        }
 17
 18        /// <summary> Initializes a new instance of SshPublicKey. </summary>
 19        /// <param name="path"> Specifies the full path on the created VM where ssh public key is stored. If the file al
 20        /// <param name="keyData"> SSH public key certificate used to authenticate with the VM through ssh. The key need
 1621        internal SshPublicKey(string path, string keyData)
 22        {
 1623            Path = path;
 1624            KeyData = keyData;
 1625        }
 26
 27        /// <summary> Specifies the full path on the created VM where ssh public key is stored. If the file already exis
 5628        public string Path { get; set; }
 29        /// <summary> SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at le
 5630        public string KeyData { get; set; }
 31    }
 32}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SshPublicKey.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.ResourceManager.Compute.Models
 12{
 13    public partial class SshPublicKey : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 1617            writer.WriteStartObject();
 1618            if (Path != null)
 19            {
 1620                writer.WritePropertyName("path");
 1621                writer.WriteStringValue(Path);
 22            }
 1623            if (KeyData != null)
 24            {
 1625                writer.WritePropertyName("keyData");
 1626                writer.WriteStringValue(KeyData);
 27            }
 1628            writer.WriteEndObject();
 1629        }
 30
 31        internal static SshPublicKey DeserializeSshPublicKey(JsonElement element)
 32        {
 1633            string path = default;
 1634            string keyData = default;
 9635            foreach (var property in element.EnumerateObject())
 36            {
 3237                if (property.NameEquals("path"))
 38                {
 1639                    if (property.Value.ValueKind == JsonValueKind.Null)
 40                    {
 41                        continue;
 42                    }
 1643                    path = property.Value.GetString();
 1644                    continue;
 45                }
 1646                if (property.NameEquals("keyData"))
 47                {
 1648                    if (property.Value.ValueKind == JsonValueKind.Null)
 49                    {
 50                        continue;
 51                    }
 1652                    keyData = property.Value.GetString();
 53                    continue;
 54                }
 55            }
 1656            return new SshPublicKey(path, keyData);
 57        }
 58    }
 59}