< Summary

Class:Azure.ResourceManager.Compute.Models.DiskEncryptionSet
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DiskEncryptionSet.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DiskEncryptionSet.Serialization.cs
Covered lines:78
Uncovered lines:32
Coverable lines:110
Total lines:256
Line coverage:70.9% (78 of 110)
Covered branches:51
Total branches:70
Branch coverage:72.8% (51 of 70)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_Identity()-100%100%
get_ActiveKey()-100%100%
get_PreviousKeys()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-51.28%50%
DeserializeDiskEncryptionSet(...)-84.21%85.42%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DiskEncryptionSet.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> disk encryption set resource. </summary>
 14    public partial class DiskEncryptionSet : Resource
 15    {
 16        /// <summary> Initializes a new instance of DiskEncryptionSet. </summary>
 17        /// <param name="location"> Resource location. </param>
 018        public DiskEncryptionSet(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 DiskEncryptionSet. </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="identity"> The managed identity for the disk encryption set. It should be given permission on t
 33        /// <param name="activeKey"> The key vault key which is currently used by this disk encryption set. </param>
 34        /// <param name="previousKeys"> A readonly collection of key vault keys previously used by this disk encryption 
 35        /// <param name="provisioningState"> The disk encryption set provisioning state. </param>
 7236        internal DiskEncryptionSet(string id, string name, string type, string location, IDictionary<string, string> tag
 37        {
 7238            Identity = identity;
 7239            ActiveKey = activeKey;
 7240            PreviousKeys = previousKeys;
 7241            ProvisioningState = provisioningState;
 7242        }
 43
 44        /// <summary> The managed identity for the disk encryption set. It should be given permission on the key vault b
 17645        public EncryptionSetIdentity Identity { get; set; }
 46        /// <summary> The key vault key which is currently used by this disk encryption set. </summary>
 20047        public KeyVaultAndKeyReference ActiveKey { get; set; }
 48        /// <summary> A readonly collection of key vault keys previously used by this disk encryption set while a key ro
 4049        public IList<KeyVaultAndKeyReference> PreviousKeys { get; }
 50        /// <summary> The disk encryption set provisioning state. </summary>
 4051        public string ProvisioningState { get; }
 52    }
 53}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\DiskEncryptionSet.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 DiskEncryptionSet : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 4018            writer.WriteStartObject();
 4019            if (Identity != null)
 20            {
 4021                writer.WritePropertyName("identity");
 4022                writer.WriteObjectValue(Identity);
 23            }
 4024            if (Id != null)
 25            {
 026                writer.WritePropertyName("id");
 027                writer.WriteStringValue(Id);
 28            }
 4029            if (Name != null)
 30            {
 031                writer.WritePropertyName("name");
 032                writer.WriteStringValue(Name);
 33            }
 4034            if (Type != null)
 35            {
 036                writer.WritePropertyName("type");
 037                writer.WriteStringValue(Type);
 38            }
 4039            writer.WritePropertyName("location");
 4040            writer.WriteStringValue(Location);
 4041            if (Tags != null)
 42            {
 043                writer.WritePropertyName("tags");
 044                writer.WriteStartObject();
 045                foreach (var item in Tags)
 46                {
 047                    writer.WritePropertyName(item.Key);
 048                    writer.WriteStringValue(item.Value);
 49                }
 050                writer.WriteEndObject();
 51            }
 4052            writer.WritePropertyName("properties");
 4053            writer.WriteStartObject();
 4054            if (ActiveKey != null)
 55            {
 4056                writer.WritePropertyName("activeKey");
 4057                writer.WriteObjectValue(ActiveKey);
 58            }
 4059            if (PreviousKeys != null)
 60            {
 061                writer.WritePropertyName("previousKeys");
 062                writer.WriteStartArray();
 063                foreach (var item in PreviousKeys)
 64                {
 065                    writer.WriteObjectValue(item);
 66                }
 067                writer.WriteEndArray();
 68            }
 4069            if (ProvisioningState != null)
 70            {
 071                writer.WritePropertyName("provisioningState");
 072                writer.WriteStringValue(ProvisioningState);
 73            }
 4074            writer.WriteEndObject();
 4075            writer.WriteEndObject();
 4076        }
 77
 78        internal static DiskEncryptionSet DeserializeDiskEncryptionSet(JsonElement element)
 79        {
 6080            EncryptionSetIdentity identity = default;
 6081            string id = default;
 6082            string name = default;
 6083            string type = default;
 6084            string location = default;
 6085            IDictionary<string, string> tags = default;
 6086            KeyVaultAndKeyReference activeKey = default;
 6087            IList<KeyVaultAndKeyReference> previousKeys = default;
 6088            string provisioningState = default;
 84889            foreach (var property in element.EnumerateObject())
 90            {
 36491                if (property.NameEquals("identity"))
 92                {
 6093                    if (property.Value.ValueKind == JsonValueKind.Null)
 94                    {
 95                        continue;
 96                    }
 6097                    identity = EncryptionSetIdentity.DeserializeEncryptionSetIdentity(property.Value);
 6098                    continue;
 99                }
 304100                if (property.NameEquals("id"))
 101                {
 60102                    if (property.Value.ValueKind == JsonValueKind.Null)
 103                    {
 104                        continue;
 105                    }
 60106                    id = property.Value.GetString();
 60107                    continue;
 108                }
 244109                if (property.NameEquals("name"))
 110                {
 60111                    if (property.Value.ValueKind == JsonValueKind.Null)
 112                    {
 113                        continue;
 114                    }
 60115                    name = property.Value.GetString();
 60116                    continue;
 117                }
 184118                if (property.NameEquals("type"))
 119                {
 60120                    if (property.Value.ValueKind == JsonValueKind.Null)
 121                    {
 122                        continue;
 123                    }
 60124                    type = property.Value.GetString();
 60125                    continue;
 126                }
 124127                if (property.NameEquals("location"))
 128                {
 60129                    location = property.Value.GetString();
 60130                    continue;
 131                }
 64132                if (property.NameEquals("tags"))
 133                {
 4134                    if (property.Value.ValueKind == JsonValueKind.Null)
 135                    {
 136                        continue;
 137                    }
 4138                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 16139                    foreach (var property0 in property.Value.EnumerateObject())
 140                    {
 4141                        if (property0.Value.ValueKind == JsonValueKind.Null)
 142                        {
 0143                            dictionary.Add(property0.Name, null);
 144                        }
 145                        else
 146                        {
 4147                            dictionary.Add(property0.Name, property0.Value.GetString());
 148                        }
 149                    }
 4150                    tags = dictionary;
 4151                    continue;
 152                }
 60153                if (property.NameEquals("properties"))
 154                {
 360155                    foreach (var property0 in property.Value.EnumerateObject())
 156                    {
 120157                        if (property0.NameEquals("activeKey"))
 158                        {
 60159                            if (property0.Value.ValueKind == JsonValueKind.Null)
 160                            {
 161                                continue;
 162                            }
 60163                            activeKey = KeyVaultAndKeyReference.DeserializeKeyVaultAndKeyReference(property0.Value);
 60164                            continue;
 165                        }
 60166                        if (property0.NameEquals("previousKeys"))
 167                        {
 0168                            if (property0.Value.ValueKind == JsonValueKind.Null)
 169                            {
 170                                continue;
 171                            }
 0172                            List<KeyVaultAndKeyReference> array = new List<KeyVaultAndKeyReference>();
 0173                            foreach (var item in property0.Value.EnumerateArray())
 174                            {
 0175                                if (item.ValueKind == JsonValueKind.Null)
 176                                {
 0177                                    array.Add(null);
 178                                }
 179                                else
 180                                {
 0181                                    array.Add(KeyVaultAndKeyReference.DeserializeKeyVaultAndKeyReference(item));
 182                                }
 183                            }
 0184                            previousKeys = array;
 0185                            continue;
 186                        }
 60187                        if (property0.NameEquals("provisioningState"))
 188                        {
 60189                            if (property0.Value.ValueKind == JsonValueKind.Null)
 190                            {
 191                                continue;
 192                            }
 60193                            provisioningState = property0.Value.GetString();
 194                            continue;
 195                        }
 196                    }
 197                    continue;
 198                }
 199            }
 60200            return new DiskEncryptionSet(id, name, type, location, tags, identity, activeKey, previousKeys, provisioning
 201        }
 202    }
 203}