< Summary

Class:Azure.ResourceManager.AppConfiguration.Models.ResourceIdentity
Assembly:Azure.ResourceManager.AppConfiguration
File(s):C:\Git\azure-sdk-for-net\sdk\appconfiguration\Azure.ResourceManager.AppConfiguration\src\Generated\Models\ResourceIdentity.cs
C:\Git\azure-sdk-for-net\sdk\appconfiguration\Azure.ResourceManager.AppConfiguration\src\Generated\Models\ResourceIdentity.Serialization.cs
Covered lines:0
Uncovered lines:57
Coverable lines:57
Total lines:150
Line coverage:0% (0 of 57)
Covered branches:0
Total branches:32
Branch coverage:0% (0 of 32)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\appconfiguration\Azure.ResourceManager.AppConfiguration\src\Generated\Models\ResourceIdentity.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.AppConfiguration.Models
 11{
 12    /// <summary> An identity that can be associated with a resource. </summary>
 13    public partial class ResourceIdentity
 14    {
 15        /// <summary> Initializes a new instance of ResourceIdentity. </summary>
 016        public ResourceIdentity()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of ResourceIdentity. </summary>
 21        /// <param name="type"> The type of managed identity used. The type &apos;SystemAssigned, UserAssigned&apos; inc
 22        /// <param name="userAssignedIdentities"> The list of user-assigned identities associated with the resource. The
 23        /// <param name="principalId"> The principal id of the identity. This property will only be provided for a syste
 24        /// <param name="tenantId"> The tenant id associated with the resource&apos;s identity. This property will only 
 025        internal ResourceIdentity(IdentityType? type, IDictionary<string, UserIdentity> userAssignedIdentities, string p
 26        {
 027            Type = type;
 028            UserAssignedIdentities = userAssignedIdentities;
 029            PrincipalId = principalId;
 030            TenantId = tenantId;
 031        }
 32
 33        /// <summary> The type of managed identity used. The type &apos;SystemAssigned, UserAssigned&apos; includes both
 034        public IdentityType? Type { get; set; }
 35        /// <summary> The list of user-assigned identities associated with the resource. The user-assigned identity dict
 036        public IDictionary<string, UserIdentity> UserAssignedIdentities { get; set; }
 37        /// <summary> The principal id of the identity. This property will only be provided for a system-assigned identi
 038        public string PrincipalId { get; }
 39        /// <summary> The tenant id associated with the resource&apos;s identity. This property will only be provided fo
 040        public string TenantId { get; }
 41    }
 42}

C:\Git\azure-sdk-for-net\sdk\appconfiguration\Azure.ResourceManager.AppConfiguration\src\Generated\Models\ResourceIdentity.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.AppConfiguration.Models
 13{
 14    public partial class ResourceIdentity : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Type != null)
 20            {
 021                writer.WritePropertyName("type");
 022                writer.WriteStringValue(Type.Value.ToString());
 23            }
 024            if (UserAssignedIdentities != null)
 25            {
 026                writer.WritePropertyName("userAssignedIdentities");
 027                writer.WriteStartObject();
 028                foreach (var item in UserAssignedIdentities)
 29                {
 030                    writer.WritePropertyName(item.Key);
 031                    writer.WriteObjectValue(item.Value);
 32                }
 033                writer.WriteEndObject();
 34            }
 035            if (PrincipalId != null)
 36            {
 037                writer.WritePropertyName("principalId");
 038                writer.WriteStringValue(PrincipalId);
 39            }
 040            if (TenantId != null)
 41            {
 042                writer.WritePropertyName("tenantId");
 043                writer.WriteStringValue(TenantId);
 44            }
 045            writer.WriteEndObject();
 046        }
 47
 48        internal static ResourceIdentity DeserializeResourceIdentity(JsonElement element)
 49        {
 050            IdentityType? type = default;
 051            IDictionary<string, UserIdentity> userAssignedIdentities = default;
 052            string principalId = default;
 053            string tenantId = default;
 054            foreach (var property in element.EnumerateObject())
 55            {
 056                if (property.NameEquals("type"))
 57                {
 058                    if (property.Value.ValueKind == JsonValueKind.Null)
 59                    {
 60                        continue;
 61                    }
 062                    type = new IdentityType(property.Value.GetString());
 063                    continue;
 64                }
 065                if (property.NameEquals("userAssignedIdentities"))
 66                {
 067                    if (property.Value.ValueKind == JsonValueKind.Null)
 68                    {
 69                        continue;
 70                    }
 071                    Dictionary<string, UserIdentity> dictionary = new Dictionary<string, UserIdentity>();
 072                    foreach (var property0 in property.Value.EnumerateObject())
 73                    {
 074                        if (property0.Value.ValueKind == JsonValueKind.Null)
 75                        {
 076                            dictionary.Add(property0.Name, null);
 77                        }
 78                        else
 79                        {
 080                            dictionary.Add(property0.Name, UserIdentity.DeserializeUserIdentity(property0.Value));
 81                        }
 82                    }
 083                    userAssignedIdentities = dictionary;
 084                    continue;
 85                }
 086                if (property.NameEquals("principalId"))
 87                {
 088                    if (property.Value.ValueKind == JsonValueKind.Null)
 89                    {
 90                        continue;
 91                    }
 092                    principalId = property.Value.GetString();
 093                    continue;
 94                }
 095                if (property.NameEquals("tenantId"))
 96                {
 097                    if (property.Value.ValueKind == JsonValueKind.Null)
 98                    {
 99                        continue;
 100                    }
 0101                    tenantId = property.Value.GetString();
 102                    continue;
 103                }
 104            }
 0105            return new ResourceIdentity(type, userAssignedIdentities, principalId, tenantId);
 106        }
 107    }
 108}