< Summary

Class:Azure.ResourceManager.Compute.Models.KeyVaultAndKeyReference
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\KeyVaultAndKeyReference.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\KeyVaultAndKeyReference.Serialization.cs
Covered lines:24
Uncovered lines:2
Coverable lines:26
Total lines:83
Line coverage:92.3% (24 of 26)
Covered branches:8
Total branches:10
Branch coverage:80% (8 of 10)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-75%50%
get_SourceVault()-100%100%
get_KeyUrl()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeKeyVaultAndKeyReference(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\KeyVaultAndKeyReference.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.Compute.Models
 11{
 12    /// <summary> Key Vault Key Url and vault id of KeK, KeK is optional and when provided is used to unwrap the encrypt
 13    public partial class KeyVaultAndKeyReference
 14    {
 15        /// <summary> Initializes a new instance of KeyVaultAndKeyReference. </summary>
 16        /// <param name="sourceVault"> Resource id of the KeyVault containing the key or secret. </param>
 17        /// <param name="keyUrl"> Url pointing to a key or secret in KeyVault. </param>
 7618        public KeyVaultAndKeyReference(SourceVault sourceVault, string keyUrl)
 19        {
 7620            if (sourceVault == null)
 21            {
 022                throw new ArgumentNullException(nameof(sourceVault));
 23            }
 7624            if (keyUrl == null)
 25            {
 026                throw new ArgumentNullException(nameof(keyUrl));
 27            }
 28
 7629            SourceVault = sourceVault;
 7630            KeyUrl = keyUrl;
 7631        }
 32
 33        /// <summary> Resource id of the KeyVault containing the key or secret. </summary>
 14434        public SourceVault SourceVault { get; set; }
 35        /// <summary> Url pointing to a key or secret in KeyVault. </summary>
 14436        public string KeyUrl { get; set; }
 37    }
 38}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\KeyVaultAndKeyReference.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 KeyVaultAndKeyReference : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 4417            writer.WriteStartObject();
 4418            writer.WritePropertyName("sourceVault");
 4419            writer.WriteObjectValue(SourceVault);
 4420            writer.WritePropertyName("keyUrl");
 4421            writer.WriteStringValue(KeyUrl);
 4422            writer.WriteEndObject();
 4423        }
 24
 25        internal static KeyVaultAndKeyReference DeserializeKeyVaultAndKeyReference(JsonElement element)
 26        {
 6027            SourceVault sourceVault = default;
 6028            string keyUrl = default;
 36029            foreach (var property in element.EnumerateObject())
 30            {
 12031                if (property.NameEquals("sourceVault"))
 32                {
 6033                    sourceVault = SourceVault.DeserializeSourceVault(property.Value);
 6034                    continue;
 35                }
 6036                if (property.NameEquals("keyUrl"))
 37                {
 6038                    keyUrl = property.Value.GetString();
 39                    continue;
 40                }
 41            }
 6042            return new KeyVaultAndKeyReference(sourceVault, keyUrl);
 43        }
 44    }
 45}