< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_PublicKey()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeSshPublicKeyResource(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SshPublicKeyResource.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;
 10
 11namespace Azure.ResourceManager.Compute.Models
 12{
 13    /// <summary> Specifies information about the SSH public key. </summary>
 14    public partial class SshPublicKeyResource : Resource
 15    {
 16        /// <summary> Initializes a new instance of SshPublicKeyResource. </summary>
 17        /// <param name="location"> Resource location. </param>
 018        public SshPublicKeyResource(string location) : base(location)
 19        {
 020            if (location == null)
 21            {
 022                throw new ArgumentNullException(nameof(location));
 23            }
 024        }
 25
 26        /// <summary> Initializes a new instance of SshPublicKeyResource. </summary>
 27        /// <param name="id"> Resource Id. </param>
 28        /// <param name="name"> Resource name. </param>
 29        /// <param name="type"> Resource type. </param>
 30        /// <param name="location"> Resource location. </param>
 31        /// <param name="tags"> Resource tags. </param>
 32        /// <param name="publicKey"> SSH public key used to authenticate to a virtual machine through ssh. If this prope
 033        internal SshPublicKeyResource(string id, string name, string type, string location, IDictionary<string, string> 
 34        {
 035            PublicKey = publicKey;
 036        }
 37
 38        /// <summary> SSH public key used to authenticate to a virtual machine through ssh. If this property is not init
 039        public string PublicKey { get; set; }
 40    }
 41}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SshPublicKeyResource.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 SshPublicKeyResource : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 024            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 029            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 034            writer.WritePropertyName("location");
 035            writer.WriteStringValue(Location);
 036            if (Tags != null)
 37            {
 038                writer.WritePropertyName("tags");
 039                writer.WriteStartObject();
 040                foreach (var item in Tags)
 41                {
 042                    writer.WritePropertyName(item.Key);
 043                    writer.WriteStringValue(item.Value);
 44                }
 045                writer.WriteEndObject();
 46            }
 047            writer.WritePropertyName("properties");
 048            writer.WriteStartObject();
 049            if (PublicKey != null)
 50            {
 051                writer.WritePropertyName("publicKey");
 052                writer.WriteStringValue(PublicKey);
 53            }
 054            writer.WriteEndObject();
 055            writer.WriteEndObject();
 056        }
 57
 58        internal static SshPublicKeyResource DeserializeSshPublicKeyResource(JsonElement element)
 59        {
 060            string id = default;
 061            string name = default;
 062            string type = default;
 063            string location = default;
 064            IDictionary<string, string> tags = default;
 065            string publicKey = default;
 066            foreach (var property in element.EnumerateObject())
 67            {
 068                if (property.NameEquals("id"))
 69                {
 070                    if (property.Value.ValueKind == JsonValueKind.Null)
 71                    {
 72                        continue;
 73                    }
 074                    id = property.Value.GetString();
 075                    continue;
 76                }
 077                if (property.NameEquals("name"))
 78                {
 079                    if (property.Value.ValueKind == JsonValueKind.Null)
 80                    {
 81                        continue;
 82                    }
 083                    name = property.Value.GetString();
 084                    continue;
 85                }
 086                if (property.NameEquals("type"))
 87                {
 088                    if (property.Value.ValueKind == JsonValueKind.Null)
 89                    {
 90                        continue;
 91                    }
 092                    type = property.Value.GetString();
 093                    continue;
 94                }
 095                if (property.NameEquals("location"))
 96                {
 097                    location = property.Value.GetString();
 098                    continue;
 99                }
 0100                if (property.NameEquals("tags"))
 101                {
 0102                    if (property.Value.ValueKind == JsonValueKind.Null)
 103                    {
 104                        continue;
 105                    }
 0106                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0107                    foreach (var property0 in property.Value.EnumerateObject())
 108                    {
 0109                        if (property0.Value.ValueKind == JsonValueKind.Null)
 110                        {
 0111                            dictionary.Add(property0.Name, null);
 112                        }
 113                        else
 114                        {
 0115                            dictionary.Add(property0.Name, property0.Value.GetString());
 116                        }
 117                    }
 0118                    tags = dictionary;
 0119                    continue;
 120                }
 0121                if (property.NameEquals("properties"))
 122                {
 0123                    foreach (var property0 in property.Value.EnumerateObject())
 124                    {
 0125                        if (property0.NameEquals("publicKey"))
 126                        {
 0127                            if (property0.Value.ValueKind == JsonValueKind.Null)
 128                            {
 129                                continue;
 130                            }
 0131                            publicKey = property0.Value.GetString();
 132                            continue;
 133                        }
 134                    }
 135                    continue;
 136                }
 137            }
 0138            return new SshPublicKeyResource(id, name, type, location, tags, publicKey);
 139        }
 140    }
 141}