< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-75%50%
get_SourceVault()-100%100%
get_SecretUrl()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeKeyVaultAndSecretReference(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\KeyVaultAndSecretReference.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 Secret Url and vault id of the encryption key. </summary>
 13    public partial class KeyVaultAndSecretReference
 14    {
 15        /// <summary> Initializes a new instance of KeyVaultAndSecretReference. </summary>
 16        /// <param name="sourceVault"> Resource id of the KeyVault containing the key or secret. </param>
 17        /// <param name="secretUrl"> Url pointing to a key or secret in KeyVault. </param>
 418        public KeyVaultAndSecretReference(SourceVault sourceVault, string secretUrl)
 19        {
 420            if (sourceVault == null)
 21            {
 022                throw new ArgumentNullException(nameof(sourceVault));
 23            }
 424            if (secretUrl == null)
 25            {
 026                throw new ArgumentNullException(nameof(secretUrl));
 27            }
 28
 429            SourceVault = sourceVault;
 430            SecretUrl = secretUrl;
 431        }
 32
 33        /// <summary> Resource id of the KeyVault containing the key or secret. </summary>
 834        public SourceVault SourceVault { get; set; }
 35        /// <summary> Url pointing to a key or secret in KeyVault. </summary>
 836        public string SecretUrl { get; set; }
 37    }
 38}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\KeyVaultAndSecretReference.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 KeyVaultAndSecretReference : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 417            writer.WriteStartObject();
 418            writer.WritePropertyName("sourceVault");
 419            writer.WriteObjectValue(SourceVault);
 420            writer.WritePropertyName("secretUrl");
 421            writer.WriteStringValue(SecretUrl);
 422            writer.WriteEndObject();
 423        }
 24
 25        internal static KeyVaultAndSecretReference DeserializeKeyVaultAndSecretReference(JsonElement element)
 26        {
 027            SourceVault sourceVault = default;
 028            string secretUrl = default;
 029            foreach (var property in element.EnumerateObject())
 30            {
 031                if (property.NameEquals("sourceVault"))
 32                {
 033                    sourceVault = SourceVault.DeserializeSourceVault(property.Value);
 034                    continue;
 35                }
 036                if (property.NameEquals("secretUrl"))
 37                {
 038                    secretUrl = property.Value.GetString();
 39                    continue;
 40                }
 41            }
 042            return new KeyVaultAndSecretReference(sourceVault, secretUrl);
 43        }
 44    }
 45}