| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using Azure.Core; |
| | | 6 | | using Azure.Core.Pipeline; |
| | | 7 | | |
| | | 8 | | namespace Azure.Data.AppConfiguration |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Options that allow users to configure the requests sent to the App Configuration service. |
| | | 12 | | /// </summary> |
| | | 13 | | public class ConfigurationClientOptions : ClientOptions |
| | | 14 | | { |
| | | 15 | | /// <summary> |
| | | 16 | | /// The latest service version supported by this client library. |
| | | 17 | | /// </summary> |
| | | 18 | | internal const ServiceVersion LatestVersion = ServiceVersion.V1_0; |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// The versions of the App Configuration service supported by this client library. |
| | | 22 | | /// </summary> |
| | | 23 | | public enum ServiceVersion |
| | | 24 | | { |
| | | 25 | | #pragma warning disable CA1707 // Identifiers should not contain underscores |
| | | 26 | | /// <summary> |
| | | 27 | | /// Version 1.0. |
| | | 28 | | /// </summary> |
| | | 29 | | V1_0 = 0 |
| | | 30 | | #pragma warning restore CA1707 // Identifiers should not contain underscores |
| | | 31 | | } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Gets the <see cref="ServiceVersion"/> of the service API used when |
| | | 35 | | /// making requests. |
| | | 36 | | /// </summary> |
| | 326 | 37 | | internal ServiceVersion Version { get; } |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Initializes a new instance of the <see cref="ConfigurationClientOptions"/> |
| | | 41 | | /// class. |
| | | 42 | | /// </summary> |
| | | 43 | | /// <param name="version"> |
| | | 44 | | /// The <see cref="ServiceVersion"/> of the service API used when |
| | | 45 | | /// making requests. |
| | | 46 | | /// </param> |
| | 326 | 47 | | public ConfigurationClientOptions(ServiceVersion version = LatestVersion) |
| | | 48 | | { |
| | 326 | 49 | | Version = version; |
| | 326 | 50 | | this.ConfigureLogging(); |
| | 326 | 51 | | } |
| | | 52 | | |
| | | 53 | | internal string GetVersionString() |
| | | 54 | | { |
| | 326 | 55 | | switch (Version) |
| | | 56 | | { |
| | | 57 | | case ServiceVersion.V1_0: |
| | 326 | 58 | | return "1.0"; |
| | | 59 | | |
| | | 60 | | default: |
| | 0 | 61 | | throw new ArgumentException(Version.ToString()); |
| | | 62 | | } |
| | | 63 | | } |
| | | 64 | | } |
| | | 65 | | } |