< Summary

Class:Azure.ResourceManager.KeyVault.Models.Permissions
Assembly:Azure.ResourceManager.KeyVault
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\Permissions.cs
C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\Permissions.Serialization.cs
Covered lines:72
Uncovered lines:0
Coverable lines:72
Total lines:161
Line coverage:100% (72 of 72)
Covered branches:34
Total branches:34
Branch coverage:100% (34 of 34)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Keys()-100%100%
get_Secrets()-100%100%
get_Certificates()-100%100%
get_Storage()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializePermissions(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\Permissions.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 Azure.Core;
 10
 11namespace Azure.ResourceManager.KeyVault.Models
 12{
 13    /// <summary> Permissions the identity has for keys, secrets, certificates and storage. </summary>
 14    public partial class Permissions
 15    {
 16        /// <summary> Initializes a new instance of Permissions. </summary>
 2417        public Permissions()
 18        {
 2419            Keys = new ChangeTrackingList<KeyPermissions>();
 2420            Secrets = new ChangeTrackingList<SecretPermissions>();
 2421            Certificates = new ChangeTrackingList<CertificatePermissions>();
 2422            Storage = new ChangeTrackingList<StoragePermissions>();
 2423        }
 24
 25        /// <summary> Initializes a new instance of Permissions. </summary>
 26        /// <param name="keys"> Permissions to keys. </param>
 27        /// <param name="secrets"> Permissions to secrets. </param>
 28        /// <param name="certificates"> Permissions to certificates. </param>
 29        /// <param name="storage"> Permissions to storage accounts. </param>
 7630        internal Permissions(IList<KeyPermissions> keys, IList<SecretPermissions> secrets, IList<CertificatePermissions>
 31        {
 7632            Keys = keys;
 7633            Secrets = secrets;
 7634            Certificates = certificates;
 7635            Storage = storage;
 7636        }
 37
 38        /// <summary> Permissions to keys. </summary>
 31239        public IList<KeyPermissions> Keys { get; }
 40        /// <summary> Permissions to secrets. </summary>
 32841        public IList<SecretPermissions> Secrets { get; }
 42        /// <summary> Permissions to certificates. </summary>
 31643        public IList<CertificatePermissions> Certificates { get; }
 44        /// <summary> Permissions to storage accounts. </summary>
 32845        public IList<StoragePermissions> Storage { get; }
 46    }
 47}

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\Permissions.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.KeyVault.Models
 13{
 14    public partial class Permissions : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 10418            writer.WriteStartObject();
 10419            if (Optional.IsCollectionDefined(Keys))
 20            {
 9621                writer.WritePropertyName("keys");
 9622                writer.WriteStartArray();
 38423                foreach (var item in Keys)
 24                {
 9625                    writer.WriteStringValue(item.ToString());
 26                }
 9627                writer.WriteEndArray();
 28            }
 10429            if (Optional.IsCollectionDefined(Secrets))
 30            {
 10431                writer.WritePropertyName("secrets");
 10432                writer.WriteStartArray();
 43233                foreach (var item in Secrets)
 34                {
 11235                    writer.WriteStringValue(item.ToString());
 36                }
 10437                writer.WriteEndArray();
 38            }
 10439            if (Optional.IsCollectionDefined(Certificates))
 40            {
 10441                writer.WritePropertyName("certificates");
 10442                writer.WriteStartArray();
 41643                foreach (var item in Certificates)
 44                {
 10445                    writer.WriteStringValue(item.ToString());
 46                }
 10447                writer.WriteEndArray();
 48            }
 10449            if (Optional.IsCollectionDefined(Storage))
 50            {
 10451                writer.WritePropertyName("storage");
 10452                writer.WriteStartArray();
 43253                foreach (var item in Storage)
 54                {
 11255                    writer.WriteStringValue(item.ToString());
 56                }
 10457                writer.WriteEndArray();
 58            }
 10459            writer.WriteEndObject();
 10460        }
 61
 62        internal static Permissions DeserializePermissions(JsonElement element)
 63        {
 7664            Optional<IList<KeyPermissions>> keys = default;
 7665            Optional<IList<SecretPermissions>> secrets = default;
 7666            Optional<IList<CertificatePermissions>> certificates = default;
 7667            Optional<IList<StoragePermissions>> storage = default;
 74468            foreach (var property in element.EnumerateObject())
 69            {
 29670                if (property.NameEquals("keys"))
 71                {
 6872                    List<KeyPermissions> array = new List<KeyPermissions>();
 27273                    foreach (var item in property.Value.EnumerateArray())
 74                    {
 6875                        array.Add(new KeyPermissions(item.GetString()));
 76                    }
 6877                    keys = array;
 6878                    continue;
 79                }
 22880                if (property.NameEquals("secrets"))
 81                {
 7682                    List<SecretPermissions> array = new List<SecretPermissions>();
 32083                    foreach (var item in property.Value.EnumerateArray())
 84                    {
 8485                        array.Add(new SecretPermissions(item.GetString()));
 86                    }
 7687                    secrets = array;
 7688                    continue;
 89                }
 15290                if (property.NameEquals("certificates"))
 91                {
 7692                    List<CertificatePermissions> array = new List<CertificatePermissions>();
 30493                    foreach (var item in property.Value.EnumerateArray())
 94                    {
 7695                        array.Add(new CertificatePermissions(item.GetString()));
 96                    }
 7697                    certificates = array;
 7698                    continue;
 99                }
 76100                if (property.NameEquals("storage"))
 101                {
 76102                    List<StoragePermissions> array = new List<StoragePermissions>();
 320103                    foreach (var item in property.Value.EnumerateArray())
 104                    {
 84105                        array.Add(new StoragePermissions(item.GetString()));
 106                    }
 76107                    storage = array;
 108                    continue;
 109                }
 110            }
 76111            return new Permissions(Optional.ToList(keys), Optional.ToList(secrets), Optional.ToList(certificates), Optio
 112        }
 113    }
 114}