< Summary

Class:Azure.Search.Documents.Indexes.Models.SearchResourceEncryptionKey
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchResourceEncryptionKey.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchResourceEncryptionKey.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\SearchResourceEncryptionKey.cs
Covered lines:0
Uncovered lines:52
Coverable lines:52
Total lines:183
Line coverage:0% (0 of 52)
Covered branches:0
Total branches:26
Branch coverage:0% (0 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeSearchResourceEncryptionKey(...)-0%0%
.ctor(...)-0%0%
get_VaultUri()-0%100%
set_VaultUri(...)-0%100%
get_KeyName()-0%100%
get_KeyVersion()-0%100%
get_ApplicationId()-0%100%
get_ApplicationSecret()-0%100%
get_AccessCredentialsInternal()-0%0%
set_AccessCredentialsInternal(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchResourceEncryptionKey.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.Search.Documents.Indexes.Models
 11{
 12    /// <summary> A customer-managed encryption key in Azure Key Vault. Keys that you create and manage can be used to e
 13    public partial class SearchResourceEncryptionKey
 14    {
 15
 16        /// <summary> Initializes a new instance of SearchResourceEncryptionKey. </summary>
 17        /// <param name="keyName"> The name of your Azure Key Vault key to be used to encrypt your data at rest. </param
 18        /// <param name="keyVersion"> The version of your Azure Key Vault key to be used to encrypt your data at rest. <
 19        /// <param name="VaultUri"> The URI of your Azure Key Vault, also referred to as DNS name, that contains the key
 20        /// <param name="accessCredentialsInternal"> Optional Azure Active Directory credentials used for accessing your
 021        internal SearchResourceEncryptionKey(string keyName, string keyVersion, string VaultUri, AzureActiveDirectoryApp
 22        {
 023            KeyName = keyName;
 024            KeyVersion = keyVersion;
 025            _vaultUri = VaultUri;
 026            AccessCredentialsInternal = accessCredentialsInternal;
 027        }
 28    }
 29}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchResourceEncryptionKey.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.Search.Documents.Indexes.Models
 12{
 13    public partial class SearchResourceEncryptionKey : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            writer.WritePropertyName("keyVaultKeyName");
 019            writer.WriteStringValue(KeyName);
 020            writer.WritePropertyName("keyVaultKeyVersion");
 021            writer.WriteStringValue(KeyVersion);
 022            writer.WritePropertyName("keyVaultUri");
 023            writer.WriteStringValue(_vaultUri);
 024            if (Optional.IsDefined(AccessCredentialsInternal))
 25            {
 026                writer.WritePropertyName("accessCredentials");
 027                writer.WriteObjectValue(AccessCredentialsInternal);
 28            }
 029            writer.WriteEndObject();
 030        }
 31
 32        internal static SearchResourceEncryptionKey DeserializeSearchResourceEncryptionKey(JsonElement element)
 33        {
 034            string keyVaultKeyName = default;
 035            string keyVaultKeyVersion = default;
 036            string keyVaultUri = default;
 037            Optional<AzureActiveDirectoryApplicationCredentials> accessCredentials = default;
 038            foreach (var property in element.EnumerateObject())
 39            {
 040                if (property.NameEquals("keyVaultKeyName"))
 41                {
 042                    keyVaultKeyName = property.Value.GetString();
 043                    continue;
 44                }
 045                if (property.NameEquals("keyVaultKeyVersion"))
 46                {
 047                    keyVaultKeyVersion = property.Value.GetString();
 048                    continue;
 49                }
 050                if (property.NameEquals("keyVaultUri"))
 51                {
 052                    keyVaultUri = property.Value.GetString();
 053                    continue;
 54                }
 055                if (property.NameEquals("accessCredentials"))
 56                {
 057                    accessCredentials = AzureActiveDirectoryApplicationCredentials.DeserializeAzureActiveDirectoryApplic
 58                    continue;
 59                }
 60            }
 061            return new SearchResourceEncryptionKey(keyVaultKeyName, keyVaultKeyVersion, keyVaultUri, accessCredentials.V
 62        }
 63    }
 64}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\SearchResourceEncryptionKey.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Threading;
 6using Azure.Core;
 7
 8namespace Azure.Search.Documents.Indexes.Models
 9{
 10    [CodeGenModel("EncryptionKey")]
 11    [CodeGenSuppress(nameof(SearchResourceEncryptionKey), typeof(string), typeof(string), typeof(string))]
 12    public partial class SearchResourceEncryptionKey
 13    {
 14        /// <summary>
 15        /// Creates a new instance of the <see cref="SearchResourceEncryptionKey"/> class.
 16        /// </summary>
 17        /// <param name="vaultUri">Required. The Azure Key Vault <see cref="Uri"/>.</param>
 18        /// <param name="keyName">Required. The name of the Azure Key Vault key to encrypt resources at rest.</param>
 19        /// <param name="keyVersion">Required. The version of the Azure Key Vault key to encrypt resources at rest.</par
 20        /// <exception cref="ArgumentNullException"><paramref name="vaultUri"/>, <paramref name="keyName"/>, or <paramre
 021        public SearchResourceEncryptionKey(Uri vaultUri, string keyName, string keyVersion)
 22        {
 023            VaultUri = vaultUri ?? throw new ArgumentNullException(nameof(vaultUri));
 024            KeyName = keyName ?? throw new ArgumentNullException(nameof(keyName));
 025            KeyVersion = keyVersion ?? throw new ArgumentNullException(nameof(keyVersion));
 026        }
 27
 28        [CodeGenMember("vaultUri")]
 29        private string _vaultUri;
 30
 31        /// <summary>
 32        /// Gets the Azure Key Vault <see cref="Uri"/>.
 33        /// </summary>
 34        public Uri VaultUri
 35        {
 036            get => new Uri(_vaultUri);
 037            private set => _vaultUri = value.ToString();
 38        }
 39
 40        /// <summary>
 41        /// Gets the name of the Azure Key Vault key to encrypt resources at rest.
 42        /// </summary>
 43        [CodeGenMember("keyVaultKeyName")]
 044        public string KeyName { get; }
 45
 46        /// <summary>
 47        /// Gets the version of the Azure Key Vault key to encrypt resources at rest.
 48        /// </summary>
 49        /// <remarks>
 50        /// A version is required in case the key rotates.
 51        /// </remarks>
 52        [CodeGenMember("keyVaultKeyVersion")]
 053        public string KeyVersion { get; }
 54
 55        /// <summary>
 56        /// Gets or sets the application ID to access the Azure Key Vault specified in the <see cref="VaultUri"/>.
 57        /// The Azure Key Vault must be in the same tenant as the Azure Search service.
 58        /// </summary>
 059        public string ApplicationId { get; set; }
 60
 61        /// <summary>
 62        /// Gets or sets the application secret to access the Azure Key Vault specified in the <see cref="VaultUri"/>.
 63        /// The Azure Key Vault must be in the same tenant as the Azure Search service.
 64        /// </summary>
 065        public string ApplicationSecret { get; set; }
 66
 67        /// <summary>
 68        /// Gets or sets an <see cref="AzureActiveDirectoryApplicationCredentials"/> for de/serialization purposes only.
 69        /// </summary>
 70        [CodeGenMember("accessCredentials")]
 71        private AzureActiveDirectoryApplicationCredentials AccessCredentialsInternal
 72        {
 73            get
 74            {
 075                if (ApplicationId != null || ApplicationSecret != null)
 76                {
 077                    return new AzureActiveDirectoryApplicationCredentials(ApplicationId, ApplicationSecret);
 78                }
 79
 080                return null;
 81            }
 82
 83            set
 84            {
 085                ApplicationId = value?.ApplicationId;
 086                ApplicationSecret = value?.ApplicationSecret;
 087            }
 88        }
 89    }
 90}