-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
SecretClientOptions.cs
99 lines (86 loc) · 3.21 KB
/
SecretClientOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using Azure.Core;
namespace Azure.Security.KeyVault.Secrets
{
/// <summary>
/// Options that allow you to configure the requests sent to Key Vault.
/// </summary>
public class SecretClientOptions : ClientOptions
{
/// <summary>
/// The latest service version supported by this client library.
/// For more information, see
/// <see href="https://docs.microsoft.com/rest/api/keyvault/key-vault-versions">Key Vault versions</see>.
/// </summary>
internal const ServiceVersion LatestVersion = ServiceVersion.V7_5;
/// <summary>
/// The versions of Azure Key Vault supported by this client library.
/// </summary>
public enum ServiceVersion
{
#pragma warning disable CA1707 // Identifiers should not contain underscores
/// <summary>
/// The Key Vault API version 7.0.
/// </summary>
V7_0 = 0,
/// <summary>
/// The Key Vault API version 7.1.
/// </summary>
V7_1 = 1,
/// <summary>
/// The Key Vault API version 7.2.
/// </summary>
V7_2 = 2,
/// <summary>
/// The Key Vault API version 7.3.
/// </summary>
V7_3 = 3,
/// <summary>
/// The Key Vault API version 7.4.
/// </summary>
V7_4 = 4,
/// <summary>
/// The Key Vault API version 7.5.
/// </summary>
V7_5 = 5,
#pragma warning restore CA1707 // Identifiers should not contain underscores
}
/// <summary>
/// Gets the <see cref="ServiceVersion"/> of the service API used when
/// making requests. For more information, see
/// <see href="https://docs.microsoft.com/rest/api/keyvault/key-vault-versions">Key Vault versions</see>.
/// </summary>
public ServiceVersion Version { get; }
/// <summary>
/// Initializes a new instance of the <see cref="SecretClientOptions"/> class.
/// </summary>
/// <param name="version">
/// The <see cref="ServiceVersion"/> of the service API used when
/// making requests.
/// </param>
public SecretClientOptions(ServiceVersion version = LatestVersion)
{
Version = version;
this.ConfigureLogging();
}
/// <summary>
/// Gets or sets whether to disable verification that the authentication challenge resource matches the Key Vault domain.
/// </summary>
public bool DisableChallengeResourceVerification { get; set; }
internal string GetVersionString()
{
return Version switch
{
ServiceVersion.V7_0 => "7.0",
ServiceVersion.V7_1 => "7.1",
ServiceVersion.V7_2 => "7.2",
ServiceVersion.V7_3 => "7.3",
ServiceVersion.V7_4 => "7.4",
ServiceVersion.V7_5 => "7.5",
_ => throw new ArgumentException(Version.ToString()),
};
}
}
}