| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using Azure.Core; |
| | 5 | |
|
| | 6 | | namespace Azure.Storage.Files.Shares |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// Provides the client configuration options for connecting to Azure File |
| | 10 | | /// Storage. |
| | 11 | | /// </summary> |
| | 12 | | public class ShareClientOptions : ClientOptions |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// The Latest service version supported by this client library. |
| | 16 | | /// </summary> |
| | 17 | | internal const ServiceVersion LatestVersion = StorageVersionExtensions.LatestVersion; |
| | 18 | |
|
| | 19 | | /// <summary> |
| | 20 | | /// The versions of Azure File Storage supported by this client |
| | 21 | | /// library. For more, see |
| | 22 | | /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/versioning-for-the-azure-storage-servic |
| | 23 | | /// Versioning for the Azure Storage services</see>. |
| | 24 | | /// </summary> |
| | 25 | | public enum ServiceVersion |
| | 26 | | { |
| | 27 | | #pragma warning disable CA1707 // Identifiers should not contain underscores |
| | 28 | | /// <summary> |
| | 29 | | /// The 2019-02-02 service version described at |
| | 30 | | /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/version-2019-02-02"> |
| | 31 | | /// Version 2019-02-02</see> |
| | 32 | | /// </summary> |
| | 33 | | V2019_02_02 = 1, |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// The 2019-07-07 service version described at |
| | 37 | | /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/version-2019-07-07"> |
| | 38 | | /// Version 2019-07-07</see> |
| | 39 | | /// </summary> |
| | 40 | | V2019_07_07 = 2, |
| | 41 | |
|
| | 42 | | /// <summary> |
| | 43 | | /// The 2019-12-12 service version. |
| | 44 | | /// </summary> |
| | 45 | | V2019_12_12 = 3 |
| | 46 | | #pragma warning restore CA1707 // Identifiers should not contain underscores |
| | 47 | | } |
| | 48 | |
|
| | 49 | | /// <summary> |
| | 50 | | /// Gets the <see cref="ServiceVersion"/> of the service API used when |
| | 51 | | /// making requests. For more, see |
| | 52 | | /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/versioning-for-the-azure-storage-servic |
| | 53 | | /// Versioning for the Azure Storage services</see>. |
| | 54 | | /// </summary> |
| 617 | 55 | | public ServiceVersion Version { get; } |
| | 56 | |
|
| | 57 | | /// <summary> |
| | 58 | | /// Initializes a new instance of the <see cref="ShareClientOptions"/> |
| | 59 | | /// class. |
| | 60 | | /// </summary> |
| | 61 | | /// <param name="version"> |
| | 62 | | /// The <see cref="ServiceVersion"/> of the service API used when |
| | 63 | | /// making requests. |
| | 64 | | /// </param> |
| 617 | 65 | | public ShareClientOptions(ServiceVersion version = LatestVersion) |
| | 66 | | { |
| 617 | 67 | | if (ServiceVersion.V2019_02_02 <= version |
| 617 | 68 | | && version <= LatestVersion) |
| | 69 | | { |
| 617 | 70 | | Version = version; |
| | 71 | | } |
| | 72 | | else |
| | 73 | | { |
| 0 | 74 | | throw Errors.VersionNotSupported(nameof(version)); |
| | 75 | | } |
| | 76 | |
|
| 617 | 77 | | this.Initialize(); |
| 617 | 78 | | AddHeadersAndQueryParameters(); |
| 617 | 79 | | } |
| | 80 | |
|
| | 81 | | /// <summary> |
| | 82 | | /// Add headers and query parameters in <see cref="DiagnosticsOptions.LoggedHeaderNames"/> and <see cref="Diagno |
| | 83 | | /// </summary> |
| | 84 | | private void AddHeadersAndQueryParameters() |
| | 85 | | { |
| 617 | 86 | | Diagnostics.LoggedHeaderNames.Add("Access-Control-Allow-Origin"); |
| 617 | 87 | | Diagnostics.LoggedHeaderNames.Add("Transfer-Encoding"); |
| 617 | 88 | | Diagnostics.LoggedHeaderNames.Add("x-ms-date"); |
| 617 | 89 | | Diagnostics.LoggedHeaderNames.Add("x-ms-error-code"); |
| 617 | 90 | | Diagnostics.LoggedHeaderNames.Add("x-ms-request-id"); |
| 617 | 91 | | Diagnostics.LoggedHeaderNames.Add("x-ms-version"); |
| 617 | 92 | | Diagnostics.LoggedHeaderNames.Add("Accept-Ranges"); |
| 617 | 93 | | Diagnostics.LoggedHeaderNames.Add("Content-Disposition"); |
| 617 | 94 | | Diagnostics.LoggedHeaderNames.Add("Content-Encoding"); |
| 617 | 95 | | Diagnostics.LoggedHeaderNames.Add("Content-Language"); |
| 617 | 96 | | Diagnostics.LoggedHeaderNames.Add("Content-MD5"); |
| 617 | 97 | | Diagnostics.LoggedHeaderNames.Add("Content-Range"); |
| 617 | 98 | | Diagnostics.LoggedHeaderNames.Add("Vary"); |
| 617 | 99 | | Diagnostics.LoggedHeaderNames.Add("x-ms-content-crc64"); |
| 617 | 100 | | Diagnostics.LoggedHeaderNames.Add("x-ms-copy-action"); |
| 617 | 101 | | Diagnostics.LoggedHeaderNames.Add("x-ms-copy-completion-time"); |
| 617 | 102 | | Diagnostics.LoggedHeaderNames.Add("x-ms-copy-id"); |
| 617 | 103 | | Diagnostics.LoggedHeaderNames.Add("x-ms-copy-progress"); |
| 617 | 104 | | Diagnostics.LoggedHeaderNames.Add("x-ms-copy-status"); |
| 617 | 105 | | Diagnostics.LoggedHeaderNames.Add("x-ms-has-immutability-policy"); |
| 617 | 106 | | Diagnostics.LoggedHeaderNames.Add("x-ms-has-legal-hold"); |
| 617 | 107 | | Diagnostics.LoggedHeaderNames.Add("x-ms-lease-state"); |
| 617 | 108 | | Diagnostics.LoggedHeaderNames.Add("x-ms-lease-status"); |
| 617 | 109 | | Diagnostics.LoggedHeaderNames.Add("x-ms-range"); |
| 617 | 110 | | Diagnostics.LoggedHeaderNames.Add("x-ms-request-server-encrypted"); |
| 617 | 111 | | Diagnostics.LoggedHeaderNames.Add("x-ms-server-encrypted"); |
| 617 | 112 | | Diagnostics.LoggedHeaderNames.Add("x-ms-snapshot"); |
| 617 | 113 | | Diagnostics.LoggedHeaderNames.Add("x-ms-source-range"); |
| 617 | 114 | | Diagnostics.LoggedHeaderNames.Add("x-ms-cache-control"); |
| 617 | 115 | | Diagnostics.LoggedHeaderNames.Add("x-ms-content-disposition"); |
| 617 | 116 | | Diagnostics.LoggedHeaderNames.Add("x-ms-content-encoding"); |
| 617 | 117 | | Diagnostics.LoggedHeaderNames.Add("x-ms-content-language"); |
| 617 | 118 | | Diagnostics.LoggedHeaderNames.Add("x-ms-content-length"); |
| 617 | 119 | | Diagnostics.LoggedHeaderNames.Add("x-ms-content-md5"); |
| 617 | 120 | | Diagnostics.LoggedHeaderNames.Add("x-ms-content-type"); |
| 617 | 121 | | Diagnostics.LoggedHeaderNames.Add("x-ms-file-attributes"); |
| 617 | 122 | | Diagnostics.LoggedHeaderNames.Add("x-ms-file-change-time"); |
| 617 | 123 | | Diagnostics.LoggedHeaderNames.Add("x-ms-file-creation-time"); |
| 617 | 124 | | Diagnostics.LoggedHeaderNames.Add("x-ms-file-id"); |
| 617 | 125 | | Diagnostics.LoggedHeaderNames.Add("x-ms-file-last-write-time"); |
| 617 | 126 | | Diagnostics.LoggedHeaderNames.Add("x-ms-file-parent-id"); |
| 617 | 127 | | Diagnostics.LoggedHeaderNames.Add("x-ms-handle-id"); |
| 617 | 128 | | Diagnostics.LoggedHeaderNames.Add("x-ms-number-of-handles-closed"); |
| 617 | 129 | | Diagnostics.LoggedHeaderNames.Add("x-ms-recursive"); |
| 617 | 130 | | Diagnostics.LoggedHeaderNames.Add("x-ms-share-quota"); |
| 617 | 131 | | Diagnostics.LoggedHeaderNames.Add("x-ms-type"); |
| 617 | 132 | | Diagnostics.LoggedHeaderNames.Add("x-ms-write"); |
| | 133 | |
|
| 617 | 134 | | Diagnostics.LoggedQueryParameters.Add("comp"); |
| 617 | 135 | | Diagnostics.LoggedQueryParameters.Add("maxresults"); |
| 617 | 136 | | Diagnostics.LoggedQueryParameters.Add("rscc"); |
| 617 | 137 | | Diagnostics.LoggedQueryParameters.Add("rscd"); |
| 617 | 138 | | Diagnostics.LoggedQueryParameters.Add("rsce"); |
| 617 | 139 | | Diagnostics.LoggedQueryParameters.Add("rscl"); |
| 617 | 140 | | Diagnostics.LoggedQueryParameters.Add("rsct"); |
| 617 | 141 | | Diagnostics.LoggedQueryParameters.Add("se"); |
| 617 | 142 | | Diagnostics.LoggedQueryParameters.Add("si"); |
| 617 | 143 | | Diagnostics.LoggedQueryParameters.Add("sip"); |
| 617 | 144 | | Diagnostics.LoggedQueryParameters.Add("sp"); |
| 617 | 145 | | Diagnostics.LoggedQueryParameters.Add("spr"); |
| 617 | 146 | | Diagnostics.LoggedQueryParameters.Add("sr"); |
| 617 | 147 | | Diagnostics.LoggedQueryParameters.Add("srt"); |
| 617 | 148 | | Diagnostics.LoggedQueryParameters.Add("ss"); |
| 617 | 149 | | Diagnostics.LoggedQueryParameters.Add("st"); |
| 617 | 150 | | Diagnostics.LoggedQueryParameters.Add("sv"); |
| 617 | 151 | | Diagnostics.LoggedQueryParameters.Add("copyid"); |
| 617 | 152 | | Diagnostics.LoggedQueryParameters.Add("restype"); |
| 617 | 153 | | } |
| | 154 | | } |
| | 155 | | } |