< Summary

Class:Azure.ResourceManager.Compute.Models.EncryptionSettingsCollection
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\EncryptionSettingsCollection.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\EncryptionSettingsCollection.Serialization.cs
Covered lines:20
Uncovered lines:25
Coverable lines:45
Total lines:125
Line coverage:44.4% (20 of 45)
Covered branches:5
Total branches:22
Branch coverage:22.7% (5 of 22)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%100%
.ctor(...)-100%100%
get_Enabled()-100%100%
get_EncryptionSettings()-100%100%
get_EncryptionSettingsVersion()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-85.71%83.33%
DeserializeEncryptionSettingsCollection(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\EncryptionSettingsCollection.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> Encryption settings for disk or snapshot. </summary>
 13    public partial class EncryptionSettingsCollection
 14    {
 15        /// <summary> Initializes a new instance of EncryptionSettingsCollection. </summary>
 16        /// <param name="enabled"> Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to 
 017        public EncryptionSettingsCollection(bool enabled)
 18        {
 019            Enabled = enabled;
 020        }
 21
 22        /// <summary> Initializes a new instance of EncryptionSettingsCollection. </summary>
 23        /// <param name="enabled"> Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to 
 24        /// <param name="encryptionSettings"> A collection of encryption settings, one for each disk volume. </param>
 25        /// <param name="encryptionSettingsVersion"> Describes what type of encryption is used for the disks. Once this 
 426        internal EncryptionSettingsCollection(bool enabled, IList<EncryptionSettingsElement> encryptionSettings, string 
 27        {
 428            Enabled = enabled;
 429            EncryptionSettings = encryptionSettings;
 430            EncryptionSettingsVersion = encryptionSettingsVersion;
 431        }
 32
 33        /// <summary> Set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryp
 834        public bool Enabled { get; set; }
 35        /// <summary> A collection of encryption settings, one for each disk volume. </summary>
 1236        public IList<EncryptionSettingsElement> EncryptionSettings { get; set; }
 37        /// <summary> Describes what type of encryption is used for the disks. Once this field is set, it cannot be over
 838        public string EncryptionSettingsVersion { get; set; }
 39    }
 40}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\EncryptionSettingsCollection.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 EncryptionSettingsCollection : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 418            writer.WriteStartObject();
 419            writer.WritePropertyName("enabled");
 420            writer.WriteBooleanValue(Enabled);
 421            if (EncryptionSettings != null)
 22            {
 423                writer.WritePropertyName("encryptionSettings");
 424                writer.WriteStartArray();
 1625                foreach (var item in EncryptionSettings)
 26                {
 427                    writer.WriteObjectValue(item);
 28                }
 429                writer.WriteEndArray();
 30            }
 431            if (EncryptionSettingsVersion != null)
 32            {
 033                writer.WritePropertyName("encryptionSettingsVersion");
 034                writer.WriteStringValue(EncryptionSettingsVersion);
 35            }
 436            writer.WriteEndObject();
 437        }
 38
 39        internal static EncryptionSettingsCollection DeserializeEncryptionSettingsCollection(JsonElement element)
 40        {
 041            bool enabled = default;
 042            IList<EncryptionSettingsElement> encryptionSettings = default;
 043            string encryptionSettingsVersion = default;
 044            foreach (var property in element.EnumerateObject())
 45            {
 046                if (property.NameEquals("enabled"))
 47                {
 048                    enabled = property.Value.GetBoolean();
 049                    continue;
 50                }
 051                if (property.NameEquals("encryptionSettings"))
 52                {
 053                    if (property.Value.ValueKind == JsonValueKind.Null)
 54                    {
 55                        continue;
 56                    }
 057                    List<EncryptionSettingsElement> array = new List<EncryptionSettingsElement>();
 058                    foreach (var item in property.Value.EnumerateArray())
 59                    {
 060                        if (item.ValueKind == JsonValueKind.Null)
 61                        {
 062                            array.Add(null);
 63                        }
 64                        else
 65                        {
 066                            array.Add(EncryptionSettingsElement.DeserializeEncryptionSettingsElement(item));
 67                        }
 68                    }
 069                    encryptionSettings = array;
 070                    continue;
 71                }
 072                if (property.NameEquals("encryptionSettingsVersion"))
 73                {
 074                    if (property.Value.ValueKind == JsonValueKind.Null)
 75                    {
 76                        continue;
 77                    }
 078                    encryptionSettingsVersion = property.Value.GetString();
 79                    continue;
 80                }
 81            }
 082            return new EncryptionSettingsCollection(enabled, encryptionSettings, encryptionSettingsVersion);
 83        }
 84    }
 85}