| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using Azure.Core; |
| | 6 | |
|
| | 7 | | namespace Azure.Security.KeyVault.Administration |
| | 8 | | { |
| | 9 | | /// <summary> |
| | 10 | | /// Options to configure the requests sent to Key Vault. |
| | 11 | | /// </summary> |
| | 12 | | public class KeyVaultBackupClientOptions : ClientOptions |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// The latest service version supported by this client library. |
| | 16 | | /// For more information, see |
| | 17 | | /// <see href="https://docs.microsoft.com/rest/api/keyvault/key-vault-versions">Key Vault versions</see>. |
| | 18 | | /// </summary> |
| | 19 | | internal const ServiceVersion LatestVersion = ServiceVersion.V7_2_Preview; |
| | 20 | |
|
| | 21 | | /// <summary> |
| | 22 | | /// The versions of Azure Key Vault supported by this client |
| | 23 | | /// library. |
| | 24 | | /// </summary> |
| | 25 | | public enum ServiceVersion |
| | 26 | | { |
| | 27 | | #pragma warning disable CA1707 // Identifiers should not contain underscores |
| | 28 | | /// <summary> |
| | 29 | | /// The Key Vault API version 7.2-preview. |
| | 30 | | /// </summary> |
| | 31 | | V7_2_Preview = 1, |
| | 32 | | #pragma warning restore CA1707 // Identifiers should not contain underscores |
| | 33 | | } |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Gets the <see cref="ServiceVersion"/> of the service API used when |
| | 37 | | /// making requests. For more information, see |
| | 38 | | /// <see href="https://docs.microsoft.com/rest/api/keyvault/key-vault-versions">Key Vault versions</see>. |
| | 39 | | /// </summary> |
| 8 | 40 | | public ServiceVersion Version { get; } |
| | 41 | |
|
| | 42 | | /// <summary> |
| | 43 | | /// Initializes a new instance of the <see cref="KeyVaultBackupClientOptions"/> class. |
| | 44 | | /// class. |
| | 45 | | /// </summary> |
| | 46 | | /// <param name="version"> |
| | 47 | | /// The <see cref="ServiceVersion"/> of the service API used when |
| | 48 | | /// making requests. |
| | 49 | | /// </param> |
| 8 | 50 | | public KeyVaultBackupClientOptions(ServiceVersion version = LatestVersion) |
| | 51 | | { |
| 8 | 52 | | Version = version; |
| | 53 | |
|
| 8 | 54 | | this.ConfigureLogging(); |
| 8 | 55 | | } |
| | 56 | |
|
| | 57 | | internal string GetVersionString() |
| | 58 | | { |
| 8 | 59 | | return Version switch |
| 8 | 60 | | { |
| 16 | 61 | | ServiceVersion.V7_2_Preview => "7.2-preview", |
| 8 | 62 | |
|
| 0 | 63 | | _ => throw new ArgumentException(Version.ToString()), |
| 8 | 64 | | }; |
| | 65 | | } |
| | 66 | | } |
| | 67 | | } |