< Summary

Class:Azure.Storage.Sas.DataLakeSasQueryParameters
Assembly:Azure.Storage.Files.DataLake
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Files.DataLake\src\Sas\DataLakeSasQueryParameters.cs
Covered lines:40
Uncovered lines:4
Coverable lines:44
Total lines:147
Line coverage:90.9% (40 of 44)
Covered branches:5
Total branches:12
Branch coverage:41.6% (5 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_KeyProperties()-100%100%
get_KeyObjectId()-100%50%
get_KeyTenantId()-100%50%
get_KeyStartsOn()-100%50%
get_KeyExpiresOn()-100%50%
get_KeyService()-100%50%
get_KeyVersion()-0%0%
get_Empty()-0%100%
.ctor()-0%100%
.ctor(...)-100%100%
.ctor(...)-100%100%
ToString()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Files.DataLake\src\Sas\DataLakeSasQueryParameters.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.Text;
 7
 8namespace Azure.Storage.Sas
 9{
 10    /// <summary>
 11    /// A <see cref="DataLakeSasQueryParameters"/> object represents the components
 12    /// that make up an Azure Storage Shared Access Signature's query
 13    /// parameters.  You can construct a new instance using
 14    /// <see cref="DataLakeSasBuilder"/>.
 15    ///
 16    /// For more information,
 17    /// <see href="https://docs.microsoft.com/rest/api/storageservices/create-service-sas">
 18    /// Create a service SAS</see>.
 19    /// </summary>
 20    public sealed class DataLakeSasQueryParameters : SasQueryParameters
 21    {
 209422        internal UserDelegationKeyProperties KeyProperties { get; set; }
 23
 24        /// <summary>
 25        /// Gets the Azure Active Directory object ID in GUID format.
 26        /// </summary>
 1627        public string KeyObjectId => KeyProperties?.ObjectId;
 28
 29        /// <summary>
 30        /// Gets the Azure Active Directory tenant ID in GUID format
 31        /// </summary>
 1632        public string KeyTenantId => KeyProperties?.TenantId;
 33
 34        /// <summary>
 35        /// Gets the time at which the key becomes valid.
 36        /// </summary>
 1637        public DateTimeOffset KeyStartsOn => KeyProperties == null ? default : KeyProperties.StartsOn;
 38
 39        /// <summary>
 40        /// Gets the time at which the key becomes expires.
 41        /// </summary>
 1642        public DateTimeOffset KeyExpiresOn => KeyProperties == null ? default : KeyProperties.ExpiresOn;
 43
 44        /// <summary>
 45        /// Gets the Storage service that accepts the key.
 46        /// </summary>
 1647        public string KeyService => KeyProperties?.Service;
 48
 49        /// <summary>
 50        /// Gets the Storage service version that created the key.
 51        /// </summary>
 052        public string KeyVersion => KeyProperties?.Version;
 53
 54        /// <summary>
 55        /// Gets empty shared access signature query parameters.
 56        /// </summary>
 057        public static new DataLakeSasQueryParameters Empty => new DataLakeSasQueryParameters();
 58
 59        internal DataLakeSasQueryParameters()
 060            : base()
 61        {
 062        }
 63
 64        /// <summary>
 65        /// Creates a new BlobSasQueryParameters instance.
 66        /// </summary>
 67        internal DataLakeSasQueryParameters(
 68            string version,
 69            AccountSasServices? services,
 70            AccountSasResourceTypes? resourceTypes,
 71            SasProtocol protocol,
 72            DateTimeOffset startsOn,
 73            DateTimeOffset expiresOn,
 74            SasIPRange ipRange,
 75            string identifier,
 76            string resource,
 77            string permissions,
 78            string signature,
 79            string keyOid = default,
 80            string keyTid = default,
 81            DateTimeOffset keyStart = default,
 82            DateTimeOffset keyExpiry = default,
 83            string keyService = default,
 84            string keyVersion = default,
 85            string cacheControl = default,
 86            string contentDisposition = default,
 87            string contentEncoding = default,
 88            string contentLanguage = default,
 89            string contentType = default)
 9290            : base(
 9291                version,
 9292                services,
 9293                resourceTypes,
 9294                protocol,
 9295                startsOn,
 9296                expiresOn,
 9297                ipRange,
 9298                identifier,
 9299                resource,
 92100                permissions,
 92101                signature,
 92102                cacheControl,
 92103                contentDisposition,
 92104                contentEncoding,
 92105                contentLanguage,
 92106                contentType)
 107        {
 92108            KeyProperties = new UserDelegationKeyProperties
 92109            {
 92110                ObjectId = keyOid,
 92111                TenantId = keyTid,
 92112                StartsOn = keyStart,
 92113                ExpiresOn = keyExpiry,
 92114                Service = keyService,
 92115                Version = keyVersion
 92116            };
 92117        }
 118
 119        /// <summary>
 120        /// Creates a new instance of the <see cref="BlobSasQueryParameters"/>
 121        /// type based on the supplied query parameters <paramref name="values"/>.
 122        /// All SAS-related query parameters will be removed from
 123        /// <paramref name="values"/>.
 124        /// </summary>
 125        /// <param name="values">URI query parameters</param>
 126        internal DataLakeSasQueryParameters(
 127            Dictionary<string, string> values)
 386128            : base(values)
 129        {
 386130            this.ParseKeyProperties(values);
 386131        }
 132
 133        /// <summary>
 134        /// Convert the SAS query parameters into a URL encoded query string.
 135        /// </summary>
 136        /// <returns>
 137        /// A URL encoded query string representing the SAS.
 138        /// </returns>
 139        public override string ToString()
 140        {
 640141            StringBuilder sb = new StringBuilder();
 640142            KeyProperties.AppendProperties(sb);
 640143            this.AppendProperties(sb);
 640144            return sb.ToString();
 145        }
 146    }
 147}