< Summary

Class:Azure.Storage.Queues.QueueClientOptions
Assembly:Azure.Storage.Queues
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Queues\src\QueueClientOptions.cs
Covered lines:45
Uncovered lines:1
Coverable lines:46
Total lines:164
Line coverage:97.8% (45 of 46)
Covered branches:2
Total branches:4
Branch coverage:50% (2 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Version()-100%100%
.ctor(...)-87.5%50%
get_GeoRedundantSecondaryUri()-100%100%
AddHeadersAndQueryParameters()-100%100%
Build(...)-100%100%
Build(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Queues\src\QueueClientOptions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using Azure.Core;
 6using Azure.Core.Pipeline;
 7using Azure.Storage.Queues.Specialized;
 8
 9namespace Azure.Storage.Queues
 10{
 11    /// <summary>
 12    /// Provides the client configuration options for connecting to Azure Queue
 13    /// Storage
 14    /// </summary>
 15    public class QueueClientOptions : ClientOptions
 16    {
 17        /// <summary>
 18        /// The Latest service version supported by this client library.
 19        /// </summary>
 20        internal const ServiceVersion LatestVersion = StorageVersionExtensions.LatestVersion;
 21
 22        /// <summary>
 23        /// The versions of Azure Queue Storage supported by this client
 24        /// library.
 25        ///
 26        /// For more information, see
 27        /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/versioning-for-the-azure-storage-servic
 28        /// Versioning for the Azure Storage services</see>.
 29        /// </summary>
 30        public enum ServiceVersion
 31        {
 32#pragma warning disable CA1707 // Identifiers should not contain underscores
 33            /// <summary>
 34            /// The 2019-02-02 service version described at
 35            /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/version-2019-02-02">
 36            /// Version 2019-02-02</see>.
 37            /// </summary>
 38            V2019_02_02 = 1,
 39
 40            /// <summary>
 41            /// The 2019-07-07 service version described at
 42            /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/version-2019-07-07">
 43            /// Version 2019-07-07</see>.
 44            /// </summary>
 45            V2019_07_07 = 2,
 46
 47            /// <summary>
 48            /// The 2019-12-12 service version.
 49            /// </summary>
 50            V2019_12_12 = 3
 51#pragma warning restore CA1707 // Identifiers should not contain underscores
 52        }
 53
 54        /// <summary>
 55        /// Gets the <see cref="ServiceVersion"/> of the service API used when
 56        /// making requests.  For more, see
 57        /// For more information, see
 58        /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/versioning-for-the-azure-storage-servic
 59        /// Versioning for the Azure Storage services</see>.
 60        /// </summary>
 33661        public ServiceVersion Version { get; }
 62
 63        /// <summary>
 64        /// Initializes a new instance of the <see cref="QueueClientOptions"/>
 65        /// class.
 66        /// </summary>
 67        /// <param name="version">
 68        /// The <see cref="ServiceVersion"/> of the service API used when
 69        /// making requests.
 70        /// </param>
 33671        public QueueClientOptions(ServiceVersion version = LatestVersion)
 72        {
 33673            if (ServiceVersion.V2019_02_02 <= version
 33674                && version <= LatestVersion)
 75            {
 33676                Version = version;
 77            }
 78            else
 79            {
 080                throw Errors.VersionNotSupported(nameof(version));
 81            }
 82
 33683            this.Initialize();
 33684            AddHeadersAndQueryParameters();
 33685        }
 86
 87        /// <summary>
 88        /// Gets or sets the secondary storage <see cref="Uri"/> that can be read from for the storage account if the
 89        /// account is enabled for RA-GRS.
 90        ///
 91        /// If this property is set, the secondary Uri will be used for GET or HEAD requests during retries.
 92        /// If the status of the response from the secondary Uri is a 404, then subsequent retries for
 93        /// the request will not use the secondary Uri again, as this indicates that the resource
 94        /// may not have propagated there yet. Otherwise, subsequent retries will alternate back and forth
 95        /// between primary and secondary Uri.
 96        /// </summary>
 37697        public Uri GeoRedundantSecondaryUri { get; set; }
 98
 99        #region Advanced Options
 100        internal ClientSideEncryptionOptions _clientSideEncryptionOptions;
 101        #endregion
 102
 103        /// <summary>
 104        /// Add headers and query parameters in <see cref="DiagnosticsOptions.LoggedHeaderNames"/> and <see cref="Diagno
 105        /// </summary>
 106        private void AddHeadersAndQueryParameters()
 107        {
 336108            Diagnostics.LoggedHeaderNames.Add("Access-Control-Allow-Origin");
 336109            Diagnostics.LoggedHeaderNames.Add("x-ms-date");
 336110            Diagnostics.LoggedHeaderNames.Add("x-ms-error-code");
 336111            Diagnostics.LoggedHeaderNames.Add("x-ms-request-id");
 336112            Diagnostics.LoggedHeaderNames.Add("x-ms-version");
 336113            Diagnostics.LoggedHeaderNames.Add("x-ms-approximate-messages-count");
 336114            Diagnostics.LoggedHeaderNames.Add("x-ms-popreceipt");
 336115            Diagnostics.LoggedHeaderNames.Add("x-ms-time-next-visible");
 116
 336117            Diagnostics.LoggedQueryParameters.Add("comp");
 336118            Diagnostics.LoggedQueryParameters.Add("maxresults");
 336119            Diagnostics.LoggedQueryParameters.Add("rscc");
 336120            Diagnostics.LoggedQueryParameters.Add("rscd");
 336121            Diagnostics.LoggedQueryParameters.Add("rsce");
 336122            Diagnostics.LoggedQueryParameters.Add("rscl");
 336123            Diagnostics.LoggedQueryParameters.Add("rsct");
 336124            Diagnostics.LoggedQueryParameters.Add("se");
 336125            Diagnostics.LoggedQueryParameters.Add("si");
 336126            Diagnostics.LoggedQueryParameters.Add("sip");
 336127            Diagnostics.LoggedQueryParameters.Add("sp");
 336128            Diagnostics.LoggedQueryParameters.Add("spr");
 336129            Diagnostics.LoggedQueryParameters.Add("sr");
 336130            Diagnostics.LoggedQueryParameters.Add("srt");
 336131            Diagnostics.LoggedQueryParameters.Add("ss");
 336132            Diagnostics.LoggedQueryParameters.Add("st");
 336133            Diagnostics.LoggedQueryParameters.Add("sv");
 336134            Diagnostics.LoggedQueryParameters.Add("include");
 336135            Diagnostics.LoggedQueryParameters.Add("marker");
 336136            Diagnostics.LoggedQueryParameters.Add("prefix");
 336137            Diagnostics.LoggedQueryParameters.Add("messagettl");
 336138            Diagnostics.LoggedQueryParameters.Add("numofmessages");
 336139            Diagnostics.LoggedQueryParameters.Add("peekonly");
 336140            Diagnostics.LoggedQueryParameters.Add("popreceipt");
 336141            Diagnostics.LoggedQueryParameters.Add("visibilitytimeout");
 336142        }
 143
 144        /// <summary>
 145        /// Create an HttpPipeline from QueueClientOptions.
 146        /// </summary>
 147        /// <param name="authentication">Optional authentication policy.</param>
 148        /// <returns>An HttpPipeline to use for Storage requests.</returns>
 149        internal HttpPipeline Build(HttpPipelinePolicy authentication = null)
 150        {
 312151            return this.Build(authentication, GeoRedundantSecondaryUri);
 152        }
 153
 154        /// <summary>
 155        /// Create an HttpPipeline from QueueClientOptions.
 156        /// </summary>
 157        /// <param name="credentials">Optional authentication credentials.</param>
 158        /// <returns>An HttpPipeline to use for Storage requests.</returns>
 159        internal HttpPipeline Build(object credentials)
 160        {
 24161            return this.Build(credentials, GeoRedundantSecondaryUri);
 162        }
 163    }
 164}