< Summary

Class:Azure.ResourceManager.KeyVault.Models.VaultProperties
Assembly:Azure.ResourceManager.KeyVault
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\VaultProperties.cs
C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\VaultProperties.Serialization.cs
Covered lines:114
Uncovered lines:12
Coverable lines:126
Total lines:255
Line coverage:90.4% (114 of 126)
Covered branches:45
Total branches:52
Branch coverage:86.5% (45 of 52)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-87.5%50%
.ctor(...)-100%100%
get_TenantId()-100%100%
get_Sku()-100%100%
get_AccessPolicies()-100%100%
get_VaultUri()-100%100%
get_EnabledForDeployment()-100%100%
get_EnabledForDiskEncryption()-100%100%
get_EnabledForTemplateDeployment()-100%100%
get_EnableSoftDelete()-100%100%
get_CreateMode()-100%100%
get_EnablePurgeProtection()-100%100%
get_NetworkAcls()-100%100%
get_PrivateEndpointConnections()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-94.59%95%
DeserializeVaultProperties(...)-85.45%83.33%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\VaultProperties.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.Collections.Generic;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.KeyVault.Models
 13{
 14    /// <summary> Properties of the vault. </summary>
 15    public partial class VaultProperties
 16    {
 17        /// <summary> Initializes a new instance of VaultProperties. </summary>
 18        /// <param name="tenantId"> The Azure Active Directory tenant ID that should be used for authenticating requests
 19        /// <param name="sku"> SKU details. </param>
 20        /// <exception cref="ArgumentNullException"> <paramref name="sku"/> is null. </exception>
 2421        public VaultProperties(Guid tenantId, Sku sku)
 22        {
 2423            if (sku == null)
 24            {
 025                throw new ArgumentNullException(nameof(sku));
 26            }
 27
 2428            TenantId = tenantId;
 2429            Sku = sku;
 2430            AccessPolicies = new ChangeTrackingList<AccessPolicyEntry>();
 2431            PrivateEndpointConnections = new ChangeTrackingList<PrivateEndpointConnectionItem>();
 2432        }
 33
 34        /// <summary> Initializes a new instance of VaultProperties. </summary>
 35        /// <param name="tenantId"> The Azure Active Directory tenant ID that should be used for authenticating requests
 36        /// <param name="sku"> SKU details. </param>
 37        /// <param name="accessPolicies"> An array of 0 to 16 identities that have access to the key vault. All identiti
 38        /// <param name="vaultUri"> The URI of the vault for performing operations on keys and secrets. </param>
 39        /// <param name="enabledForDeployment"> Property to specify whether Azure Virtual Machines are permitted to retr
 40        /// <param name="enabledForDiskEncryption"> Property to specify whether Azure Disk Encryption is permitted to re
 41        /// <param name="enabledForTemplateDeployment"> Property to specify whether Azure Resource Manager is permitted 
 42        /// <param name="enableSoftDelete"> Property to specify whether the &apos;soft delete&apos; functionality is ena
 43        /// <param name="createMode"> The vault&apos;s create mode to indicate whether the vault need to be recovered or
 44        /// <param name="enablePurgeProtection"> Property specifying whether protection against purge is enabled for thi
 45        /// <param name="networkAcls"> Rules governing the accessibility of the key vault from specific network location
 46        /// <param name="privateEndpointConnections"> List of private endpoint connections associated with the key vault
 7647        internal VaultProperties(Guid tenantId, Sku sku, IList<AccessPolicyEntry> accessPolicies, string vaultUri, bool?
 48        {
 7649            TenantId = tenantId;
 7650            Sku = sku;
 7651            AccessPolicies = accessPolicies;
 7652            VaultUri = vaultUri;
 7653            EnabledForDeployment = enabledForDeployment;
 7654            EnabledForDiskEncryption = enabledForDiskEncryption;
 7655            EnabledForTemplateDeployment = enabledForTemplateDeployment;
 7656            EnableSoftDelete = enableSoftDelete;
 7657            CreateMode = createMode;
 7658            EnablePurgeProtection = enablePurgeProtection;
 7659            NetworkAcls = networkAcls;
 7660            PrivateEndpointConnections = privateEndpointConnections;
 7661        }
 62
 63        /// <summary> The Azure Active Directory tenant ID that should be used for authenticating requests to the key va
 24064        public Guid TenantId { get; set; }
 65        /// <summary> SKU details. </summary>
 24466        public Sku Sku { get; set; }
 67        /// <summary> An array of 0 to 16 identities that have access to the key vault. All identities in the array must
 27668        public IList<AccessPolicyEntry> AccessPolicies { get; }
 69        /// <summary> The URI of the vault for performing operations on keys and secrets. </summary>
 32470        public string VaultUri { get; set; }
 71        /// <summary> Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored a
 34472        public bool? EnabledForDeployment { get; set; }
 73        /// <summary> Property to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault 
 34474        public bool? EnabledForDiskEncryption { get; set; }
 75        /// <summary> Property to specify whether Azure Resource Manager is permitted to retrieve secrets from the key v
 34476        public bool? EnabledForTemplateDeployment { get; set; }
 77        /// <summary> Property to specify whether the &apos;soft delete&apos; functionality is enabled for this key vaul
 32478        public bool? EnableSoftDelete { get; set; }
 79        /// <summary> The vault&apos;s create mode to indicate whether the vault need to be recovered or not. </summary>
 19280        public CreateMode? CreateMode { get; set; }
 81        /// <summary> Property specifying whether protection against purge is enabled for this vault. Setting this prope
 18082        public bool? EnablePurgeProtection { get; set; }
 83        /// <summary> Rules governing the accessibility of the key vault from specific network locations. </summary>
 40484        public NetworkRuleSet NetworkAcls { get; set; }
 85        /// <summary> List of private endpoint connections associated with the key vault. </summary>
 086        public IReadOnlyList<PrivateEndpointConnectionItem> PrivateEndpointConnections { get; }
 87    }
 88}

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.ResourceManager.KeyVault\src\Generated\Models\VaultProperties.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.Collections.Generic;
 10using System.Text.Json;
 11using Azure.Core;
 12
 13namespace Azure.ResourceManager.KeyVault.Models
 14{
 15    public partial class VaultProperties : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 10419            writer.WriteStartObject();
 10420            writer.WritePropertyName("tenantId");
 10421            writer.WriteStringValue(TenantId);
 10422            writer.WritePropertyName("sku");
 10423            writer.WriteObjectValue(Sku);
 10424            if (Optional.IsCollectionDefined(AccessPolicies))
 25            {
 10426                writer.WritePropertyName("accessPolicies");
 10427                writer.WriteStartArray();
 41628                foreach (var item in AccessPolicies)
 29                {
 10430                    writer.WriteObjectValue(item);
 31                }
 10432                writer.WriteEndArray();
 33            }
 10434            if (Optional.IsDefined(VaultUri))
 35            {
 10436                writer.WritePropertyName("vaultUri");
 10437                writer.WriteStringValue(VaultUri);
 38            }
 10439            if (Optional.IsDefined(EnabledForDeployment))
 40            {
 10441                writer.WritePropertyName("enabledForDeployment");
 10442                writer.WriteBooleanValue(EnabledForDeployment.Value);
 43            }
 10444            if (Optional.IsDefined(EnabledForDiskEncryption))
 45            {
 10446                writer.WritePropertyName("enabledForDiskEncryption");
 10447                writer.WriteBooleanValue(EnabledForDiskEncryption.Value);
 48            }
 10449            if (Optional.IsDefined(EnabledForTemplateDeployment))
 50            {
 10451                writer.WritePropertyName("enabledForTemplateDeployment");
 10452                writer.WriteBooleanValue(EnabledForTemplateDeployment.Value);
 53            }
 10454            if (Optional.IsDefined(EnableSoftDelete))
 55            {
 6456                writer.WritePropertyName("enableSoftDelete");
 6457                writer.WriteBooleanValue(EnableSoftDelete.Value);
 58            }
 10459            if (Optional.IsDefined(CreateMode))
 60            {
 861                writer.WritePropertyName("createMode");
 862                writer.WriteStringValue(CreateMode.Value.ToSerialString());
 63            }
 10464            if (Optional.IsDefined(EnablePurgeProtection))
 65            {
 066                writer.WritePropertyName("enablePurgeProtection");
 067                writer.WriteBooleanValue(EnablePurgeProtection.Value);
 68            }
 10469            if (Optional.IsDefined(NetworkAcls))
 70            {
 10471                writer.WritePropertyName("networkAcls");
 10472                writer.WriteObjectValue(NetworkAcls);
 73            }
 10474            writer.WriteEndObject();
 10475        }
 76
 77        internal static VaultProperties DeserializeVaultProperties(JsonElement element)
 78        {
 7679            Guid tenantId = default;
 7680            Sku sku = default;
 7681            Optional<IList<AccessPolicyEntry>> accessPolicies = default;
 7682            Optional<string> vaultUri = default;
 7683            Optional<bool> enabledForDeployment = default;
 7684            Optional<bool> enabledForDiskEncryption = default;
 7685            Optional<bool> enabledForTemplateDeployment = default;
 7686            Optional<bool> enableSoftDelete = default;
 7687            Optional<CreateMode> createMode = default;
 7688            Optional<bool> enablePurgeProtection = default;
 7689            Optional<NetworkRuleSet> networkAcls = default;
 7690            Optional<IReadOnlyList<PrivateEndpointConnectionItem>> privateEndpointConnections = default;
 167291            foreach (var property in element.EnumerateObject())
 92            {
 76093                if (property.NameEquals("tenantId"))
 94                {
 7695                    tenantId = property.Value.GetGuid();
 7696                    continue;
 97                }
 68498                if (property.NameEquals("sku"))
 99                {
 76100                    sku = Sku.DeserializeSku(property.Value);
 76101                    continue;
 102                }
 608103                if (property.NameEquals("accessPolicies"))
 104                {
 76105                    List<AccessPolicyEntry> array = new List<AccessPolicyEntry>();
 304106                    foreach (var item in property.Value.EnumerateArray())
 107                    {
 76108                        array.Add(AccessPolicyEntry.DeserializeAccessPolicyEntry(item));
 109                    }
 76110                    accessPolicies = array;
 76111                    continue;
 112                }
 532113                if (property.NameEquals("vaultUri"))
 114                {
 76115                    vaultUri = property.Value.GetString();
 76116                    continue;
 117                }
 456118                if (property.NameEquals("enabledForDeployment"))
 119                {
 76120                    enabledForDeployment = property.Value.GetBoolean();
 76121                    continue;
 122                }
 380123                if (property.NameEquals("enabledForDiskEncryption"))
 124                {
 76125                    enabledForDiskEncryption = property.Value.GetBoolean();
 76126                    continue;
 127                }
 304128                if (property.NameEquals("enabledForTemplateDeployment"))
 129                {
 76130                    enabledForTemplateDeployment = property.Value.GetBoolean();
 76131                    continue;
 132                }
 228133                if (property.NameEquals("enableSoftDelete"))
 134                {
 76135                    enableSoftDelete = property.Value.GetBoolean();
 76136                    continue;
 137                }
 152138                if (property.NameEquals("createMode"))
 139                {
 0140                    createMode = property.Value.GetString().ToCreateMode();
 0141                    continue;
 142                }
 152143                if (property.NameEquals("enablePurgeProtection"))
 144                {
 0145                    enablePurgeProtection = property.Value.GetBoolean();
 0146                    continue;
 147                }
 152148                if (property.NameEquals("networkAcls"))
 149                {
 76150                    networkAcls = NetworkRuleSet.DeserializeNetworkRuleSet(property.Value);
 76151                    continue;
 152                }
 76153                if (property.NameEquals("privateEndpointConnections"))
 154                {
 0155                    List<PrivateEndpointConnectionItem> array = new List<PrivateEndpointConnectionItem>();
 0156                    foreach (var item in property.Value.EnumerateArray())
 157                    {
 0158                        array.Add(PrivateEndpointConnectionItem.DeserializePrivateEndpointConnectionItem(item));
 159                    }
 0160                    privateEndpointConnections = array;
 161                    continue;
 162                }
 163            }
 76164            return new VaultProperties(tenantId, sku, Optional.ToList(accessPolicies), vaultUri.Value, Optional.ToNullab
 165        }
 166    }
 167}