< Summary

Class:Azure.ResourceManager.Compute.Models.EncryptionSetIdentity
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\EncryptionSetIdentity.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\EncryptionSetIdentity.Serialization.cs
Covered lines:32
Uncovered lines:7
Coverable lines:39
Total lines:111
Line coverage:82% (32 of 39)
Covered branches:18
Total branches:20
Branch coverage:90% (18 of 20)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Type()-100%100%
get_PrincipalId()-100%100%
get_TenantId()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-66.67%66.67%
DeserializeEncryptionSetIdentity(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\EncryptionSetIdentity.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> The managed identity for the disk encryption set. It should be given permission on the key vault befor
 11    public partial class EncryptionSetIdentity
 12    {
 13        /// <summary> Initializes a new instance of EncryptionSetIdentity. </summary>
 014        public EncryptionSetIdentity()
 15        {
 016            Type = "SystemAssigned";
 017        }
 18
 19        /// <summary> Initializes a new instance of EncryptionSetIdentity. </summary>
 20        /// <param name="type"> The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is suppo
 21        /// <param name="principalId"> The object id of the Managed Identity Resource. This will be sent to the RP from 
 22        /// <param name="tenantId"> The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM
 7223        internal EncryptionSetIdentity(string type, string principalId, string tenantId)
 24        {
 7225            Type = type;
 7226            PrincipalId = principalId;
 7227            TenantId = tenantId;
 7228        }
 29
 30        /// <summary> The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported. </su
 16431        public string Type { get; set; }
 32        /// <summary> The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-
 4033        public string PrincipalId { get; }
 34        /// <summary> The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-
 4035        public string TenantId { get; }
 36    }
 37}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\EncryptionSetIdentity.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 EncryptionSetIdentity : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 4017            writer.WriteStartObject();
 4018            if (Type != null)
 19            {
 4020                writer.WritePropertyName("type");
 4021                writer.WriteStringValue(Type);
 22            }
 4023            if (PrincipalId != null)
 24            {
 025                writer.WritePropertyName("principalId");
 026                writer.WriteStringValue(PrincipalId);
 27            }
 4028            if (TenantId != null)
 29            {
 030                writer.WritePropertyName("tenantId");
 031                writer.WriteStringValue(TenantId);
 32            }
 4033            writer.WriteEndObject();
 4034        }
 35
 36        internal static EncryptionSetIdentity DeserializeEncryptionSetIdentity(JsonElement element)
 37        {
 6038            string type = default;
 6039            string principalId = default;
 6040            string tenantId = default;
 48041            foreach (var property in element.EnumerateObject())
 42            {
 18043                if (property.NameEquals("type"))
 44                {
 6045                    if (property.Value.ValueKind == JsonValueKind.Null)
 46                    {
 47                        continue;
 48                    }
 6049                    type = property.Value.GetString();
 6050                    continue;
 51                }
 12052                if (property.NameEquals("principalId"))
 53                {
 6054                    if (property.Value.ValueKind == JsonValueKind.Null)
 55                    {
 56                        continue;
 57                    }
 6058                    principalId = property.Value.GetString();
 6059                    continue;
 60                }
 6061                if (property.NameEquals("tenantId"))
 62                {
 6063                    if (property.Value.ValueKind == JsonValueKind.Null)
 64                    {
 65                        continue;
 66                    }
 6067                    tenantId = property.Value.GetString();
 68                    continue;
 69                }
 70            }
 6071            return new EncryptionSetIdentity(type, principalId, tenantId);
 72        }
 73    }
 74}