From c2da275da96506936f27954c4f018ad7c2d69589 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 27 Nov 2020 06:39:58 +0000 Subject: [PATCH] CodeGen from PR 10962 in Azure/azure-rest-api-specs Merge fb51938e82c54fe038f7b7fdb912c2374e72e360 into a3d10d31bcda46c3d6c863288c3375a4f7b28786 --- ...repareDataMoveOperationResultOperations.cs | 10 +- ...ckupResourceEncryptionConfigsOperations.cs | 427 ++++++++++++++++++ ...ceEncryptionConfigsOperationsExtensions.cs | 112 +++++ ...repareDataMoveOperationResultOperations.cs | 4 +- ...ckupResourceEncryptionConfigsOperations.cs | 79 ++++ .../Generated/IRecoveryPointsOperations.cs | 39 -- .../IRecoveryServicesBackupClient.cs | 45 +- .../Models/BackupResourceEncryptionConfig.cs | 90 ++++ .../BackupResourceEncryptionConfigResource.cs | 63 +++ .../Generated/Models/EncryptionAtRestType.cs | 23 + .../src/Generated/Models/ErrorResponse.cs | 7 +- .../Models/InfrastructureEncryptionState.cs | 23 + .../src/Generated/Models/LastUpdateStatus.cs | 26 ++ .../src/Generated/RecoveryPointsOperations.cs | 232 ---------- .../RecoveryPointsOperationsExtensions.cs | 68 --- .../Generated/RecoveryServicesBackupClient.cs | 56 +-- .../SdkInfo_RecoveryServicesBackupClient.cs | 21 +- 17 files changed, 868 insertions(+), 457 deletions(-) create mode 100644 sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BackupResourceEncryptionConfigsOperations.cs create mode 100644 sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BackupResourceEncryptionConfigsOperationsExtensions.cs create mode 100644 sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IBackupResourceEncryptionConfigsOperations.cs create mode 100644 sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/BackupResourceEncryptionConfig.cs create mode 100644 sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/BackupResourceEncryptionConfigResource.cs create mode 100644 sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/EncryptionAtRestType.cs create mode 100644 sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/InfrastructureEncryptionState.cs create mode 100644 sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/LastUpdateStatus.cs diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BMSPrepareDataMoveOperationResultOperations.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BMSPrepareDataMoveOperationResultOperations.cs index fe73bc75cfda..5d3ebbf98aed 100644 --- a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BMSPrepareDataMoveOperationResultOperations.cs +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BMSPrepareDataMoveOperationResultOperations.cs @@ -84,7 +84,7 @@ internal BMSPrepareDataMoveOperationResultOperations(RecoveryServicesBackupClien /// /// A response object containing the response body and response headers. /// - public async Task> BeginGetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginGetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (vaultName == null) { @@ -217,7 +217,7 @@ internal BMSPrepareDataMoveOperationResultOperations(RecoveryServicesBackupClien throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -230,7 +230,7 @@ internal BMSPrepareDataMoveOperationResultOperations(RecoveryServicesBackupClien _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -249,9 +249,5 @@ internal BMSPrepareDataMoveOperationResultOperations(RecoveryServicesBackupClien return _result; } - public Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - throw new System.NotImplementedException(); - } } } diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BackupResourceEncryptionConfigsOperations.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BackupResourceEncryptionConfigsOperations.cs new file mode 100644 index 000000000000..b864c1d2d5d4 --- /dev/null +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BackupResourceEncryptionConfigsOperations.cs @@ -0,0 +1,427 @@ +// +// 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.RecoveryServices.Backup +{ + 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; + + /// + /// BackupResourceEncryptionConfigsOperations operations. + /// + internal partial class BackupResourceEncryptionConfigsOperations : IServiceOperations, IBackupResourceEncryptionConfigsOperations + { + /// + /// Initializes a new instance of the BackupResourceEncryptionConfigsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BackupResourceEncryptionConfigsOperations(RecoveryServicesBackupClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the RecoveryServicesBackupClient + /// + public RecoveryServicesBackupClient Client { get; private set; } + + /// + /// Fetches Vault Encryption config. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// 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 vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-10-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + 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.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig").ToString(); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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); + } + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new NewErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + NewErrorResponse _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; + } + + /// + /// Updates Vault encryption config. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// Vault encryption input config request + /// + /// + /// 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 UpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupResourceEncryptionConfigResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2020-10-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + 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.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig").ToString(); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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); + } + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new NewErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + NewErrorResponse _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; + } + + } +} diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BackupResourceEncryptionConfigsOperationsExtensions.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BackupResourceEncryptionConfigsOperationsExtensions.cs new file mode 100644 index 000000000000..305ec99c106b --- /dev/null +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/BackupResourceEncryptionConfigsOperationsExtensions.cs @@ -0,0 +1,112 @@ +// +// 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.RecoveryServices.Backup +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BackupResourceEncryptionConfigsOperations. + /// + public static partial class BackupResourceEncryptionConfigsOperationsExtensions + { + /// + /// Fetches Vault Encryption config. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + public static BackupResourceEncryptionConfigResource Get(this IBackupResourceEncryptionConfigsOperations operations, string vaultName, string resourceGroupName) + { + return operations.GetAsync(vaultName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Fetches Vault Encryption config. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBackupResourceEncryptionConfigsOperations operations, string vaultName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(vaultName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates Vault encryption config. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// Vault encryption input config request + /// + public static void Update(this IBackupResourceEncryptionConfigsOperations operations, string vaultName, string resourceGroupName, BackupResourceEncryptionConfigResource parameters) + { + operations.UpdateAsync(vaultName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates Vault encryption config. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// Vault encryption input config request + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IBackupResourceEncryptionConfigsOperations operations, string vaultName, string resourceGroupName, BackupResourceEncryptionConfigResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IBMSPrepareDataMoveOperationResultOperations.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IBMSPrepareDataMoveOperationResultOperations.cs index aab1f1057495..597163fcedb4 100644 --- a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IBMSPrepareDataMoveOperationResultOperations.cs +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IBMSPrepareDataMoveOperationResultOperations.cs @@ -50,7 +50,7 @@ public partial interface IBMSPrepareDataMoveOperationResultOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Fetches Operation Result for Prepare Data Move /// @@ -78,6 +78,6 @@ public partial interface IBMSPrepareDataMoveOperationResultOperations /// /// Thrown when a required parameter is null /// - Task> BeginGetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginGetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IBackupResourceEncryptionConfigsOperations.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IBackupResourceEncryptionConfigsOperations.cs new file mode 100644 index 000000000000..82b3e54592a0 --- /dev/null +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IBackupResourceEncryptionConfigsOperations.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.RecoveryServices.Backup +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BackupResourceEncryptionConfigsOperations operations. + /// + public partial interface IBackupResourceEncryptionConfigsOperations + { + /// + /// Fetches Vault Encryption config. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// 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 vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates Vault encryption config. + /// + /// + /// The name of the recovery services vault. + /// + /// + /// The name of the resource group where the recovery services vault is + /// present. + /// + /// + /// Vault encryption input config request + /// + /// + /// 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 UpdateWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupResourceEncryptionConfigResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IRecoveryPointsOperations.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IRecoveryPointsOperations.cs index d2aa94fe345d..2d6874694647 100644 --- a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IRecoveryPointsOperations.cs +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IRecoveryPointsOperations.cs @@ -104,45 +104,6 @@ public partial interface IRecoveryPointsOperations /// Task> GetWithHttpMessagesAsync(string vaultName, string resourceGroupName, string fabricName, string containerName, string protectedItemName, string recoveryPointId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns the Access token for communication between BMS and - /// Protection service - /// - /// - /// The name of the recovery services vault. - /// - /// - /// The name of the resource group where the recovery services vault is - /// present. - /// - /// - /// Fabric name associated with the container. - /// - /// - /// Name of the container. - /// - /// - /// Name of the Protected Item. - /// - /// - /// Recovery Point Id - /// - /// - /// 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> GetAccessTokenWithHttpMessagesAsync(string vaultName, string resourceGroupName, string fabricName, string containerName, string protectedItemName, string recoveryPointId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Lists the backup copies for the backed up item. /// /// diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IRecoveryServicesBackupClient.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IRecoveryServicesBackupClient.cs index 9d30c0f9a708..7e37e854fe21 100644 --- a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IRecoveryServicesBackupClient.cs +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/IRecoveryServicesBackupClient.cs @@ -68,6 +68,11 @@ public partial interface IRecoveryServicesBackupClient : System.IDisposable bool? GenerateClientRequestId { get; set; } + /// + /// Gets the IBackupResourceEncryptionConfigsOperations. + /// + IBackupResourceEncryptionConfigsOperations BackupResourceEncryptionConfigs { get; } + /// /// Gets the IBMSPrepareDataMoveOperationResultOperations. /// @@ -153,46 +158,6 @@ public partial interface IRecoveryServicesBackupClient : System.IDisposable /// IBackupProtectedItemsOperations BackupProtectedItems { get; } - /// - /// Gets the IAadPropertiesOperations. - /// - IAadPropertiesOperations AadProperties { get; } - - /// - /// Gets the ICrossRegionRestoreOperations. - /// - ICrossRegionRestoreOperations CrossRegionRestore { get; } - - /// - /// Gets the IBackupCrrJobDetailsOperations. - /// - IBackupCrrJobDetailsOperations BackupCrrJobDetails { get; } - - /// - /// Gets the IBackupCrrJobsOperations. - /// - IBackupCrrJobsOperations BackupCrrJobs { get; } - - /// - /// Gets the ICrrOperationResultsOperations. - /// - ICrrOperationResultsOperations CrrOperationResults { get; } - - /// - /// Gets the ICrrOperationStatusOperations. - /// - ICrrOperationStatusOperations CrrOperationStatus { get; } - - /// - /// Gets the IRecoveryPointsCrrOperations. - /// - IRecoveryPointsCrrOperations RecoveryPointsCrr { get; } - - /// - /// Gets the IBackupProtectedItemsCrrOperations. - /// - IBackupProtectedItemsCrrOperations BackupProtectedItemsCrr { get; } - /// /// Gets the IOperationOperations. /// diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/BackupResourceEncryptionConfig.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/BackupResourceEncryptionConfig.cs new file mode 100644 index 000000000000..af6f9d24d6cb --- /dev/null +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/BackupResourceEncryptionConfig.cs @@ -0,0 +1,90 @@ +// +// 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.RecoveryServices.Backup.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class BackupResourceEncryptionConfig + { + /// + /// Initializes a new instance of the BackupResourceEncryptionConfig + /// class. + /// + public BackupResourceEncryptionConfig() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupResourceEncryptionConfig + /// class. + /// + /// Encryption At Rest Type. + /// Possible values include: 'Invalid', 'MicrosoftManaged', + /// 'CustomerManaged' + /// Key Vault Key URI + /// Key Vault Subscription Id + /// Possible values include: 'Invalid', + /// 'NotEnabled', 'PartiallySucceeded', 'PartiallyFailed', 'Failed', + /// 'Succeeded' + /// Possible values + /// include: 'Invalid', 'Disabled', 'Enabled' + public BackupResourceEncryptionConfig(string encryptionAtRestType = default(string), string keyUri = default(string), string subscriptionId = default(string), string lastUpdateStatus = default(string), string infrastructureEncryptionState = default(string)) + { + EncryptionAtRestType = encryptionAtRestType; + KeyUri = keyUri; + SubscriptionId = subscriptionId; + LastUpdateStatus = lastUpdateStatus; + InfrastructureEncryptionState = infrastructureEncryptionState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets encryption At Rest Type. Possible values include: + /// 'Invalid', 'MicrosoftManaged', 'CustomerManaged' + /// + [JsonProperty(PropertyName = "encryptionAtRestType")] + public string EncryptionAtRestType { get; set; } + + /// + /// Gets or sets key Vault Key URI + /// + [JsonProperty(PropertyName = "keyUri")] + public string KeyUri { get; set; } + + /// + /// Gets or sets key Vault Subscription Id + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Gets or sets possible values include: 'Invalid', 'NotEnabled', + /// 'PartiallySucceeded', 'PartiallyFailed', 'Failed', 'Succeeded' + /// + [JsonProperty(PropertyName = "lastUpdateStatus")] + public string LastUpdateStatus { get; set; } + + /// + /// Gets or sets possible values include: 'Invalid', 'Disabled', + /// 'Enabled' + /// + [JsonProperty(PropertyName = "infrastructureEncryptionState")] + public string InfrastructureEncryptionState { get; set; } + + } +} diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/BackupResourceEncryptionConfigResource.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/BackupResourceEncryptionConfigResource.cs new file mode 100644 index 000000000000..01891ae7d091 --- /dev/null +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/BackupResourceEncryptionConfigResource.cs @@ -0,0 +1,63 @@ +// +// 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.RecoveryServices.Backup.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class BackupResourceEncryptionConfigResource : Resource + { + /// + /// Initializes a new instance of the + /// BackupResourceEncryptionConfigResource class. + /// + public BackupResourceEncryptionConfigResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BackupResourceEncryptionConfigResource class. + /// + /// Resource Id represents the complete path to the + /// resource. + /// Resource name associated with the + /// resource. + /// Resource type represents the complete path of + /// the form Namespace/ResourceType/ResourceType/... + /// Resource location. + /// Resource tags. + /// Optional ETag. + /// BackupResourceEncryptionConfigResource + /// properties + public BackupResourceEncryptionConfigResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string eTag = default(string), BackupResourceEncryptionConfig properties = default(BackupResourceEncryptionConfig)) + : base(id, name, type, location, tags, eTag) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets backupResourceEncryptionConfigResource properties + /// + [JsonProperty(PropertyName = "properties")] + public BackupResourceEncryptionConfig Properties { get; set; } + + } +} diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/EncryptionAtRestType.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/EncryptionAtRestType.cs new file mode 100644 index 000000000000..cf638c2e2f8c --- /dev/null +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/EncryptionAtRestType.cs @@ -0,0 +1,23 @@ +// +// 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.RecoveryServices.Backup.Models +{ + + /// + /// Defines values for EncryptionAtRestType. + /// + public static class EncryptionAtRestType + { + public const string Invalid = "Invalid"; + public const string MicrosoftManaged = "MicrosoftManaged"; + public const string CustomerManaged = "CustomerManaged"; + } +} diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/ErrorResponse.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/ErrorResponse.cs index fa75cf104bb3..838e8f530486 100644 --- a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/ErrorResponse.cs +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/ErrorResponse.cs @@ -16,8 +16,13 @@ namespace Microsoft.Azure.Management.RecoveryServices.Backup.Models using System.Linq; /// - /// The resource management error response. + /// Error Response /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.) + /// public partial class ErrorResponse { /// diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/InfrastructureEncryptionState.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/InfrastructureEncryptionState.cs new file mode 100644 index 000000000000..c065ffe67036 --- /dev/null +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/InfrastructureEncryptionState.cs @@ -0,0 +1,23 @@ +// +// 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.RecoveryServices.Backup.Models +{ + + /// + /// Defines values for InfrastructureEncryptionState. + /// + public static class InfrastructureEncryptionState + { + public const string Invalid = "Invalid"; + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; + } +} diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/LastUpdateStatus.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/LastUpdateStatus.cs new file mode 100644 index 000000000000..e40ea735eef2 --- /dev/null +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/Models/LastUpdateStatus.cs @@ -0,0 +1,26 @@ +// +// 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.RecoveryServices.Backup.Models +{ + + /// + /// Defines values for LastUpdateStatus. + /// + public static class LastUpdateStatus + { + public const string Invalid = "Invalid"; + public const string NotEnabled = "NotEnabled"; + public const string PartiallySucceeded = "PartiallySucceeded"; + public const string PartiallyFailed = "PartiallyFailed"; + public const string Failed = "Failed"; + public const string Succeeded = "Succeeded"; + } +} diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryPointsOperations.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryPointsOperations.cs index b3b6d724b958..633a2d828927 100644 --- a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryPointsOperations.cs +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryPointsOperations.cs @@ -519,238 +519,6 @@ internal RecoveryPointsOperations(RecoveryServicesBackupClient client) return _result; } - /// - /// Returns the Access token for communication between BMS and Protection - /// service - /// - /// - /// The name of the recovery services vault. - /// - /// - /// The name of the resource group where the recovery services vault is - /// present. - /// - /// - /// Fabric name associated with the container. - /// - /// - /// Name of the container. - /// - /// - /// Name of the Protected Item. - /// - /// - /// Recovery Point Id - /// - /// - /// 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> GetAccessTokenWithHttpMessagesAsync(string vaultName, string resourceGroupName, string fabricName, string containerName, string protectedItemName, string recoveryPointId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (vaultName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (fabricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "fabricName"); - } - if (containerName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "containerName"); - } - if (protectedItemName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "protectedItemName"); - } - if (recoveryPointId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "recoveryPointId"); - } - string apiVersion = "2018-12-20"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("vaultName", vaultName); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("fabricName", fabricName); - tracingParameters.Add("containerName", containerName); - tracingParameters.Add("protectedItemName", protectedItemName); - tracingParameters.Add("recoveryPointId", recoveryPointId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetAccessToken", 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.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken").ToString(); - _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{fabricName}", System.Uri.EscapeDataString(fabricName)); - _url = _url.Replace("{containerName}", System.Uri.EscapeDataString(containerName)); - _url = _url.Replace("{protectedItemName}", System.Uri.EscapeDataString(protectedItemName)); - _url = _url.Replace("{recoveryPointId}", System.Uri.EscapeDataString(recoveryPointId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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("POST"); - _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); - } - System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - /// /// Lists the backup copies for the backed up item. /// diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryPointsOperationsExtensions.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryPointsOperationsExtensions.cs index 6d93906ad872..e6ecbe1a9930 100644 --- a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryPointsOperationsExtensions.cs +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryPointsOperationsExtensions.cs @@ -160,74 +160,6 @@ public static RecoveryPointResource Get(this IRecoveryPointsOperations operation } } - /// - /// Returns the Access token for communication between BMS and Protection - /// service - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the recovery services vault. - /// - /// - /// The name of the resource group where the recovery services vault is - /// present. - /// - /// - /// Fabric name associated with the container. - /// - /// - /// Name of the container. - /// - /// - /// Name of the Protected Item. - /// - /// - /// Recovery Point Id - /// - public static CrrAccessTokenResource GetAccessToken(this IRecoveryPointsOperations operations, string vaultName, string resourceGroupName, string fabricName, string containerName, string protectedItemName, string recoveryPointId) - { - return operations.GetAccessTokenAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointId).GetAwaiter().GetResult(); - } - - /// - /// Returns the Access token for communication between BMS and Protection - /// service - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the recovery services vault. - /// - /// - /// The name of the resource group where the recovery services vault is - /// present. - /// - /// - /// Fabric name associated with the container. - /// - /// - /// Name of the container. - /// - /// - /// Name of the Protected Item. - /// - /// - /// Recovery Point Id - /// - /// - /// The cancellation token. - /// - public static async Task GetAccessTokenAsync(this IRecoveryPointsOperations operations, string vaultName, string resourceGroupName, string fabricName, string containerName, string protectedItemName, string recoveryPointId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetAccessTokenWithHttpMessagesAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Lists the backup copies for the backed up item. /// diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryServicesBackupClient.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryServicesBackupClient.cs index 785d8e6a5fde..21a10d44260d 100644 --- a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryServicesBackupClient.cs +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/RecoveryServicesBackupClient.cs @@ -71,6 +71,11 @@ public partial class RecoveryServicesBackupClient : ServiceClient public bool? GenerateClientRequestId { get; set; } + /// + /// Gets the IBackupResourceEncryptionConfigsOperations. + /// + public virtual IBackupResourceEncryptionConfigsOperations BackupResourceEncryptionConfigs { get; private set; } + /// /// Gets the IBMSPrepareDataMoveOperationResultOperations. /// @@ -161,46 +166,6 @@ public partial class RecoveryServicesBackupClient : ServiceClient public virtual IOperationOperations Operation { get; private set; } - /// - /// Gets the IAadPropertiesOperations. - /// - public virtual IAadPropertiesOperations AadProperties { get; private set; } - - /// - /// Gets the ICrossRegionRestoreOperations. - /// - public virtual ICrossRegionRestoreOperations CrossRegionRestore { get; private set; } - - /// - /// Gets the IBackupCrrJobDetailsOperations. - /// - public virtual IBackupCrrJobDetailsOperations BackupCrrJobDetails { get; private set; } - - /// - /// Gets the IBackupCrrJobsOperations. - /// - public virtual IBackupCrrJobsOperations BackupCrrJobs { get; private set; } - - /// - /// Gets the ICrrOperationResultsOperations. - /// - public virtual ICrrOperationResultsOperations CrrOperationResults { get; private set; } - - /// - /// Gets the ICrrOperationStatusOperations. - /// - public virtual ICrrOperationStatusOperations CrrOperationStatus { get; private set; } - - /// - /// Gets the IRecoveryPointsCrrOperations. - /// - public virtual IRecoveryPointsCrrOperations RecoveryPointsCrr { get; private set; } - - /// - /// Gets the IBackupProtectedItemsCrrOperations. - /// - public virtual IBackupProtectedItemsCrrOperations BackupProtectedItemsCrr { get; private set; } - /// /// Gets the IProtectionIntentOperations. /// @@ -552,6 +517,7 @@ public RecoveryServicesBackupClient(System.Uri baseUri, ServiceClientCredentials /// private void Initialize() { + BackupResourceEncryptionConfigs = new BackupResourceEncryptionConfigsOperations(this); BMSPrepareDataMoveOperationResult = new BMSPrepareDataMoveOperationResultOperations(this); PrivateEndpointConnection = new PrivateEndpointConnectionOperations(this); BackupResourceVaultConfigs = new BackupResourceVaultConfigsOperations(this); @@ -570,14 +536,6 @@ private void Initialize() Jobs = new JobsOperations(this); BackupProtectedItems = new BackupProtectedItemsOperations(this); Operation = new OperationOperations(this); - AadProperties = new AadPropertiesOperations(this); - CrossRegionRestore = new CrossRegionRestoreOperations(this); - BackupCrrJobDetails = new BackupCrrJobDetailsOperations(this); - BackupCrrJobs = new BackupCrrJobsOperations(this); - CrrOperationResults = new CrrOperationResultsOperations(this); - CrrOperationStatus = new CrrOperationStatusOperations(this); - RecoveryPointsCrr = new RecoveryPointsCrrOperations(this); - BackupProtectedItemsCrr = new BackupProtectedItemsCrrOperations(this); ProtectionIntent = new ProtectionIntentOperations(this); BackupStatus = new BackupStatusOperations(this); FeatureSupport = new FeatureSupportOperations(this); @@ -629,6 +587,8 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("objectType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("objectType")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("objectType")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("objectType")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("schedulePolicyType")); diff --git a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/SdkInfo_RecoveryServicesBackupClient.cs b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/SdkInfo_RecoveryServicesBackupClient.cs index c755417171e8..38d8fcffafcf 100644 --- a/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/SdkInfo_RecoveryServicesBackupClient.cs +++ b/sdk/recoveryservices-backup/Microsoft.Azure.Management.RecoveryServices.Backup/src/Generated/SdkInfo_RecoveryServicesBackupClient.cs @@ -19,9 +19,6 @@ public static IEnumerable> ApiInfo_RecoveryService { return new Tuple[] { - new Tuple("RecoveryServices", "AadProperties", "2018-12-20"), - new Tuple("RecoveryServices", "BackupCrrJobDetails", "2018-12-20"), - new Tuple("RecoveryServices", "BackupCrrJobs", "2018-12-20"), new Tuple("RecoveryServices", "BMSPrepareDataMove", "2020-07-01"), new Tuple("RecoveryServices", "BMSPrepareDataMoveOperationResult", "2020-07-01"), new Tuple("RecoveryServices", "BMSTriggerDataMove", "2020-07-01"), @@ -32,9 +29,9 @@ public static IEnumerable> ApiInfo_RecoveryService new Tuple("RecoveryServices", "BackupPolicies", "2019-06-15"), new Tuple("RecoveryServices", "BackupProtectableItems", "2016-12-01"), new Tuple("RecoveryServices", "BackupProtectedItems", "2019-06-15"), - new Tuple("RecoveryServices", "BackupProtectedItemsCrr", "2018-12-20"), new Tuple("RecoveryServices", "BackupProtectionContainers", "2016-12-01"), new Tuple("RecoveryServices", "BackupProtectionIntent", "2017-07-01"), + new Tuple("RecoveryServices", "BackupResourceEncryptionConfigs", "2020-10-01"), new Tuple("RecoveryServices", "BackupResourceStorageConfigs", "2016-12-01"), new Tuple("RecoveryServices", "BackupResourceVaultConfigs", "2019-06-15"), new Tuple("RecoveryServices", "BackupStatus", "2017-07-01"), @@ -42,9 +39,6 @@ public static IEnumerable> ApiInfo_RecoveryService new Tuple("RecoveryServices", "BackupWorkloadItems", "2016-12-01"), new Tuple("RecoveryServices", "Backups", "2016-12-01"), new Tuple("RecoveryServices", "ExportJobsOperationResults", "2019-06-15"), - new Tuple("RecoveryServices", "CrossRegionRestore", "2018-12-20"), - new Tuple("RecoveryServices", "CrrOperationResults", "2018-12-20"), - new Tuple("RecoveryServices", "CrrOperationStatus", "2018-12-20"), new Tuple("RecoveryServices", "FeatureSupport", "2017-07-01"), new Tuple("RecoveryServices", "GetOperationStatus", "2020-02-02"), new Tuple("RecoveryServices", "GetOperationStatus", "2020-07-01"), @@ -70,22 +64,9 @@ public static IEnumerable> ApiInfo_RecoveryService new Tuple("RecoveryServices", "ProtectionPolicyOperationStatuses", "2016-12-01"), new Tuple("RecoveryServices", "RecoveryPoints", "2019-06-15"), new Tuple("RecoveryServices", "Restores", "2019-06-15"), - new Tuple("RecoveryServices", "RecoveryPoints", "2018-12-20"), - new Tuple("RecoveryServices", "RecoveryPointsCrr", "2018-12-20"), new Tuple("RecoveryServices", "SecurityPINs", "2016-12-01"), }.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/recoveryservicesbackup/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-2020-07 --csharp-sdks-folder=C:\\SwaggerSDK\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "edecc359f7d4219a73bed5c7114f51754b7ef7db"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -