diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs
index f3de174aee62..621287c8eae8 100644
--- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs
@@ -48,6 +48,11 @@ public partial interface IKeyVaultManagementClient : System.IDisposable
///
string SubscriptionId { get; set; }
+ ///
+ /// Client Api Version.
+ ///
+ string ApiVersion { get; }
+
///
/// The preferred language for the response.
///
@@ -88,9 +93,9 @@ public partial interface IKeyVaultManagementClient : System.IDisposable
IOperations Operations { get; }
///
- /// Gets the IManagedHsmsOperations.
+ /// Gets the IKeysOperations.
///
- IManagedHsmsOperations ManagedHsms { get; }
+ IKeysOperations Keys { get; }
}
}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeysOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeysOperations.cs
new file mode 100644
index 000000000000..473cf582c9d1
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeysOperations.cs
@@ -0,0 +1,226 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// KeysOperations operations.
+ ///
+ public partial interface IKeysOperations
+ {
+ ///
+ /// Creates the first version of a new key if it does not exist. If it
+ /// already exists, then the existing key is returned without any write
+ /// operations being performed. This API does not create subsequent
+ /// versions, and does not update existing keys.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key
+ /// vault.
+ ///
+ ///
+ /// The name of the key vault which contains the key to be created.
+ ///
+ ///
+ /// The name of the key to be created.
+ ///
+ ///
+ /// The parameters used to create the specified key.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CreateIfNotExistWithHttpMessagesAsync(string resourceGroupName, string vaultName, string keyName, KeyCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets the current version of the specified key from the specified
+ /// key vault.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key
+ /// vault.
+ ///
+ ///
+ /// The name of the vault which contains the key to be retrieved.
+ ///
+ ///
+ /// The name of the key to be retrieved.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string keyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the keys in the specified key vault.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key
+ /// vault.
+ ///
+ ///
+ /// The name of the vault which contains the keys to be retrieved.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets the specified version of the specified key in the specified
+ /// key vault.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key
+ /// vault.
+ ///
+ ///
+ /// The name of the vault which contains the key version to be
+ /// retrieved.
+ ///
+ ///
+ /// The name of the key version to be retrieved.
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetVersionWithHttpMessagesAsync(string resourceGroupName, string vaultName, string keyName, string keyVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the versions of the specified key in the specified key vault.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key
+ /// vault.
+ ///
+ ///
+ /// The name of the vault which contains the key versions to be
+ /// retrieved.
+ ///
+ ///
+ /// The name of the key versions to be retrieved.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListVersionsWithHttpMessagesAsync(string resourceGroupName, string vaultName, string keyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the keys in the specified key vault.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the versions of the specified key in the specified key vault.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListVersionsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs
index 5445b99956e7..6a0d1566a202 100644
--- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs
@@ -54,6 +54,11 @@ public partial class KeyVaultManagementClient : ServiceClient
public string SubscriptionId { get; set; }
+ ///
+ /// Client Api Version.
+ ///
+ public string ApiVersion { get; private set; }
+
///
/// The preferred language for the response.
///
@@ -93,9 +98,9 @@ public partial class KeyVaultManagementClient : ServiceClient
- /// Gets the IManagedHsmsOperations.
+ /// Gets the IKeysOperations.
///
- public virtual IManagedHsmsOperations ManagedHsms { get; private set; }
+ public virtual IKeysOperations Keys { get; private set; }
///
/// Initializes a new instance of the KeyVaultManagementClient class.
@@ -342,8 +347,9 @@ private void Initialize()
PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this);
PrivateLinkResources = new PrivateLinkResourcesOperations(this);
Operations = new Operations(this);
- ManagedHsms = new ManagedHsmsOperations(this);
+ Keys = new KeysOperations(this);
BaseUri = new System.Uri("https://management.azure.com");
+ ApiVersion = "2019-09-01";
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeysOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeysOperations.cs
new file mode 100644
index 000000000000..3662b5382893
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeysOperations.cs
@@ -0,0 +1,1516 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// KeysOperations operations.
+ ///
+ internal partial class KeysOperations : IServiceOperations, IKeysOperations
+ {
+ ///
+ /// Initializes a new instance of the KeysOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal KeysOperations(KeyVaultManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the KeyVaultManagementClient
+ ///
+ public KeyVaultManagementClient Client { get; private set; }
+
+ ///
+ /// Creates the first version of a new key if it does not exist. If it already
+ /// exists, then the existing key is returned without any write operations
+ /// being performed. This API does not create subsequent versions, and does not
+ /// update existing keys.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the key vault which contains the key to be created.
+ ///
+ ///
+ /// The name of the key to be created.
+ ///
+ ///
+ /// The parameters used to create the specified key.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CreateIfNotExistWithHttpMessagesAsync(string resourceGroupName, string vaultName, string keyName, KeyCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
+ if (vaultName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(vaultName, "^[a-zA-Z0-9-]{3,24}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$");
+ }
+ }
+ if (keyName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "keyName");
+ }
+ if (keyName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(keyName, "^[a-zA-Z0-9-]{1,127}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "keyName", "^[a-zA-Z0-9-]{1,127}$");
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("keyName", keyName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateIfNotExist", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets the current version of the specified key from the specified key vault.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the key to be retrieved.
+ ///
+ ///
+ /// The name of the key to be retrieved.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string vaultName, string keyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
+ if (vaultName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(vaultName, "^[a-zA-Z0-9-]{3,24}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$");
+ }
+ }
+ if (keyName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "keyName");
+ }
+ if (keyName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(keyName, "^[a-zA-Z0-9-]{1,127}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "keyName", "^[a-zA-Z0-9-]{1,127}$");
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("keyName", keyName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists the keys in the specified key vault.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the keys to be retrieved.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
+ if (vaultName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(vaultName, "^[a-zA-Z0-9-]{3,24}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$");
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets the specified version of the specified key in the specified key vault.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the key version to be retrieved.
+ ///
+ ///
+ /// The name of the key version to be retrieved.
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetVersionWithHttpMessagesAsync(string resourceGroupName, string vaultName, string keyName, string keyVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
+ if (vaultName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(vaultName, "^[a-zA-Z0-9-]{3,24}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$");
+ }
+ }
+ if (keyName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "keyName");
+ }
+ if (keyName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(keyName, "^[a-zA-Z0-9-]{1,127}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "keyName", "^[a-zA-Z0-9-]{1,127}$");
+ }
+ }
+ if (keyVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "keyVersion");
+ }
+ if (keyVersion != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(keyVersion, "^[a-fA-F0-9]{32}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "keyVersion", "^[a-fA-F0-9]{32}$");
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("keyName", keyName);
+ tracingParameters.Add("keyVersion", keyVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetVersion", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName));
+ _url = _url.Replace("{keyVersion}", System.Uri.EscapeDataString(keyVersion));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists the versions of the specified key in the specified key vault.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the key versions to be retrieved.
+ ///
+ ///
+ /// The name of the key versions to be retrieved.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListVersionsWithHttpMessagesAsync(string resourceGroupName, string vaultName, string keyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (vaultName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
+ }
+ if (vaultName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(vaultName, "^[a-zA-Z0-9-]{3,24}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$");
+ }
+ }
+ if (keyName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "keyName");
+ }
+ if (keyName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(keyName, "^[a-zA-Z0-9-]{1,127}$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "keyName", "^[a-zA-Z0-9-]{1,127}$");
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("vaultName", vaultName);
+ tracingParameters.Add("keyName", keyName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListVersions", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
+ _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists the keys in the specified key vault.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists the versions of the specified key in the specified key vault.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListVersionsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListVersionsNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeysOperationsExtensions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeysOperationsExtensions.cs
new file mode 100644
index 000000000000..4aca734b7a74
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeysOperationsExtensions.cs
@@ -0,0 +1,335 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for KeysOperations.
+ ///
+ public static partial class KeysOperationsExtensions
+ {
+ ///
+ /// Creates the first version of a new key if it does not exist. If it already
+ /// exists, then the existing key is returned without any write operations
+ /// being performed. This API does not create subsequent versions, and does not
+ /// update existing keys.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the key vault which contains the key to be created.
+ ///
+ ///
+ /// The name of the key to be created.
+ ///
+ ///
+ /// The parameters used to create the specified key.
+ ///
+ public static Key CreateIfNotExist(this IKeysOperations operations, string resourceGroupName, string vaultName, string keyName, KeyCreateParameters parameters)
+ {
+ return operations.CreateIfNotExistAsync(resourceGroupName, vaultName, keyName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates the first version of a new key if it does not exist. If it already
+ /// exists, then the existing key is returned without any write operations
+ /// being performed. This API does not create subsequent versions, and does not
+ /// update existing keys.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the key vault which contains the key to be created.
+ ///
+ ///
+ /// The name of the key to be created.
+ ///
+ ///
+ /// The parameters used to create the specified key.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateIfNotExistAsync(this IKeysOperations operations, string resourceGroupName, string vaultName, string keyName, KeyCreateParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateIfNotExistWithHttpMessagesAsync(resourceGroupName, vaultName, keyName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets the current version of the specified key from the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the key to be retrieved.
+ ///
+ ///
+ /// The name of the key to be retrieved.
+ ///
+ public static Key Get(this IKeysOperations operations, string resourceGroupName, string vaultName, string keyName)
+ {
+ return operations.GetAsync(resourceGroupName, vaultName, keyName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets the current version of the specified key from the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the key to be retrieved.
+ ///
+ ///
+ /// The name of the key to be retrieved.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IKeysOperations operations, string resourceGroupName, string vaultName, string keyName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, keyName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists the keys in the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the keys to be retrieved.
+ ///
+ public static IPage List(this IKeysOperations operations, string resourceGroupName, string vaultName)
+ {
+ return operations.ListAsync(resourceGroupName, vaultName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists the keys in the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the keys to be retrieved.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IKeysOperations operations, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vaultName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets the specified version of the specified key in the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the key version to be retrieved.
+ ///
+ ///
+ /// The name of the key version to be retrieved.
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ ///
+ public static Key GetVersion(this IKeysOperations operations, string resourceGroupName, string vaultName, string keyName, string keyVersion)
+ {
+ return operations.GetVersionAsync(resourceGroupName, vaultName, keyName, keyVersion).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets the specified version of the specified key in the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the key version to be retrieved.
+ ///
+ ///
+ /// The name of the key version to be retrieved.
+ ///
+ ///
+ /// The version of the key to be retrieved.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetVersionAsync(this IKeysOperations operations, string resourceGroupName, string vaultName, string keyName, string keyVersion, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetVersionWithHttpMessagesAsync(resourceGroupName, vaultName, keyName, keyVersion, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists the versions of the specified key in the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the key versions to be retrieved.
+ ///
+ ///
+ /// The name of the key versions to be retrieved.
+ ///
+ public static IPage ListVersions(this IKeysOperations operations, string resourceGroupName, string vaultName, string keyName)
+ {
+ return operations.ListVersionsAsync(resourceGroupName, vaultName, keyName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists the versions of the specified key in the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group which contains the specified key vault.
+ ///
+ ///
+ /// The name of the vault which contains the key versions to be retrieved.
+ ///
+ ///
+ /// The name of the key versions to be retrieved.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListVersionsAsync(this IKeysOperations operations, string resourceGroupName, string vaultName, string keyName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListVersionsWithHttpMessagesAsync(resourceGroupName, vaultName, keyName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists the keys in the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this IKeysOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists the keys in the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListNextAsync(this IKeysOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists the versions of the specified key in the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListVersionsNext(this IKeysOperations operations, string nextPageLink)
+ {
+ return operations.ListVersionsNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists the versions of the specified key in the specified key vault.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListVersionsNextAsync(this IKeysOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListVersionsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Attributes.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Attributes.cs
new file mode 100644
index 000000000000..7c6c6c3edc74
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Attributes.cs
@@ -0,0 +1,107 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The object attributes managed by the Azure Key Vault service.
+ ///
+ public partial class Attributes
+ {
+ ///
+ /// Initializes a new instance of the Attributes class.
+ ///
+ public Attributes()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Attributes class.
+ ///
+ /// Determines whether or not the object is
+ /// enabled.
+ /// Not before date in seconds since
+ /// 1970-01-01T00:00:00Z.
+ /// Expiry date in seconds since
+ /// 1970-01-01T00:00:00Z.
+ /// Creation time in seconds since
+ /// 1970-01-01T00:00:00Z.
+ /// Last updated time in seconds since
+ /// 1970-01-01T00:00:00Z.
+ /// The deletion recovery level currently
+ /// in effect for the object. If it contains 'Purgeable', then the
+ /// object can be permanently deleted by a privileged user; otherwise,
+ /// only the system can purge the object at the end of the retention
+ /// interval. Possible values include: 'Purgeable',
+ /// 'Recoverable+Purgeable', 'Recoverable',
+ /// 'Recoverable+ProtectedSubscription'
+ public Attributes(bool? enabled = default(bool?), long? notBefore = default(long?), long? expires = default(long?), long? created = default(long?), long? updated = default(long?), string recoveryLevel = default(string))
+ {
+ Enabled = enabled;
+ NotBefore = notBefore;
+ Expires = expires;
+ Created = created;
+ Updated = updated;
+ RecoveryLevel = recoveryLevel;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets determines whether or not the object is enabled.
+ ///
+ [JsonProperty(PropertyName = "enabled")]
+ public bool? Enabled { get; set; }
+
+ ///
+ /// Gets or sets not before date in seconds since 1970-01-01T00:00:00Z.
+ ///
+ [JsonProperty(PropertyName = "nbf")]
+ public long? NotBefore { get; set; }
+
+ ///
+ /// Gets or sets expiry date in seconds since 1970-01-01T00:00:00Z.
+ ///
+ [JsonProperty(PropertyName = "exp")]
+ public long? Expires { get; set; }
+
+ ///
+ /// Gets creation time in seconds since 1970-01-01T00:00:00Z.
+ ///
+ [JsonProperty(PropertyName = "created")]
+ public long? Created { get; private set; }
+
+ ///
+ /// Gets last updated time in seconds since 1970-01-01T00:00:00Z.
+ ///
+ [JsonProperty(PropertyName = "updated")]
+ public long? Updated { get; private set; }
+
+ ///
+ /// Gets the deletion recovery level currently in effect for the
+ /// object. If it contains 'Purgeable', then the object can be
+ /// permanently deleted by a privileged user; otherwise, only the
+ /// system can purge the object at the end of the retention interval.
+ /// Possible values include: 'Purgeable', 'Recoverable+Purgeable',
+ /// 'Recoverable', 'Recoverable+ProtectedSubscription'
+ ///
+ [JsonProperty(PropertyName = "recoveryLevel")]
+ public string RecoveryLevel { get; private set; }
+
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/CertificatePermissions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/CertificatePermissions.cs
index e67ca8c27a2b..da3ebb7b9ff8 100644
--- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/CertificatePermissions.cs
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/CertificatePermissions.cs
@@ -16,6 +16,7 @@ namespace Microsoft.Azure.Management.KeyVault.Models
///
public static class CertificatePermissions
{
+ public const string All = "all";
public const string Get = "get";
public const string List = "list";
public const string Delete = "delete";
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletionRecoveryLevel.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletionRecoveryLevel.cs
new file mode 100644
index 000000000000..08f8a1c76fdc
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/DeletionRecoveryLevel.cs
@@ -0,0 +1,24 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault.Models
+{
+
+ ///
+ /// Defines values for DeletionRecoveryLevel.
+ ///
+ public static class DeletionRecoveryLevel
+ {
+ public const string Purgeable = "Purgeable";
+ public const string RecoverablePurgeable = "Recoverable+Purgeable";
+ public const string Recoverable = "Recoverable";
+ public const string RecoverableProtectedSubscription = "Recoverable+ProtectedSubscription";
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/JsonWebKeyCurveName.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/JsonWebKeyCurveName.cs
new file mode 100644
index 000000000000..9a09f4e2ac66
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/JsonWebKeyCurveName.cs
@@ -0,0 +1,24 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault.Models
+{
+
+ ///
+ /// Defines values for JsonWebKeyCurveName.
+ ///
+ public static class JsonWebKeyCurveName
+ {
+ public const string P256 = "P-256";
+ public const string P384 = "P-384";
+ public const string P521 = "P-521";
+ public const string P256K = "P-256K";
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/JsonWebKeyOperation.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/JsonWebKeyOperation.cs
new file mode 100644
index 000000000000..507bbc3ba36f
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/JsonWebKeyOperation.cs
@@ -0,0 +1,27 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault.Models
+{
+
+ ///
+ /// Defines values for JsonWebKeyOperation.
+ ///
+ public static class JsonWebKeyOperation
+ {
+ public const string Encrypt = "encrypt";
+ public const string Decrypt = "decrypt";
+ public const string Sign = "sign";
+ public const string Verify = "verify";
+ public const string WrapKey = "wrapKey";
+ public const string UnwrapKey = "unwrapKey";
+ public const string Import = "import";
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/JsonWebKeyType.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/JsonWebKeyType.cs
new file mode 100644
index 000000000000..ecb780e8117d
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/JsonWebKeyType.cs
@@ -0,0 +1,24 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault.Models
+{
+
+ ///
+ /// Defines values for JsonWebKeyType.
+ ///
+ public static class JsonWebKeyType
+ {
+ public const string EC = "EC";
+ public const string ECHSM = "EC-HSM";
+ public const string RSA = "RSA";
+ public const string RSAHSM = "RSA-HSM";
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Key.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Key.cs
new file mode 100644
index 000000000000..9953908e35e3
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Key.cs
@@ -0,0 +1,138 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The key resource.
+ ///
+ [Rest.Serialization.JsonTransformation]
+ public partial class Key : Resource
+ {
+ ///
+ /// Initializes a new instance of the Key class.
+ ///
+ public Key()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Key class.
+ ///
+ /// Fully qualified identifier of the key vault
+ /// resource.
+ /// Name of the key vault resource.
+ /// Resource type of the key vault resource.
+ /// Azure location of the key vault
+ /// resource.
+ /// Tags assigned to the key vault resource.
+ /// The attributes of the key.
+ /// The type of the key. For valid values, see
+ /// JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA',
+ /// 'RSA-HSM'
+ /// The key size in bits. For example: 2048,
+ /// 3072, or 4096 for RSA.
+ /// The elliptic curve name. For valid values,
+ /// see JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384',
+ /// 'P-521', 'P-256K'
+ /// The URI to retrieve the current version of the
+ /// key.
+ /// The URI to retrieve the specific
+ /// version of the key.
+ public Key(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), KeyAttributes attributes = default(KeyAttributes), string kty = default(string), IList keyOps = default(IList), int? keySize = default(int?), string curveName = default(string), string keyUri = default(string), string keyUriWithVersion = default(string))
+ : base(id, name, type, location, tags)
+ {
+ Attributes = attributes;
+ Kty = kty;
+ KeyOps = keyOps;
+ KeySize = keySize;
+ CurveName = curveName;
+ KeyUri = keyUri;
+ KeyUriWithVersion = keyUriWithVersion;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the attributes of the key.
+ ///
+ [JsonProperty(PropertyName = "properties.attributes")]
+ public KeyAttributes Attributes { get; set; }
+
+ ///
+ /// Gets or sets the type of the key. For valid values, see
+ /// JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA',
+ /// 'RSA-HSM'
+ ///
+ [JsonProperty(PropertyName = "properties.kty")]
+ public string Kty { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "properties.keyOps")]
+ public IList KeyOps { get; set; }
+
+ ///
+ /// Gets or sets the key size in bits. For example: 2048, 3072, or 4096
+ /// for RSA.
+ ///
+ [JsonProperty(PropertyName = "properties.keySize")]
+ public int? KeySize { get; set; }
+
+ ///
+ /// Gets or sets the elliptic curve name. For valid values, see
+ /// JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384',
+ /// 'P-521', 'P-256K'
+ ///
+ [JsonProperty(PropertyName = "properties.curveName")]
+ public string CurveName { get; set; }
+
+ ///
+ /// Gets the URI to retrieve the current version of the key.
+ ///
+ [JsonProperty(PropertyName = "properties.keyUri")]
+ public string KeyUri { get; private set; }
+
+ ///
+ /// Gets the URI to retrieve the specific version of the key.
+ ///
+ [JsonProperty(PropertyName = "properties.keyUriWithVersion")]
+ public string KeyUriWithVersion { get; private set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Kty != null)
+ {
+ if (Kty.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Kty", 1);
+ }
+ }
+ }
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyAttributes.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyAttributes.cs
new file mode 100644
index 000000000000..ef10dfaa85ff
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyAttributes.cs
@@ -0,0 +1,60 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault.Models
+{
+ using System.Linq;
+
+ ///
+ /// The attributes of the key.
+ ///
+ public partial class KeyAttributes : Attributes
+ {
+ ///
+ /// Initializes a new instance of the KeyAttributes class.
+ ///
+ public KeyAttributes()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the KeyAttributes class.
+ ///
+ /// Determines whether or not the object is
+ /// enabled.
+ /// Not before date in seconds since
+ /// 1970-01-01T00:00:00Z.
+ /// Expiry date in seconds since
+ /// 1970-01-01T00:00:00Z.
+ /// Creation time in seconds since
+ /// 1970-01-01T00:00:00Z.
+ /// Last updated time in seconds since
+ /// 1970-01-01T00:00:00Z.
+ /// The deletion recovery level currently
+ /// in effect for the object. If it contains 'Purgeable', then the
+ /// object can be permanently deleted by a privileged user; otherwise,
+ /// only the system can purge the object at the end of the retention
+ /// interval. Possible values include: 'Purgeable',
+ /// 'Recoverable+Purgeable', 'Recoverable',
+ /// 'Recoverable+ProtectedSubscription'
+ public KeyAttributes(bool? enabled = default(bool?), long? notBefore = default(long?), long? expires = default(long?), long? created = default(long?), long? updated = default(long?), string recoveryLevel = default(string))
+ : base(enabled, notBefore, expires, created, updated, recoveryLevel)
+ {
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyCreateParameters.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyCreateParameters.cs
new file mode 100644
index 000000000000..22c51c5ffff9
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyCreateParameters.cs
@@ -0,0 +1,82 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The parameters used to create a key.
+ ///
+ public partial class KeyCreateParameters : IResource
+ {
+ ///
+ /// Initializes a new instance of the KeyCreateParameters class.
+ ///
+ public KeyCreateParameters()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the KeyCreateParameters class.
+ ///
+ /// The properties of the key to be
+ /// created.
+ /// The tags that will be assigned to the
+ /// key.
+ public KeyCreateParameters(KeyProperties properties, IDictionary tags = default(IDictionary))
+ {
+ Tags = tags;
+ Properties = properties;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the tags that will be assigned to the key.
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// Gets or sets the properties of the key to be created.
+ ///
+ [JsonProperty(PropertyName = "properties")]
+ public KeyProperties Properties { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Properties == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Properties");
+ }
+ if (Properties != null)
+ {
+ Properties.Validate();
+ }
+ }
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyPermissions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyPermissions.cs
index f069fc994269..52b1c230ef81 100644
--- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyPermissions.cs
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyPermissions.cs
@@ -16,6 +16,7 @@ namespace Microsoft.Azure.Management.KeyVault.Models
///
public static class KeyPermissions
{
+ public const string All = "all";
public const string Encrypt = "encrypt";
public const string Decrypt = "decrypt";
public const string WrapKey = "wrapKey";
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyProperties.cs
new file mode 100644
index 000000000000..e0fac1a3a464
--- /dev/null
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/KeyProperties.cs
@@ -0,0 +1,128 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.KeyVault.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The properties of the key.
+ ///
+ public partial class KeyProperties
+ {
+ ///
+ /// Initializes a new instance of the KeyProperties class.
+ ///
+ public KeyProperties()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the KeyProperties class.
+ ///
+ /// The attributes of the key.
+ /// The type of the key. For valid values, see
+ /// JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA',
+ /// 'RSA-HSM'
+ /// The key size in bits. For example: 2048,
+ /// 3072, or 4096 for RSA.
+ /// The elliptic curve name. For valid values,
+ /// see JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384',
+ /// 'P-521', 'P-256K'
+ /// The URI to retrieve the current version of the
+ /// key.
+ /// The URI to retrieve the specific
+ /// version of the key.
+ public KeyProperties(KeyAttributes attributes = default(KeyAttributes), string kty = default(string), IList keyOps = default(IList), int? keySize = default(int?), string curveName = default(string), string keyUri = default(string), string keyUriWithVersion = default(string))
+ {
+ Attributes = attributes;
+ Kty = kty;
+ KeyOps = keyOps;
+ KeySize = keySize;
+ CurveName = curveName;
+ KeyUri = keyUri;
+ KeyUriWithVersion = keyUriWithVersion;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the attributes of the key.
+ ///
+ [JsonProperty(PropertyName = "attributes")]
+ public KeyAttributes Attributes { get; set; }
+
+ ///
+ /// Gets or sets the type of the key. For valid values, see
+ /// JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA',
+ /// 'RSA-HSM'
+ ///
+ [JsonProperty(PropertyName = "kty")]
+ public string Kty { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "keyOps")]
+ public IList KeyOps { get; set; }
+
+ ///
+ /// Gets or sets the key size in bits. For example: 2048, 3072, or 4096
+ /// for RSA.
+ ///
+ [JsonProperty(PropertyName = "keySize")]
+ public int? KeySize { get; set; }
+
+ ///
+ /// Gets or sets the elliptic curve name. For valid values, see
+ /// JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384',
+ /// 'P-521', 'P-256K'
+ ///
+ [JsonProperty(PropertyName = "curveName")]
+ public string CurveName { get; set; }
+
+ ///
+ /// Gets the URI to retrieve the current version of the key.
+ ///
+ [JsonProperty(PropertyName = "keyUri")]
+ public string KeyUri { get; private set; }
+
+ ///
+ /// Gets the URI to retrieve the specific version of the key.
+ ///
+ [JsonProperty(PropertyName = "keyUriWithVersion")]
+ public string KeyUriWithVersion { get; private set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Kty != null)
+ {
+ if (Kty.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Kty", 1);
+ }
+ }
+ }
+ }
+}
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPermissions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPermissions.cs
index efe8c1730fec..ed8a95736ee8 100644
--- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPermissions.cs
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPermissions.cs
@@ -16,6 +16,7 @@ namespace Microsoft.Azure.Management.KeyVault.Models
///
public static class SecretPermissions
{
+ public const string All = "all";
public const string Get = "get";
public const string List = "list";
public const string Set = "set";
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/StoragePermissions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/StoragePermissions.cs
index dfa64ca47cf7..2604b8dfb846 100644
--- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/StoragePermissions.cs
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/StoragePermissions.cs
@@ -16,6 +16,7 @@ namespace Microsoft.Azure.Management.KeyVault.Models
///
public static class StoragePermissions
{
+ public const string All = "all";
public const string Get = "get";
public const string List = "list";
public const string Delete = "delete";
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs
index e6a9bb02727c..c7f6e2a12097 100644
--- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs
@@ -65,12 +65,21 @@ internal Operations(KeyVaultManagementClient client)
///
/// Thrown when unable to deserialize the response
///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
///
/// A response object containing the response body and response headers.
///
public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- string apiVersion = "2019-09-01";
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -78,7 +87,6 @@ internal Operations(KeyVaultManagementClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
@@ -86,9 +94,9 @@ internal Operations(KeyVaultManagementClient client)
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.KeyVault/operations").ToString();
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs
index 970a8e9528b0..e064090a5b66 100644
--- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs
@@ -109,7 +109,10 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName");
}
- string apiVersion = "2019-09-01";
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -120,7 +123,6 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client)
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
@@ -132,9 +134,9 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client)
_url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -323,11 +325,14 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName");
}
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (properties == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "properties");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -338,7 +343,6 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client)
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("properties", properties);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Put", tracingParameters);
@@ -351,9 +355,9 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client)
_url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -584,7 +588,10 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName");
}
- string apiVersion = "2019-09-01";
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -595,7 +602,6 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client)
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
}
@@ -607,9 +613,9 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client)
_url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs
index fea7442aebbf..b1bde0a13752 100644
--- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs
@@ -101,7 +101,10 @@ internal PrivateLinkResourcesOperations(KeyVaultManagementClient client)
throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$");
}
}
- string apiVersion = "2019-09-01";
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -111,7 +114,6 @@ internal PrivateLinkResourcesOperations(KeyVaultManagementClient client)
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("vaultName", vaultName);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListByVault", tracingParameters);
}
@@ -122,9 +124,9 @@ internal PrivateLinkResourcesOperations(KeyVaultManagementClient client)
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs
index a7a5f8d6aef5..bfac409694b9 100644
--- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SdkInfo_KeyVaultManagementClient.cs
@@ -19,7 +19,7 @@ public static IEnumerable> ApiInfo_KeyVaultManagem
{
return new Tuple[]
{
- new Tuple("KeyVault", "ManagedHsms", "2020-04-01-preview"),
+ new Tuple("KeyVault", "Keys", "2019-09-01"),
new Tuple("KeyVault", "Operations", "2019-09-01"),
new Tuple("KeyVault", "PrivateEndpointConnections", "2019-09-01"),
new Tuple("KeyVault", "PrivateLinkResources", "2019-09-01"),
@@ -28,16 +28,5 @@ public static IEnumerable> ApiInfo_KeyVaultManagem
}.AsEnumerable();
}
}
- // BEGIN: Code Generation Metadata Section
- public static readonly String AutoRestVersion = "v2";
- public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413";
- public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/keyvault/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-preview-2020-04 --csharp.output-folder=C:\\Users\\yeliu\\code\\azure-sdk-for-net\\sdk\\keyvault\\Microsoft.Azure.Management.KeyVault\\src\\Generated";
- public static readonly String GithubForkName = "Azure";
- public static readonly String GithubBranchName = "master";
- public static readonly String GithubCommidId = "2a2233b0baf0246cd881711511802584efb92bd4";
- public static readonly String CodeGenerationErrors = "";
- public static readonly String GithubRepoName = "azure-rest-api-specs";
- // END: Code Generation Metadata Section
}
}
-
diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs
index bdbf8d307169..175587fccdb5 100644
--- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs
+++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs
@@ -125,6 +125,10 @@ internal VaultsOperations(KeyVaultManagementClient client)
throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$");
}
}
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (parameters == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
@@ -133,7 +137,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -143,7 +146,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("vaultName", vaultName);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters);
@@ -155,9 +157,9 @@ internal VaultsOperations(KeyVaultManagementClient client)
_url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -345,11 +347,14 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
}
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -359,7 +364,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("vaultName", vaultName);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
}
@@ -370,9 +374,9 @@ internal VaultsOperations(KeyVaultManagementClient client)
_url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -521,11 +525,14 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "vaultName");
}
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -535,7 +542,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("vaultName", vaultName);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
@@ -546,9 +552,9 @@ internal VaultsOperations(KeyVaultManagementClient client)
_url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -728,6 +734,10 @@ internal VaultsOperations(KeyVaultManagementClient client)
throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$");
}
}
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (parameters == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
@@ -740,7 +750,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -751,7 +760,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("operationKind", operationKind);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "UpdateAccessPolicy", tracingParameters);
@@ -764,9 +772,9 @@ internal VaultsOperations(KeyVaultManagementClient client)
_url = _url.Replace("{operationKind}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationKind, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -954,11 +962,14 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -968,7 +979,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("top", top);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters);
}
@@ -982,9 +992,9 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
_queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"'))));
}
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -1141,11 +1151,14 @@ internal VaultsOperations(KeyVaultManagementClient client)
///
public async Task>> ListBySubscriptionWithHttpMessagesAsync(int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1154,7 +1167,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("top", top);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters);
}
@@ -1167,9 +1179,9 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
_queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"'))));
}
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -1322,11 +1334,14 @@ internal VaultsOperations(KeyVaultManagementClient client)
///
public async Task>> ListDeletedWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1334,7 +1349,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "ListDeleted", tracingParameters);
}
@@ -1343,9 +1357,9 @@ internal VaultsOperations(KeyVaultManagementClient client)
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -1512,11 +1526,14 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "location");
}
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1526,7 +1543,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("location", location);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "GetDeleted", tracingParameters);
}
@@ -1537,9 +1553,9 @@ internal VaultsOperations(KeyVaultManagementClient client)
_url = _url.Replace("{location}", System.Uri.EscapeDataString(location));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -1917,11 +1933,14 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
vaultName.Validate();
}
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -1930,7 +1949,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("vaultName", vaultName);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters);
}
@@ -1939,9 +1957,9 @@ internal VaultsOperations(KeyVaultManagementClient client)
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -2124,6 +2142,10 @@ internal VaultsOperations(KeyVaultManagementClient client)
throw new ValidationException(ValidationRules.Pattern, "vaultName", "^[a-zA-Z0-9-]{3,24}$");
}
}
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (parameters == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
@@ -2136,7 +2158,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -2146,7 +2167,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("vaultName", vaultName);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
@@ -2158,9 +2178,9 @@ internal VaultsOperations(KeyVaultManagementClient client)
_url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -2349,11 +2369,14 @@ internal VaultsOperations(KeyVaultManagementClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "location");
}
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
- string apiVersion = "2019-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -2363,7 +2386,6 @@ internal VaultsOperations(KeyVaultManagementClient client)
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("vaultName", vaultName);
tracingParameters.Add("location", location);
- tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "BeginPurgeDeleted", tracingParameters);
}
@@ -2374,9 +2396,9 @@ internal VaultsOperations(KeyVaultManagementClient client)
_url = _url.Replace("{location}", System.Uri.EscapeDataString(location));
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
List _queryParameters = new List();
- if (apiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
}
if (_queryParameters.Count > 0)
{