< Summary

Class:Azure.ResourceManager.KeyVault.Models.AccessPolicyEntry
Assembly:Azure.ResourceManager.KeyVault
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\AccessPolicyEntry.cs
C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\AccessPolicyEntry.Serialization.cs
Covered lines:46
Uncovered lines:2
Coverable lines:48
Total lines:123
Line coverage:95.8% (46 of 48)
Covered branches:14
Total branches:16
Branch coverage:87.5% (14 of 16)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-77.78%50%
.ctor(...)-100%100%
get_TenantId()-100%100%
get_ObjectId()-100%100%
get_ApplicationId()-100%100%
get_Permissions()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeAccessPolicyEntry(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\AccessPolicyEntry.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;
 9
 10namespace Azure.ResourceManager.KeyVault.Models
 11{
 12    /// <summary> An identity that have access to the key vault. All identities in the array must use the same tenant ID
 13    public partial class AccessPolicyEntry
 14    {
 15        /// <summary> Initializes a new instance of AccessPolicyEntry. </summary>
 16        /// <param name="tenantId"> The Azure Active Directory tenant ID that should be used for authenticating requests
 17        /// <param name="objectId"> The object ID of a user, service principal or security group in the Azure Active Dir
 18        /// <param name="permissions"> Permissions the identity has for keys, secrets and certificates. </param>
 19        /// <exception cref="ArgumentNullException"> <paramref name="objectId"/> or <paramref name="permissions"/> is nu
 2420        public AccessPolicyEntry(Guid tenantId, string objectId, Permissions permissions)
 21        {
 2422            if (objectId == null)
 23            {
 024                throw new ArgumentNullException(nameof(objectId));
 25            }
 2426            if (permissions == null)
 27            {
 028                throw new ArgumentNullException(nameof(permissions));
 29            }
 30
 2431            TenantId = tenantId;
 2432            ObjectId = objectId;
 2433            Permissions = permissions;
 2434        }
 35
 36        /// <summary> Initializes a new instance of AccessPolicyEntry. </summary>
 37        /// <param name="tenantId"> The Azure Active Directory tenant ID that should be used for authenticating requests
 38        /// <param name="objectId"> The object ID of a user, service principal or security group in the Azure Active Dir
 39        /// <param name="applicationId">  Application ID of the client making request on behalf of a principal. </param>
 40        /// <param name="permissions"> Permissions the identity has for keys, secrets and certificates. </param>
 7641        internal AccessPolicyEntry(Guid tenantId, string objectId, Guid? applicationId, Permissions permissions)
 42        {
 7643            TenantId = tenantId;
 7644            ObjectId = objectId;
 7645            ApplicationId = applicationId;
 7646            Permissions = permissions;
 7647        }
 48
 49        /// <summary> The Azure Active Directory tenant ID that should be used for authenticating requests to the key va
 26050        public Guid TenantId { get; set; }
 51        /// <summary> The object ID of a user, service principal or security group in the Azure Active Directory tenant 
 26052        public string ObjectId { get; set; }
 53        /// <summary>  Application ID of the client making request on behalf of a principal. </summary>
 26054        public Guid? ApplicationId { get; set; }
 55        /// <summary> Permissions the identity has for keys, secrets and certificates. </summary>
 56856        public Permissions Permissions { get; set; }
 57    }
 58}

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\AccessPolicyEntry.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;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.KeyVault.Models
 13{
 14    public partial class AccessPolicyEntry : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 10418            writer.WriteStartObject();
 10419            writer.WritePropertyName("tenantId");
 10420            writer.WriteStringValue(TenantId);
 10421            writer.WritePropertyName("objectId");
 10422            writer.WriteStringValue(ObjectId);
 10423            if (Optional.IsDefined(ApplicationId))
 24            {
 1625                writer.WritePropertyName("applicationId");
 1626                writer.WriteStringValue(ApplicationId.Value);
 27            }
 10428            writer.WritePropertyName("permissions");
 10429            writer.WriteObjectValue(Permissions);
 10430            writer.WriteEndObject();
 10431        }
 32
 33        internal static AccessPolicyEntry DeserializeAccessPolicyEntry(JsonElement element)
 34        {
 7635            Guid tenantId = default;
 7636            string objectId = default;
 7637            Optional<Guid> applicationId = default;
 7638            Permissions permissions = default;
 63239            foreach (var property in element.EnumerateObject())
 40            {
 24041                if (property.NameEquals("tenantId"))
 42                {
 7643                    tenantId = property.Value.GetGuid();
 7644                    continue;
 45                }
 16446                if (property.NameEquals("objectId"))
 47                {
 7648                    objectId = property.Value.GetString();
 7649                    continue;
 50                }
 8851                if (property.NameEquals("applicationId"))
 52                {
 1253                    applicationId = property.Value.GetGuid();
 1254                    continue;
 55                }
 7656                if (property.NameEquals("permissions"))
 57                {
 7658                    permissions = Permissions.DeserializePermissions(property.Value);
 59                    continue;
 60                }
 61            }
 7662            return new AccessPolicyEntry(tenantId, objectId, Optional.ToNullable(applicationId), permissions);
 63        }
 64    }
 65}