From af41387f5587f50f90775f4445096d75d867e274 Mon Sep 17 00:00:00 2001 From: Yeming Liu Date: Fri, 24 Jul 2020 13:53:13 +0800 Subject: [PATCH 1/8] mhsm --- .../Generated/IKeyVaultManagementClient.cs | 5 +++++ .../src/Generated/KeyVaultManagementClient.cs | 8 ++++++- .../src/Generated/Models/VaultProperties.cs | 8 +++---- .../SdkInfo_KeyVaultManagementClient.cs | 22 +++++-------------- 4 files changed, 22 insertions(+), 21 deletions(-) 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 c52d34e300bc7..dd040c46597c0 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs @@ -92,5 +92,10 @@ public partial interface IKeyVaultManagementClient : System.IDisposable /// IOperations Operations { get; } + /// + /// Gets the IManagedHsmsOperations. + /// + IManagedHsmsOperations ManagedHsms { get; } + } } 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 6939f97563710..a072ab5544e18 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs @@ -97,6 +97,11 @@ public partial class KeyVaultManagementClient : ServiceClient public virtual IOperations Operations { get; private set; } + /// + /// Gets the IManagedHsmsOperations. + /// + public virtual IManagedHsmsOperations ManagedHsms { 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); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-09-01"; + ApiVersion = "2020-04-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs index 976ca743b9bc4..9f580d1ae2b6d 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/VaultProperties.cs @@ -37,7 +37,7 @@ public VaultProperties() /// should be used for authenticating requests to the key /// vault. /// SKU details - /// An array of 0 to 16 identities that + /// An array of 0 to 1024 identities that /// have access to the key vault. All identities in the array must use /// the same tenant ID as the key vault's tenant ID. When `createMode` /// is set to `recover`, access policies are not required. Otherwise, @@ -122,9 +122,9 @@ public VaultProperties() public Sku Sku { get; set; } /// - /// Gets or sets an array of 0 to 16 identities that have access to the - /// key vault. All identities in the array must use the same tenant ID - /// as the key vault's tenant ID. When `createMode` is set to + /// Gets or sets an array of 0 to 1024 identities that have access to + /// the key vault. All identities in the array must use the same tenant + /// ID as the key vault's tenant ID. When `createMode` is set to /// `recover`, access policies are not required. Otherwise, access /// policies are required. /// 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 2ec2c146cb466..3f8e2aaf5e30c 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,24 +19,14 @@ public static IEnumerable> ApiInfo_KeyVaultManagem { return new Tuple[] { - new Tuple("KeyVault", "Operations", "2019-09-01"), - new Tuple("KeyVault", "PrivateEndpointConnections", "2019-09-01"), - new Tuple("KeyVault", "PrivateLinkResources", "2019-09-01"), - new Tuple("KeyVault", "Vaults", "2019-09-01"), - new Tuple("KeyVaultManagementClient", "Vaults", "2019-09-01"), + new Tuple("KeyVault", "ManagedHsms", "2020-04-01-preview"), + new Tuple("KeyVault", "Operations", "2020-04-01-preview"), + new Tuple("KeyVault", "PrivateEndpointConnections", "2020-04-01-preview"), + new Tuple("KeyVault", "PrivateLinkResources", "2020-04-01-preview"), + new Tuple("KeyVault", "Vaults", "2020-04-01-preview"), + new Tuple("KeyVaultManagementClient", "Vaults", "2020-04-01-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "2.0.4413"; - 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=2.0.4413 --reflect-api-versions --csharp.output-folder=C:\\Users\\yeliu\\isra-fel\\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 = "c9a1ed48c35572cf59cb5030e678a9d614684a7f"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - From 086e8d02f94115211c004f050cc9d95e110da72e Mon Sep 17 00:00:00 2001 From: Yeming Liu Date: Fri, 24 Jul 2020 13:53:26 +0800 Subject: [PATCH 2/8] mhsm2 --- .../src/Generated/IManagedHsmsOperations.cs | 305 +++ .../src/Generated/ManagedHsmsOperations.cs | 1662 +++++++++++++++++ .../ManagedHsmsOperationsExtensions.cs | 473 +++++ .../src/Generated/Models/Error.cs | 68 + .../src/Generated/Models/ManagedHsm.cs | 73 + .../src/Generated/Models/ManagedHsmError.cs | 51 + .../Models/ManagedHsmErrorException.cs | 62 + .../Generated/Models/ManagedHsmProperties.cs | 167 ++ .../Generated/Models/ManagedHsmResource.cs | 113 ++ .../src/Generated/Models/ManagedHsmSku.cs | 75 + .../src/Generated/Models/ManagedHsmSkuName.cs | 60 + .../src/Generated/Models/ProvisioningState.cs | 53 + 12 files changed, 3162 insertions(+) create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IManagedHsmsOperations.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperationsExtensions.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Error.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsm.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmError.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmErrorException.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmResource.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmSku.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmSkuName.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ProvisioningState.cs diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IManagedHsmsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IManagedHsmsOperations.cs new file mode 100644 index 0000000000000..0d326629baf74 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IManagedHsmsOperations.cs @@ -0,0 +1,305 @@ +// +// 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; + + /// + /// ManagedHsmsOperations operations. + /// + public partial interface IManagedHsmsOperations + { + /// + /// Create or update a managed HSM Pool in the specified subscription. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to create or update the managed HSM Pool + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a managed HSM Pool in the specified subscription. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to patch the managed HSM Pool + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified managed HSM Pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool to delete + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified managed HSM Pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool. + /// + /// + /// 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 name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The List operation gets information about the managed HSM Pools + /// associated with the subscription and within the specified resource + /// group. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Maximum number of results to return. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The List operation gets information about the managed HSM Pools + /// associated with the subscription. + /// + /// + /// Maximum number of results to return. + /// + /// + /// 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>> ListBySubscriptionWithHttpMessagesAsync(int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a managed HSM Pool in the specified subscription. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to create or update the managed HSM Pool + /// + /// + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a managed HSM Pool in the specified subscription. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to patch the managed HSM Pool + /// + /// + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified managed HSM Pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool to delete + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The List operation gets information about the managed HSM Pools + /// associated with the subscription and within the specified resource + /// group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The List operation gets information about the managed HSM Pools + /// associated with the subscription. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs new file mode 100644 index 0000000000000..7f303c89cc95a --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs @@ -0,0 +1,1662 @@ +// +// 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; + + /// + /// ManagedHsmsOperations operations. + /// + internal partial class ManagedHsmsOperations : IServiceOperations, IManagedHsmsOperations + { + /// + /// Initializes a new instance of the ManagedHsmsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedHsmsOperations(KeyVaultManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the KeyVaultManagementClient + /// + public KeyVaultManagementClient Client { get; private set; } + + /// + /// Create or update a managed HSM Pool in the specified subscription. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to create or update the managed HSM Pool + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, name, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a managed HSM Pool in the specified subscription. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to patch the managed HSM Pool + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, name, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the specified managed HSM Pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool to delete + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, name, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified managed HSM Pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool. + /// + /// + /// 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 name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + 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/managedHSMs/{name}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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 ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription and within the specified resource group. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Maximum number of results to return. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + 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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("top", top); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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/managedHSMs").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + 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 ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription. + /// + /// + /// Maximum number of results to return. + /// + /// + /// 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>> 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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("top", top); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + 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 ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// Create or update a managed HSM Pool in the specified subscription. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to create or update the managed HSM Pool + /// + /// + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[a-zA-Z0-9]{3,24}$")) + { + throw new ValidationException(ValidationRules.Pattern, "name", "^[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"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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/managedHSMs/{name}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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 && (int)_statusCode != 202) + { + var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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; + } + + /// + /// Update a managed HSM Pool in the specified subscription. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to patch the managed HSM Pool + /// + /// + /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string name, ManagedHsm parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[a-zA-Z0-9]{3,24}$")) + { + throw new ValidationException(ValidationRules.Pattern, "name", "^[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"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", 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/managedHSMs/{name}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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("PATCH"); + _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 && (int)_statusCode != 202) + { + var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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; + } + + /// + /// Deletes the specified managed HSM Pool. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool to delete + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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/managedHSMs/{name}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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("DELETE"); + _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 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription and within the specified resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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 ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription. + /// + /// + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", 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 ManagedHsmErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ManagedHsmError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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/ManagedHsmsOperationsExtensions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperationsExtensions.cs new file mode 100644 index 0000000000000..b58e3160edf31 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperationsExtensions.cs @@ -0,0 +1,473 @@ +// +// 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 ManagedHsmsOperations. + /// + public static partial class ManagedHsmsOperationsExtensions + { + /// + /// Create or update a managed HSM Pool in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to create or update the managed HSM Pool + /// + public static ManagedHsm CreateOrUpdate(this IManagedHsmsOperations operations, string resourceGroupName, string name, ManagedHsm parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, name, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a managed HSM Pool in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to create or update the managed HSM Pool + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedHsmsOperations operations, string resourceGroupName, string name, ManagedHsm parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, name, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a managed HSM Pool in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to patch the managed HSM Pool + /// + public static ManagedHsm Update(this IManagedHsmsOperations operations, string resourceGroupName, string name, ManagedHsm parameters) + { + return operations.UpdateAsync(resourceGroupName, name, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update a managed HSM Pool in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to patch the managed HSM Pool + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IManagedHsmsOperations operations, string resourceGroupName, string name, ManagedHsm parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, name, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified managed HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool to delete + /// + public static void Delete(this IManagedHsmsOperations operations, string resourceGroupName, string name) + { + operations.DeleteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified managed HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool to delete + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IManagedHsmsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the specified managed HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool. + /// + public static ManagedHsm Get(this IManagedHsmsOperations operations, string resourceGroupName, string name) + { + return operations.GetAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified managed HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedHsmsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription and within the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Maximum number of results to return. + /// + public static IPage ListByResourceGroup(this IManagedHsmsOperations operations, string resourceGroupName, int? top = default(int?)) + { + return operations.ListByResourceGroupAsync(resourceGroupName, top).GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription and within the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Maximum number of results to return. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IManagedHsmsOperations operations, string resourceGroupName, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, top, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Maximum number of results to return. + /// + public static IPage ListBySubscription(this IManagedHsmsOperations operations, int? top = default(int?)) + { + return operations.ListBySubscriptionAsync(top).GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Maximum number of results to return. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IManagedHsmsOperations operations, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(top, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a managed HSM Pool in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to create or update the managed HSM Pool + /// + public static ManagedHsm BeginCreateOrUpdate(this IManagedHsmsOperations operations, string resourceGroupName, string name, ManagedHsm parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, name, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a managed HSM Pool in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to create or update the managed HSM Pool + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IManagedHsmsOperations operations, string resourceGroupName, string name, ManagedHsm parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, name, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a managed HSM Pool in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to patch the managed HSM Pool + /// + public static ManagedHsm BeginUpdate(this IManagedHsmsOperations operations, string resourceGroupName, string name, ManagedHsm parameters) + { + return operations.BeginUpdateAsync(resourceGroupName, name, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update a managed HSM Pool in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// Name of the managed HSM Pool + /// + /// + /// Parameters to patch the managed HSM Pool + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IManagedHsmsOperations operations, string resourceGroupName, string name, ManagedHsm parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, name, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified managed HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool to delete + /// + public static void BeginDelete(this IManagedHsmsOperations operations, string resourceGroupName, string name) + { + operations.BeginDeleteAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified managed HSM Pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group that contains the managed HSM pool. + /// + /// + /// The name of the managed HSM Pool to delete + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IManagedHsmsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription and within the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IManagedHsmsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription and within the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IManagedHsmsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IManagedHsmsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the managed HSM Pools associated + /// with the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IManagedHsmsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Error.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Error.cs new file mode 100644 index 0000000000000..77ae9e8bbe92b --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Error.cs @@ -0,0 +1,68 @@ +// +// 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 server error. + /// + public partial class Error + { + /// + /// Initializes a new instance of the Error class. + /// + public Error() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Error class. + /// + /// The error code. + /// The error message. + /// The inner error, contains a more specific + /// error code. + public Error(string code = default(string), string message = default(string), Error innerError = default(Error)) + { + Code = code; + Message = message; + InnerError = innerError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the inner error, contains a more specific error code. + /// + [JsonProperty(PropertyName = "innererror")] + public Error InnerError { get; private set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsm.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsm.cs new file mode 100644 index 0000000000000..2c8d405f635e8 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsm.cs @@ -0,0 +1,73 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Resource information with extended details. + /// + public partial class ManagedHsm : ManagedHsmResource + { + /// + /// Initializes a new instance of the ManagedHsm class. + /// + public ManagedHsm() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedHsm class. + /// + /// The Azure Resource Manager resource ID for the + /// managed HSM Pool. + /// The name of the managed HSM Pool. + /// The resource type of the managed HSM + /// Pool. + /// The supported Azure location where the + /// managed HSM Pool should be created. + /// SKU details + /// Resource tags + /// Properties of the managed HSM + public ManagedHsm(string id = default(string), string name = default(string), string type = default(string), string location = default(string), ManagedHsmSku sku = default(ManagedHsmSku), IDictionary tags = default(IDictionary), ManagedHsmProperties properties = default(ManagedHsmProperties)) + : base(id, name, type, location, sku, tags) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the managed HSM + /// + [JsonProperty(PropertyName = "properties")] + public ManagedHsmProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmError.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmError.cs new file mode 100644 index 0000000000000..bcaf15f1b9cb2 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmError.cs @@ -0,0 +1,51 @@ +// +// 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 error exception. + /// + public partial class ManagedHsmError + { + /// + /// Initializes a new instance of the ManagedHsmError class. + /// + public ManagedHsmError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedHsmError class. + /// + /// The server error. + public ManagedHsmError(Error error = default(Error)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the server error. + /// + [JsonProperty(PropertyName = "error")] + public Error Error { get; private set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmErrorException.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmErrorException.cs new file mode 100644 index 0000000000000..69094783a2cbe --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmErrorException.cs @@ -0,0 +1,62 @@ +// +// 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; + + /// + /// Exception thrown for an invalid response with ManagedHsmError + /// information. + /// + public partial class ManagedHsmErrorException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ManagedHsmError Body { get; set; } + + /// + /// Initializes a new instance of the ManagedHsmErrorException class. + /// + public ManagedHsmErrorException() + { + } + + /// + /// Initializes a new instance of the ManagedHsmErrorException class. + /// + /// The exception message. + public ManagedHsmErrorException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ManagedHsmErrorException class. + /// + /// The exception message. + /// Inner exception. + public ManagedHsmErrorException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs new file mode 100644 index 0000000000000..6bd62776bc370 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs @@ -0,0 +1,167 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of the managed HSM Pool + /// + public partial class ManagedHsmProperties + { + /// + /// Initializes a new instance of the ManagedHsmProperties class. + /// + public ManagedHsmProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedHsmProperties class. + /// + /// The Azure Active Directory tenant ID that + /// should be used for authenticating requests to the managed HSM + /// pool. + /// The security domain id that should + /// be used for restoring data from this managed HSM pool to a new + /// managed hsm pool. + /// Array of initial administrators + /// object ids for this managed hsm pool. + /// The URI of the managed hsm pool for + /// performing operations on keys. + /// Property to specify whether the + /// 'soft delete' functionality is enabled for this managed HSM pool. + /// If it's not set to any value(true or false) when creating new + /// managed HSM pool, it will be set to true by default. Once set to + /// true, it cannot be reverted to false. + /// softDelete data retention + /// days. It accepts >=7 and <=90. + /// Property specifying whether + /// protection against purge is enabled for this managed HSM pool. + /// Setting this property to true activates protection against purge + /// for this managed HSM pool and its content - only the Managed HSM + /// service may initiate a hard, irrecoverable deletion. The setting is + /// effective only if soft delete is also enabled. Enabling this + /// functionality is irreversible. + /// The create mode to indicate whether the + /// resource is being created or is being recovered from a deleted + /// resource. Possible values include: 'recover', 'default' + /// Resource Status Message. + /// Provisioning state. Possible values + /// include: 'Succeeded', 'Provisioning', 'Failed', 'Updating', + /// 'Deleting', 'Activated', 'SecurityDomainRestore', + /// 'Restoring' + public ManagedHsmProperties(System.Guid? tenantId = default(System.Guid?), System.Guid? securityDomainId = default(System.Guid?), IList initialAdminObjectIds = default(IList), string hsmPoolUri = default(string), bool? enableSoftDelete = default(bool?), int? softDeleteRetentionInDays = default(int?), bool? enablePurgeProtection = default(bool?), CreateMode? createMode = default(CreateMode?), string statusMessage = default(string), string provisioningState = default(string)) + { + TenantId = tenantId; + SecurityDomainId = securityDomainId; + InitialAdminObjectIds = initialAdminObjectIds; + HsmPoolUri = hsmPoolUri; + EnableSoftDelete = enableSoftDelete; + SoftDeleteRetentionInDays = softDeleteRetentionInDays; + EnablePurgeProtection = enablePurgeProtection; + CreateMode = createMode; + StatusMessage = statusMessage; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Azure Active Directory tenant ID that should be + /// used for authenticating requests to the managed HSM pool. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid? TenantId { get; set; } + + /// + /// Gets or sets the security domain id that should be used for + /// restoring data from this managed HSM pool to a new managed hsm + /// pool. + /// + [JsonProperty(PropertyName = "securityDomainId")] + public System.Guid? SecurityDomainId { get; set; } + + /// + /// Gets or sets array of initial administrators object ids for this + /// managed hsm pool. + /// + [JsonProperty(PropertyName = "initialAdminObjectIds")] + public IList InitialAdminObjectIds { get; set; } + + /// + /// Gets or sets the URI of the managed hsm pool for performing + /// operations on keys. + /// + [JsonProperty(PropertyName = "hsmPoolUri")] + public string HsmPoolUri { get; set; } + + /// + /// Gets or sets property to specify whether the 'soft delete' + /// functionality is enabled for this managed HSM pool. If it's not set + /// to any value(true or false) when creating new managed HSM pool, it + /// will be set to true by default. Once set to true, it cannot be + /// reverted to false. + /// + [JsonProperty(PropertyName = "enableSoftDelete")] + public bool? EnableSoftDelete { get; set; } + + /// + /// Gets or sets softDelete data retention days. It accepts &gt;=7 + /// and &lt;=90. + /// + [JsonProperty(PropertyName = "softDeleteRetentionInDays")] + public int? SoftDeleteRetentionInDays { get; set; } + + /// + /// Gets or sets property specifying whether protection against purge + /// is enabled for this managed HSM pool. Setting this property to true + /// activates protection against purge for this managed HSM pool and + /// its content - only the Managed HSM service may initiate a hard, + /// irrecoverable deletion. The setting is effective only if soft + /// delete is also enabled. Enabling this functionality is + /// irreversible. + /// + [JsonProperty(PropertyName = "enablePurgeProtection")] + public bool? EnablePurgeProtection { get; set; } + + /// + /// Gets or sets the create mode to indicate whether the resource is + /// being created or is being recovered from a deleted resource. + /// Possible values include: 'recover', 'default' + /// + [JsonProperty(PropertyName = "createMode")] + public CreateMode? CreateMode { get; set; } + + /// + /// Gets resource Status Message. + /// + [JsonProperty(PropertyName = "statusMessage")] + public string StatusMessage { get; private set; } + + /// + /// Gets provisioning state. Possible values include: 'Succeeded', + /// 'Provisioning', 'Failed', 'Updating', 'Deleting', 'Activated', + /// 'SecurityDomainRestore', 'Restoring' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmResource.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmResource.cs new file mode 100644 index 0000000000000..5d65eecafb53b --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmResource.cs @@ -0,0 +1,113 @@ +// +// 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; + + /// + /// Managed HSM resource + /// + public partial class ManagedHsmResource : IResource + { + /// + /// Initializes a new instance of the ManagedHsmResource class. + /// + public ManagedHsmResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedHsmResource class. + /// + /// The Azure Resource Manager resource ID for the + /// managed HSM Pool. + /// The name of the managed HSM Pool. + /// The resource type of the managed HSM + /// Pool. + /// The supported Azure location where the + /// managed HSM Pool should be created. + /// SKU details + /// Resource tags + public ManagedHsmResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), ManagedHsmSku sku = default(ManagedHsmSku), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Sku = sku; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Azure Resource Manager resource ID for the managed HSM + /// Pool. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the managed HSM Pool. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type of the managed HSM Pool. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the supported Azure location where the managed HSM + /// Pool should be created. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets SKU details + /// + [JsonProperty(PropertyName = "sku")] + public ManagedHsmSku Sku { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sku != null) + { + Sku.Validate(); + } + } + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmSku.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmSku.cs new file mode 100644 index 0000000000000..ee026d520adbb --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmSku.cs @@ -0,0 +1,75 @@ +// +// 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; + + /// + /// SKU details + /// + public partial class ManagedHsmSku + { + /// + /// Initializes a new instance of the ManagedHsmSku class. + /// + public ManagedHsmSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedHsmSku class. + /// + /// SKU of the managed HSM Pool. Possible values + /// include: 'Standard_B1', 'Custom_B32' + public ManagedHsmSku(ManagedHsmSkuName name) + { + Name = name; + CustomInit(); + } + /// + /// Static constructor for ManagedHsmSku class. + /// + static ManagedHsmSku() + { + Family = "B"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets SKU of the managed HSM Pool. Possible values include: + /// 'Standard_B1', 'Custom_B32' + /// + [JsonProperty(PropertyName = "name")] + public ManagedHsmSkuName Name { get; set; } + + /// + /// SKU Family of the managed HSM Pool + /// + [JsonProperty(PropertyName = "family")] + public static string Family { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmSkuName.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmSkuName.cs new file mode 100644 index 0000000000000..a7443c2cebf84 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmSkuName.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 Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ManagedHsmSkuName. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ManagedHsmSkuName + { + [EnumMember(Value = "Standard_B1")] + StandardB1, + [EnumMember(Value = "Custom_B32")] + CustomB32 + } + internal static class ManagedHsmSkuNameEnumExtension + { + internal static string ToSerializedValue(this ManagedHsmSkuName? value) + { + return value == null ? null : ((ManagedHsmSkuName)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ManagedHsmSkuName value) + { + switch( value ) + { + case ManagedHsmSkuName.StandardB1: + return "Standard_B1"; + case ManagedHsmSkuName.CustomB32: + return "Custom_B32"; + } + return null; + } + + internal static ManagedHsmSkuName? ParseManagedHsmSkuName(this string value) + { + switch( value ) + { + case "Standard_B1": + return ManagedHsmSkuName.StandardB1; + case "Custom_B32": + return ManagedHsmSkuName.CustomB32; + } + return null; + } + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ProvisioningState.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..9bbe9c85523d1 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,53 @@ +// +// 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 ProvisioningState. + /// + public static class ProvisioningState + { + /// + /// The managed HSM Pool has been full provisioned. + /// + public const string Succeeded = "Succeeded"; + /// + /// The managed HSM Pool is currently being provisioned. + /// + public const string Provisioning = "Provisioning"; + /// + /// Provisioning of the managed HSM Pool has failed. + /// + public const string Failed = "Failed"; + /// + /// The managed HSM Pool is currently being updated. + /// + public const string Updating = "Updating"; + /// + /// The managed HSM Pool is currently being deleted. + /// + public const string Deleting = "Deleting"; + /// + /// The managed HSM pool is ready for normal use. + /// + public const string Activated = "Activated"; + /// + /// The managed HSM pool is waiting for a security domain restore + /// action. + /// + public const string SecurityDomainRestore = "SecurityDomainRestore"; + /// + /// The managed HSM pool is being restored from full HSM backup. + /// + public const string Restoring = "Restoring"; + } +} From 1188851d7912487196c3f670e3f56a52263a7e03 Mon Sep 17 00:00:00 2001 From: Yeming Liu Date: Fri, 24 Jul 2020 14:52:27 +0800 Subject: [PATCH 3/8] exclude from test --- .../tests/Microsoft.Azure.Management.KeyVault.Tests.csproj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/tests/Microsoft.Azure.Management.KeyVault.Tests.csproj b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/tests/Microsoft.Azure.Management.KeyVault.Tests.csproj index 20c7490dca96c..bbfb05f0f0e5b 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/tests/Microsoft.Azure.Management.KeyVault.Tests.csproj +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/tests/Microsoft.Azure.Management.KeyVault.Tests.csproj @@ -5,7 +5,8 @@ KeyVault.Tests Class Library 1.0.0 Microsoft Corporation - KeyVaultManagement.Tests + KeyVaultManagement.Tests + True @@ -13,7 +14,7 @@ - + PreserveNewest From ae93649487ac1035a0bab14a3ac58d9018e88d2c Mon Sep 17 00:00:00 2001 From: Yeming Liu Date: Mon, 10 Aug 2020 12:46:33 +0800 Subject: [PATCH 4/8] mhsm3 --- .../Generated/IKeyVaultManagementClient.cs | 5 - .../src/Generated/KeyVaultManagementClient.cs | 6 - .../src/Generated/ManagedHsmsOperations.cs | 60 ++++------ .../src/Generated/Operations.cs | 16 +-- .../PrivateEndpointConnectionsOperations.cs | 30 ++--- .../PrivateLinkResourcesOperations.cs | 10 +- .../SdkInfo_KeyVaultManagementClient.cs | 10 +- .../src/Generated/VaultsOperations.cs | 110 +++++++----------- 8 files changed, 93 insertions(+), 154 deletions(-) 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 dd040c46597c0..f3de174aee621 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs @@ -48,11 +48,6 @@ public partial interface IKeyVaultManagementClient : System.IDisposable /// string SubscriptionId { get; set; } - /// - /// Client Api Version. - /// - string ApiVersion { get; } - /// /// The preferred language for the response. /// 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 a072ab5544e18..5445b99956e7e 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs @@ -54,11 +54,6 @@ 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. /// @@ -349,7 +344,6 @@ private void Initialize() Operations = new Operations(this); ManagedHsms = new ManagedHsmsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-04-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs index 7f303c89cc95a..77d3d9ac9e81d 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs @@ -162,14 +162,11 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - 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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -179,6 +176,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -189,9 +187,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -350,14 +348,11 @@ internal ManagedHsmsOperations(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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -367,6 +362,7 @@ internal ManagedHsmsOperations(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); } @@ -380,9 +376,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -534,14 +530,11 @@ internal ManagedHsmsOperations(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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -550,6 +543,7 @@ internal ManagedHsmsOperations(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); } @@ -562,9 +556,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -736,10 +730,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) throw new ValidationException(ValidationRules.Pattern, "name", "^[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"); @@ -752,6 +742,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -761,6 +752,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); @@ -772,9 +764,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -970,10 +962,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) throw new ValidationException(ValidationRules.Pattern, "name", "^[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"); @@ -982,6 +970,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -991,6 +980,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); @@ -1002,9 +992,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1187,14 +1177,11 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - 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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1204,6 +1191,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1214,9 +1202,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { 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 c7f6e2a12097f..e6a9bb02727cf 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs @@ -65,21 +65,12 @@ 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)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -87,6 +78,7 @@ 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); } @@ -94,9 +86,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 e064090a5b662..970a8e9528b01 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -109,10 +109,7 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -123,6 +120,7 @@ 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); } @@ -134,9 +132,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -325,14 +323,11 @@ 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; @@ -343,6 +338,7 @@ 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); @@ -355,9 +351,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -588,10 +584,7 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -602,6 +595,7 @@ 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); } @@ -613,9 +607,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 b1bde0a13752d..fea7442aebbf9 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs @@ -101,10 +101,7 @@ internal PrivateLinkResourcesOperations(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"); - } + string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -114,6 +111,7 @@ 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); } @@ -124,9 +122,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 3f8e2aaf5e30c..82ea52f2c007e 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 @@ -20,11 +20,11 @@ public static IEnumerable> ApiInfo_KeyVaultManagem return new Tuple[] { new Tuple("KeyVault", "ManagedHsms", "2020-04-01-preview"), - new Tuple("KeyVault", "Operations", "2020-04-01-preview"), - new Tuple("KeyVault", "PrivateEndpointConnections", "2020-04-01-preview"), - new Tuple("KeyVault", "PrivateLinkResources", "2020-04-01-preview"), - new Tuple("KeyVault", "Vaults", "2020-04-01-preview"), - new Tuple("KeyVaultManagementClient", "Vaults", "2020-04-01-preview"), + new Tuple("KeyVault", "Operations", "2019-09-01"), + new Tuple("KeyVault", "PrivateEndpointConnections", "2019-09-01"), + new Tuple("KeyVault", "PrivateLinkResources", "2019-09-01"), + new Tuple("KeyVault", "Vaults", "2019-09-01"), + new Tuple("KeyVaultManagementClient", "Vaults", "2019-09-01"), }.AsEnumerable(); } } 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 175587fccdb5e..bdbf8d3071695 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs @@ -125,10 +125,6 @@ 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"); @@ -137,6 +133,7 @@ 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; @@ -146,6 +143,7 @@ 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); @@ -157,9 +155,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -347,14 +345,11 @@ 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; @@ -364,6 +359,7 @@ 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); } @@ -374,9 +370,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -525,14 +521,11 @@ 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; @@ -542,6 +535,7 @@ 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); } @@ -552,9 +546,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -734,10 +728,6 @@ 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"); @@ -750,6 +740,7 @@ 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; @@ -760,6 +751,7 @@ 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); @@ -772,9 +764,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -962,14 +954,11 @@ 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; @@ -979,6 +968,7 @@ 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); } @@ -992,9 +982,9 @@ internal VaultsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1151,14 +1141,11 @@ 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; @@ -1167,6 +1154,7 @@ 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); } @@ -1179,9 +1167,9 @@ internal VaultsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1334,14 +1322,11 @@ 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; @@ -1349,6 +1334,7 @@ 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); } @@ -1357,9 +1343,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1526,14 +1512,11 @@ 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; @@ -1543,6 +1526,7 @@ 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); } @@ -1553,9 +1537,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1933,14 +1917,11 @@ 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; @@ -1949,6 +1930,7 @@ 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); } @@ -1957,9 +1939,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -2142,10 +2124,6 @@ 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"); @@ -2158,6 +2136,7 @@ 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; @@ -2167,6 +2146,7 @@ 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); @@ -2178,9 +2158,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -2369,14 +2349,11 @@ 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; @@ -2386,6 +2363,7 @@ 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); } @@ -2396,9 +2374,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { From 685a0b8d54fa3878ec8537310942bee7b92353a9 Mon Sep 17 00:00:00 2001 From: Yeming Liu Date: Mon, 10 Aug 2020 12:47:51 +0800 Subject: [PATCH 5/8] bump up version --- .../src/Microsoft.Azure.Management.KeyVault.csproj | 4 ++-- .../src/Properties/AssemblyInfo.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Microsoft.Azure.Management.KeyVault.csproj b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Microsoft.Azure.Management.KeyVault.csproj index 9f3259e2bdf7c..bf4a8113f894f 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Microsoft.Azure.Management.KeyVault.csproj +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Microsoft.Azure.Management.KeyVault.csproj @@ -11,11 +11,11 @@ Microsoft Azure Key Vault Management Microsoft.Azure.Management.KeyVault - 3.0.1 + 3.1.0-preview.1 Microsoft Azure key vault management;Key Vault; diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Properties/AssemblyInfo.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Properties/AssemblyInfo.cs index a43aeaf836d15..3d19fed1e9f68 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Properties/AssemblyInfo.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyDescription("Provides key vault management capabilities for Microsoft Azure.")] [assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.0.1.0")] +[assembly: AssemblyFileVersion("3.1.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")] From d2ae4b67e4a1e208ebf7364cc0f789f022a14fa2 Mon Sep 17 00:00:00 2001 From: Yeming Liu Date: Tue, 25 Aug 2020 10:17:43 +0800 Subject: [PATCH 6/8] all new api versions --- .../keyvault_resource-manager.txt | 10 +- .../Generated/IKeyVaultManagementClient.cs | 10 + .../src/Generated/ISecretsOperations.cs | 180 +++ .../src/Generated/KeyVaultManagementClient.cs | 12 + .../src/Generated/ManagedHsmsOperations.cs | 60 +- .../src/Generated/Models/Attributes.cs | 94 ++ .../Generated/Models/ManagedHsmProperties.cs | 14 +- .../src/Generated/Models/Secret.cs | 75 ++ .../src/Generated/Models/SecretAttributes.cs | 53 + .../Models/SecretCreateOrUpdateParameters.cs | 79 ++ .../Generated/Models/SecretPatchParameters.cs | 64 + .../Generated/Models/SecretPatchProperties.cs | 67 + .../src/Generated/Models/SecretProperties.cs | 91 ++ .../src/Generated/Operations.cs | 16 +- .../PrivateEndpointConnectionsOperations.cs | 30 +- .../PrivateLinkResourcesOperations.cs | 10 +- .../SdkInfo_KeyVaultManagementClient.cs | 22 +- .../src/Generated/SecretsOperations.cs | 1152 +++++++++++++++++ .../Generated/SecretsOperationsExtensions.cs | 275 ++++ .../src/Generated/VaultsOperations.cs | 110 +- 20 files changed, 2313 insertions(+), 111 deletions(-) create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ISecretsOperations.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Attributes.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Secret.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretAttributes.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchParameters.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchProperties.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretProperties.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperations.cs create mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperationsExtensions.cs diff --git a/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt b/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt index 417f9ba83d67a..670bea203fc60 100644 --- a/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt @@ -1,14 +1,14 @@ -Installing AutoRest version: 2.0.4413 +Installing AutoRest version: v2 AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/keyvault/resource-manager/readme.md --csharp --version=2.0.4413 --reflect-api-versions --csharp.output-folder=C:\Users\yeliu\isra-fel\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.Management.KeyVault\src\Generated -2020-03-24 07:45:59 UTC +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 --csharp.output-folder=C:\Users\yeliu\isra-fel\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.Management.KeyVault\src\Generated +2020-08-25 02:02:28 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: c9a1ed48c35572cf59cb5030e678a9d614684a7f +Commit: 94e9e121fa0af1abd6e7ec824844cfcd712fcba7 AutoRest information -Requested version: 2.0.4413 +Requested version: v2 Bootstrapper version: autorest@2.0.4413 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 f3de174aee621..af573d1e2c42f 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. /// @@ -87,6 +92,11 @@ public partial interface IKeyVaultManagementClient : System.IDisposable /// IOperations Operations { get; } + /// + /// Gets the ISecretsOperations. + /// + ISecretsOperations Secrets { get; } + /// /// Gets the IManagedHsmsOperations. /// diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ISecretsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ISecretsOperations.cs new file mode 100644 index 0000000000000..2ae6a0d839d52 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ISecretsOperations.cs @@ -0,0 +1,180 @@ +// +// 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; + + /// + /// SecretsOperations operations. + /// + public partial interface ISecretsOperations + { + /// + /// Create or update a secret in a key vault in the specified + /// subscription. NOTE: This API is intended for internal use in ARM + /// deployments. Users should use the data-plane REST service for + /// interaction with vault secrets. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// Name of the vault + /// + /// + /// Name of the secret + /// + /// + /// Parameters to create or update the secret + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string secretName, SecretCreateOrUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a secret in the specified subscription. NOTE: This API is + /// intended for internal use in ARM deployments. Users should use the + /// data-plane REST service for interaction with vault secrets. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// Name of the vault + /// + /// + /// Name of the secret + /// + /// + /// Parameters to patch the secret + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string secretName, SecretPatchParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified secret. NOTE: This API is intended for internal + /// use in ARM deployments. Users should use the data-plane REST + /// service for interaction with vault secrets. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// The name of the vault. + /// + /// + /// The name of the secret. + /// + /// + /// 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 secretName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The List operation gets information about the secrets in a vault. + /// NOTE: This API is intended for internal use in ARM deployments. + /// Users should use the data-plane REST service for interaction with + /// vault secrets. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// The name of the vault. + /// + /// + /// Maximum number of results to return. + /// + /// + /// 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, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The List operation gets information about the secrets in a vault. + /// NOTE: This API is intended for internal use in ARM deployments. + /// Users should use the data-plane REST service for interaction with + /// vault secrets. + /// + /// + /// 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)); + } +} 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 5445b99956e7e..b753490727796 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. /// @@ -92,6 +97,11 @@ public partial class KeyVaultManagementClient : ServiceClient public virtual IOperations Operations { get; private set; } + /// + /// Gets the ISecretsOperations. + /// + public virtual ISecretsOperations Secrets { get; private set; } + /// /// Gets the IManagedHsmsOperations. /// @@ -342,8 +352,10 @@ private void Initialize() PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); PrivateLinkResources = new PrivateLinkResourcesOperations(this); Operations = new Operations(this); + Secrets = new SecretsOperations(this); ManagedHsms = new ManagedHsmsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2020-04-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs index 77d3d9ac9e81d..7f303c89cc95a 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs @@ -162,11 +162,14 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } + 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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -176,7 +179,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -187,9 +189,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _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) { @@ -348,11 +350,14 @@ internal ManagedHsmsOperations(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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -362,7 +367,6 @@ internal ManagedHsmsOperations(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); } @@ -376,9 +380,9 @@ internal ManagedHsmsOperations(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) { @@ -530,11 +534,14 @@ internal ManagedHsmsOperations(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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -543,7 +550,6 @@ internal ManagedHsmsOperations(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); } @@ -556,9 +562,9 @@ internal ManagedHsmsOperations(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) { @@ -730,6 +736,10 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) throw new ValidationException(ValidationRules.Pattern, "name", "^[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"); @@ -742,7 +752,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -752,7 +761,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); @@ -764,9 +772,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _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) { @@ -962,6 +970,10 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) throw new ValidationException(ValidationRules.Pattern, "name", "^[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"); @@ -970,7 +982,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -980,7 +991,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); @@ -992,9 +1002,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _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) { @@ -1177,11 +1187,14 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } + 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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1191,7 +1204,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1202,9 +1214,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _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) { 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 0000000000000..f7dd2e39d1b56 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Attributes.cs @@ -0,0 +1,94 @@ +// +// 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.Linq; + + /// + /// The object attributes managed by the KeyVault 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 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. + public Attributes(bool? enabled = default(bool?), System.DateTime? notBefore = default(System.DateTime?), System.DateTime? expires = default(System.DateTime?), System.DateTime? created = default(System.DateTime?), System.DateTime? updated = default(System.DateTime?)) + { + Enabled = enabled; + NotBefore = notBefore; + Expires = expires; + Created = created; + Updated = updated; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets determines whether 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. + /// + [JsonConverter(typeof(UnixTimeJsonConverter))] + [JsonProperty(PropertyName = "nbf")] + public System.DateTime? NotBefore { get; set; } + + /// + /// Gets or sets expiry date in seconds since 1970-01-01T00:00:00Z. + /// + [JsonConverter(typeof(UnixTimeJsonConverter))] + [JsonProperty(PropertyName = "exp")] + public System.DateTime? Expires { get; set; } + + /// + /// Gets creation time in seconds since 1970-01-01T00:00:00Z. + /// + [JsonConverter(typeof(UnixTimeJsonConverter))] + [JsonProperty(PropertyName = "created")] + public System.DateTime? Created { get; private set; } + + /// + /// Gets last updated time in seconds since 1970-01-01T00:00:00Z. + /// + [JsonConverter(typeof(UnixTimeJsonConverter))] + [JsonProperty(PropertyName = "updated")] + public System.DateTime? Updated { get; private set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs index 6bd62776bc370..f3a0a3092e833 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/ManagedHsmProperties.cs @@ -34,9 +34,6 @@ public ManagedHsmProperties() /// The Azure Active Directory tenant ID that /// should be used for authenticating requests to the managed HSM /// pool. - /// The security domain id that should - /// be used for restoring data from this managed HSM pool to a new - /// managed hsm pool. /// Array of initial administrators /// object ids for this managed hsm pool. /// The URI of the managed hsm pool for @@ -63,10 +60,9 @@ public ManagedHsmProperties() /// include: 'Succeeded', 'Provisioning', 'Failed', 'Updating', /// 'Deleting', 'Activated', 'SecurityDomainRestore', /// 'Restoring' - public ManagedHsmProperties(System.Guid? tenantId = default(System.Guid?), System.Guid? securityDomainId = default(System.Guid?), IList initialAdminObjectIds = default(IList), string hsmPoolUri = default(string), bool? enableSoftDelete = default(bool?), int? softDeleteRetentionInDays = default(int?), bool? enablePurgeProtection = default(bool?), CreateMode? createMode = default(CreateMode?), string statusMessage = default(string), string provisioningState = default(string)) + public ManagedHsmProperties(System.Guid? tenantId = default(System.Guid?), IList initialAdminObjectIds = default(IList), string hsmPoolUri = default(string), bool? enableSoftDelete = default(bool?), int? softDeleteRetentionInDays = default(int?), bool? enablePurgeProtection = default(bool?), CreateMode? createMode = default(CreateMode?), string statusMessage = default(string), string provisioningState = default(string)) { TenantId = tenantId; - SecurityDomainId = securityDomainId; InitialAdminObjectIds = initialAdminObjectIds; HsmPoolUri = hsmPoolUri; EnableSoftDelete = enableSoftDelete; @@ -90,14 +86,6 @@ public ManagedHsmProperties() [JsonProperty(PropertyName = "tenantId")] public System.Guid? TenantId { get; set; } - /// - /// Gets or sets the security domain id that should be used for - /// restoring data from this managed HSM pool to a new managed hsm - /// pool. - /// - [JsonProperty(PropertyName = "securityDomainId")] - public System.Guid? SecurityDomainId { get; set; } - /// /// Gets or sets array of initial administrators object ids for this /// managed hsm pool. diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Secret.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Secret.cs new file mode 100644 index 0000000000000..18608bc439a86 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Secret.cs @@ -0,0 +1,75 @@ +// +// 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; + + /// + /// Resource information with extended details. + /// + public partial class Secret : Resource + { + /// + /// Initializes a new instance of the Secret class. + /// + public Secret() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Secret class. + /// + /// Properties of the secret + /// 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. + public Secret(SecretProperties properties, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type, location, tags) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the secret + /// + [JsonProperty(PropertyName = "properties")] + public SecretProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretAttributes.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretAttributes.cs new file mode 100644 index 0000000000000..1c825ad962011 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretAttributes.cs @@ -0,0 +1,53 @@ +// +// 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 secret management attributes. + /// + public partial class SecretAttributes : Attributes + { + /// + /// Initializes a new instance of the SecretAttributes class. + /// + public SecretAttributes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretAttributes class. + /// + /// Determines whether 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. + public SecretAttributes(bool? enabled = default(bool?), System.DateTime? notBefore = default(System.DateTime?), System.DateTime? expires = default(System.DateTime?), System.DateTime? created = default(System.DateTime?), System.DateTime? updated = default(System.DateTime?)) + : base(enabled, notBefore, expires, created, updated) + { + 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/SecretCreateOrUpdateParameters.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.cs new file mode 100644 index 0000000000000..3f2385209c1a2 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.cs @@ -0,0 +1,79 @@ +// +// 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; + + /// + /// Parameters for creating or updating a secret + /// + public partial class SecretCreateOrUpdateParameters : IResource + { + /// + /// Initializes a new instance of the SecretCreateOrUpdateParameters + /// class. + /// + public SecretCreateOrUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretCreateOrUpdateParameters + /// class. + /// + /// Properties of the secret + /// The tags that will be assigned to the secret. + /// + public SecretCreateOrUpdateParameters(SecretProperties 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 secret. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets properties of the secret + /// + [JsonProperty(PropertyName = "properties")] + public SecretProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + } + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchParameters.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchParameters.cs new file mode 100644 index 0000000000000..beb3463ce70f8 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchParameters.cs @@ -0,0 +1,64 @@ +// +// 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; + + /// + /// Parameters for patching a secret + /// + public partial class SecretPatchParameters : IResource + { + /// + /// Initializes a new instance of the SecretPatchParameters class. + /// + public SecretPatchParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretPatchParameters class. + /// + /// The tags that will be assigned to the secret. + /// + /// Properties of the secret + public SecretPatchParameters(IDictionary tags = default(IDictionary), SecretPatchProperties properties = default(SecretPatchProperties)) + { + 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 secret. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets properties of the secret + /// + [JsonProperty(PropertyName = "properties")] + public SecretPatchProperties Properties { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchProperties.cs new file mode 100644 index 0000000000000..d63bd3f1c41c3 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchProperties.cs @@ -0,0 +1,67 @@ +// +// 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; + + /// + /// Properties of the secret + /// + public partial class SecretPatchProperties + { + /// + /// Initializes a new instance of the SecretPatchProperties class. + /// + public SecretPatchProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretPatchProperties class. + /// + /// The value of the secret. + /// The content type of the secret. + /// The attributes of the secret. + public SecretPatchProperties(string value = default(string), string contentType = default(string), SecretAttributes attributes = default(SecretAttributes)) + { + Value = value; + ContentType = contentType; + Attributes = attributes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the value of the secret. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets the content type of the secret. + /// + [JsonProperty(PropertyName = "contentType")] + public string ContentType { get; set; } + + /// + /// Gets or sets the attributes of the secret. + /// + [JsonProperty(PropertyName = "attributes")] + public SecretAttributes Attributes { get; set; } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretProperties.cs new file mode 100644 index 0000000000000..fea7f564746a7 --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretProperties.cs @@ -0,0 +1,91 @@ +// +// 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; + + /// + /// Properties of the secret + /// + public partial class SecretProperties + { + /// + /// Initializes a new instance of the SecretProperties class. + /// + public SecretProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecretProperties class. + /// + /// The value of the secret. NOTE: 'value' will + /// never be returned from the service, as APIs using this model are is + /// intended for internal use in ARM deployments. Users should use the + /// data-plane REST service for interaction with vault secrets. + /// The content type of the secret. + /// The attributes of the secret. + /// The URI to retrieve the current version of + /// the secret. + /// The URI to retrieve the specific + /// version of the secret. + public SecretProperties(string value = default(string), string contentType = default(string), SecretAttributes attributes = default(SecretAttributes), string secretUri = default(string), string secretUriWithVersion = default(string)) + { + Value = value; + ContentType = contentType; + Attributes = attributes; + SecretUri = secretUri; + SecretUriWithVersion = secretUriWithVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the value of the secret. NOTE: 'value' will never be + /// returned from the service, as APIs using this model are is intended + /// for internal use in ARM deployments. Users should use the + /// data-plane REST service for interaction with vault secrets. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets the content type of the secret. + /// + [JsonProperty(PropertyName = "contentType")] + public string ContentType { get; set; } + + /// + /// Gets or sets the attributes of the secret. + /// + [JsonProperty(PropertyName = "attributes")] + public SecretAttributes Attributes { get; set; } + + /// + /// Gets the URI to retrieve the current version of the secret. + /// + [JsonProperty(PropertyName = "secretUri")] + public string SecretUri { get; private set; } + + /// + /// Gets the URI to retrieve the specific version of the secret. + /// + [JsonProperty(PropertyName = "secretUriWithVersion")] + public string SecretUriWithVersion { get; private set; } + + } +} 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 e6a9bb02727cf..c7f6e2a12097f 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 970a8e9528b01..e064090a5b662 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 fea7442aebbf9..b1bde0a13752d 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 82ea52f2c007e..f7b446d90c2a7 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 @@ -20,13 +20,25 @@ public static IEnumerable> ApiInfo_KeyVaultManagem return new Tuple[] { new Tuple("KeyVault", "ManagedHsms", "2020-04-01-preview"), - new Tuple("KeyVault", "Operations", "2019-09-01"), - new Tuple("KeyVault", "PrivateEndpointConnections", "2019-09-01"), - new Tuple("KeyVault", "PrivateLinkResources", "2019-09-01"), - new Tuple("KeyVault", "Vaults", "2019-09-01"), - new Tuple("KeyVaultManagementClient", "Vaults", "2019-09-01"), + new Tuple("KeyVault", "Operations", "2020-04-01-preview"), + new Tuple("KeyVault", "PrivateEndpointConnections", "2020-04-01-preview"), + new Tuple("KeyVault", "PrivateLinkResources", "2020-04-01-preview"), + new Tuple("KeyVault", "Secrets", "2020-04-01-preview"), + new Tuple("KeyVault", "Vaults", "2020-04-01-preview"), + new Tuple("KeyVaultManagementClient", "Vaults", "2020-04-01-preview"), }.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 --csharp.output-folder=C:\\Users\\yeliu\\isra-fel\\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 = "94e9e121fa0af1abd6e7ec824844cfcd712fcba7"; + 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/SecretsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperations.cs new file mode 100644 index 0000000000000..ac8319c087c4f --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperations.cs @@ -0,0 +1,1152 @@ +// +// 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; + + /// + /// SecretsOperations operations. + /// + internal partial class SecretsOperations : IServiceOperations, ISecretsOperations + { + /// + /// Initializes a new instance of the SecretsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SecretsOperations(KeyVaultManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the KeyVaultManagementClient + /// + public KeyVaultManagementClient Client { get; private set; } + + /// + /// Create or update a secret in a key vault in the specified subscription. + /// NOTE: This API is intended for internal use in ARM deployments. Users + /// should use the data-plane REST service for interaction with vault secrets. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// Name of the vault + /// + /// + /// Name of the secret + /// + /// + /// Parameters to create or update the secret + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string secretName, SecretCreateOrUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (secretName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretName"); + } + if (secretName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(secretName, "^[a-zA-Z0-9-]{1,127}$")) + { + throw new ValidationException(ValidationRules.Pattern, "secretName", "^[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(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // 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("secretName", secretName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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}/secrets/{secretName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{secretName}", System.Uri.EscapeDataString(secretName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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 && (int)_statusCode != 201) + { + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _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; + } + + /// + /// Update a secret in the specified subscription. NOTE: This API is intended + /// for internal use in ARM deployments. Users should use the data-plane REST + /// service for interaction with vault secrets. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// Name of the vault + /// + /// + /// Name of the secret + /// + /// + /// Parameters to patch the secret + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string secretName, SecretPatchParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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 (secretName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretName"); + } + if (secretName != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(secretName, "^[a-zA-Z0-9-]{1,127}$")) + { + throw new ValidationException(ValidationRules.Pattern, "secretName", "^[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 (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // 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("secretName", secretName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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}/secrets/{secretName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{secretName}", System.Uri.EscapeDataString(secretName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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("PATCH"); + _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 && (int)_statusCode != 201) + { + 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); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _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 secret. NOTE: This API is intended for internal use in + /// ARM deployments. Users should use the data-plane REST service for + /// interaction with vault secrets. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// The name of the vault. + /// + /// + /// The name of the secret. + /// + /// + /// 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 secretName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (secretName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "secretName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // 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("secretName", secretName); + 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}/secrets/{secretName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{secretName}", System.Uri.EscapeDataString(secretName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + 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; + } + + /// + /// The List operation gets information about the secrets in a vault. NOTE: + /// This API is intended for internal use in ARM deployments. Users should use + /// the data-plane REST service for interaction with vault secrets. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// The name of the vault. + /// + /// + /// Maximum number of results to return. + /// + /// + /// 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, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + 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"); + } + // 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("top", top); + 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}/secrets").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// The List operation gets information about the secrets in a vault. NOTE: + /// This API is intended for internal use in ARM deployments. Users should use + /// the data-plane REST service for interaction with vault secrets. + /// + /// + /// 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; + } + + } +} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperationsExtensions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperationsExtensions.cs new file mode 100644 index 0000000000000..c3bcb9af20cbd --- /dev/null +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperationsExtensions.cs @@ -0,0 +1,275 @@ +// +// 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 SecretsOperations. + /// + public static partial class SecretsOperationsExtensions + { + /// + /// Create or update a secret in a key vault in the specified subscription. + /// NOTE: This API is intended for internal use in ARM deployments. Users + /// should use the data-plane REST service for interaction with vault secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// Name of the vault + /// + /// + /// Name of the secret + /// + /// + /// Parameters to create or update the secret + /// + public static Secret CreateOrUpdate(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName, SecretCreateOrUpdateParameters parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, vaultName, secretName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update a secret in a key vault in the specified subscription. + /// NOTE: This API is intended for internal use in ARM deployments. Users + /// should use the data-plane REST service for interaction with vault secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// Name of the vault + /// + /// + /// Name of the secret + /// + /// + /// Parameters to create or update the secret + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName, SecretCreateOrUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, secretName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a secret in the specified subscription. NOTE: This API is intended + /// for internal use in ARM deployments. Users should use the data-plane REST + /// service for interaction with vault secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// Name of the vault + /// + /// + /// Name of the secret + /// + /// + /// Parameters to patch the secret + /// + public static Secret Update(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName, SecretPatchParameters parameters) + { + return operations.UpdateAsync(resourceGroupName, vaultName, secretName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update a secret in the specified subscription. NOTE: This API is intended + /// for internal use in ARM deployments. Users should use the data-plane REST + /// service for interaction with vault secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// Name of the vault + /// + /// + /// Name of the secret + /// + /// + /// Parameters to patch the secret + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName, SecretPatchParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vaultName, secretName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the specified secret. NOTE: This API is intended for internal use in + /// ARM deployments. Users should use the data-plane REST service for + /// interaction with vault secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// The name of the vault. + /// + /// + /// The name of the secret. + /// + public static Secret Get(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName) + { + return operations.GetAsync(resourceGroupName, vaultName, secretName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified secret. NOTE: This API is intended for internal use in + /// ARM deployments. Users should use the data-plane REST service for + /// interaction with vault secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// The name of the vault. + /// + /// + /// The name of the secret. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, secretName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The List operation gets information about the secrets in a vault. NOTE: + /// This API is intended for internal use in ARM deployments. Users should use + /// the data-plane REST service for interaction with vault secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// The name of the vault. + /// + /// + /// Maximum number of results to return. + /// + public static IPage List(this ISecretsOperations operations, string resourceGroupName, string vaultName, int? top = default(int?)) + { + return operations.ListAsync(resourceGroupName, vaultName, top).GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the secrets in a vault. NOTE: + /// This API is intended for internal use in ARM deployments. Users should use + /// the data-plane REST service for interaction with vault secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Resource Group to which the vault belongs. + /// + /// + /// The name of the vault. + /// + /// + /// Maximum number of results to return. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISecretsOperations operations, string resourceGroupName, string vaultName, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vaultName, top, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The List operation gets information about the secrets in a vault. NOTE: + /// This API is intended for internal use in ARM deployments. Users should use + /// the data-plane REST service for interaction with vault secrets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISecretsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// The List operation gets information about the secrets in a vault. NOTE: + /// This API is intended for internal use in ARM deployments. Users should use + /// the data-plane REST service for interaction with vault secrets. + /// + /// + /// 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 ISecretsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} 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 bdbf8d3071695..175587fccdb5e 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) { From d2d6ab3bd226fb9c1c2b05c389c72f8312e1e2f1 Mon Sep 17 00:00:00 2001 From: Yeming Liu Date: Tue, 25 Aug 2020 15:45:40 +0800 Subject: [PATCH 7/8] generate from merged spec --- .../keyvault_resource-manager.txt | 4 +- .../AzSdk.RP.props | 2 +- .../Generated/IKeyVaultManagementClient.cs | 10 - .../src/Generated/ISecretsOperations.cs | 180 --- .../src/Generated/KeyVaultManagementClient.cs | 12 - .../src/Generated/ManagedHsmsOperations.cs | 60 +- .../src/Generated/Models/Attributes.cs | 94 -- .../src/Generated/Models/Secret.cs | 75 -- .../src/Generated/Models/SecretAttributes.cs | 53 - .../Models/SecretCreateOrUpdateParameters.cs | 79 -- .../Generated/Models/SecretPatchParameters.cs | 64 - .../Generated/Models/SecretPatchProperties.cs | 67 - .../src/Generated/Models/SecretProperties.cs | 91 -- .../src/Generated/Operations.cs | 16 +- .../PrivateEndpointConnectionsOperations.cs | 30 +- .../PrivateLinkResourcesOperations.cs | 10 +- .../SdkInfo_KeyVaultManagementClient.cs | 13 +- .../src/Generated/SecretsOperations.cs | 1152 ----------------- .../Generated/SecretsOperationsExtensions.cs | 275 ---- .../src/Generated/VaultsOperations.cs | 110 +- ...Microsoft.Azure.Management.KeyVault.csproj | 6 +- 21 files changed, 100 insertions(+), 2303 deletions(-) delete mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ISecretsOperations.cs delete mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Attributes.cs delete mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Secret.cs delete mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretAttributes.cs delete mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.cs delete mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchParameters.cs delete mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchProperties.cs delete mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretProperties.cs delete mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperations.cs delete mode 100644 sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperationsExtensions.cs diff --git a/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt b/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt index 670bea203fc60..c6cfdb64184ab 100644 --- a/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt @@ -4,11 +4,11 @@ Commencing code generation Generating CSharp code Executing AutoRest command 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 --csharp.output-folder=C:\Users\yeliu\isra-fel\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.Management.KeyVault\src\Generated -2020-08-25 02:02:28 UTC +2020-08-25 07:40:12 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 94e9e121fa0af1abd6e7ec824844cfcd712fcba7 +Commit: 122829cebe6e4177e9eb6ff349071d3e2034b0e7 AutoRest information Requested version: v2 Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/AzSdk.RP.props b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/AzSdk.RP.props index 54bffcb3f9f61..e6952d50565de 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/AzSdk.RP.props +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/AzSdk.RP.props @@ -1,7 +1,7 @@ - KeyVault_2019-09-01;KeyVaultManagementClient_2019-09-01; + KeyVault_2019-09-01;KeyVault_2020-04-01-preview;KeyVaultManagementClient_2019-09-01; $(PackageTags);$(CommonTags);$(AzureApiTag); \ No newline at end of file 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 af573d1e2c42f..f3de174aee621 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/IKeyVaultManagementClient.cs @@ -48,11 +48,6 @@ public partial interface IKeyVaultManagementClient : System.IDisposable /// string SubscriptionId { get; set; } - /// - /// Client Api Version. - /// - string ApiVersion { get; } - /// /// The preferred language for the response. /// @@ -92,11 +87,6 @@ public partial interface IKeyVaultManagementClient : System.IDisposable /// IOperations Operations { get; } - /// - /// Gets the ISecretsOperations. - /// - ISecretsOperations Secrets { get; } - /// /// Gets the IManagedHsmsOperations. /// diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ISecretsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ISecretsOperations.cs deleted file mode 100644 index 2ae6a0d839d52..0000000000000 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ISecretsOperations.cs +++ /dev/null @@ -1,180 +0,0 @@ -// -// 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; - - /// - /// SecretsOperations operations. - /// - public partial interface ISecretsOperations - { - /// - /// Create or update a secret in a key vault in the specified - /// subscription. NOTE: This API is intended for internal use in ARM - /// deployments. Users should use the data-plane REST service for - /// interaction with vault secrets. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// Name of the vault - /// - /// - /// Name of the secret - /// - /// - /// Parameters to create or update the secret - /// - /// - /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string secretName, SecretCreateOrUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update a secret in the specified subscription. NOTE: This API is - /// intended for internal use in ARM deployments. Users should use the - /// data-plane REST service for interaction with vault secrets. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// Name of the vault - /// - /// - /// Name of the secret - /// - /// - /// Parameters to patch the secret - /// - /// - /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string secretName, SecretPatchParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the specified secret. NOTE: This API is intended for internal - /// use in ARM deployments. Users should use the data-plane REST - /// service for interaction with vault secrets. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// The name of the vault. - /// - /// - /// The name of the secret. - /// - /// - /// 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 secretName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// The List operation gets information about the secrets in a vault. - /// NOTE: This API is intended for internal use in ARM deployments. - /// Users should use the data-plane REST service for interaction with - /// vault secrets. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// The name of the vault. - /// - /// - /// Maximum number of results to return. - /// - /// - /// 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, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// The List operation gets information about the secrets in a vault. - /// NOTE: This API is intended for internal use in ARM deployments. - /// Users should use the data-plane REST service for interaction with - /// vault secrets. - /// - /// - /// 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)); - } -} 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 b753490727796..5445b99956e7e 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/KeyVaultManagementClient.cs @@ -54,11 +54,6 @@ 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. /// @@ -97,11 +92,6 @@ public partial class KeyVaultManagementClient : ServiceClient public virtual IOperations Operations { get; private set; } - /// - /// Gets the ISecretsOperations. - /// - public virtual ISecretsOperations Secrets { get; private set; } - /// /// Gets the IManagedHsmsOperations. /// @@ -352,10 +342,8 @@ private void Initialize() PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); PrivateLinkResources = new PrivateLinkResourcesOperations(this); Operations = new Operations(this); - Secrets = new SecretsOperations(this); ManagedHsms = new ManagedHsmsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-04-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs index 7f303c89cc95a..77d3d9ac9e81d 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/ManagedHsmsOperations.cs @@ -162,14 +162,11 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - 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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -179,6 +176,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -189,9 +187,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -350,14 +348,11 @@ internal ManagedHsmsOperations(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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -367,6 +362,7 @@ internal ManagedHsmsOperations(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); } @@ -380,9 +376,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -534,14 +530,11 @@ internal ManagedHsmsOperations(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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -550,6 +543,7 @@ internal ManagedHsmsOperations(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); } @@ -562,9 +556,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -736,10 +730,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) throw new ValidationException(ValidationRules.Pattern, "name", "^[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"); @@ -752,6 +742,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -761,6 +752,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); @@ -772,9 +764,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -970,10 +962,6 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) throw new ValidationException(ValidationRules.Pattern, "name", "^[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"); @@ -982,6 +970,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + string apiVersion = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -991,6 +980,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); @@ -1002,9 +992,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1187,14 +1177,11 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - 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 = "2020-04-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1204,6 +1191,7 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("name", name); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1214,9 +1202,9 @@ internal ManagedHsmsOperations(KeyVaultManagementClient client) _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { 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 deleted file mode 100644 index f7dd2e39d1b56..0000000000000 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Attributes.cs +++ /dev/null @@ -1,94 +0,0 @@ -// -// 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.Linq; - - /// - /// The object attributes managed by the KeyVault 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 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. - public Attributes(bool? enabled = default(bool?), System.DateTime? notBefore = default(System.DateTime?), System.DateTime? expires = default(System.DateTime?), System.DateTime? created = default(System.DateTime?), System.DateTime? updated = default(System.DateTime?)) - { - Enabled = enabled; - NotBefore = notBefore; - Expires = expires; - Created = created; - Updated = updated; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets determines whether 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. - /// - [JsonConverter(typeof(UnixTimeJsonConverter))] - [JsonProperty(PropertyName = "nbf")] - public System.DateTime? NotBefore { get; set; } - - /// - /// Gets or sets expiry date in seconds since 1970-01-01T00:00:00Z. - /// - [JsonConverter(typeof(UnixTimeJsonConverter))] - [JsonProperty(PropertyName = "exp")] - public System.DateTime? Expires { get; set; } - - /// - /// Gets creation time in seconds since 1970-01-01T00:00:00Z. - /// - [JsonConverter(typeof(UnixTimeJsonConverter))] - [JsonProperty(PropertyName = "created")] - public System.DateTime? Created { get; private set; } - - /// - /// Gets last updated time in seconds since 1970-01-01T00:00:00Z. - /// - [JsonConverter(typeof(UnixTimeJsonConverter))] - [JsonProperty(PropertyName = "updated")] - public System.DateTime? Updated { get; private set; } - - } -} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Secret.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Secret.cs deleted file mode 100644 index 18608bc439a86..0000000000000 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/Secret.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// 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; - - /// - /// Resource information with extended details. - /// - public partial class Secret : Resource - { - /// - /// Initializes a new instance of the Secret class. - /// - public Secret() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Secret class. - /// - /// Properties of the secret - /// 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. - public Secret(SecretProperties properties, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) - : base(id, name, type, location, tags) - { - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets properties of the secret - /// - [JsonProperty(PropertyName = "properties")] - public SecretProperties Properties { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Properties == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); - } - } - } -} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretAttributes.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretAttributes.cs deleted file mode 100644 index 1c825ad962011..0000000000000 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretAttributes.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// 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 secret management attributes. - /// - public partial class SecretAttributes : Attributes - { - /// - /// Initializes a new instance of the SecretAttributes class. - /// - public SecretAttributes() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecretAttributes class. - /// - /// Determines whether 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. - public SecretAttributes(bool? enabled = default(bool?), System.DateTime? notBefore = default(System.DateTime?), System.DateTime? expires = default(System.DateTime?), System.DateTime? created = default(System.DateTime?), System.DateTime? updated = default(System.DateTime?)) - : base(enabled, notBefore, expires, created, updated) - { - 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/SecretCreateOrUpdateParameters.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.cs deleted file mode 100644 index 3f2385209c1a2..0000000000000 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretCreateOrUpdateParameters.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -// 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; - - /// - /// Parameters for creating or updating a secret - /// - public partial class SecretCreateOrUpdateParameters : IResource - { - /// - /// Initializes a new instance of the SecretCreateOrUpdateParameters - /// class. - /// - public SecretCreateOrUpdateParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecretCreateOrUpdateParameters - /// class. - /// - /// Properties of the secret - /// The tags that will be assigned to the secret. - /// - public SecretCreateOrUpdateParameters(SecretProperties 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 secret. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets or sets properties of the secret - /// - [JsonProperty(PropertyName = "properties")] - public SecretProperties Properties { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Properties == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); - } - } - } -} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchParameters.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchParameters.cs deleted file mode 100644 index beb3463ce70f8..0000000000000 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchParameters.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// 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; - - /// - /// Parameters for patching a secret - /// - public partial class SecretPatchParameters : IResource - { - /// - /// Initializes a new instance of the SecretPatchParameters class. - /// - public SecretPatchParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecretPatchParameters class. - /// - /// The tags that will be assigned to the secret. - /// - /// Properties of the secret - public SecretPatchParameters(IDictionary tags = default(IDictionary), SecretPatchProperties properties = default(SecretPatchProperties)) - { - 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 secret. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets or sets properties of the secret - /// - [JsonProperty(PropertyName = "properties")] - public SecretPatchProperties Properties { get; set; } - - } -} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchProperties.cs deleted file mode 100644 index d63bd3f1c41c3..0000000000000 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretPatchProperties.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// 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; - - /// - /// Properties of the secret - /// - public partial class SecretPatchProperties - { - /// - /// Initializes a new instance of the SecretPatchProperties class. - /// - public SecretPatchProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecretPatchProperties class. - /// - /// The value of the secret. - /// The content type of the secret. - /// The attributes of the secret. - public SecretPatchProperties(string value = default(string), string contentType = default(string), SecretAttributes attributes = default(SecretAttributes)) - { - Value = value; - ContentType = contentType; - Attributes = attributes; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the value of the secret. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Gets or sets the content type of the secret. - /// - [JsonProperty(PropertyName = "contentType")] - public string ContentType { get; set; } - - /// - /// Gets or sets the attributes of the secret. - /// - [JsonProperty(PropertyName = "attributes")] - public SecretAttributes Attributes { get; set; } - - } -} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretProperties.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretProperties.cs deleted file mode 100644 index fea7f564746a7..0000000000000 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Models/SecretProperties.cs +++ /dev/null @@ -1,91 +0,0 @@ -// -// 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; - - /// - /// Properties of the secret - /// - public partial class SecretProperties - { - /// - /// Initializes a new instance of the SecretProperties class. - /// - public SecretProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecretProperties class. - /// - /// The value of the secret. NOTE: 'value' will - /// never be returned from the service, as APIs using this model are is - /// intended for internal use in ARM deployments. Users should use the - /// data-plane REST service for interaction with vault secrets. - /// The content type of the secret. - /// The attributes of the secret. - /// The URI to retrieve the current version of - /// the secret. - /// The URI to retrieve the specific - /// version of the secret. - public SecretProperties(string value = default(string), string contentType = default(string), SecretAttributes attributes = default(SecretAttributes), string secretUri = default(string), string secretUriWithVersion = default(string)) - { - Value = value; - ContentType = contentType; - Attributes = attributes; - SecretUri = secretUri; - SecretUriWithVersion = secretUriWithVersion; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the value of the secret. NOTE: 'value' will never be - /// returned from the service, as APIs using this model are is intended - /// for internal use in ARM deployments. Users should use the - /// data-plane REST service for interaction with vault secrets. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Gets or sets the content type of the secret. - /// - [JsonProperty(PropertyName = "contentType")] - public string ContentType { get; set; } - - /// - /// Gets or sets the attributes of the secret. - /// - [JsonProperty(PropertyName = "attributes")] - public SecretAttributes Attributes { get; set; } - - /// - /// Gets the URI to retrieve the current version of the secret. - /// - [JsonProperty(PropertyName = "secretUri")] - public string SecretUri { get; private set; } - - /// - /// Gets the URI to retrieve the specific version of the secret. - /// - [JsonProperty(PropertyName = "secretUriWithVersion")] - public string SecretUriWithVersion { get; private set; } - - } -} 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 c7f6e2a12097f..e6a9bb02727cf 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/Operations.cs @@ -65,21 +65,12 @@ 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)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -87,6 +78,7 @@ 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); } @@ -94,9 +86,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 e064090a5b662..970a8e9528b01 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -109,10 +109,7 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -123,6 +120,7 @@ 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); } @@ -134,9 +132,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -325,14 +323,11 @@ 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; @@ -343,6 +338,7 @@ 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); @@ -355,9 +351,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -588,10 +584,7 @@ internal PrivateEndpointConnectionsOperations(KeyVaultManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -602,6 +595,7 @@ 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); } @@ -613,9 +607,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 b1bde0a13752d..fea7442aebbf9 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/PrivateLinkResourcesOperations.cs @@ -101,10 +101,7 @@ internal PrivateLinkResourcesOperations(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"); - } + string apiVersion = "2019-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -114,6 +111,7 @@ 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); } @@ -124,9 +122,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 f7b446d90c2a7..0af6c64bbca4c 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 @@ -20,12 +20,11 @@ public static IEnumerable> ApiInfo_KeyVaultManagem return new Tuple[] { new Tuple("KeyVault", "ManagedHsms", "2020-04-01-preview"), - new Tuple("KeyVault", "Operations", "2020-04-01-preview"), - new Tuple("KeyVault", "PrivateEndpointConnections", "2020-04-01-preview"), - new Tuple("KeyVault", "PrivateLinkResources", "2020-04-01-preview"), - new Tuple("KeyVault", "Secrets", "2020-04-01-preview"), - new Tuple("KeyVault", "Vaults", "2020-04-01-preview"), - new Tuple("KeyVaultManagementClient", "Vaults", "2020-04-01-preview"), + new Tuple("KeyVault", "Operations", "2019-09-01"), + new Tuple("KeyVault", "PrivateEndpointConnections", "2019-09-01"), + new Tuple("KeyVault", "PrivateLinkResources", "2019-09-01"), + new Tuple("KeyVault", "Vaults", "2019-09-01"), + new Tuple("KeyVaultManagementClient", "Vaults", "2019-09-01"), }.AsEnumerable(); } } @@ -35,7 +34,7 @@ public static IEnumerable> ApiInfo_KeyVaultManagem 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 --csharp.output-folder=C:\\Users\\yeliu\\isra-fel\\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 = "94e9e121fa0af1abd6e7ec824844cfcd712fcba7"; + public static readonly String GithubCommidId = "122829cebe6e4177e9eb6ff349071d3e2034b0e7"; 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/SecretsOperations.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperations.cs deleted file mode 100644 index ac8319c087c4f..0000000000000 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperations.cs +++ /dev/null @@ -1,1152 +0,0 @@ -// -// 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; - - /// - /// SecretsOperations operations. - /// - internal partial class SecretsOperations : IServiceOperations, ISecretsOperations - { - /// - /// Initializes a new instance of the SecretsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SecretsOperations(KeyVaultManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the KeyVaultManagementClient - /// - public KeyVaultManagementClient Client { get; private set; } - - /// - /// Create or update a secret in a key vault in the specified subscription. - /// NOTE: This API is intended for internal use in ARM deployments. Users - /// should use the data-plane REST service for interaction with vault secrets. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// Name of the vault - /// - /// - /// Name of the secret - /// - /// - /// Parameters to create or update the secret - /// - /// - /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string secretName, SecretCreateOrUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - 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 (secretName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "secretName"); - } - if (secretName != null) - { - if (!System.Text.RegularExpressions.Regex.IsMatch(secretName, "^[a-zA-Z0-9-]{1,127}$")) - { - throw new ValidationException(ValidationRules.Pattern, "secretName", "^[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(); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - // 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("secretName", secretName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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}/secrets/{secretName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); - _url = _url.Replace("{secretName}", System.Uri.EscapeDataString(secretName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - 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 && (int)_statusCode != 201) - { - 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); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _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; - } - - /// - /// Update a secret in the specified subscription. NOTE: This API is intended - /// for internal use in ARM deployments. Users should use the data-plane REST - /// service for interaction with vault secrets. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// Name of the vault - /// - /// - /// Name of the secret - /// - /// - /// Parameters to patch the secret - /// - /// - /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string vaultName, string secretName, SecretPatchParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - 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 (secretName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "secretName"); - } - if (secretName != null) - { - if (!System.Text.RegularExpressions.Regex.IsMatch(secretName, "^[a-zA-Z0-9-]{1,127}$")) - { - throw new ValidationException(ValidationRules.Pattern, "secretName", "^[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 (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - // 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("secretName", secretName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", 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}/secrets/{secretName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); - _url = _url.Replace("{secretName}", System.Uri.EscapeDataString(secretName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - 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("PATCH"); - _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 && (int)_statusCode != 201) - { - 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); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _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 secret. NOTE: This API is intended for internal use in - /// ARM deployments. Users should use the data-plane REST service for - /// interaction with vault secrets. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// The name of the vault. - /// - /// - /// The name of the secret. - /// - /// - /// 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 secretName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (vaultName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); - } - if (secretName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "secretName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - // 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("secretName", secretName); - 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}/secrets/{secretName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); - _url = _url.Replace("{secretName}", System.Uri.EscapeDataString(secretName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - 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; - } - - /// - /// The List operation gets information about the secrets in a vault. NOTE: - /// This API is intended for internal use in ARM deployments. Users should use - /// the data-plane REST service for interaction with vault secrets. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// The name of the vault. - /// - /// - /// Maximum number of results to return. - /// - /// - /// 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, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (vaultName == null) - { - 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"); - } - // 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("top", top); - 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}/secrets").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - 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; - } - - /// - /// The List operation gets information about the secrets in a vault. NOTE: - /// This API is intended for internal use in ARM deployments. Users should use - /// the data-plane REST service for interaction with vault secrets. - /// - /// - /// 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; - } - - } -} diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperationsExtensions.cs b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperationsExtensions.cs deleted file mode 100644 index c3bcb9af20cbd..0000000000000 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/SecretsOperationsExtensions.cs +++ /dev/null @@ -1,275 +0,0 @@ -// -// 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 SecretsOperations. - /// - public static partial class SecretsOperationsExtensions - { - /// - /// Create or update a secret in a key vault in the specified subscription. - /// NOTE: This API is intended for internal use in ARM deployments. Users - /// should use the data-plane REST service for interaction with vault secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// Name of the vault - /// - /// - /// Name of the secret - /// - /// - /// Parameters to create or update the secret - /// - public static Secret CreateOrUpdate(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName, SecretCreateOrUpdateParameters parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, vaultName, secretName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Create or update a secret in a key vault in the specified subscription. - /// NOTE: This API is intended for internal use in ARM deployments. Users - /// should use the data-plane REST service for interaction with vault secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// Name of the vault - /// - /// - /// Name of the secret - /// - /// - /// Parameters to create or update the secret - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName, SecretCreateOrUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, vaultName, secretName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Update a secret in the specified subscription. NOTE: This API is intended - /// for internal use in ARM deployments. Users should use the data-plane REST - /// service for interaction with vault secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// Name of the vault - /// - /// - /// Name of the secret - /// - /// - /// Parameters to patch the secret - /// - public static Secret Update(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName, SecretPatchParameters parameters) - { - return operations.UpdateAsync(resourceGroupName, vaultName, secretName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Update a secret in the specified subscription. NOTE: This API is intended - /// for internal use in ARM deployments. Users should use the data-plane REST - /// service for interaction with vault secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// Name of the vault - /// - /// - /// Name of the secret - /// - /// - /// Parameters to patch the secret - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName, SecretPatchParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, vaultName, secretName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the specified secret. NOTE: This API is intended for internal use in - /// ARM deployments. Users should use the data-plane REST service for - /// interaction with vault secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// The name of the vault. - /// - /// - /// The name of the secret. - /// - public static Secret Get(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName) - { - return operations.GetAsync(resourceGroupName, vaultName, secretName).GetAwaiter().GetResult(); - } - - /// - /// Gets the specified secret. NOTE: This API is intended for internal use in - /// ARM deployments. Users should use the data-plane REST service for - /// interaction with vault secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// The name of the vault. - /// - /// - /// The name of the secret. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISecretsOperations operations, string resourceGroupName, string vaultName, string secretName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, secretName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// The List operation gets information about the secrets in a vault. NOTE: - /// This API is intended for internal use in ARM deployments. Users should use - /// the data-plane REST service for interaction with vault secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// The name of the vault. - /// - /// - /// Maximum number of results to return. - /// - public static IPage List(this ISecretsOperations operations, string resourceGroupName, string vaultName, int? top = default(int?)) - { - return operations.ListAsync(resourceGroupName, vaultName, top).GetAwaiter().GetResult(); - } - - /// - /// The List operation gets information about the secrets in a vault. NOTE: - /// This API is intended for internal use in ARM deployments. Users should use - /// the data-plane REST service for interaction with vault secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Resource Group to which the vault belongs. - /// - /// - /// The name of the vault. - /// - /// - /// Maximum number of results to return. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ISecretsOperations operations, string resourceGroupName, string vaultName, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vaultName, top, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// The List operation gets information about the secrets in a vault. NOTE: - /// This API is intended for internal use in ARM deployments. Users should use - /// the data-plane REST service for interaction with vault secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ISecretsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// The List operation gets information about the secrets in a vault. NOTE: - /// This API is intended for internal use in ARM deployments. Users should use - /// the data-plane REST service for interaction with vault secrets. - /// - /// - /// 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 ISecretsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} 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 175587fccdb5e..bdbf8d3071695 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Generated/VaultsOperations.cs @@ -125,10 +125,6 @@ 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"); @@ -137,6 +133,7 @@ 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; @@ -146,6 +143,7 @@ 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); @@ -157,9 +155,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -347,14 +345,11 @@ 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; @@ -364,6 +359,7 @@ 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); } @@ -374,9 +370,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -525,14 +521,11 @@ 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; @@ -542,6 +535,7 @@ 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); } @@ -552,9 +546,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -734,10 +728,6 @@ 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"); @@ -750,6 +740,7 @@ 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; @@ -760,6 +751,7 @@ 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); @@ -772,9 +764,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -962,14 +954,11 @@ 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; @@ -979,6 +968,7 @@ 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); } @@ -992,9 +982,9 @@ internal VaultsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1151,14 +1141,11 @@ 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; @@ -1167,6 +1154,7 @@ 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); } @@ -1179,9 +1167,9 @@ internal VaultsOperations(KeyVaultManagementClient client) { _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); } - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1334,14 +1322,11 @@ 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; @@ -1349,6 +1334,7 @@ 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); } @@ -1357,9 +1343,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1526,14 +1512,11 @@ 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; @@ -1543,6 +1526,7 @@ 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); } @@ -1553,9 +1537,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1933,14 +1917,11 @@ 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; @@ -1949,6 +1930,7 @@ 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); } @@ -1957,9 +1939,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -2142,10 +2124,6 @@ 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"); @@ -2158,6 +2136,7 @@ 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; @@ -2167,6 +2146,7 @@ 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); @@ -2178,9 +2158,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -2369,14 +2349,11 @@ 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; @@ -2386,6 +2363,7 @@ 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); } @@ -2396,9 +2374,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 (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Microsoft.Azure.Management.KeyVault.csproj b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Microsoft.Azure.Management.KeyVault.csproj index bf4a8113f894f..443a693991320 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Microsoft.Azure.Management.KeyVault.csproj +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/src/Microsoft.Azure.Management.KeyVault.csproj @@ -11,11 +11,11 @@ Microsoft Azure Key Vault Management Microsoft.Azure.Management.KeyVault - 3.1.0-preview.1 + 3.1.0 Microsoft Azure key vault management;Key Vault; - + From 20b0124854ebddc1e499066ab366de0aea64a627 Mon Sep 17 00:00:00 2001 From: Yeming Liu Date: Tue, 25 Aug 2020 16:01:03 +0800 Subject: [PATCH 8/8] include tests --- eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt | 2 +- .../tests/Microsoft.Azure.Management.KeyVault.Tests.csproj | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt b/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt index c6cfdb64184ab..ffba64259597a 100644 --- a/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/keyvault_resource-manager.txt @@ -4,7 +4,7 @@ Commencing code generation Generating CSharp code Executing AutoRest command 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 --csharp.output-folder=C:\Users\yeliu\isra-fel\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.Management.KeyVault\src\Generated -2020-08-25 07:40:12 UTC +2020-08-25 07:58:48 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master diff --git a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/tests/Microsoft.Azure.Management.KeyVault.Tests.csproj b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/tests/Microsoft.Azure.Management.KeyVault.Tests.csproj index bbfb05f0f0e5b..605face229049 100644 --- a/sdk/keyvault/Microsoft.Azure.Management.KeyVault/tests/Microsoft.Azure.Management.KeyVault.Tests.csproj +++ b/sdk/keyvault/Microsoft.Azure.Management.KeyVault/tests/Microsoft.Azure.Management.KeyVault.Tests.csproj @@ -6,7 +6,6 @@ 1.0.0 Microsoft Corporation KeyVaultManagement.Tests - True