diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperations.cs new file mode 100644 index 0000000000000..c8c93a05244ba --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperations.cs @@ -0,0 +1,2405 @@ +// +// 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.DataProtection +{ + 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; + + /// + /// BackupInstancesOperations operations. + /// + internal partial class BackupInstancesOperations : IServiceOperations, IBackupInstancesOperations + { + /// + /// Initializes a new instance of the BackupInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BackupInstancesOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Gets a backup instances belonging to a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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>> GetBackupInstancesInVaultWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetBackupInstancesInVault", 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.DataProtection/backupVaults/{vaultName}/backupInstances").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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a backup instance with name in a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// 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, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("backupInstanceName", backupInstanceName); + 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}").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("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName)); + 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 name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PutWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginPutWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Trigger adhoc backup + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Name for the Rule of the Policy which needs to be applied for this backup + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> AdhocBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginAdhocBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, backupRuleOptions, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Validate whether adhoc backup will be successful or not + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ValidateForBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginValidateForBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstance, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// rehydrate recovery point for restore for a BackupInstance + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// Request body for operation + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> TriggerRehydrateWithHttpMessagesAsync(string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginTriggerRehydrateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, backupInstanceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Triggers restore for a BackupInstance + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> TriggerRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginTriggerRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Validates if Restore can be triggered for a DataSource + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Gets or sets the restore request object. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ValidateRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginValidateRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, restoreRequestObject, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for 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> BeginPutWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("backupInstanceName", backupInstanceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPut", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}").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("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName)); + 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; + } + + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// 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 vaultName, string resourceGroupName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("backupInstanceName", backupInstanceName); + 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}").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("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName)); + 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 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 AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Trigger adhoc backup + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Name for the Rule of the Policy which needs to be applied for this backup + /// + /// + /// 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> BeginAdhocBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName"); + } + if (backupRuleOptions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupRuleOptions"); + } + if (backupRuleOptions != null) + { + backupRuleOptions.Validate(); + } + TriggerBackupRequest parameters = new TriggerBackupRequest(); + if (backupRuleOptions != null) + { + parameters.BackupRuleOptions = backupRuleOptions; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("backupInstanceName", backupInstanceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginAdhocBackup", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup").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("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName)); + 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("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; + 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 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Validate whether adhoc backup will be successful or not + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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> BeginValidateForBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupInstance == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupInstance"); + } + if (backupInstance != null) + { + backupInstance.Validate(); + } + ValidateForBackupRequest parameters = new ValidateForBackupRequest(); + if (backupInstance != null) + { + parameters.BackupInstance = backupInstance; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginValidateForBackup", 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.DataProtection/backupVaults/{vaultName}/validateForBackup").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 (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("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; + 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 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// rehydrate recovery point for restore for a BackupInstance + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// Request body for operation + /// + /// + /// + /// + /// 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> BeginTriggerRehydrateWithHttpMessagesAsync(string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (backupInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName"); + } + // 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("parameters", parameters); + tracingParameters.Add("backupInstanceName", backupInstanceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginTriggerRehydrate", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName)); + 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("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; + 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 != 202 && (int)_statusCode != 204) + { + 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 AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Triggers restore for a BackupInstance + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for 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> BeginTriggerRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("backupInstanceName", backupInstanceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginTriggerRestore", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore").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("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName)); + 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("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; + 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 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Validates if Restore can be triggered for a DataSource + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Gets or sets the restore request object. + /// + /// + /// 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> BeginValidateRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName"); + } + if (restoreRequestObject == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "restoreRequestObject"); + } + if (restoreRequestObject != null) + { + restoreRequestObject.Validate(); + } + ValidateRestoreRequestObject parameters = new ValidateRestoreRequestObject(); + if (restoreRequestObject != null) + { + parameters.RestoreRequestObject = restoreRequestObject; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("backupInstanceName", backupInstanceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginValidateRestore", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore").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("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName)); + 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("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; + 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 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a backup instances belonging to a backup vault + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetBackupInstancesInVaultNextWithHttpMessagesAsync(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, "GetBackupInstancesInVaultNext", 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/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperationsExtensions.cs new file mode 100644 index 0000000000000..8f4f18022ba32 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupInstancesOperationsExtensions.cs @@ -0,0 +1,817 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BackupInstancesOperations. + /// + public static partial class BackupInstancesOperationsExtensions + { + /// + /// Gets a backup instances belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + public static IPage GetBackupInstancesInVault(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName) + { + return operations.GetBackupInstancesInVaultAsync(vaultName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a backup instances belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The cancellation token. + /// + public static async Task> GetBackupInstancesInVaultAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetBackupInstancesInVaultWithHttpMessagesAsync(vaultName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a backup instance with name in a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + public static BackupInstanceResource Get(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName) + { + return operations.GetAsync(vaultName, resourceGroupName, backupInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a backup instance with name in a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for operation + /// + public static BackupInstanceResource Put(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters) + { + return operations.PutAsync(vaultName, resourceGroupName, backupInstanceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for operation + /// + /// + /// The cancellation token. + /// + public static async Task PutAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + public static BackupInstancesDeleteHeaders Delete(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName) + { + return operations.DeleteAsync(vaultName, resourceGroupName, backupInstanceName).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Trigger adhoc backup + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Name for the Rule of the Policy which needs to be applied for this backup + /// + public static OperationJobExtendedInfo AdhocBackup(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions) + { + return operations.AdhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, backupRuleOptions).GetAwaiter().GetResult(); + } + + /// + /// Trigger adhoc backup + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Name for the Rule of the Policy which needs to be applied for this backup + /// + /// + /// The cancellation token. + /// + public static async Task AdhocBackupAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.AdhocBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, backupRuleOptions, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Validate whether adhoc backup will be successful or not + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + public static OperationJobExtendedInfo ValidateForBackup(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, BackupInstance backupInstance) + { + return operations.ValidateForBackupAsync(vaultName, resourceGroupName, backupInstance).GetAwaiter().GetResult(); + } + + /// + /// Validate whether adhoc backup will be successful or not + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task ValidateForBackupAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, BackupInstance backupInstance, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ValidateForBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstance, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// rehydrate recovery point for restore for a BackupInstance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// Request body for operation + /// + /// + /// + public static BackupInstancesTriggerRehydrateHeaders TriggerRehydrate(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName) + { + return operations.TriggerRehydrateAsync(resourceGroupName, vaultName, parameters, backupInstanceName).GetAwaiter().GetResult(); + } + + /// + /// rehydrate recovery point for restore for a BackupInstance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// Request body for operation + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task TriggerRehydrateAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.TriggerRehydrateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, backupInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Triggers restore for a BackupInstance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for operation + /// + public static OperationJobExtendedInfo TriggerRestore(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters) + { + return operations.TriggerRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Triggers restore for a BackupInstance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for operation + /// + /// + /// The cancellation token. + /// + public static async Task TriggerRestoreAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.TriggerRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Validates if Restore can be triggered for a DataSource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Gets or sets the restore request object. + /// + public static OperationJobExtendedInfo ValidateRestore(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject) + { + return operations.ValidateRestoreAsync(vaultName, resourceGroupName, backupInstanceName, restoreRequestObject).GetAwaiter().GetResult(); + } + + /// + /// Validates if Restore can be triggered for a DataSource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Gets or sets the restore request object. + /// + /// + /// The cancellation token. + /// + public static async Task ValidateRestoreAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ValidateRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, restoreRequestObject, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for operation + /// + public static BackupInstanceResource BeginPut(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters) + { + return operations.BeginPutAsync(vaultName, resourceGroupName, backupInstanceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginPutAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPutWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + public static BackupInstancesDeleteHeaders BeginDelete(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName) + { + return operations.BeginDeleteAsync(vaultName, resourceGroupName, backupInstanceName).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Trigger adhoc backup + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Name for the Rule of the Policy which needs to be applied for this backup + /// + public static OperationJobExtendedInfo BeginAdhocBackup(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions) + { + return operations.BeginAdhocBackupAsync(vaultName, resourceGroupName, backupInstanceName, backupRuleOptions).GetAwaiter().GetResult(); + } + + /// + /// Trigger adhoc backup + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Name for the Rule of the Policy which needs to be applied for this backup + /// + /// + /// The cancellation token. + /// + public static async Task BeginAdhocBackupAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginAdhocBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, backupRuleOptions, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Validate whether adhoc backup will be successful or not + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + public static OperationJobExtendedInfo BeginValidateForBackup(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, BackupInstance backupInstance) + { + return operations.BeginValidateForBackupAsync(vaultName, resourceGroupName, backupInstance).GetAwaiter().GetResult(); + } + + /// + /// Validate whether adhoc backup will be successful or not + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginValidateForBackupAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, BackupInstance backupInstance, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginValidateForBackupWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstance, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// rehydrate recovery point for restore for a BackupInstance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// Request body for operation + /// + /// + /// + public static BackupInstancesTriggerRehydrateHeaders BeginTriggerRehydrate(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName) + { + return operations.BeginTriggerRehydrateAsync(resourceGroupName, vaultName, parameters, backupInstanceName).GetAwaiter().GetResult(); + } + + /// + /// rehydrate recovery point for restore for a BackupInstance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// Request body for operation + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginTriggerRehydrateAsync(this IBackupInstancesOperations operations, string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginTriggerRehydrateWithHttpMessagesAsync(resourceGroupName, vaultName, parameters, backupInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Triggers restore for a BackupInstance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for operation + /// + public static OperationJobExtendedInfo BeginTriggerRestore(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters) + { + return operations.BeginTriggerRestoreAsync(vaultName, resourceGroupName, backupInstanceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Triggers restore for a BackupInstance + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginTriggerRestoreAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginTriggerRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Validates if Restore can be triggered for a DataSource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Gets or sets the restore request object. + /// + public static OperationJobExtendedInfo BeginValidateRestore(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject) + { + return operations.BeginValidateRestoreAsync(vaultName, resourceGroupName, backupInstanceName, restoreRequestObject).GetAwaiter().GetResult(); + } + + /// + /// Validates if Restore can be triggered for a DataSource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Gets or sets the restore request object. + /// + /// + /// The cancellation token. + /// + public static async Task BeginValidateRestoreAsync(this IBackupInstancesOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginValidateRestoreWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, restoreRequestObject, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a backup instances belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage GetBackupInstancesInVaultNext(this IBackupInstancesOperations operations, string nextPageLink) + { + return operations.GetBackupInstancesInVaultNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a backup instances belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> GetBackupInstancesInVaultNextAsync(this IBackupInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetBackupInstancesInVaultNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperations.cs new file mode 100644 index 0000000000000..911484a198ad9 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperations.cs @@ -0,0 +1,1035 @@ +// +// 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.DataProtection +{ + 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; + + /// + /// BackupPoliciesOperations operations. + /// + internal partial class BackupPoliciesOperations : IServiceOperations, IBackupPoliciesOperations + { + /// + /// Initializes a new instance of the BackupPoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BackupPoliciesOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Returns list of backup policies belonging to a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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>> ListWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + 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.DataProtection/backupVaults/{vaultName}/backupPolicies").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 (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a backup policy belonging to a backup vault + /// + /// + /// Gets a backup policy belonging to a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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, string backupPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupPolicyName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("backupPolicyName", backupPolicyName); + 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.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}").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("{backupPolicyName}", System.Uri.EscapeDataString(backupPolicyName)); + 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; + } + + /// + /// Creates or Updates a backup policy belonging to a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// Request body for 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> PutWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupPolicyName, BaseBackupPolicyResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupPolicyName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("backupPolicyName", backupPolicyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Put", 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.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}").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("{backupPolicyName}", System.Uri.EscapeDataString(backupPolicyName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a backup policy belonging to a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupPolicyName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("backupPolicyName", backupPolicyName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}").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("{backupPolicyName}", System.Uri.EscapeDataString(backupPolicyName)); + 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 != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns list of backup policies belonging to a backup vault + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperationsExtensions.cs new file mode 100644 index 0000000000000..6bf4e4743cd7a --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupPoliciesOperationsExtensions.cs @@ -0,0 +1,240 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BackupPoliciesOperations. + /// + public static partial class BackupPoliciesOperationsExtensions + { + /// + /// Returns list of backup policies belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + public static IPage List(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName) + { + return operations.ListAsync(vaultName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Returns list of backup policies belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(vaultName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a backup policy belonging to a backup vault + /// + /// + /// Gets a backup policy belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + public static BaseBackupPolicyResource Get(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName) + { + return operations.GetAsync(vaultName, resourceGroupName, backupPolicyName).GetAwaiter().GetResult(); + } + + /// + /// Gets a backup policy belonging to a backup vault + /// + /// + /// Gets a backup policy belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(vaultName, resourceGroupName, backupPolicyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or Updates a backup policy belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// Request body for operation + /// + public static BaseBackupPolicyResource Put(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName, BaseBackupPolicyResource parameters) + { + return operations.PutAsync(vaultName, resourceGroupName, backupPolicyName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or Updates a backup policy belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// Request body for operation + /// + /// + /// The cancellation token. + /// + public static async Task PutAsync(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName, BaseBackupPolicyResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(vaultName, resourceGroupName, backupPolicyName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a backup policy belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + public static void Delete(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName) + { + operations.DeleteAsync(vaultName, resourceGroupName, backupPolicyName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a backup policy belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBackupPoliciesOperations operations, string vaultName, string resourceGroupName, string backupPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(vaultName, resourceGroupName, backupPolicyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns list of backup policies belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IBackupPoliciesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Returns list of backup policies belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IBackupPoliciesOperations 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/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperations.cs new file mode 100644 index 0000000000000..e3b48946aefcb --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperations.cs @@ -0,0 +1,1836 @@ +// +// 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.DataProtection +{ + 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; + + /// + /// BackupVaultsOperations operations. + /// + internal partial class BackupVaultsOperations : IServiceOperations, IBackupVaultsOperations + { + /// + /// Initializes a new instance of the BackupVaultsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BackupVaultsOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Returns resource collection belonging to a subscription. + /// + /// + /// 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>> GetResourcesInSubscriptionWithHttpMessagesAsync(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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetResourcesInSubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults").ToString(); + _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; + } + + /// + /// Returns resource collection belonging to a resource group. + /// + /// + /// The name of the resource group where the backup 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>> GetResourcesInResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + 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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetResourcesInResourceGroup", 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.DataProtection/backupVaults").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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; + } + + /// + /// Returns a resource belonging to a resource group. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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 (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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.DataProtection/backupVaults/{vaultName}").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 (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; + } + + /// + /// Creates or updates a BackupVault resource belonging to a resource group. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PutWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupVaultResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginPutWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a BackupVault resource from the resource group. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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.DataProtection/backupVaults/{vaultName}").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 (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 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a BackupVault resource belonging to a resource group. For example, + /// updating tags for a resource. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PatchWithHttpMessagesAsync(string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginPatchWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// API to check for resource name availability + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The location in which uniqueness will be verified. + /// + /// + /// Check name availability request + /// + /// + /// 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> CheckNameAvailabilityWithHttpMessagesAsync(string resourceGroupName, string location, CheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("location", location); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", 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.DataProtection/locations/{location}/checkNameAvailability").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + 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("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; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a BackupVault resource belonging to a resource group. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for 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> BeginPutWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupVaultResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPut", 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.DataProtection/backupVaults/{vaultName}").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 (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; + } + + /// + /// Updates a BackupVault resource belonging to a resource group. For example, + /// updating tags for a resource. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for 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> BeginPatchWithHttpMessagesAsync(string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPatch", 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.DataProtection/backupVaults/{vaultName}").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 (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 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; + } + + /// + /// Returns resource collection belonging to a 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>> GetResourcesInSubscriptionNextWithHttpMessagesAsync(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, "GetResourcesInSubscriptionNext", 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; + } + + /// + /// Returns resource collection belonging to a 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>> GetResourcesInResourceGroupNextWithHttpMessagesAsync(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, "GetResourcesInResourceGroupNext", 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/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperationsExtensions.cs new file mode 100644 index 0000000000000..988a23beb6b43 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/BackupVaultsOperationsExtensions.cs @@ -0,0 +1,466 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BackupVaultsOperations. + /// + public static partial class BackupVaultsOperationsExtensions + { + /// + /// Returns resource collection belonging to a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage GetResourcesInSubscription(this IBackupVaultsOperations operations) + { + return operations.GetResourcesInSubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Returns resource collection belonging to a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> GetResourcesInSubscriptionAsync(this IBackupVaultsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetResourcesInSubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns resource collection belonging to a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + public static IPage GetResourcesInResourceGroup(this IBackupVaultsOperations operations, string resourceGroupName) + { + return operations.GetResourcesInResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Returns resource collection belonging to a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The cancellation token. + /// + public static async Task> GetResourcesInResourceGroupAsync(this IBackupVaultsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetResourcesInResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a resource belonging to a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + public static BackupVaultResource Get(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName) + { + return operations.GetAsync(vaultName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Returns a resource belonging to a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(vaultName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a BackupVault resource belonging to a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for operation + /// + public static BackupVaultResource Put(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, BackupVaultResource parameters) + { + return operations.PutAsync(vaultName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a BackupVault resource belonging to a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for operation + /// + /// + /// The cancellation token. + /// + public static async Task PutAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, BackupVaultResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a BackupVault resource from the resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + public static void Delete(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName) + { + operations.DeleteAsync(vaultName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a BackupVault resource from the resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(vaultName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a BackupVault resource belonging to a resource group. For example, + /// updating tags for a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for operation + /// + public static BackupVaultResource Patch(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, PatchResourceRequestInput parameters) + { + return operations.PatchAsync(vaultName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a BackupVault resource belonging to a resource group. For example, + /// updating tags for a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for operation + /// + /// + /// The cancellation token. + /// + public static async Task PatchAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PatchWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// API to check for resource name availability + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The location in which uniqueness will be verified. + /// + /// + /// Check name availability request + /// + public static CheckNameAvailabilityResult CheckNameAvailability(this IBackupVaultsOperations operations, string resourceGroupName, string location, CheckNameAvailabilityRequest parameters) + { + return operations.CheckNameAvailabilityAsync(resourceGroupName, location, parameters).GetAwaiter().GetResult(); + } + + /// + /// API to check for resource name availability + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The location in which uniqueness will be verified. + /// + /// + /// Check name availability request + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IBackupVaultsOperations operations, string resourceGroupName, string location, CheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(resourceGroupName, location, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a BackupVault resource belonging to a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for operation + /// + public static BackupVaultResource BeginPut(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, BackupVaultResource parameters) + { + return operations.BeginPutAsync(vaultName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a BackupVault resource belonging to a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginPutAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, BackupVaultResource parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPutWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a BackupVault resource belonging to a resource group. For example, + /// updating tags for a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for operation + /// + public static BackupVaultResource BeginPatch(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, PatchResourceRequestInput parameters) + { + return operations.BeginPatchAsync(vaultName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a BackupVault resource belonging to a resource group. For example, + /// updating tags for a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginPatchAsync(this IBackupVaultsOperations operations, string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPatchWithHttpMessagesAsync(vaultName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns resource collection belonging to a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage GetResourcesInSubscriptionNext(this IBackupVaultsOperations operations, string nextPageLink) + { + return operations.GetResourcesInSubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Returns resource collection belonging to a 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> GetResourcesInSubscriptionNextAsync(this IBackupVaultsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetResourcesInSubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns resource collection belonging to a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage GetResourcesInResourceGroupNext(this IBackupVaultsOperations operations, string nextPageLink) + { + return operations.GetResourcesInResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Returns resource collection belonging to a 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> GetResourcesInResourceGroupNextAsync(this IBackupVaultsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetResourcesInResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/DataProtectionClient.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/DataProtectionClient.cs new file mode 100644 index 0000000000000..92c2463996875 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/DataProtectionClient.cs @@ -0,0 +1,1043 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + 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; + + /// + /// Open API 2.0 Specs for Azure Data Protection service + /// + public partial class DataProtectionClient : ServiceClient, IDataProtectionClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// The subscription Id. + /// + public string SubscriptionId { get; set; } + + /// + /// Client Api Version. + /// + public string ApiVersion { get; private set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IBackupVaultsOperations. + /// + public virtual IBackupVaultsOperations BackupVaults { get; private set; } + + /// + /// Gets the IOperationResultOperations. + /// + public virtual IOperationResultOperations OperationResult { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IBackupPoliciesOperations. + /// + public virtual IBackupPoliciesOperations BackupPolicies { get; private set; } + + /// + /// Gets the IBackupInstancesOperations. + /// + public virtual IBackupInstancesOperations BackupInstances { get; private set; } + + /// + /// Gets the IRecoveryPointsOperations. + /// + public virtual IRecoveryPointsOperations RecoveryPoints { get; private set; } + + /// + /// Gets the IRecoveryPointOperations. + /// + public virtual IRecoveryPointOperations RecoveryPoint { get; private set; } + + /// + /// Gets the IJobsOperations. + /// + public virtual IJobsOperations Jobs { get; private set; } + + /// + /// Gets the IJobOperations. + /// + public virtual IJobOperations Job { get; private set; } + + /// + /// Gets the IExportJobsOperations. + /// + public virtual IExportJobsOperations ExportJobs { get; private set; } + + /// + /// Gets the IExportJobsOperationResultOperations. + /// + public virtual IExportJobsOperationResultOperations ExportJobsOperationResult { get; private set; } + + /// + /// Initializes a new instance of the DataProtectionClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling DataProtectionClient.Dispose(). False: will not dispose provided httpClient + protected DataProtectionClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the DataProtectionClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected DataProtectionClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the DataProtectionClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected DataProtectionClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the DataProtectionClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected DataProtectionClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the DataProtectionClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected DataProtectionClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the DataProtectionClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public DataProtectionClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the DataProtectionClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling DataProtectionClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public DataProtectionClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the DataProtectionClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public DataProtectionClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the DataProtectionClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public DataProtectionClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the DataProtectionClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public DataProtectionClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + BackupVaults = new BackupVaultsOperations(this); + OperationResult = new OperationResultOperations(this); + Operations = new Operations(this); + BackupPolicies = new BackupPoliciesOperations(this); + BackupInstances = new BackupInstancesOperations(this); + RecoveryPoints = new RecoveryPointsOperations(this); + RecoveryPoint = new RecoveryPointOperations(this); + Jobs = new JobsOperations(this); + Job = new JobOperations(this); + ExportJobs = new ExportJobsOperations(this); + ExportJobsOperationResult = new ExportJobsOperationResultOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2021-02-01-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + 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("objectType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("objectType")); + 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("objectType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("objectType")); + 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("objectType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("objectType")); + 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("objectType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("objectType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("objectType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("objectType")); + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + /// + /// Gets the operation status for a resource. + /// + /// + /// + /// + /// + /// + /// 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> GetOperationStatusWithHttpMessagesAsync(string location, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOperationStatus", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + 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 (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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> GetOperationResultPatchWithHttpMessagesAsync(string vaultName, string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetOperationResultPatch", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}").ToString(); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + 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 (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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; + } + + /// + /// Validates if a feature is supported + /// + /// + /// + /// + /// Feature support request object + /// + /// + /// 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> CheckFeatureSupportWithHttpMessagesAsync(string location, FeatureValidationRequestBase parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckFeatureSupport", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + 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 (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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 = SafeJsonConvert.SerializeObject(parameters, 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/DataProtectionClientExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/DataProtectionClientExtensions.cs new file mode 100644 index 0000000000000..ac4e7abcc0d38 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/DataProtectionClientExtensions.cs @@ -0,0 +1,137 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DataProtectionClient. + /// + public static partial class DataProtectionClientExtensions + { + /// + /// Gets the operation status for a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static OperationResource GetOperationStatus(this IDataProtectionClient operations, string location, string operationId) + { + return operations.GetOperationStatusAsync(location, operationId).GetAwaiter().GetResult(); + } + + /// + /// Gets the operation status for a resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetOperationStatusAsync(this IDataProtectionClient operations, string location, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOperationStatusWithHttpMessagesAsync(location, operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + public static BackupVaultResource GetOperationResultPatch(this IDataProtectionClient operations, string vaultName, string resourceGroupName, string operationId) + { + return operations.GetOperationResultPatchAsync(vaultName, resourceGroupName, operationId).GetAwaiter().GetResult(); + } + + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetOperationResultPatchAsync(this IDataProtectionClient operations, string vaultName, string resourceGroupName, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetOperationResultPatchWithHttpMessagesAsync(vaultName, resourceGroupName, operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Validates if a feature is supported + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// Feature support request object + /// + public static FeatureValidationResponseBase CheckFeatureSupport(this IDataProtectionClient operations, string location, FeatureValidationRequestBase parameters) + { + return operations.CheckFeatureSupportAsync(location, parameters).GetAwaiter().GetResult(); + } + + /// + /// Validates if a feature is supported + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// Feature support request object + /// + /// + /// The cancellation token. + /// + public static async Task CheckFeatureSupportAsync(this IDataProtectionClient operations, string location, FeatureValidationRequestBase parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckFeatureSupportWithHttpMessagesAsync(location, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperationResultOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperationResultOperations.cs new file mode 100644 index 0000000000000..a8a0263c70082 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperationResultOperations.cs @@ -0,0 +1,254 @@ +// +// 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.DataProtection +{ + 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; + + /// + /// ExportJobsOperationResultOperations operations. + /// + internal partial class ExportJobsOperationResultOperations : IServiceOperations, IExportJobsOperationResultOperations + { + /// + /// Initializes a new instance of the ExportJobsOperationResultOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ExportJobsOperationResultOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Gets the operation result of operation triggered by Export Jobs API. If the + /// operation is successful, then it also contains URL of a Blob and a SAS key + /// to access the same. The blob contains exported jobs in JSON serialized + /// format. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// OperationID which represents the export job. + /// + /// + /// 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 operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + // 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("operationId", operationId); + 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.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + 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 && (int)_statusCode != 202) + { + 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/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperationResultOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperationResultOperationsExtensions.cs new file mode 100644 index 0000000000000..87416c6eb1706 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperationResultOperationsExtensions.cs @@ -0,0 +1,77 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ExportJobsOperationResultOperations. + /// + public static partial class ExportJobsOperationResultOperationsExtensions + { + /// + /// Gets the operation result of operation triggered by Export Jobs API. If the + /// operation is successful, then it also contains URL of a Blob and a SAS key + /// to access the same. The blob contains exported jobs in JSON serialized + /// format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// OperationID which represents the export job. + /// + public static ExportJobsResult Get(this IExportJobsOperationResultOperations operations, string resourceGroupName, string vaultName, string operationId) + { + return operations.GetAsync(resourceGroupName, vaultName, operationId).GetAwaiter().GetResult(); + } + + /// + /// Gets the operation result of operation triggered by Export Jobs API. If the + /// operation is successful, then it also contains URL of a Blob and a SAS key + /// to access the same. The blob contains exported jobs in JSON serialized + /// format. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// OperationID which represents the export job. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IExportJobsOperationResultOperations operations, string resourceGroupName, string vaultName, string operationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, operationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperations.cs new file mode 100644 index 0000000000000..651e30b45bb14 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperations.cs @@ -0,0 +1,256 @@ +// +// 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.DataProtection +{ + 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; + + /// + /// ExportJobsOperations operations. + /// + internal partial class ExportJobsOperations : IServiceOperations, IExportJobsOperations + { + /// + /// Initializes a new instance of the ExportJobsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ExportJobsOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Triggers export of jobs and returns an OperationID to track. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> TriggerWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginTriggerWithHttpMessagesAsync(resourceGroupName, vaultName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Triggers export of jobs and returns an OperationID to track. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// 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> BeginTriggerWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginTrigger", 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.DataProtection/backupVaults/{vaultName}/exportBackupJobs").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + List _queryParameters = new List(); + if (_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); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + 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 AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperationsExtensions.cs new file mode 100644 index 0000000000000..d440cfbc5b72d --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/ExportJobsOperationsExtensions.cs @@ -0,0 +1,105 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ExportJobsOperations. + /// + public static partial class ExportJobsOperationsExtensions + { + /// + /// Triggers export of jobs and returns an OperationID to track. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + public static ExportJobsTriggerHeaders Trigger(this IExportJobsOperations operations, string resourceGroupName, string vaultName) + { + return operations.TriggerAsync(resourceGroupName, vaultName).GetAwaiter().GetResult(); + } + + /// + /// Triggers export of jobs and returns an OperationID to track. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// The cancellation token. + /// + public static async Task TriggerAsync(this IExportJobsOperations operations, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.TriggerWithHttpMessagesAsync(resourceGroupName, vaultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Triggers export of jobs and returns an OperationID to track. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + public static ExportJobsTriggerHeaders BeginTrigger(this IExportJobsOperations operations, string resourceGroupName, string vaultName) + { + return operations.BeginTriggerAsync(resourceGroupName, vaultName).GetAwaiter().GetResult(); + } + + /// + /// Triggers export of jobs and returns an OperationID to track. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// The cancellation token. + /// + public static async Task BeginTriggerAsync(this IExportJobsOperations operations, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginTriggerWithHttpMessagesAsync(resourceGroupName, vaultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupInstancesOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupInstancesOperations.cs new file mode 100644 index 0000000000000..e46434356d04e --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupInstancesOperations.cs @@ -0,0 +1,498 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BackupInstancesOperations operations. + /// + public partial interface IBackupInstancesOperations + { + /// + /// Gets a backup instances belonging to a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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>> GetBackupInstancesInVaultWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a backup instance with name in a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// 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, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for 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> PutWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// 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 vaultName, string resourceGroupName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Trigger adhoc backup + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Name for the Rule of the Policy which needs to be applied for this + /// backup + /// + /// + /// 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> AdhocBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validate whether adhoc backup will be successful or not + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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> ValidateForBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// rehydrate recovery point for restore for a BackupInstance + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// Request body for operation + /// + /// + /// + /// + /// 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> TriggerRehydrateWithHttpMessagesAsync(string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Triggers restore for a BackupInstance + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for 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> TriggerRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validates if Restore can be triggered for a DataSource + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Gets or sets the restore request object. + /// + /// + /// 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> ValidateRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for 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> BeginPutWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, BackupInstanceResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// 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 vaultName, string resourceGroupName, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Trigger adhoc backup + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Name for the Rule of the Policy which needs to be applied for this + /// backup + /// + /// + /// 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> BeginAdhocBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AdHocBackupRuleOptions backupRuleOptions, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validate whether adhoc backup will be successful or not + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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> BeginValidateForBackupWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupInstance backupInstance, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// rehydrate recovery point for restore for a BackupInstance + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// Request body for operation + /// + /// + /// + /// + /// 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> BeginTriggerRehydrateWithHttpMessagesAsync(string resourceGroupName, string vaultName, AzureBackupRehydrationRequest parameters, string backupInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Triggers restore for a BackupInstance + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Request body for 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> BeginTriggerRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validates if Restore can be triggered for a DataSource + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// Gets or sets the restore request object. + /// + /// + /// 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> BeginValidateRestoreWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, AzureBackupRestoreRequest restoreRequestObject, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a backup instances belonging to a backup vault + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetBackupInstancesInVaultNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupPoliciesOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupPoliciesOperations.cs new file mode 100644 index 0000000000000..b6f98ad0ee5e9 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupPoliciesOperations.cs @@ -0,0 +1,158 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BackupPoliciesOperations operations. + /// + public partial interface IBackupPoliciesOperations + { + /// + /// Returns list of backup policies belonging to a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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>> ListWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a backup policy belonging to a backup vault + /// + /// + /// Gets a backup policy belonging to a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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, string backupPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or Updates a backup policy belonging to a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// Request body for 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> PutWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupPolicyName, BaseBackupPolicyResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a backup policy belonging to a backup vault + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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 a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns list of backup policies belonging to a backup vault + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupVaultsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupVaultsOperations.cs new file mode 100644 index 0000000000000..54f7d5482220a --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IBackupVaultsOperations.cs @@ -0,0 +1,303 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BackupVaultsOperations operations. + /// + public partial interface IBackupVaultsOperations + { + /// + /// Returns resource collection belonging to a subscription. + /// + /// + /// 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>> GetResourcesInSubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns resource collection belonging to a resource group. + /// + /// + /// The name of the resource group where the backup 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>> GetResourcesInResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a resource belonging to a resource group. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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)); + /// + /// Creates or updates a BackupVault resource belonging to a resource + /// group. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for 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> PutWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupVaultResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a BackupVault resource from the resource group. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup 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 a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string vaultName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a BackupVault resource belonging to a resource group. For + /// example, updating tags for a resource. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for 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> PatchWithHttpMessagesAsync(string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// API to check for resource name availability + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The location in which uniqueness will be verified. + /// + /// + /// Check name availability request + /// + /// + /// 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> CheckNameAvailabilityWithHttpMessagesAsync(string resourceGroupName, string location, CheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a BackupVault resource belonging to a resource + /// group. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for 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> BeginPutWithHttpMessagesAsync(string vaultName, string resourceGroupName, BackupVaultResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a BackupVault resource belonging to a resource group. For + /// example, updating tags for a resource. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// Request body for 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> BeginPatchWithHttpMessagesAsync(string vaultName, string resourceGroupName, PatchResourceRequestInput parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns resource collection belonging to a 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>> GetResourcesInSubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns resource collection belonging to a 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>> GetResourcesInResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IDataProtectionClient.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IDataProtectionClient.cs new file mode 100644 index 0000000000000..a91532931859c --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IDataProtectionClient.cs @@ -0,0 +1,179 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Open API 2.0 Specs for Azure Data Protection service + /// + public partial interface IDataProtectionClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The subscription Id. + /// + string SubscriptionId { get; set; } + + /// + /// Client Api Version. + /// + string ApiVersion { get; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IBackupVaultsOperations. + /// + IBackupVaultsOperations BackupVaults { get; } + + /// + /// Gets the IOperationResultOperations. + /// + IOperationResultOperations OperationResult { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IBackupPoliciesOperations. + /// + IBackupPoliciesOperations BackupPolicies { get; } + + /// + /// Gets the IBackupInstancesOperations. + /// + IBackupInstancesOperations BackupInstances { get; } + + /// + /// Gets the IRecoveryPointsOperations. + /// + IRecoveryPointsOperations RecoveryPoints { get; } + + /// + /// Gets the IRecoveryPointOperations. + /// + IRecoveryPointOperations RecoveryPoint { get; } + + /// + /// Gets the IJobsOperations. + /// + IJobsOperations Jobs { get; } + + /// + /// Gets the IJobOperations. + /// + IJobOperations Job { get; } + + /// + /// Gets the IExportJobsOperations. + /// + IExportJobsOperations ExportJobs { get; } + + /// + /// Gets the IExportJobsOperationResultOperations. + /// + IExportJobsOperationResultOperations ExportJobsOperationResult { get; } + + /// + /// Gets the operation status for a resource. + /// + /// + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> GetOperationStatusWithHttpMessagesAsync(string location, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> GetOperationResultPatchWithHttpMessagesAsync(string vaultName, string resourceGroupName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Validates if a feature is supported + /// + /// + /// + /// + /// Feature support request object + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> CheckFeatureSupportWithHttpMessagesAsync(string location, FeatureValidationRequestBase parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IExportJobsOperationResultOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IExportJobsOperationResultOperations.cs new file mode 100644 index 0000000000000..90b74d17a871e --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IExportJobsOperationResultOperations.cs @@ -0,0 +1,58 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ExportJobsOperationResultOperations operations. + /// + public partial interface IExportJobsOperationResultOperations + { + /// + /// Gets the operation result of operation triggered by Export Jobs + /// API. If the operation is successful, then it also contains URL of a + /// Blob and a SAS key to access the same. The blob contains exported + /// jobs in JSON serialized format. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// OperationID which represents the export job. + /// + /// + /// 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 operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IExportJobsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IExportJobsOperations.cs new file mode 100644 index 0000000000000..8adcc65858c89 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IExportJobsOperations.cs @@ -0,0 +1,71 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ExportJobsOperations operations. + /// + public partial interface IExportJobsOperations + { + /// + /// Triggers export of jobs and returns an OperationID to track. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// 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> TriggerWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Triggers export of jobs and returns an OperationID to track. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// 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> BeginTriggerWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IJobOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IJobOperations.cs new file mode 100644 index 0000000000000..7eda13ba0d92f --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IJobOperations.cs @@ -0,0 +1,56 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// JobOperations operations. + /// + public partial interface IJobOperations + { + /// + /// Gets a job with id in a backup vault + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// The Job ID. This is a GUID-formatted string (e.g. + /// 00000000-0000-0000-0000-000000000000). + /// + /// + /// 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 jobId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IJobsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IJobsOperations.cs new file mode 100644 index 0000000000000..934b1eee274a6 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IJobsOperations.cs @@ -0,0 +1,74 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// JobsOperations operations. + /// + public partial interface IJobsOperations + { + /// + /// Returns list of jobs belonging to a backup vault + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns list of jobs belonging to a backup vault + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperationResultOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperationResultOperations.cs new file mode 100644 index 0000000000000..0b9071f47e47f --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperationResultOperations.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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OperationResultOperations operations. + /// + public partial interface IOperationResultOperations + { + /// + /// Gets the operation status for a resource. + /// + /// + /// Gets the operation result for a resource + /// + /// + /// + /// + /// + /// + /// 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 operationId, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperations.cs new file mode 100644 index 0000000000000..dfc6a2ed33c80 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IOperations.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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Returns the list of available operations. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the list of available operations. + /// + /// + /// 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/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRecoveryPointOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRecoveryPointOperations.cs new file mode 100644 index 0000000000000..8709cd2687abc --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRecoveryPointOperations.cs @@ -0,0 +1,57 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// RecoveryPointOperations operations. + /// + public partial interface IRecoveryPointOperations + { + /// + /// Gets a Recovery Point using recoveryPointId for a Datasource. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// + /// + /// 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, string backupInstanceName, string recoveryPointId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRecoveryPointsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRecoveryPointsOperations.cs new file mode 100644 index 0000000000000..6809bf1b3c0f0 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/IRecoveryPointsOperations.cs @@ -0,0 +1,84 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// RecoveryPointsOperations operations. + /// + public partial interface IRecoveryPointsOperations + { + /// + /// Returns a list of Recovery Points for a DataSource in a vault. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// skipToken Filter. + /// + /// + /// 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>> GetListWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of Recovery Points for a DataSource in a vault. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobOperations.cs new file mode 100644 index 0000000000000..578839820c51d --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobOperations.cs @@ -0,0 +1,260 @@ +// +// 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.DataProtection +{ + 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; + + /// + /// JobOperations operations. + /// + internal partial class JobOperations : IServiceOperations, IJobOperations + { + /// + /// Initializes a new instance of the JobOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal JobOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Gets a job with id in a backup vault + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// The Job ID. This is a GUID-formatted string (e.g. + /// 00000000-0000-0000-0000-000000000000). + /// + /// + /// 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 jobId, 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"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + if (jobId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "jobId"); + } + // 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("jobId", jobId); + 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.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + _url = _url.Replace("{jobId}", System.Uri.EscapeDataString(jobId)); + 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; + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobOperationsExtensions.cs new file mode 100644 index 0000000000000..f2faadb5fc68c --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobOperationsExtensions.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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for JobOperations. + /// + public static partial class JobOperationsExtensions + { + /// + /// Gets a job with id in a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// The Job ID. This is a GUID-formatted string (e.g. + /// 00000000-0000-0000-0000-000000000000). + /// + public static AzureBackupJobResource Get(this IJobOperations operations, string resourceGroupName, string vaultName, string jobId) + { + return operations.GetAsync(resourceGroupName, vaultName, jobId).GetAwaiter().GetResult(); + } + + /// + /// Gets a job with id in a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// The Job ID. This is a GUID-formatted string (e.g. + /// 00000000-0000-0000-0000-000000000000). + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IJobOperations operations, string resourceGroupName, string vaultName, string jobId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, vaultName, jobId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobsOperations.cs new file mode 100644 index 0000000000000..289fbd1f6bdb9 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobsOperations.cs @@ -0,0 +1,423 @@ +// +// 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.DataProtection +{ + 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; + + /// + /// JobsOperations operations. + /// + internal partial class JobsOperations : IServiceOperations, IJobsOperations + { + /// + /// Initializes a new instance of the JobsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal JobsOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Returns list of jobs belonging to a backup vault + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string vaultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (vaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "vaultName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{vaultName}", System.Uri.EscapeDataString(vaultName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns list of jobs belonging to a backup vault + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobsOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobsOperationsExtensions.cs new file mode 100644 index 0000000000000..bbee7362fa3d9 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/JobsOperationsExtensions.cs @@ -0,0 +1,99 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for JobsOperations. + /// + public static partial class JobsOperationsExtensions + { + /// + /// Returns list of jobs belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + public static IPage List(this IJobsOperations operations, string resourceGroupName, string vaultName) + { + return operations.ListAsync(resourceGroupName, vaultName).GetAwaiter().GetResult(); + } + + /// + /// Returns list of jobs belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup vault. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IJobsOperations operations, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, vaultName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns list of jobs belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IJobsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Returns list of jobs belonging to a backup vault + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IJobsOperations 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/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AbsoluteDeleteOption.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AbsoluteDeleteOption.cs new file mode 100644 index 0000000000000..bdeef3022b874 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AbsoluteDeleteOption.cs @@ -0,0 +1,58 @@ +// +// 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.DataProtection.Models +{ + using System.Linq; + + /// + /// AbsoluteDeleteOption + /// + /// + /// Delete option with duration + /// + public partial class AbsoluteDeleteOption : DeleteOption + { + /// + /// Initializes a new instance of the AbsoluteDeleteOption class. + /// + public AbsoluteDeleteOption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AbsoluteDeleteOption class. + /// + /// Duration of deletion after given + /// timespan + public AbsoluteDeleteOption(string duration) + : base(duration) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AbsoluteMarker.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AbsoluteMarker.cs new file mode 100644 index 0000000000000..f7a46d6151980 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AbsoluteMarker.cs @@ -0,0 +1,25 @@ +// +// 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.DataProtection.Models +{ + + /// + /// Defines values for AbsoluteMarker. + /// + public static class AbsoluteMarker + { + public const string AllBackup = "AllBackup"; + public const string FirstOfDay = "FirstOfDay"; + public const string FirstOfMonth = "FirstOfMonth"; + public const string FirstOfWeek = "FirstOfWeek"; + public const string FirstOfYear = "FirstOfYear"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdHocBackupRuleOptions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdHocBackupRuleOptions.cs new file mode 100644 index 0000000000000..363d187a4b4ec --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdHocBackupRuleOptions.cs @@ -0,0 +1,76 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// AdHocBackupRuleOptions + /// + /// + /// Adhoc backup rules + /// + public partial class AdHocBackupRuleOptions + { + /// + /// Initializes a new instance of the AdHocBackupRuleOptions class. + /// + public AdHocBackupRuleOptions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AdHocBackupRuleOptions class. + /// + public AdHocBackupRuleOptions(string ruleName, AdhocBackupTriggerOption triggerOption) + { + RuleName = ruleName; + TriggerOption = triggerOption; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "ruleName")] + public string RuleName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "triggerOption")] + public AdhocBackupTriggerOption TriggerOption { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RuleName"); + } + if (TriggerOption == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TriggerOption"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdhocBackupTriggerOption.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdhocBackupTriggerOption.cs new file mode 100644 index 0000000000000..706e594bb13ca --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdhocBackupTriggerOption.cs @@ -0,0 +1,52 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// AdhocBackupTriggerOption + /// + /// + /// Adhoc backup trigger option + /// + public partial class AdhocBackupTriggerOption + { + /// + /// Initializes a new instance of the AdhocBackupTriggerOption class. + /// + public AdhocBackupTriggerOption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AdhocBackupTriggerOption class. + /// + public AdhocBackupTriggerOption(string retentionTagOverride = default(string)) + { + RetentionTagOverride = retentionTagOverride; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "retentionTagOverride")] + public string RetentionTagOverride { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdhocBasedTaggingCriteria.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdhocBasedTaggingCriteria.cs new file mode 100644 index 0000000000000..4027a83fb17b6 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdhocBasedTaggingCriteria.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// AdhocBasedTaggingCriteria + /// + /// + /// Adhoc backup tagging criteria + /// + public partial class AdhocBasedTaggingCriteria + { + /// + /// Initializes a new instance of the AdhocBasedTaggingCriteria class. + /// + public AdhocBasedTaggingCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AdhocBasedTaggingCriteria class. + /// + /// Retention tag information + public AdhocBasedTaggingCriteria(RetentionTag tagInfo = default(RetentionTag)) + { + TagInfo = tagInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets retention tag information + /// + [JsonProperty(PropertyName = "tagInfo")] + public RetentionTag TagInfo { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TagInfo != null) + { + TagInfo.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdhocBasedTriggerContext.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdhocBasedTriggerContext.cs new file mode 100644 index 0000000000000..34b57086ea748 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AdhocBasedTriggerContext.cs @@ -0,0 +1,74 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// AdhocBasedTriggerContext + /// + /// + /// Adhoc trigger context + /// + public partial class AdhocBasedTriggerContext : TriggerContext + { + /// + /// Initializes a new instance of the AdhocBasedTriggerContext class. + /// + public AdhocBasedTriggerContext() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AdhocBasedTriggerContext class. + /// + /// Tagging Criteria containing retention + /// tag for adhoc backup. + public AdhocBasedTriggerContext(AdhocBasedTaggingCriteria taggingCriteria) + { + TaggingCriteria = taggingCriteria; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets tagging Criteria containing retention tag for adhoc + /// backup. + /// + [JsonProperty(PropertyName = "taggingCriteria")] + public AdhocBasedTaggingCriteria TaggingCriteria { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TaggingCriteria == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TaggingCriteria"); + } + if (TaggingCriteria != null) + { + TaggingCriteria.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupDiscreteRecoveryPoint.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupDiscreteRecoveryPoint.cs new file mode 100644 index 0000000000000..d66d2250627ab --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupDiscreteRecoveryPoint.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// AzureBackupDiscreteRecoveryPoint + /// + /// + /// Azure backup discrete RecoveryPoint + /// + public partial class AzureBackupDiscreteRecoveryPoint : AzureBackupRecoveryPoint + { + /// + /// Initializes a new instance of the AzureBackupDiscreteRecoveryPoint + /// class. + /// + public AzureBackupDiscreteRecoveryPoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureBackupDiscreteRecoveryPoint + /// class. + /// + public AzureBackupDiscreteRecoveryPoint(System.DateTime recoveryPointTime, string friendlyName = default(string), IList recoveryPointDataStoresDetails = default(IList), string policyName = default(string), string policyVersion = default(string), string recoveryPointId = default(string), string recoveryPointType = default(string), string retentionTagName = default(string), string retentionTagVersion = default(string)) + { + FriendlyName = friendlyName; + RecoveryPointDataStoresDetails = recoveryPointDataStoresDetails; + RecoveryPointTime = recoveryPointTime; + PolicyName = policyName; + PolicyVersion = policyVersion; + RecoveryPointId = recoveryPointId; + RecoveryPointType = recoveryPointType; + RetentionTagName = retentionTagName; + RetentionTagVersion = retentionTagVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "friendlyName")] + public string FriendlyName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "recoveryPointDataStoresDetails")] + public IList RecoveryPointDataStoresDetails { get; set; } + + /// + /// + [JsonProperty(PropertyName = "recoveryPointTime")] + public System.DateTime RecoveryPointTime { get; set; } + + /// + /// + [JsonProperty(PropertyName = "policyName")] + public string PolicyName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "policyVersion")] + public string PolicyVersion { get; set; } + + /// + /// + [JsonProperty(PropertyName = "recoveryPointId")] + public string RecoveryPointId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "recoveryPointType")] + public string RecoveryPointType { get; set; } + + /// + /// + [JsonProperty(PropertyName = "retentionTagName")] + public string RetentionTagName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "retentionTagVersion")] + public string RetentionTagVersion { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupJob.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupJob.cs new file mode 100644 index 0000000000000..c56036fb32082 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupJob.cs @@ -0,0 +1,372 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// AzureBackup Job Class + /// + public partial class AzureBackupJob + { + /// + /// Initializes a new instance of the AzureBackupJob class. + /// + public AzureBackupJob() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureBackupJob class. + /// + /// Job Activity Id + /// Name of the Backup + /// Instance + /// ARM ID of the DataSource + /// Location of the DataSource + /// User Friendly Name of the + /// DataSource + /// Data Source Set Name of the + /// DataSource + /// Type of DataSource + /// Indicated that whether the job is + /// adhoc(true) or scheduled(false) + /// It indicates the type of Job i.e. + /// Backup:full/log/diff ;Restore:ALR/OLR; Tiering:Backup/Archive ; + /// Management:ConfigureProtection/UnConfigure + /// It indicates the type of Job i.e. + /// Backup/Restore/Tiering/Management + /// Indicated whether progress is enabled + /// for the job + /// Resource Group Name of the + /// Datasource + /// SubscriptionId corresponding to + /// the DataSource + /// StartTime of the job(in UTC) + /// Status of the job like + /// InProgress/Success/Failed/Cancelled/SuccessWithWarning + /// Subscription Id of the corresponding + /// backup vault + /// List of supported actions + /// Name of the vault + /// ARM ID of the Backup + /// Instance + /// Total run time of the job. ISO 8601 + /// format. + /// EndTime of the job(in UTC) + /// A List, detailing the errors related to + /// the job + /// Extended Information about the + /// job + /// ARM ID of the policy + /// Name of the policy + /// Url which contains job's progress + /// It indicates the sub type of operation + /// i.e. in case of Restore it can be ALR/OLR + public AzureBackupJob(string activityID, string backupInstanceFriendlyName, string dataSourceId, string dataSourceLocation, string dataSourceName, string dataSourceSetName, string dataSourceType, bool isUserTriggered, string operation, string operationCategory, bool progressEnabled, string sourceResourceGroup, string sourceSubscriptionID, System.DateTime startTime, string status, string subscriptionId, IList supportedActions, string vaultName, string backupInstanceId = default(string), string duration = default(string), System.DateTime? endTime = default(System.DateTime?), IList errorDetails = default(IList), JobExtendedInfo extendedInfo = default(JobExtendedInfo), string policyId = default(string), string policyName = default(string), string progressUrl = default(string), string restoreType = default(string), string etag = default(string), string sourceDataStoreName = default(string), string destinationDataStoreName = default(string)) + { + ActivityID = activityID; + BackupInstanceFriendlyName = backupInstanceFriendlyName; + BackupInstanceId = backupInstanceId; + DataSourceId = dataSourceId; + DataSourceLocation = dataSourceLocation; + DataSourceName = dataSourceName; + DataSourceSetName = dataSourceSetName; + DataSourceType = dataSourceType; + Duration = duration; + EndTime = endTime; + ErrorDetails = errorDetails; + ExtendedInfo = extendedInfo; + IsUserTriggered = isUserTriggered; + Operation = operation; + OperationCategory = operationCategory; + PolicyId = policyId; + PolicyName = policyName; + ProgressEnabled = progressEnabled; + ProgressUrl = progressUrl; + RestoreType = restoreType; + SourceResourceGroup = sourceResourceGroup; + SourceSubscriptionID = sourceSubscriptionID; + StartTime = startTime; + Status = status; + SubscriptionId = subscriptionId; + SupportedActions = supportedActions; + VaultName = vaultName; + Etag = etag; + SourceDataStoreName = sourceDataStoreName; + DestinationDataStoreName = destinationDataStoreName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets job Activity Id + /// + [JsonProperty(PropertyName = "activityID")] + public string ActivityID { get; set; } + + /// + /// Gets or sets name of the Backup Instance + /// + [JsonProperty(PropertyName = "backupInstanceFriendlyName")] + public string BackupInstanceFriendlyName { get; set; } + + /// + /// Gets ARM ID of the Backup Instance + /// + [JsonProperty(PropertyName = "backupInstanceId")] + public string BackupInstanceId { get; private set; } + + /// + /// Gets or sets ARM ID of the DataSource + /// + [JsonProperty(PropertyName = "dataSourceId")] + public string DataSourceId { get; set; } + + /// + /// Gets or sets location of the DataSource + /// + [JsonProperty(PropertyName = "dataSourceLocation")] + public string DataSourceLocation { get; set; } + + /// + /// Gets or sets user Friendly Name of the DataSource + /// + [JsonProperty(PropertyName = "dataSourceName")] + public string DataSourceName { get; set; } + + /// + /// Gets or sets data Source Set Name of the DataSource + /// + [JsonProperty(PropertyName = "dataSourceSetName")] + public string DataSourceSetName { get; set; } + + /// + /// Gets or sets type of DataSource + /// + [JsonProperty(PropertyName = "dataSourceType")] + public string DataSourceType { get; set; } + + /// + /// Gets or sets total run time of the job. ISO 8601 format. + /// + [JsonProperty(PropertyName = "duration")] + public string Duration { get; set; } + + /// + /// Gets endTime of the job(in UTC) + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; private set; } + + /// + /// Gets a List, detailing the errors related to the job + /// + [JsonProperty(PropertyName = "errorDetails")] + public IList ErrorDetails { get; private set; } + + /// + /// Gets extended Information about the job + /// + [JsonProperty(PropertyName = "extendedInfo")] + public JobExtendedInfo ExtendedInfo { get; private set; } + + /// + /// Gets or sets indicated that whether the job is adhoc(true) or + /// scheduled(false) + /// + [JsonProperty(PropertyName = "isUserTriggered")] + public bool IsUserTriggered { get; set; } + + /// + /// Gets or sets it indicates the type of Job i.e. Backup:full/log/diff + /// ;Restore:ALR/OLR; Tiering:Backup/Archive ; + /// Management:ConfigureProtection/UnConfigure + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets it indicates the type of Job i.e. + /// Backup/Restore/Tiering/Management + /// + [JsonProperty(PropertyName = "operationCategory")] + public string OperationCategory { get; set; } + + /// + /// Gets ARM ID of the policy + /// + [JsonProperty(PropertyName = "policyId")] + public string PolicyId { get; private set; } + + /// + /// Gets name of the policy + /// + [JsonProperty(PropertyName = "policyName")] + public string PolicyName { get; private set; } + + /// + /// Gets or sets indicated whether progress is enabled for the job + /// + [JsonProperty(PropertyName = "progressEnabled")] + public bool ProgressEnabled { get; set; } + + /// + /// Gets url which contains job's progress + /// + [JsonProperty(PropertyName = "progressUrl")] + public string ProgressUrl { get; private set; } + + /// + /// Gets it indicates the sub type of operation i.e. in case of Restore + /// it can be ALR/OLR + /// + [JsonProperty(PropertyName = "restoreType")] + public string RestoreType { get; private set; } + + /// + /// Gets or sets resource Group Name of the Datasource + /// + [JsonProperty(PropertyName = "sourceResourceGroup")] + public string SourceResourceGroup { get; set; } + + /// + /// Gets or sets subscriptionId corresponding to the DataSource + /// + [JsonProperty(PropertyName = "sourceSubscriptionID")] + public string SourceSubscriptionID { get; set; } + + /// + /// Gets or sets startTime of the job(in UTC) + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime StartTime { get; set; } + + /// + /// Gets or sets status of the job like + /// InProgress/Success/Failed/Cancelled/SuccessWithWarning + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets subscription Id of the corresponding backup vault + /// + [JsonProperty(PropertyName = "subscriptionId")] + public string SubscriptionId { get; set; } + + /// + /// Gets or sets list of supported actions + /// + [JsonProperty(PropertyName = "supportedActions")] + public IList SupportedActions { get; set; } + + /// + /// Gets or sets name of the vault + /// + [JsonProperty(PropertyName = "vaultName")] + public string VaultName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sourceDataStoreName")] + public string SourceDataStoreName { get; set; } + + /// + /// + [JsonProperty(PropertyName = "destinationDataStoreName")] + public string DestinationDataStoreName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ActivityID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ActivityID"); + } + if (BackupInstanceFriendlyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BackupInstanceFriendlyName"); + } + if (DataSourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceId"); + } + if (DataSourceLocation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceLocation"); + } + if (DataSourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceName"); + } + if (DataSourceSetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceSetName"); + } + if (DataSourceType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceType"); + } + if (Operation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Operation"); + } + if (OperationCategory == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperationCategory"); + } + if (SourceResourceGroup == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceResourceGroup"); + } + if (SourceSubscriptionID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceSubscriptionID"); + } + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SubscriptionId"); + } + if (SupportedActions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SupportedActions"); + } + if (VaultName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "VaultName"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupJobResource.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupJobResource.cs new file mode 100644 index 0000000000000..22f11fd3e689d --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupJobResource.cs @@ -0,0 +1,71 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// AzureBackup Job Resource Class + /// + public partial class AzureBackupJobResource : DppResource + { + /// + /// Initializes a new instance of the AzureBackupJobResource class. + /// + public AzureBackupJobResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureBackupJobResource 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/... + /// AzureBackupJobResource properties + public AzureBackupJobResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), AzureBackupJob properties = default(AzureBackupJob)) + : base(id, name, type, systemData) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets azureBackupJobResource properties + /// + [JsonProperty(PropertyName = "properties")] + public AzureBackupJob Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupParams.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupParams.cs new file mode 100644 index 0000000000000..df49dcb4d65a0 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupParams.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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// AzureBackupParams + /// + /// + /// Azure backup parameters + /// + public partial class AzureBackupParams : BackupParameters + { + /// + /// Initializes a new instance of the AzureBackupParams class. + /// + public AzureBackupParams() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureBackupParams class. + /// + /// BackupType ; Full/Incremental etc + public AzureBackupParams(string backupType) + { + BackupType = backupType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets backupType ; Full/Incremental etc + /// + [JsonProperty(PropertyName = "backupType")] + public string BackupType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BackupType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BackupType"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPoint.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPoint.cs new file mode 100644 index 0000000000000..afecf4f87e8d8 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPoint.cs @@ -0,0 +1,38 @@ +// +// 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.DataProtection.Models +{ + using System.Linq; + + /// + /// AzureBackupRecoveryPoint + /// + /// + /// Azure backup recoveryPoint + /// + public partial class AzureBackupRecoveryPoint + { + /// + /// Initializes a new instance of the AzureBackupRecoveryPoint class. + /// + public AzureBackupRecoveryPoint() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPointBasedRestoreRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPointBasedRestoreRequest.cs new file mode 100644 index 0000000000000..35b08d7f53bef --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPointBasedRestoreRequest.cs @@ -0,0 +1,76 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// AzureBackupRecoveryPointBasedRestoreRequest + /// + /// + /// Azure backup recoveryPoint based restore request + /// + public partial class AzureBackupRecoveryPointBasedRestoreRequest : AzureBackupRestoreRequest + { + /// + /// Initializes a new instance of the + /// AzureBackupRecoveryPointBasedRestoreRequest class. + /// + public AzureBackupRecoveryPointBasedRestoreRequest() + { + RestoreTargetInfo = new RestoreTargetInfoBase(); + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AzureBackupRecoveryPointBasedRestoreRequest class. + /// + /// Gets or sets the restore target + /// information. + /// Gets or sets the type of the + /// source data store. Possible values include: 'ArchiveStore', + /// 'SnapshotStore', 'VaultStore' + public AzureBackupRecoveryPointBasedRestoreRequest(RestoreTargetInfoBase restoreTargetInfo, string sourceDataStoreType, string recoveryPointId) + : base(restoreTargetInfo, sourceDataStoreType) + { + RecoveryPointId = recoveryPointId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "recoveryPointId")] + public string RecoveryPointId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (RecoveryPointId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RecoveryPointId"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPointResource.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPointResource.cs new file mode 100644 index 0000000000000..43737ec3018b7 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRecoveryPointResource.cs @@ -0,0 +1,54 @@ +// +// 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.DataProtection.Models +{ + using System.Linq; + + /// + /// AzureBackupRecoveryPointResource + /// + /// + /// Azure backup recoveryPoint resource + /// + public partial class AzureBackupRecoveryPointResource : DppResource + { + /// + /// Initializes a new instance of the AzureBackupRecoveryPointResource + /// class. + /// + public AzureBackupRecoveryPointResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureBackupRecoveryPointResource + /// 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/... + public AzureBackupRecoveryPointResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRehydrationRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRehydrationRequest.cs new file mode 100644 index 0000000000000..8b72851e9aff6 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRehydrationRequest.cs @@ -0,0 +1,95 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// AzureBackupRehydrationRequest + /// + /// + /// Azure Backup Rehydrate Request + /// + public partial class AzureBackupRehydrationRequest + { + /// + /// Initializes a new instance of the AzureBackupRehydrationRequest + /// class. + /// + public AzureBackupRehydrationRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureBackupRehydrationRequest + /// class. + /// + /// Id of the recovery point to be + /// recovered + /// Retention duration in + /// ISO 8601 format i.e P10D . + /// Priority to be used for + /// rehydration. Values High or Standard. Possible values include: + /// 'Invalid', 'High', 'Standard' + public AzureBackupRehydrationRequest(string recoveryPointId, string rehydrationRetentionDuration, string rehydrationPriority = default(string)) + { + RecoveryPointId = recoveryPointId; + RehydrationPriority = rehydrationPriority; + RehydrationRetentionDuration = rehydrationRetentionDuration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets id of the recovery point to be recovered + /// + [JsonProperty(PropertyName = "recoveryPointId")] + public string RecoveryPointId { get; set; } + + /// + /// Gets or sets priority to be used for rehydration. Values High or + /// Standard. Possible values include: 'Invalid', 'High', 'Standard' + /// + [JsonProperty(PropertyName = "rehydrationPriority")] + public string RehydrationPriority { get; set; } + + /// + /// Gets or sets retention duration in ISO 8601 format i.e P10D . + /// + [JsonProperty(PropertyName = "rehydrationRetentionDuration")] + public string RehydrationRetentionDuration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RecoveryPointId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RecoveryPointId"); + } + if (RehydrationRetentionDuration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RehydrationRetentionDuration"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreRequest.cs new file mode 100644 index 0000000000000..51f4ca15a49d1 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreRequest.cs @@ -0,0 +1,85 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// AzureBackupRestoreRequest + /// + /// + /// Azure backup restore request + /// + public partial class AzureBackupRestoreRequest + { + /// + /// Initializes a new instance of the AzureBackupRestoreRequest class. + /// + public AzureBackupRestoreRequest() + { + RestoreTargetInfo = new RestoreTargetInfoBase(); + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureBackupRestoreRequest class. + /// + /// Gets or sets the restore target + /// information. + /// Gets or sets the type of the + /// source data store. Possible values include: 'ArchiveStore', + /// 'SnapshotStore', 'VaultStore' + public AzureBackupRestoreRequest(RestoreTargetInfoBase restoreTargetInfo, string sourceDataStoreType) + { + RestoreTargetInfo = restoreTargetInfo; + SourceDataStoreType = sourceDataStoreType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the restore target information. + /// + [JsonProperty(PropertyName = "restoreTargetInfo")] + public RestoreTargetInfoBase RestoreTargetInfo { get; set; } + + /// + /// Gets or sets the type of the source data store. Possible values + /// include: 'ArchiveStore', 'SnapshotStore', 'VaultStore' + /// + [JsonProperty(PropertyName = "sourceDataStoreType")] + public string SourceDataStoreType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RestoreTargetInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RestoreTargetInfo"); + } + if (SourceDataStoreType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceDataStoreType"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreWithRehydrationRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreWithRehydrationRequest.cs new file mode 100644 index 0000000000000..2389fa6656173 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRestoreWithRehydrationRequest.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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// AzureBackupRestoreWithRehydrationRequest + /// + /// + /// AzureBackup Restore with Rehydration Request + /// + public partial class AzureBackupRestoreWithRehydrationRequest : AzureBackupRecoveryPointBasedRestoreRequest + { + /// + /// Initializes a new instance of the + /// AzureBackupRestoreWithRehydrationRequest class. + /// + public AzureBackupRestoreWithRehydrationRequest() + { + RestoreTargetInfo = new RestoreTargetInfoBase(); + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AzureBackupRestoreWithRehydrationRequest class. + /// + /// Gets or sets the restore target + /// information. + /// Gets or sets the type of the + /// source data store. Possible values include: 'ArchiveStore', + /// 'SnapshotStore', 'VaultStore' + /// Priority to be used for + /// rehydration. Values High or Standard. Possible values include: + /// 'Invalid', 'High', 'Standard' + /// Retention duration in + /// ISO 8601 format i.e P10D . + public AzureBackupRestoreWithRehydrationRequest(RestoreTargetInfoBase restoreTargetInfo, string sourceDataStoreType, string recoveryPointId, string rehydrationPriority, string rehydrationRetentionDuration) + : base(restoreTargetInfo, sourceDataStoreType, recoveryPointId) + { + RehydrationPriority = rehydrationPriority; + RehydrationRetentionDuration = rehydrationRetentionDuration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets priority to be used for rehydration. Values High or + /// Standard. Possible values include: 'Invalid', 'High', 'Standard' + /// + [JsonProperty(PropertyName = "rehydrationPriority")] + public string RehydrationPriority { get; set; } + + /// + /// Gets or sets retention duration in ISO 8601 format i.e P10D . + /// + [JsonProperty(PropertyName = "rehydrationRetentionDuration")] + public string RehydrationRetentionDuration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (RehydrationPriority == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RehydrationPriority"); + } + if (RehydrationRetentionDuration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RehydrationRetentionDuration"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRule.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRule.cs new file mode 100644 index 0000000000000..11f890c168c2c --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureBackupRule.cs @@ -0,0 +1,88 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// AzureBackupRule + /// + /// + /// Azure backup rule + /// + public partial class AzureBackupRule : BasePolicyRule + { + /// + /// Initializes a new instance of the AzureBackupRule class. + /// + public AzureBackupRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureBackupRule class. + /// + public AzureBackupRule(string name, DataStoreInfoBase dataStore, TriggerContext trigger, BackupParameters backupParameters = default(BackupParameters)) + : base(name) + { + BackupParameters = backupParameters; + DataStore = dataStore; + Trigger = trigger; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "backupParameters")] + public BackupParameters BackupParameters { get; set; } + + /// + /// + [JsonProperty(PropertyName = "dataStore")] + public DataStoreInfoBase DataStore { get; set; } + + /// + /// + [JsonProperty(PropertyName = "trigger")] + public TriggerContext Trigger { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (DataStore == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataStore"); + } + if (Trigger == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Trigger"); + } + if (DataStore != null) + { + DataStore.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureOperationalStoreParameters.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureOperationalStoreParameters.cs new file mode 100644 index 0000000000000..4be5490971fbd --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureOperationalStoreParameters.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Parameters for Operational-Tier DataStore + /// + public partial class AzureOperationalStoreParameters : DataStoreParameters + { + /// + /// Initializes a new instance of the AzureOperationalStoreParameters + /// class. + /// + public AzureOperationalStoreParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureOperationalStoreParameters + /// class. + /// + /// type of datastore; + /// Operational/Vault/Archive. Possible values include: + /// 'OperationalStore', 'VaultStore', 'ArchiveStore' + /// Gets or sets the Resource Group + /// Uri. + public AzureOperationalStoreParameters(string dataStoreType, string resourceGroupId = default(string)) + : base(dataStoreType) + { + ResourceGroupId = resourceGroupId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Resource Group Uri. + /// + [JsonProperty(PropertyName = "resourceGroupId")] + public string ResourceGroupId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureRetentionRule.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureRetentionRule.cs new file mode 100644 index 0000000000000..38f0b6ac82693 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/AzureRetentionRule.cs @@ -0,0 +1,86 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// AzureRetentionRule + /// + /// + /// Azure retention rule + /// + public partial class AzureRetentionRule : BasePolicyRule + { + /// + /// Initializes a new instance of the AzureRetentionRule class. + /// + public AzureRetentionRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureRetentionRule class. + /// + public AzureRetentionRule(string name, IList lifecycles, bool? isDefault = default(bool?)) + : base(name) + { + IsDefault = isDefault; + Lifecycles = lifecycles; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "isDefault")] + public bool? IsDefault { get; set; } + + /// + /// + [JsonProperty(PropertyName = "lifecycles")] + public IList Lifecycles { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Lifecycles == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Lifecycles"); + } + if (Lifecycles != null) + { + foreach (var element in Lifecycles) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupCriteria.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupCriteria.cs new file mode 100644 index 0000000000000..8d6841cf0e3e1 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupCriteria.cs @@ -0,0 +1,38 @@ +// +// 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.DataProtection.Models +{ + using System.Linq; + + /// + /// BackupCriteria + /// + /// + /// BackupCriteria base class + /// + public partial class BackupCriteria + { + /// + /// Initializes a new instance of the BackupCriteria class. + /// + public BackupCriteria() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstance.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstance.cs new file mode 100644 index 0000000000000..11c1231e3f983 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstance.cs @@ -0,0 +1,171 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Backup Instance + /// + public partial class BackupInstance + { + /// + /// Initializes a new instance of the BackupInstance class. + /// + public BackupInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupInstance class. + /// + /// Gets or sets the Backup Instance + /// friendly name. + /// Gets or sets the data source + /// information. + /// Gets or sets the policy + /// information. + /// Gets or sets the data source set + /// information. + /// Specifies the protection status of + /// the resource + /// Specifies the current + /// protection state of the resource. Possible values include: + /// 'Invalid', 'NotProtected', 'ConfiguringProtection', + /// 'ProtectionConfigured', 'BackupSchedulesSuspended', + /// 'RetentionSchedulesSuspended', 'ProtectionStopped', + /// 'ProtectionError', 'ConfiguringProtectionFailed', 'SoftDeleting', + /// 'SoftDeleted', 'UpdatingProtection' + /// Specifies the protection error + /// of the resource + /// Specifies the provisioning state of + /// the resource i.e. provisioning/updating/Succeeded/Failed + public BackupInstance(string friendlyName, Datasource dataSourceInfo, PolicyInfo policyInfo, string objectType, DatasourceSet dataSourceSetInfo = default(DatasourceSet), ProtectionStatusDetails protectionStatus = default(ProtectionStatusDetails), string currentProtectionState = default(string), UserFacingError protectionErrorDetails = default(UserFacingError), string provisioningState = default(string)) + { + FriendlyName = friendlyName; + DataSourceInfo = dataSourceInfo; + DataSourceSetInfo = dataSourceSetInfo; + PolicyInfo = policyInfo; + ProtectionStatus = protectionStatus; + CurrentProtectionState = currentProtectionState; + ProtectionErrorDetails = protectionErrorDetails; + ProvisioningState = provisioningState; + ObjectType = objectType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Backup Instance friendly name. + /// + [JsonProperty(PropertyName = "friendlyName")] + public string FriendlyName { get; set; } + + /// + /// Gets or sets the data source information. + /// + [JsonProperty(PropertyName = "dataSourceInfo")] + public Datasource DataSourceInfo { get; set; } + + /// + /// Gets or sets the data source set information. + /// + [JsonProperty(PropertyName = "dataSourceSetInfo")] + public DatasourceSet DataSourceSetInfo { get; set; } + + /// + /// Gets or sets the policy information. + /// + [JsonProperty(PropertyName = "policyInfo")] + public PolicyInfo PolicyInfo { get; set; } + + /// + /// Gets specifies the protection status of the resource + /// + [JsonProperty(PropertyName = "protectionStatus")] + public ProtectionStatusDetails ProtectionStatus { get; private set; } + + /// + /// Gets specifies the current protection state of the resource. + /// Possible values include: 'Invalid', 'NotProtected', + /// 'ConfiguringProtection', 'ProtectionConfigured', + /// 'BackupSchedulesSuspended', 'RetentionSchedulesSuspended', + /// 'ProtectionStopped', 'ProtectionError', + /// 'ConfiguringProtectionFailed', 'SoftDeleting', 'SoftDeleted', + /// 'UpdatingProtection' + /// + [JsonProperty(PropertyName = "currentProtectionState")] + public string CurrentProtectionState { get; private set; } + + /// + /// Gets specifies the protection error of the resource + /// + [JsonProperty(PropertyName = "protectionErrorDetails")] + public UserFacingError ProtectionErrorDetails { get; private set; } + + /// + /// Gets specifies the provisioning state of the resource i.e. + /// provisioning/updating/Succeeded/Failed + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "objectType")] + public string ObjectType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (FriendlyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FriendlyName"); + } + if (DataSourceInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceInfo"); + } + if (PolicyInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PolicyInfo"); + } + if (ObjectType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ObjectType"); + } + if (DataSourceInfo != null) + { + DataSourceInfo.Validate(); + } + if (DataSourceSetInfo != null) + { + DataSourceSetInfo.Validate(); + } + if (PolicyInfo != null) + { + PolicyInfo.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstanceResource.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstanceResource.cs new file mode 100644 index 0000000000000..05eb25afa7acd --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstanceResource.cs @@ -0,0 +1,183 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// BackupInstanceResource + /// + /// + /// BackupInstance Resource + /// + [Rest.Serialization.JsonTransformation] + public partial class BackupInstanceResource : DppResource + { + /// + /// Initializes a new instance of the BackupInstanceResource class. + /// + public BackupInstanceResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupInstanceResource class. + /// + /// Gets or sets the Backup Instance + /// friendly name. + /// Gets or sets the data source + /// information. + /// Gets or sets the policy + /// information. + /// 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/... + /// Gets or sets the data source set + /// information. + /// Specifies the protection status of + /// the resource + /// Specifies the current + /// protection state of the resource. Possible values include: + /// 'Invalid', 'NotProtected', 'ConfiguringProtection', + /// 'ProtectionConfigured', 'BackupSchedulesSuspended', + /// 'RetentionSchedulesSuspended', 'ProtectionStopped', + /// 'ProtectionError', 'ConfiguringProtectionFailed', 'SoftDeleting', + /// 'SoftDeleted', 'UpdatingProtection' + /// Specifies the protection error + /// of the resource + /// Specifies the provisioning state of + /// the resource i.e. provisioning/updating/Succeeded/Failed + public BackupInstanceResource(string friendlyName, Datasource dataSourceInfo, PolicyInfo policyInfo, string objectType, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), DatasourceSet dataSourceSetInfo = default(DatasourceSet), ProtectionStatusDetails protectionStatus = default(ProtectionStatusDetails), string currentProtectionState = default(string), UserFacingError protectionErrorDetails = default(UserFacingError), string provisioningState = default(string)) + : base(id, name, type, systemData) + { + FriendlyName = friendlyName; + DataSourceInfo = dataSourceInfo; + DataSourceSetInfo = dataSourceSetInfo; + PolicyInfo = policyInfo; + ProtectionStatus = protectionStatus; + CurrentProtectionState = currentProtectionState; + ProtectionErrorDetails = protectionErrorDetails; + ProvisioningState = provisioningState; + ObjectType = objectType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Backup Instance friendly name. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; set; } + + /// + /// Gets or sets the data source information. + /// + [JsonProperty(PropertyName = "properties.dataSourceInfo")] + public Datasource DataSourceInfo { get; set; } + + /// + /// Gets or sets the data source set information. + /// + [JsonProperty(PropertyName = "properties.dataSourceSetInfo")] + public DatasourceSet DataSourceSetInfo { get; set; } + + /// + /// Gets or sets the policy information. + /// + [JsonProperty(PropertyName = "properties.policyInfo")] + public PolicyInfo PolicyInfo { get; set; } + + /// + /// Gets specifies the protection status of the resource + /// + [JsonProperty(PropertyName = "properties.protectionStatus")] + public ProtectionStatusDetails ProtectionStatus { get; private set; } + + /// + /// Gets specifies the current protection state of the resource. + /// Possible values include: 'Invalid', 'NotProtected', + /// 'ConfiguringProtection', 'ProtectionConfigured', + /// 'BackupSchedulesSuspended', 'RetentionSchedulesSuspended', + /// 'ProtectionStopped', 'ProtectionError', + /// 'ConfiguringProtectionFailed', 'SoftDeleting', 'SoftDeleted', + /// 'UpdatingProtection' + /// + [JsonProperty(PropertyName = "properties.currentProtectionState")] + public string CurrentProtectionState { get; private set; } + + /// + /// Gets specifies the protection error of the resource + /// + [JsonProperty(PropertyName = "properties.protectionErrorDetails")] + public UserFacingError ProtectionErrorDetails { get; private set; } + + /// + /// Gets specifies the provisioning state of the resource i.e. + /// provisioning/updating/Succeeded/Failed + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties.objectType")] + public string ObjectType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (FriendlyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FriendlyName"); + } + if (DataSourceInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceInfo"); + } + if (PolicyInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PolicyInfo"); + } + if (ObjectType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ObjectType"); + } + if (DataSourceInfo != null) + { + DataSourceInfo.Validate(); + } + if (DataSourceSetInfo != null) + { + DataSourceSetInfo.Validate(); + } + if (PolicyInfo != null) + { + PolicyInfo.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesAdhocBackupHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesAdhocBackupHeaders.cs new file mode 100644 index 0000000000000..ac3c81ee38d29 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesAdhocBackupHeaders.cs @@ -0,0 +1,77 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for AdhocBackup operation. + /// + public partial class BackupInstancesAdhocBackupHeaders + { + /// + /// Initializes a new instance of the BackupInstancesAdhocBackupHeaders + /// class. + /// + public BackupInstancesAdhocBackupHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupInstancesAdhocBackupHeaders + /// class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public BackupInstancesAdhocBackupHeaders(string location = default(string), string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesDeleteHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesDeleteHeaders.cs new file mode 100644 index 0000000000000..e241bf358db21 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesDeleteHeaders.cs @@ -0,0 +1,77 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class BackupInstancesDeleteHeaders + { + /// + /// Initializes a new instance of the BackupInstancesDeleteHeaders + /// class. + /// + public BackupInstancesDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupInstancesDeleteHeaders + /// class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public BackupInstancesDeleteHeaders(string location = default(string), string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesTriggerRehydrateHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesTriggerRehydrateHeaders.cs new file mode 100644 index 0000000000000..9042422bbceb9 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesTriggerRehydrateHeaders.cs @@ -0,0 +1,77 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for TriggerRehydrate operation. + /// + public partial class BackupInstancesTriggerRehydrateHeaders + { + /// + /// Initializes a new instance of the + /// BackupInstancesTriggerRehydrateHeaders class. + /// + public BackupInstancesTriggerRehydrateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BackupInstancesTriggerRehydrateHeaders class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public BackupInstancesTriggerRehydrateHeaders(string location = default(string), string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesTriggerRestoreHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesTriggerRestoreHeaders.cs new file mode 100644 index 0000000000000..8e1cd506d458a --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesTriggerRestoreHeaders.cs @@ -0,0 +1,77 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for TriggerRestore operation. + /// + public partial class BackupInstancesTriggerRestoreHeaders + { + /// + /// Initializes a new instance of the + /// BackupInstancesTriggerRestoreHeaders class. + /// + public BackupInstancesTriggerRestoreHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BackupInstancesTriggerRestoreHeaders class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public BackupInstancesTriggerRestoreHeaders(string location = default(string), string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesValidateForBackupHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesValidateForBackupHeaders.cs new file mode 100644 index 0000000000000..068d7a271d82a --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesValidateForBackupHeaders.cs @@ -0,0 +1,77 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for ValidateForBackup operation. + /// + public partial class BackupInstancesValidateForBackupHeaders + { + /// + /// Initializes a new instance of the + /// BackupInstancesValidateForBackupHeaders class. + /// + public BackupInstancesValidateForBackupHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BackupInstancesValidateForBackupHeaders class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public BackupInstancesValidateForBackupHeaders(string location = default(string), string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesValidateRestoreHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesValidateRestoreHeaders.cs new file mode 100644 index 0000000000000..9aa9032970e72 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupInstancesValidateRestoreHeaders.cs @@ -0,0 +1,77 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for ValidateRestore operation. + /// + public partial class BackupInstancesValidateRestoreHeaders + { + /// + /// Initializes a new instance of the + /// BackupInstancesValidateRestoreHeaders class. + /// + public BackupInstancesValidateRestoreHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// BackupInstancesValidateRestoreHeaders class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// The URL of the resource used to + /// check the status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public BackupInstancesValidateRestoreHeaders(string location = default(string), string azureAsyncOperation = default(string), int? retryAfter = default(int?)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupParameters.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupParameters.cs new file mode 100644 index 0000000000000..c8b4629b7f85b --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupParameters.cs @@ -0,0 +1,38 @@ +// +// 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.DataProtection.Models +{ + using System.Linq; + + /// + /// BackupParameters + /// + /// + /// BackupParameters base + /// + public partial class BackupParameters + { + /// + /// Initializes a new instance of the BackupParameters class. + /// + public BackupParameters() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupPolicy.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupPolicy.cs new file mode 100644 index 0000000000000..f8876d262a397 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupPolicy.cs @@ -0,0 +1,86 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// BackupPolicy + /// + /// + /// Rule based backup policy + /// + public partial class BackupPolicy : BaseBackupPolicy + { + /// + /// Initializes a new instance of the BackupPolicy class. + /// + public BackupPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupPolicy class. + /// + /// Type of datasource for the backup + /// management + /// Policy rule dictionary that contains + /// rules for each backuptype i.e Full/Incremental/Logs etc + public BackupPolicy(IList datasourceTypes, IList policyRules) + : base(datasourceTypes) + { + PolicyRules = policyRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets policy rule dictionary that contains rules for each + /// backuptype i.e Full/Incremental/Logs etc + /// + [JsonProperty(PropertyName = "policyRules")] + public IList PolicyRules { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (PolicyRules == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PolicyRules"); + } + if (PolicyRules != null) + { + foreach (var element in PolicyRules) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupSchedule.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupSchedule.cs new file mode 100644 index 0000000000000..7f0ff2573869e --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupSchedule.cs @@ -0,0 +1,71 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// BackupSchedule + /// + /// + /// Schedule for backup + /// + public partial class BackupSchedule + { + /// + /// Initializes a new instance of the BackupSchedule class. + /// + public BackupSchedule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupSchedule class. + /// + /// ISO 8601 repeating time + /// interval format + public BackupSchedule(IList repeatingTimeIntervals) + { + RepeatingTimeIntervals = repeatingTimeIntervals; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ISO 8601 repeating time interval format + /// + [JsonProperty(PropertyName = "repeatingTimeIntervals")] + public IList RepeatingTimeIntervals { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RepeatingTimeIntervals == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RepeatingTimeIntervals"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupVaultResource.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupVaultResource.cs new file mode 100644 index 0000000000000..22f85ed16309c --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BackupVaultResource.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// BackupVault Resource + /// + /// + /// Backup Vault Resource + /// + [Rest.Serialization.JsonTransformation] + public partial class BackupVaultResource : DppTrackedResource + { + /// + /// Initializes a new instance of the BackupVaultResource class. + /// + public BackupVaultResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupVaultResource class. + /// + /// Optional ETag. + /// Resource Id represents the complete path to the + /// resource. + /// Input Managed Identity Details + /// Resource location. + /// Resource name associated with the + /// resource. + /// Resource tags. + /// Resource type represents the complete path of + /// the form Namespace/ResourceType/ResourceType/... + /// Provisioning state of the + /// BackupVault resource. Possible values include: 'Failed', + /// 'Provisioning', 'Succeeded', 'Unknown', 'Updating' + /// Storage Settings + public BackupVaultResource(string eTag = default(string), string id = default(string), DppIdentityDetails identity = default(DppIdentityDetails), string location = default(string), string name = default(string), IDictionary tags = default(IDictionary), string type = default(string), SystemData systemData = default(SystemData), string provisioningState = default(string), IList storageSettings = default(IList)) + : base(eTag, id, identity, location, name, tags, type, systemData) + { + ProvisioningState = provisioningState; + StorageSettings = storageSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets provisioning state of the BackupVault resource. Possible + /// values include: 'Failed', 'Provisioning', 'Succeeded', 'Unknown', + /// 'Updating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets storage Settings + /// + [JsonProperty(PropertyName = "properties.storageSettings")] + public IList StorageSettings { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BaseBackupPolicy.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BaseBackupPolicy.cs new file mode 100644 index 0000000000000..751621ac4accf --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BaseBackupPolicy.cs @@ -0,0 +1,71 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// BaseBackupPolicy + /// + /// + /// BackupPolicy base + /// + public partial class BaseBackupPolicy + { + /// + /// Initializes a new instance of the BaseBackupPolicy class. + /// + public BaseBackupPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BaseBackupPolicy class. + /// + /// Type of datasource for the backup + /// management + public BaseBackupPolicy(IList datasourceTypes) + { + DatasourceTypes = datasourceTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of datasource for the backup management + /// + [JsonProperty(PropertyName = "datasourceTypes")] + public IList DatasourceTypes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DatasourceTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatasourceTypes"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BaseBackupPolicyResource.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BaseBackupPolicyResource.cs new file mode 100644 index 0000000000000..85f2343ea3846 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BaseBackupPolicyResource.cs @@ -0,0 +1,80 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// BaseBackupPolicyResource + /// + /// + /// BaseBackupPolicy resource + /// + [Rest.Serialization.JsonTransformation] + public partial class BaseBackupPolicyResource : DppResource + { + /// + /// Initializes a new instance of the BaseBackupPolicyResource class. + /// + public BaseBackupPolicyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BaseBackupPolicyResource class. + /// + /// Type of datasource for the backup + /// management + /// 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/... + public BaseBackupPolicyResource(IList datasourceTypes, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) + { + DatasourceTypes = datasourceTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of datasource for the backup management + /// + [JsonProperty(PropertyName = "properties.datasourceTypes")] + public IList DatasourceTypes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DatasourceTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatasourceTypes"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BasePolicyRule.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BasePolicyRule.cs new file mode 100644 index 0000000000000..316146a57c071 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/BasePolicyRule.cs @@ -0,0 +1,66 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// BasePolicyRule + /// + /// + /// BasePolicy Rule + /// + public partial class BasePolicyRule + { + /// + /// Initializes a new instance of the BasePolicyRule class. + /// + public BasePolicyRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BasePolicyRule class. + /// + public BasePolicyRule(string name) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CheckNameAvailabilityRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CheckNameAvailabilityRequest.cs new file mode 100644 index 0000000000000..a90cfbbaf222e --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CheckNameAvailabilityRequest.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// CheckNameAvailabilityRequest + /// + /// + /// CheckNameAvailability Request + /// + public partial class CheckNameAvailabilityRequest + { + /// + /// Initializes a new instance of the CheckNameAvailabilityRequest + /// class. + /// + public CheckNameAvailabilityRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameAvailabilityRequest + /// class. + /// + /// Resource name for which availability needs to be + /// checked + /// Describes the Resource type: + /// Microsoft.DataProtection/BackupVaults + public CheckNameAvailabilityRequest(string name = default(string), string type = default(string)) + { + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource name for which availability needs to be + /// checked + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets describes the Resource type: + /// Microsoft.DataProtection/BackupVaults + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CheckNameAvailabilityResult.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CheckNameAvailabilityResult.cs new file mode 100644 index 0000000000000..616950ff328cb --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CheckNameAvailabilityResult.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// CheckNameAvailabilityResult + /// + /// + /// CheckNameAvailability Result + /// + public partial class CheckNameAvailabilityResult + { + /// + /// Initializes a new instance of the CheckNameAvailabilityResult + /// class. + /// + public CheckNameAvailabilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameAvailabilityResult + /// class. + /// + /// Gets or sets the message. + /// Gets or sets a value indicating whether + /// [name available]. + /// Gets or sets the reason. + public CheckNameAvailabilityResult(string message = default(string), bool? nameAvailable = default(bool?), string reason = default(string)) + { + Message = message; + NameAvailable = nameAvailable; + Reason = reason; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets a value indicating whether [name available]. + /// + [JsonProperty(PropertyName = "nameAvailable")] + public bool? NameAvailable { get; set; } + + /// + /// Gets or sets the reason. + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryDisplay.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryDisplay.cs new file mode 100644 index 0000000000000..01463cf2ec3e6 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryDisplay.cs @@ -0,0 +1,83 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ClientDiscoveryDisplay + /// + /// + /// Localized display information of an operation. + /// + public partial class ClientDiscoveryDisplay + { + /// + /// Initializes a new instance of the ClientDiscoveryDisplay class. + /// + public ClientDiscoveryDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ClientDiscoveryDisplay class. + /// + /// Description of the operation having + /// details of what operation is about. + /// Operations Name itself. + /// Name of the provider for display + /// purposes + /// ResourceType for which this Operation can be + /// performed. + public ClientDiscoveryDisplay(string description = default(string), string operation = default(string), string provider = default(string), string resource = default(string)) + { + Description = description; + Operation = operation; + Provider = provider; + Resource = resource; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets description of the operation having details of what + /// operation is about. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets operations Name itself. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets name of the provider for display purposes + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets resourceType for which this Operation can be + /// performed. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryForLogSpecification.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryForLogSpecification.cs new file mode 100644 index 0000000000000..a1869e65cc489 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryForLogSpecification.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ClientDiscoveryForLogSpecification + /// + /// + /// Class to represent shoebox log specification in json client discovery. + /// + public partial class ClientDiscoveryForLogSpecification + { + /// + /// Initializes a new instance of the + /// ClientDiscoveryForLogSpecification class. + /// + public ClientDiscoveryForLogSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ClientDiscoveryForLogSpecification class. + /// + /// blob duration of shoebox log + /// specification + /// Localized display name + /// Name for shoebox log specification. + public ClientDiscoveryForLogSpecification(string blobDuration = default(string), string displayName = default(string), string name = default(string)) + { + BlobDuration = blobDuration; + DisplayName = displayName; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets blob duration of shoebox log specification + /// + [JsonProperty(PropertyName = "blobDuration")] + public string BlobDuration { get; set; } + + /// + /// Gets or sets localized display name + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets name for shoebox log specification. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryForServiceSpecification.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryForServiceSpecification.cs new file mode 100644 index 0000000000000..6a896996a7981 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryForServiceSpecification.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// ClientDiscoveryForServiceSpecification + /// + /// + /// Class to represent shoebox service specification in json client + /// discovery. + /// + public partial class ClientDiscoveryForServiceSpecification + { + /// + /// Initializes a new instance of the + /// ClientDiscoveryForServiceSpecification class. + /// + public ClientDiscoveryForServiceSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ClientDiscoveryForServiceSpecification class. + /// + /// List of log specifications of this + /// operation. + public ClientDiscoveryForServiceSpecification(IList logSpecifications = default(IList)) + { + LogSpecifications = logSpecifications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of log specifications of this operation. + /// + [JsonProperty(PropertyName = "logSpecifications")] + public IList LogSpecifications { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryValueForSingleApi.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryValueForSingleApi.cs new file mode 100644 index 0000000000000..a730cf1048eb0 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ClientDiscoveryValueForSingleApi.cs @@ -0,0 +1,97 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// ClientDiscoveryValueForSingleApi + /// + /// + /// Available operation details. + /// + [Rest.Serialization.JsonTransformation] + public partial class ClientDiscoveryValueForSingleApi + { + /// + /// Initializes a new instance of the ClientDiscoveryValueForSingleApi + /// class. + /// + public ClientDiscoveryValueForSingleApi() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ClientDiscoveryValueForSingleApi + /// class. + /// + /// Contains the localized display information + /// for this particular operation + /// Name of the Operation. + /// Indicates whether the operation is a + /// data action + /// The intended executor of the operation;governs + /// the display of the operation in the RBAC UX and the audit logs + /// UX + /// Operation properties. + public ClientDiscoveryValueForSingleApi(ClientDiscoveryDisplay display = default(ClientDiscoveryDisplay), string name = default(string), bool? isDataAction = default(bool?), string origin = default(string), ClientDiscoveryForServiceSpecification serviceSpecification = default(ClientDiscoveryForServiceSpecification)) + { + Display = display; + Name = name; + IsDataAction = isDataAction; + Origin = origin; + ServiceSpecification = serviceSpecification; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets contains the localized display information for this + /// particular operation + /// + [JsonProperty(PropertyName = "display")] + public ClientDiscoveryDisplay Display { get; set; } + + /// + /// Gets or sets name of the Operation. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets indicates whether the operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } + + /// + /// Gets or sets the intended executor of the operation;governs the + /// display of the operation in the RBAC UX and the audit logs UX + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + /// + /// Gets or sets operation properties. + /// + [JsonProperty(PropertyName = "properties.serviceSpecification")] + public ClientDiscoveryForServiceSpecification ServiceSpecification { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CopyOnExpiryOption.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CopyOnExpiryOption.cs new file mode 100644 index 0000000000000..8d98c16fcb6c6 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CopyOnExpiryOption.cs @@ -0,0 +1,38 @@ +// +// 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.DataProtection.Models +{ + using System.Linq; + + /// + /// CopyOnExpiryOption + /// + /// + /// Copy on Expiry Option + /// + public partial class CopyOnExpiryOption : CopyOption + { + /// + /// Initializes a new instance of the CopyOnExpiryOption class. + /// + public CopyOnExpiryOption() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CopyOption.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CopyOption.cs new file mode 100644 index 0000000000000..189916ad5c0df --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CopyOption.cs @@ -0,0 +1,38 @@ +// +// 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.DataProtection.Models +{ + using System.Linq; + + /// + /// CopyOption + /// + /// + /// Options to copy + /// + public partial class CopyOption + { + /// + /// Initializes a new instance of the CopyOption class. + /// + public CopyOption() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CreatedByType.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..cfdbd6bdd6f38 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CurrentProtectionState.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CurrentProtectionState.cs new file mode 100644 index 0000000000000..fbf24a71033c9 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CurrentProtectionState.cs @@ -0,0 +1,32 @@ +// +// 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.DataProtection.Models +{ + + /// + /// Defines values for CurrentProtectionState. + /// + public static class CurrentProtectionState + { + public const string Invalid = "Invalid"; + public const string NotProtected = "NotProtected"; + public const string ConfiguringProtection = "ConfiguringProtection"; + public const string ProtectionConfigured = "ProtectionConfigured"; + public const string BackupSchedulesSuspended = "BackupSchedulesSuspended"; + public const string RetentionSchedulesSuspended = "RetentionSchedulesSuspended"; + public const string ProtectionStopped = "ProtectionStopped"; + public const string ProtectionError = "ProtectionError"; + public const string ConfiguringProtectionFailed = "ConfiguringProtectionFailed"; + public const string SoftDeleting = "SoftDeleting"; + public const string SoftDeleted = "SoftDeleted"; + public const string UpdatingProtection = "UpdatingProtection"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CustomCopyOption.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CustomCopyOption.cs new file mode 100644 index 0000000000000..0420f11540d36 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/CustomCopyOption.cs @@ -0,0 +1,54 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// CustomCopyOption + /// + /// + /// Duration based custom options to copy + /// + public partial class CustomCopyOption : CopyOption + { + /// + /// Initializes a new instance of the CustomCopyOption class. + /// + public CustomCopyOption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomCopyOption class. + /// + /// Data copied after given timespan + public CustomCopyOption(string duration = default(string)) + { + Duration = duration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets data copied after given timespan + /// + [JsonProperty(PropertyName = "duration")] + public string Duration { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DataStoreInfoBase.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DataStoreInfoBase.cs new file mode 100644 index 0000000000000..cb600945c8cf7 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DataStoreInfoBase.cs @@ -0,0 +1,85 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// DataStoreInfoBase + /// + /// + /// DataStoreInfo base + /// + public partial class DataStoreInfoBase + { + /// + /// Initializes a new instance of the DataStoreInfoBase class. + /// + public DataStoreInfoBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataStoreInfoBase class. + /// + /// type of datastore; + /// Operational/Vault/Archive. Possible values include: + /// 'OperationalStore', 'VaultStore', 'ArchiveStore' + /// Type of Datasource object, used to + /// initialize the right inherited type + public DataStoreInfoBase(string dataStoreType, string objectType) + { + DataStoreType = dataStoreType; + ObjectType = objectType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of datastore; Operational/Vault/Archive. Possible + /// values include: 'OperationalStore', 'VaultStore', 'ArchiveStore' + /// + [JsonProperty(PropertyName = "dataStoreType")] + public string DataStoreType { get; set; } + + /// + /// Gets or sets type of Datasource object, used to initialize the + /// right inherited type + /// + [JsonProperty(PropertyName = "objectType")] + public string ObjectType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DataStoreType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataStoreType"); + } + if (ObjectType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ObjectType"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DataStoreParameters.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DataStoreParameters.cs new file mode 100644 index 0000000000000..650583e52a290 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DataStoreParameters.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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Parameters for DataStore + /// + public partial class DataStoreParameters + { + /// + /// Initializes a new instance of the DataStoreParameters class. + /// + public DataStoreParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataStoreParameters class. + /// + /// type of datastore; + /// Operational/Vault/Archive. Possible values include: + /// 'OperationalStore', 'VaultStore', 'ArchiveStore' + public DataStoreParameters(string dataStoreType) + { + DataStoreType = dataStoreType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of datastore; Operational/Vault/Archive. Possible + /// values include: 'OperationalStore', 'VaultStore', 'ArchiveStore' + /// + [JsonProperty(PropertyName = "dataStoreType")] + public string DataStoreType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DataStoreType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataStoreType"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DataStoreTypes.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DataStoreTypes.cs new file mode 100644 index 0000000000000..83c0b645afa88 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DataStoreTypes.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.DataProtection.Models +{ + + /// + /// Defines values for DataStoreTypes. + /// + public static class DataStoreTypes + { + public const string OperationalStore = "OperationalStore"; + public const string VaultStore = "VaultStore"; + public const string ArchiveStore = "ArchiveStore"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Datasource.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Datasource.cs new file mode 100644 index 0000000000000..e8aed6f1c8a24 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Datasource.cs @@ -0,0 +1,125 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Datasource + /// + /// + /// Datasource to be backed up + /// + public partial class Datasource + { + /// + /// Initializes a new instance of the Datasource class. + /// + public Datasource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Datasource class. + /// + /// Full ARM ID of the resource. For azure + /// resources, this is ARM ID. For non azure resources, this will be + /// the ID created by backup service via Fabric/Vault. + /// DatasourceType of the + /// resource. + /// Type of Datasource object, used to + /// initialize the right inherited type + /// Location of datasource. + /// Unique identifier of the resource in the + /// context of parent. + /// Resource Type of Datasource. + /// Uri of the resource. + public Datasource(string resourceID, string datasourceType = default(string), string objectType = default(string), string resourceLocation = default(string), string resourceName = default(string), string resourceType = default(string), string resourceUri = default(string)) + { + DatasourceType = datasourceType; + ObjectType = objectType; + ResourceID = resourceID; + ResourceLocation = resourceLocation; + ResourceName = resourceName; + ResourceType = resourceType; + ResourceUri = resourceUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets datasourceType of the resource. + /// + [JsonProperty(PropertyName = "datasourceType")] + public string DatasourceType { get; set; } + + /// + /// Gets or sets type of Datasource object, used to initialize the + /// right inherited type + /// + [JsonProperty(PropertyName = "objectType")] + public string ObjectType { get; set; } + + /// + /// Gets or sets full ARM ID of the resource. For azure resources, this + /// is ARM ID. For non azure resources, this will be the ID created by + /// backup service via Fabric/Vault. + /// + [JsonProperty(PropertyName = "resourceID")] + public string ResourceID { get; set; } + + /// + /// Gets or sets location of datasource. + /// + [JsonProperty(PropertyName = "resourceLocation")] + public string ResourceLocation { get; set; } + + /// + /// Gets or sets unique identifier of the resource in the context of + /// parent. + /// + [JsonProperty(PropertyName = "resourceName")] + public string ResourceName { get; set; } + + /// + /// Gets or sets resource Type of Datasource. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets or sets uri of the resource. + /// + [JsonProperty(PropertyName = "resourceUri")] + public string ResourceUri { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ResourceID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceID"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DatasourceSet.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DatasourceSet.cs new file mode 100644 index 0000000000000..44ae489c39ccc --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DatasourceSet.cs @@ -0,0 +1,125 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// DatasourceSet + /// + /// + /// DatasourceSet details of datasource to be backed up + /// + public partial class DatasourceSet + { + /// + /// Initializes a new instance of the DatasourceSet class. + /// + public DatasourceSet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatasourceSet class. + /// + /// Full ARM ID of the resource. For azure + /// resources, this is ARM ID. For non azure resources, this will be + /// the ID created by backup service via Fabric/Vault. + /// DatasourceType of the + /// resource. + /// Type of Datasource object, used to + /// initialize the right inherited type + /// Location of datasource. + /// Unique identifier of the resource in the + /// context of parent. + /// Resource Type of Datasource. + /// Uri of the resource. + public DatasourceSet(string resourceID, string datasourceType = default(string), string objectType = default(string), string resourceLocation = default(string), string resourceName = default(string), string resourceType = default(string), string resourceUri = default(string)) + { + DatasourceType = datasourceType; + ObjectType = objectType; + ResourceID = resourceID; + ResourceLocation = resourceLocation; + ResourceName = resourceName; + ResourceType = resourceType; + ResourceUri = resourceUri; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets datasourceType of the resource. + /// + [JsonProperty(PropertyName = "datasourceType")] + public string DatasourceType { get; set; } + + /// + /// Gets or sets type of Datasource object, used to initialize the + /// right inherited type + /// + [JsonProperty(PropertyName = "objectType")] + public string ObjectType { get; set; } + + /// + /// Gets or sets full ARM ID of the resource. For azure resources, this + /// is ARM ID. For non azure resources, this will be the ID created by + /// backup service via Fabric/Vault. + /// + [JsonProperty(PropertyName = "resourceID")] + public string ResourceID { get; set; } + + /// + /// Gets or sets location of datasource. + /// + [JsonProperty(PropertyName = "resourceLocation")] + public string ResourceLocation { get; set; } + + /// + /// Gets or sets unique identifier of the resource in the context of + /// parent. + /// + [JsonProperty(PropertyName = "resourceName")] + public string ResourceName { get; set; } + + /// + /// Gets or sets resource Type of Datasource. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets or sets uri of the resource. + /// + [JsonProperty(PropertyName = "resourceUri")] + public string ResourceUri { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ResourceID == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceID"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Day.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Day.cs new file mode 100644 index 0000000000000..6696515011ca3 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Day.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Day + /// + /// + /// Day of the week + /// + public partial class Day + { + /// + /// Initializes a new instance of the Day class. + /// + public Day() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Day class. + /// + /// Date of the month + /// Whether Date is last date of month + public Day(int? date = default(int?), bool? isLast = default(bool?)) + { + Date = date; + IsLast = isLast; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets date of the month + /// + [JsonProperty(PropertyName = "date")] + public int? Date { get; set; } + + /// + /// Gets or sets whether Date is last date of month + /// + [JsonProperty(PropertyName = "isLast")] + public bool? IsLast { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DayOfWeek.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DayOfWeek.cs new file mode 100644 index 0000000000000..f3b746f3fb637 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DayOfWeek.cs @@ -0,0 +1,27 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + + /// + /// Defines values for DayOfWeek. + /// + public static class DayOfWeek + { + public const string Friday = "Friday"; + public const string Monday = "Monday"; + public const string Saturday = "Saturday"; + public const string Sunday = "Sunday"; + public const string Thursday = "Thursday"; + public const string Tuesday = "Tuesday"; + public const string Wednesday = "Wednesday"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DeleteOption.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DeleteOption.cs new file mode 100644 index 0000000000000..d97d270007988 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DeleteOption.cs @@ -0,0 +1,69 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// DeleteOption + /// + /// + /// Delete Option + /// + public partial class DeleteOption + { + /// + /// Initializes a new instance of the DeleteOption class. + /// + public DeleteOption() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeleteOption class. + /// + /// Duration of deletion after given + /// timespan + public DeleteOption(string duration) + { + Duration = duration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets duration of deletion after given timespan + /// + [JsonProperty(PropertyName = "duration")] + public string Duration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Duration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Duration"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppIdentityDetails.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppIdentityDetails.cs new file mode 100644 index 0000000000000..5f5792da2bb71 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppIdentityDetails.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// DppIdentityDetails + /// + /// + /// Identity details + /// + public partial class DppIdentityDetails + { + /// + /// Initializes a new instance of the DppIdentityDetails class. + /// + public DppIdentityDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DppIdentityDetails class. + /// + /// The object ID of the service principal + /// object for the managed identity that is used to grant role-based + /// access to an Azure resource. + /// A Globally Unique Identifier (GUID) that + /// represents the Azure AD tenant where the resource is now a + /// member. + /// The identityType which can be either + /// SystemAssigned or None + public DppIdentityDetails(string principalId = default(string), string tenantId = default(string), string type = default(string)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the object ID of the service principal object for the managed + /// identity that is used to grant role-based access to an Azure + /// resource. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets a Globally Unique Identifier (GUID) that represents the Azure + /// AD tenant where the resource is now a member. + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the identityType which can be either SystemAssigned or + /// None + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppResource.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppResource.cs new file mode 100644 index 0000000000000..f47f6f739fe72 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppResource.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// DppResource + /// + /// + /// Resource class + /// + public partial class DppResource : IResource + { + /// + /// Initializes a new instance of the DppResource class. + /// + public DppResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DppResource 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/... + public DppResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id represents the complete path to the resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name associated with the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type represents the complete path of the form + /// Namespace/ResourceType/ResourceType/... + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppResourceList.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppResourceList.cs new file mode 100644 index 0000000000000..f116cd150450e --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppResourceList.cs @@ -0,0 +1,56 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// List Resource + /// + /// + /// ListResource + /// + public partial class DppResourceList + { + /// + /// Initializes a new instance of the DppResourceList class. + /// + public DppResourceList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DppResourceList class. + /// + /// The uri to fetch the next page of resources. + /// Call ListNext() fetches next page of resources. + public DppResourceList(string nextLink = default(string)) + { + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the uri to fetch the next page of resources. Call + /// ListNext() fetches next page of resources. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppTrackedResource.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppTrackedResource.cs new file mode 100644 index 0000000000000..3ad713376b7ee --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppTrackedResource.cs @@ -0,0 +1,110 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class DppTrackedResource : IResource + { + /// + /// Initializes a new instance of the DppTrackedResource class. + /// + public DppTrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DppTrackedResource class. + /// + /// Optional ETag. + /// Resource Id represents the complete path to the + /// resource. + /// Input Managed Identity Details + /// Resource location. + /// Resource name associated with the + /// resource. + /// Resource tags. + /// Resource type represents the complete path of + /// the form Namespace/ResourceType/ResourceType/... + public DppTrackedResource(string eTag = default(string), string id = default(string), DppIdentityDetails identity = default(DppIdentityDetails), string location = default(string), string name = default(string), IDictionary tags = default(IDictionary), string type = default(string), SystemData systemData = default(SystemData)) + { + ETag = eTag; + Id = id; + Identity = identity; + Location = location; + Name = name; + Tags = tags; + Type = type; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets optional ETag. + /// + [JsonProperty(PropertyName = "eTag")] + public string ETag { get; set; } + + /// + /// Gets resource Id represents the complete path to the resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets or sets input Managed Identity Details + /// + [JsonProperty(PropertyName = "identity")] + public DppIdentityDetails Identity { get; set; } + + /// + /// Gets or sets resource location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets resource name associated with the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets resource type represents the complete path of the form + /// Namespace/ResourceType/ResourceType/... + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppTrackedResourceList.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppTrackedResourceList.cs new file mode 100644 index 0000000000000..0c8eebca323fd --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/DppTrackedResourceList.cs @@ -0,0 +1,50 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class DppTrackedResourceList + { + /// + /// Initializes a new instance of the DppTrackedResourceList class. + /// + public DppTrackedResourceList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DppTrackedResourceList class. + /// + /// The uri to fetch the next page of resources. + /// Call ListNext() fetches next page of resources. + public DppTrackedResourceList(string nextLink = default(string)) + { + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the uri to fetch the next page of resources. Call + /// ListNext() fetches next page of resources. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Error.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Error.cs new file mode 100644 index 0000000000000..8b24b058c2b84 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Error.cs @@ -0,0 +1,85 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource management error response. + /// + 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 additional info. + /// The error code. + /// The error details. + /// The error message. + /// The error target. + public Error(IList additionalInfo = default(IList), string code = default(string), IList details = default(IList), string message = default(string), string target = default(string)) + { + AdditionalInfo = additionalInfo; + Code = code; + Details = details; + Message = message; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 0000000000000..0ee4461683081 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info. + /// The additional info type. + public ErrorAdditionalInfo(object info = default(object), string type = default(string)) + { + Info = info; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ExportJobsResult.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ExportJobsResult.cs new file mode 100644 index 0000000000000..bd35db56b707c --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ExportJobsResult.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ExportJobsResult + /// + /// + /// The result for export jobs containing blob details. + /// + public partial class ExportJobsResult + { + /// + /// Initializes a new instance of the ExportJobsResult class. + /// + public ExportJobsResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExportJobsResult class. + /// + /// URL of the blob into which the serialized + /// string of list of jobs is exported. + /// SAS key to access the blob. + /// URL of the blob into which the + /// ExcelFile is uploaded. + /// SAS key to access the ExcelFile + /// blob. + public ExportJobsResult(string blobUrl = default(string), string blobSasKey = default(string), string excelFileBlobUrl = default(string), string excelFileBlobSasKey = default(string)) + { + BlobUrl = blobUrl; + BlobSasKey = blobSasKey; + ExcelFileBlobUrl = excelFileBlobUrl; + ExcelFileBlobSasKey = excelFileBlobSasKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets URL of the blob into which the serialized string of list of + /// jobs is exported. + /// + [JsonProperty(PropertyName = "blobUrl")] + public string BlobUrl { get; private set; } + + /// + /// Gets SAS key to access the blob. + /// + [JsonProperty(PropertyName = "blobSasKey")] + public string BlobSasKey { get; private set; } + + /// + /// Gets URL of the blob into which the ExcelFile is uploaded. + /// + [JsonProperty(PropertyName = "excelFileBlobUrl")] + public string ExcelFileBlobUrl { get; private set; } + + /// + /// Gets SAS key to access the ExcelFile blob. + /// + [JsonProperty(PropertyName = "excelFileBlobSasKey")] + public string ExcelFileBlobSasKey { get; private set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ExportJobsTriggerHeaders.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ExportJobsTriggerHeaders.cs new file mode 100644 index 0000000000000..c9df8984f5e83 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ExportJobsTriggerHeaders.cs @@ -0,0 +1,65 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Trigger operation. + /// + public partial class ExportJobsTriggerHeaders + { + /// + /// Initializes a new instance of the ExportJobsTriggerHeaders class. + /// + public ExportJobsTriggerHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExportJobsTriggerHeaders class. + /// + /// The URL of the resource used to check the + /// status of the asynchronous operation. + /// Suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + public ExportJobsTriggerHeaders(string location = default(string), int? retryAfter = default(int?)) + { + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the URL of the resource used to check the status of + /// the asynchronous operation. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets suggested delay to check the status of the + /// asynchronous operation. The value is an integer that represents the + /// seconds. + /// + [JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureSupportStatus.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureSupportStatus.cs new file mode 100644 index 0000000000000..58c16d61c20b1 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureSupportStatus.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.DataProtection.Models +{ + + /// + /// Defines values for FeatureSupportStatus. + /// + public static class FeatureSupportStatus + { + public const string Invalid = "Invalid"; + public const string NotSupported = "NotSupported"; + public const string AlphaPreview = "AlphaPreview"; + public const string PrivatePreview = "PrivatePreview"; + public const string PublicPreview = "PublicPreview"; + public const string GenerallyAvailable = "GenerallyAvailable"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureType.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureType.cs new file mode 100644 index 0000000000000..481ec8c9f1d2a --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureType.cs @@ -0,0 +1,22 @@ +// +// 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.DataProtection.Models +{ + + /// + /// Defines values for FeatureType. + /// + public static class FeatureType + { + public const string Invalid = "Invalid"; + public const string DataSourceType = "DataSourceType"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationRequest.cs new file mode 100644 index 0000000000000..d015b787a33d6 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationRequest.cs @@ -0,0 +1,61 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Base class for feature object + /// + public partial class FeatureValidationRequest : FeatureValidationRequestBase + { + /// + /// Initializes a new instance of the FeatureValidationRequest class. + /// + public FeatureValidationRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FeatureValidationRequest class. + /// + /// backup support feature type. Possible + /// values include: 'Invalid', 'DataSourceType' + /// backup support feature name. + public FeatureValidationRequest(string featureType = default(string), string featureName = default(string)) + { + FeatureType = featureType; + FeatureName = featureName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets backup support feature type. Possible values include: + /// 'Invalid', 'DataSourceType' + /// + [JsonProperty(PropertyName = "featureType")] + public string FeatureType { get; set; } + + /// + /// Gets or sets backup support feature name. + /// + [JsonProperty(PropertyName = "featureName")] + public string FeatureName { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationRequestBase.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationRequestBase.cs new file mode 100644 index 0000000000000..da4a29209e116 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationRequestBase.cs @@ -0,0 +1,36 @@ +// +// 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.DataProtection.Models +{ + using System.Linq; + + /// + /// Base class for Backup Feature support + /// + public partial class FeatureValidationRequestBase + { + /// + /// Initializes a new instance of the FeatureValidationRequestBase + /// class. + /// + public FeatureValidationRequestBase() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationResponse.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationResponse.cs new file mode 100644 index 0000000000000..443b2ab5a6f2a --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationResponse.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Feature Validation Response + /// + public partial class FeatureValidationResponse : FeatureValidationResponseBase + { + /// + /// Initializes a new instance of the FeatureValidationResponse class. + /// + public FeatureValidationResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FeatureValidationResponse class. + /// + /// backup support feature type. Possible + /// values include: 'Invalid', 'DataSourceType' + /// Response features + public FeatureValidationResponse(string featureType = default(string), IList features = default(IList)) + { + FeatureType = featureType; + Features = features; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets backup support feature type. Possible values include: + /// 'Invalid', 'DataSourceType' + /// + [JsonProperty(PropertyName = "featureType")] + public string FeatureType { get; set; } + + /// + /// Gets or sets response features + /// + [JsonProperty(PropertyName = "features")] + public IList Features { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationResponseBase.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationResponseBase.cs new file mode 100644 index 0000000000000..9897681d1496b --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/FeatureValidationResponseBase.cs @@ -0,0 +1,36 @@ +// +// 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.DataProtection.Models +{ + using System.Linq; + + /// + /// Base class for Backup Feature support + /// + public partial class FeatureValidationResponseBase + { + /// + /// Initializes a new instance of the FeatureValidationResponseBase + /// class. + /// + public FeatureValidationResponseBase() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ImmediateCopyOption.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ImmediateCopyOption.cs new file mode 100644 index 0000000000000..6c05eb881a2ad --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ImmediateCopyOption.cs @@ -0,0 +1,38 @@ +// +// 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.DataProtection.Models +{ + using System.Linq; + + /// + /// ImmediateCopyOption + /// + /// + /// Immediate copy Option + /// + public partial class ImmediateCopyOption : CopyOption + { + /// + /// Initializes a new instance of the ImmediateCopyOption class. + /// + public ImmediateCopyOption() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/InnerError.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/InnerError.cs new file mode 100644 index 0000000000000..9db3fa241a2a7 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/InnerError.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// InnerError + /// + /// + /// Inner Error + /// + public partial class InnerError + { + /// + /// Initializes a new instance of the InnerError class. + /// + public InnerError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InnerError class. + /// + /// Any Key value pairs that can be + /// provided to the client for additional verbose information. + /// Unique code for this error + /// Child Inner Error, to allow + /// Nesting. + public InnerError(IDictionary additionalInfo = default(IDictionary), string code = default(string), InnerError embeddedInnerError = default(InnerError)) + { + AdditionalInfo = additionalInfo; + Code = code; + EmbeddedInnerError = embeddedInnerError; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets any Key value pairs that can be provided to the client + /// for additional verbose information. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IDictionary AdditionalInfo { get; set; } + + /// + /// Gets or sets unique code for this error + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets child Inner Error, to allow Nesting. + /// + [JsonProperty(PropertyName = "embeddedInnerError")] + public InnerError EmbeddedInnerError { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/JobExtendedInfo.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/JobExtendedInfo.cs new file mode 100644 index 0000000000000..2aa61dd0572db --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/JobExtendedInfo.cs @@ -0,0 +1,106 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Extended Information about the job + /// + public partial class JobExtendedInfo + { + /// + /// Initializes a new instance of the JobExtendedInfo class. + /// + public JobExtendedInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobExtendedInfo class. + /// + /// Job's Additional Details + /// State of the Backup + /// Instance + /// Number of bytes + /// transferred + /// Destination where restore is + /// done + /// Details of the Source Recovery + /// Point + /// List of Sub Tasks of the job + /// Details of the Target Recovery + /// Point + public JobExtendedInfo(IDictionary additionalDetails = default(IDictionary), string backupInstanceState = default(string), double? dataTransferredInBytes = default(double?), string recoveryDestination = default(string), RestoreJobRecoveryPointDetails sourceRecoverPoint = default(RestoreJobRecoveryPointDetails), IList subTasks = default(IList), RestoreJobRecoveryPointDetails targetRecoverPoint = default(RestoreJobRecoveryPointDetails)) + { + AdditionalDetails = additionalDetails; + BackupInstanceState = backupInstanceState; + DataTransferredInBytes = dataTransferredInBytes; + RecoveryDestination = recoveryDestination; + SourceRecoverPoint = sourceRecoverPoint; + SubTasks = subTasks; + TargetRecoverPoint = targetRecoverPoint; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets job's Additional Details + /// + [JsonProperty(PropertyName = "additionalDetails")] + public IDictionary AdditionalDetails { get; set; } + + /// + /// Gets state of the Backup Instance + /// + [JsonProperty(PropertyName = "backupInstanceState")] + public string BackupInstanceState { get; private set; } + + /// + /// Gets number of bytes transferred + /// + [JsonProperty(PropertyName = "dataTransferredInBytes")] + public double? DataTransferredInBytes { get; private set; } + + /// + /// Gets destination where restore is done + /// + [JsonProperty(PropertyName = "recoveryDestination")] + public string RecoveryDestination { get; private set; } + + /// + /// Gets details of the Source Recovery Point + /// + [JsonProperty(PropertyName = "sourceRecoverPoint")] + public RestoreJobRecoveryPointDetails SourceRecoverPoint { get; private set; } + + /// + /// Gets list of Sub Tasks of the job + /// + [JsonProperty(PropertyName = "subTasks")] + public IList SubTasks { get; private set; } + + /// + /// Gets details of the Target Recovery Point + /// + [JsonProperty(PropertyName = "targetRecoverPoint")] + public RestoreJobRecoveryPointDetails TargetRecoverPoint { get; private set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/JobSubTask.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/JobSubTask.cs new file mode 100644 index 0000000000000..61bcd82a9d7b1 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/JobSubTask.cs @@ -0,0 +1,104 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Details of Job's Sub Task + /// + public partial class JobSubTask + { + /// + /// Initializes a new instance of the JobSubTask class. + /// + public JobSubTask() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobSubTask class. + /// + /// Task Id of the Sub Task + /// Name of the Sub Task + /// Status of the Sub Task + /// Additional details of Sub + /// Tasks + /// Progress of the Sub Task + public JobSubTask(int taskId, string taskName, string taskStatus, IDictionary additionalDetails = default(IDictionary), string taskProgress = default(string)) + { + AdditionalDetails = additionalDetails; + TaskId = taskId; + TaskName = taskName; + TaskProgress = taskProgress; + TaskStatus = taskStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional details of Sub Tasks + /// + [JsonProperty(PropertyName = "additionalDetails")] + public IDictionary AdditionalDetails { get; set; } + + /// + /// Gets or sets task Id of the Sub Task + /// + [JsonProperty(PropertyName = "taskId")] + public int TaskId { get; set; } + + /// + /// Gets or sets name of the Sub Task + /// + [JsonProperty(PropertyName = "taskName")] + public string TaskName { get; set; } + + /// + /// Gets progress of the Sub Task + /// + [JsonProperty(PropertyName = "taskProgress")] + public string TaskProgress { get; private set; } + + /// + /// Gets or sets status of the Sub Task + /// + [JsonProperty(PropertyName = "taskStatus")] + public string TaskStatus { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TaskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TaskName"); + } + if (TaskStatus == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TaskStatus"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Month.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Month.cs new file mode 100644 index 0000000000000..da11e5982bf07 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Month.cs @@ -0,0 +1,32 @@ +// +// 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.DataProtection.Models +{ + + /// + /// Defines values for Month. + /// + public static class Month + { + public const string April = "April"; + public const string August = "August"; + public const string December = "December"; + public const string February = "February"; + public const string January = "January"; + public const string July = "July"; + public const string June = "June"; + public const string March = "March"; + public const string May = "May"; + public const string November = "November"; + public const string October = "October"; + public const string September = "September"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/OperationExtendedInfo.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/OperationExtendedInfo.cs new file mode 100644 index 0000000000000..118a716e040ff --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/OperationExtendedInfo.cs @@ -0,0 +1,57 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// OperationExtendedInfo + /// + /// + /// Operation Extended Info + /// + public partial class OperationExtendedInfo + { + /// + /// Initializes a new instance of the OperationExtendedInfo class. + /// + public OperationExtendedInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationExtendedInfo class. + /// + /// This property will be used as the + /// discriminator for deciding the specific types in the polymorphic + /// chain of types. + public OperationExtendedInfo(string objectType = default(string)) + { + ObjectType = objectType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this property will be used as the discriminator for + /// deciding the specific types in the polymorphic chain of types. + /// + [JsonProperty(PropertyName = "objectType")] + public string ObjectType { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/OperationJobExtendedInfo.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/OperationJobExtendedInfo.cs new file mode 100644 index 0000000000000..e1cb5f8e3fb66 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/OperationJobExtendedInfo.cs @@ -0,0 +1,59 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// OperationJobExtendedInfo + /// + /// + /// Operation Job Extended Info + /// + public partial class OperationJobExtendedInfo : OperationExtendedInfo + { + /// + /// Initializes a new instance of the OperationJobExtendedInfo class. + /// + public OperationJobExtendedInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationJobExtendedInfo class. + /// + /// This property will be used as the + /// discriminator for deciding the specific types in the polymorphic + /// chain of types. + /// Arm Id of the job created for this + /// operation. + public OperationJobExtendedInfo(string objectType = default(string), string jobId = default(string)) + : base(objectType) + { + JobId = jobId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets arm Id of the job created for this operation. + /// + [JsonProperty(PropertyName = "jobId")] + public string JobId { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/OperationResource.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/OperationResource.cs new file mode 100644 index 0000000000000..08e5eeace08ba --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/OperationResource.cs @@ -0,0 +1,119 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// OperationResource + /// + /// + /// Operation Resource + /// + [Rest.Serialization.JsonTransformation] + public partial class OperationResource + { + /// + /// Initializes a new instance of the OperationResource class. + /// + public OperationResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationResource class. + /// + /// End time of the operation + /// Required if status == failed or status == + /// canceled. This is the OData v4 error format, used by the RPC and + /// will go into the v2.2 Azure REST API guidelines. + /// The full set of optional properties (e.g. inner errors / details) + /// can be found in the "Error Response" section. + /// It should match what is used to GET the operation + /// result + /// It must match the last segment of the "id" + /// field, and will typically be a GUID / system generated + /// value + /// This property will be used as the + /// discriminator for deciding the specific types in the polymorphic + /// chain of types. + /// Start time of the operation + public OperationResource(System.DateTime? endTime = default(System.DateTime?), Error error = default(Error), string id = default(string), string name = default(string), string objectType = default(string), System.DateTime? startTime = default(System.DateTime?), string status = default(string)) + { + EndTime = endTime; + Error = error; + Id = id; + Name = name; + ObjectType = objectType; + StartTime = startTime; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets end time of the operation + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets required if status == failed or status == canceled. + /// This is the OData v4 error format, used by the RPC and will go into + /// the v2.2 Azure REST API guidelines. + /// The full set of optional properties (e.g. inner errors / details) + /// can be found in the "Error Response" section. + /// + [JsonProperty(PropertyName = "error")] + public Error Error { get; set; } + + /// + /// Gets or sets it should match what is used to GET the operation + /// result + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets it must match the last segment of the "id" field, and + /// will typically be a GUID / system generated value + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets this property will be used as the discriminator for + /// deciding the specific types in the polymorphic chain of types. + /// + [JsonProperty(PropertyName = "properties.objectType")] + public string ObjectType { get; set; } + + /// + /// Gets or sets start time of the operation + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Page.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Page.cs new file mode 100644 index 0000000000000..8a2d2c53f9f6a --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Page.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.DataProtection.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/PatchResourceRequestInput.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/PatchResourceRequestInput.cs new file mode 100644 index 0000000000000..719cd50a9317f --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/PatchResourceRequestInput.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// PatchResourceRequestInput + /// + /// + /// Patch Request content for Microsoft.DataProtection resources + /// + public partial class PatchResourceRequestInput + { + /// + /// Initializes a new instance of the PatchResourceRequestInput class. + /// + public PatchResourceRequestInput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PatchResourceRequestInput class. + /// + /// Input Managed Identity Details + /// Resource tags. + public PatchResourceRequestInput(DppIdentityDetails identity = default(DppIdentityDetails), IDictionary tags = default(IDictionary)) + { + Identity = identity; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets input Managed Identity Details + /// + [JsonProperty(PropertyName = "identity")] + public DppIdentityDetails Identity { get; set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/PolicyInfo.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/PolicyInfo.cs new file mode 100644 index 0000000000000..38987e97e0ce5 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/PolicyInfo.cs @@ -0,0 +1,81 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// PolicyInfo + /// + /// + /// Policy Info in backupInstance + /// + public partial class PolicyInfo + { + /// + /// Initializes a new instance of the PolicyInfo class. + /// + public PolicyInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyInfo class. + /// + /// Policy parameters for the backup + /// instance + public PolicyInfo(string policyId, string policyVersion = default(string), PolicyParameters policyParameters = default(PolicyParameters)) + { + PolicyId = policyId; + PolicyVersion = policyVersion; + PolicyParameters = policyParameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "policyId")] + public string PolicyId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "policyVersion")] + public string PolicyVersion { get; private set; } + + /// + /// Gets or sets policy parameters for the backup instance + /// + [JsonProperty(PropertyName = "policyParameters")] + public PolicyParameters PolicyParameters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PolicyId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PolicyId"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/PolicyParameters.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/PolicyParameters.cs new file mode 100644 index 0000000000000..3e85f056b0949 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/PolicyParameters.cs @@ -0,0 +1,54 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Parameters in Policy + /// + public partial class PolicyParameters + { + /// + /// Initializes a new instance of the PolicyParameters class. + /// + public PolicyParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyParameters class. + /// + /// Gets or sets the DataStore + /// Parameters + public PolicyParameters(IList dataStoreParametersList = default(IList)) + { + DataStoreParametersList = dataStoreParametersList; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the DataStore Parameters + /// + [JsonProperty(PropertyName = "dataStoreParametersList")] + public IList DataStoreParametersList { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ProtectionStatusDetails.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ProtectionStatusDetails.cs new file mode 100644 index 0000000000000..172b9ba5167e1 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ProtectionStatusDetails.cs @@ -0,0 +1,69 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ProtectionStatusDetails + /// + /// + /// Protection status details + /// + public partial class ProtectionStatusDetails + { + /// + /// Initializes a new instance of the ProtectionStatusDetails class. + /// + public ProtectionStatusDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProtectionStatusDetails class. + /// + /// Specifies the protection status error of + /// the resource + /// Specifies the protection status of the + /// resource. Possible values include: 'ConfiguringProtection', + /// 'ConfiguringProtectionFailed', 'ProtectionConfigured', + /// 'ProtectionStopped', 'SoftDeleted', 'SoftDeleting' + public ProtectionStatusDetails(UserFacingError errorDetails = default(UserFacingError), string status = default(string)) + { + ErrorDetails = errorDetails; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the protection status error of the resource + /// + [JsonProperty(PropertyName = "errorDetails")] + public UserFacingError ErrorDetails { get; set; } + + /// + /// Gets or sets specifies the protection status of the resource. + /// Possible values include: 'ConfiguringProtection', + /// 'ConfiguringProtectionFailed', 'ProtectionConfigured', + /// 'ProtectionStopped', 'SoftDeleted', 'SoftDeleting' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ProvisioningState.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..d192764a91314 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,25 @@ +// +// 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.DataProtection.Models +{ + + /// + /// Defines values for ProvisioningState. + /// + public static class ProvisioningState + { + public const string Failed = "Failed"; + public const string Provisioning = "Provisioning"; + public const string Succeeded = "Succeeded"; + public const string Unknown = "Unknown"; + public const string Updating = "Updating"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RecoveryPointDataStoreDetails.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RecoveryPointDataStoreDetails.cs new file mode 100644 index 0000000000000..3e99d335eaf2a --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RecoveryPointDataStoreDetails.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// RecoveryPointDataStoreDetails + /// + /// + /// RecoveryPoint datastore details + /// + public partial class RecoveryPointDataStoreDetails + { + /// + /// Initializes a new instance of the RecoveryPointDataStoreDetails + /// class. + /// + public RecoveryPointDataStoreDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecoveryPointDataStoreDetails + /// class. + /// + /// Possible values include: + /// 'CREATE_IN_PROGRESS', 'COMPLETED', 'DELETE_IN_PROGRESS', 'DELETED', + /// 'FAILED' + public RecoveryPointDataStoreDetails(System.DateTime? creationTime = default(System.DateTime?), System.DateTime? expiryTime = default(System.DateTime?), string id = default(string), string metaData = default(string), string state = default(string), string type = default(string), bool? visible = default(bool?), System.DateTime? rehydrationExpiryTime = default(System.DateTime?), string rehydrationStatus = default(string)) + { + CreationTime = creationTime; + ExpiryTime = expiryTime; + Id = id; + MetaData = metaData; + State = state; + Type = type; + Visible = visible; + RehydrationExpiryTime = rehydrationExpiryTime; + RehydrationStatus = rehydrationStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "creationTime")] + public System.DateTime? CreationTime { get; set; } + + /// + /// + [JsonProperty(PropertyName = "expiryTime")] + public System.DateTime? ExpiryTime { get; set; } + + /// + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// + [JsonProperty(PropertyName = "metaData")] + public string MetaData { get; set; } + + /// + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + /// + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// + [JsonProperty(PropertyName = "visible")] + public bool? Visible { get; set; } + + /// + /// + [JsonProperty(PropertyName = "rehydrationExpiryTime")] + public System.DateTime? RehydrationExpiryTime { get; private set; } + + /// + /// Gets possible values include: 'CREATE_IN_PROGRESS', 'COMPLETED', + /// 'DELETE_IN_PROGRESS', 'DELETED', 'FAILED' + /// + [JsonProperty(PropertyName = "rehydrationStatus")] + public string RehydrationStatus { get; private set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RecoveryPointsFilters.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RecoveryPointsFilters.cs new file mode 100644 index 0000000000000..6a809025e6d98 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RecoveryPointsFilters.cs @@ -0,0 +1,76 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class RecoveryPointsFilters + { + /// + /// Initializes a new instance of the RecoveryPointsFilters class. + /// + public RecoveryPointsFilters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RecoveryPointsFilters class. + /// + public RecoveryPointsFilters(string restorePointDataStoreId = default(string), bool? isVisible = default(bool?), string startDate = default(string), string endDate = default(string), bool? extendedInfo = default(bool?), string restorePointState = default(string)) + { + RestorePointDataStoreId = restorePointDataStoreId; + IsVisible = isVisible; + StartDate = startDate; + EndDate = endDate; + ExtendedInfo = extendedInfo; + RestorePointState = restorePointState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "restorePointDataStoreId")] + public string RestorePointDataStoreId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "isVisible")] + public bool? IsVisible { get; set; } + + /// + /// + [JsonProperty(PropertyName = "startDate")] + public string StartDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "endDate")] + public string EndDate { get; set; } + + /// + /// + [JsonProperty(PropertyName = "extendedInfo")] + public bool? ExtendedInfo { get; set; } + + /// + /// + [JsonProperty(PropertyName = "restorePointState")] + public string RestorePointState { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RehydrationPriority.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RehydrationPriority.cs new file mode 100644 index 0000000000000..65b197930b1ef --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RehydrationPriority.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.DataProtection.Models +{ + + /// + /// Defines values for RehydrationPriority. + /// + public static class RehydrationPriority + { + public const string Invalid = "Invalid"; + public const string High = "High"; + public const string Standard = "Standard"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RehydrationStatus.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RehydrationStatus.cs new file mode 100644 index 0000000000000..d19c9d7e85d04 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RehydrationStatus.cs @@ -0,0 +1,25 @@ +// +// 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.DataProtection.Models +{ + + /// + /// Defines values for RehydrationStatus. + /// + public static class RehydrationStatus + { + public const string CREATEINPROGRESS = "CREATE_IN_PROGRESS"; + public const string COMPLETED = "COMPLETED"; + public const string DELETEINPROGRESS = "DELETE_IN_PROGRESS"; + public const string DELETED = "DELETED"; + public const string FAILED = "FAILED"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreFilesTargetInfo.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreFilesTargetInfo.cs new file mode 100644 index 0000000000000..d7b3e302bce64 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreFilesTargetInfo.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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class encapsulating restore as files target parameters + /// + public partial class RestoreFilesTargetInfo : RestoreTargetInfoBase + { + /// + /// Initializes a new instance of the RestoreFilesTargetInfo class. + /// + public RestoreFilesTargetInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestoreFilesTargetInfo class. + /// + /// Destination of RestoreAsFiles + /// operation, when destination is not a datasource + /// Target Restore region + public RestoreFilesTargetInfo(TargetDetails targetDetails, string restoreLocation = default(string)) + : base(restoreLocation) + { + TargetDetails = targetDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets destination of RestoreAsFiles operation, when + /// destination is not a datasource + /// + [JsonProperty(PropertyName = "targetDetails")] + public TargetDetails TargetDetails { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TargetDetails == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TargetDetails"); + } + if (TargetDetails != null) + { + TargetDetails.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreJobRecoveryPointDetails.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreJobRecoveryPointDetails.cs new file mode 100644 index 0000000000000..ce9c1e82a9a3a --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreJobRecoveryPointDetails.cs @@ -0,0 +1,54 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class RestoreJobRecoveryPointDetails + { + /// + /// Initializes a new instance of the RestoreJobRecoveryPointDetails + /// class. + /// + public RestoreJobRecoveryPointDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestoreJobRecoveryPointDetails + /// class. + /// + public RestoreJobRecoveryPointDetails(string recoveryPointID = default(string), System.DateTime? recoveryPointTime = default(System.DateTime?)) + { + RecoveryPointID = recoveryPointID; + RecoveryPointTime = recoveryPointTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "recoveryPointID")] + public string RecoveryPointID { get; set; } + + /// + /// + [JsonProperty(PropertyName = "recoveryPointTime")] + public System.DateTime? RecoveryPointTime { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreTargetInfo.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreTargetInfo.cs new file mode 100644 index 0000000000000..33b3e29d358f1 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreTargetInfo.cs @@ -0,0 +1,84 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class encapsulating restore target parameters + /// + public partial class RestoreTargetInfo : RestoreTargetInfoBase + { + /// + /// Initializes a new instance of the RestoreTargetInfo class. + /// + public RestoreTargetInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestoreTargetInfo class. + /// + /// Information of target DS + /// Target Restore region + /// Information of target DS + /// Set + public RestoreTargetInfo(Datasource datasourceInfo, string restoreLocation = default(string), DatasourceSet datasourceSetInfo = default(DatasourceSet)) + : base(restoreLocation) + { + DatasourceInfo = datasourceInfo; + DatasourceSetInfo = datasourceSetInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets information of target DS + /// + [JsonProperty(PropertyName = "datasourceInfo")] + public Datasource DatasourceInfo { get; set; } + + /// + /// Gets or sets information of target DS Set + /// + [JsonProperty(PropertyName = "datasourceSetInfo")] + public DatasourceSet DatasourceSetInfo { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DatasourceInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DatasourceInfo"); + } + if (DatasourceInfo != null) + { + DatasourceInfo.Validate(); + } + if (DatasourceSetInfo != null) + { + DatasourceSetInfo.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreTargetInfoBase.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreTargetInfoBase.cs new file mode 100644 index 0000000000000..24c8eb40f70e4 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreTargetInfoBase.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Base class common to RestoreTargetInfo and RestoreFilesTargetInfo + /// + public partial class RestoreTargetInfoBase + { + /// + /// Initializes a new instance of the RestoreTargetInfoBase class. + /// + public RestoreTargetInfoBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RestoreTargetInfoBase class. + /// + /// Target Restore region + public RestoreTargetInfoBase(string restoreLocation = default(string)) + { + RestoreLocation = restoreLocation; + CustomInit(); + } + /// + /// Static constructor for RestoreTargetInfoBase class. + /// + static RestoreTargetInfoBase() + { + RecoveryOption = "FailIfExists"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets target Restore region + /// + [JsonProperty(PropertyName = "restoreLocation")] + public string RestoreLocation { get; set; } + + /// + /// Recovery Option + /// + [JsonProperty(PropertyName = "recoveryOption")] + public static string RecoveryOption { get; private set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreTargetLocationType.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreTargetLocationType.cs new file mode 100644 index 0000000000000..f0ce1a65ed595 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RestoreTargetLocationType.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.DataProtection.Models +{ + + /// + /// Defines values for RestoreTargetLocationType. + /// + public static class RestoreTargetLocationType + { + public const string Invalid = "Invalid"; + public const string AzureBlobs = "AzureBlobs"; + public const string AzureFiles = "AzureFiles"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RetentionTag.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RetentionTag.cs new file mode 100644 index 0000000000000..206261df32506 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/RetentionTag.cs @@ -0,0 +1,85 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// RetentionTag + /// + /// + /// Retention tag + /// + public partial class RetentionTag + { + /// + /// Initializes a new instance of the RetentionTag class. + /// + public RetentionTag() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RetentionTag class. + /// + /// Retention Tag Name to relate it to retention + /// rule. + /// Retention Tag version. + /// Retention Tag version. + public RetentionTag(string tagName, string eTag = default(string), string id = default(string)) + { + ETag = eTag; + Id = id; + TagName = tagName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets retention Tag version. + /// + [JsonProperty(PropertyName = "eTag")] + public string ETag { get; private set; } + + /// + /// Gets retention Tag version. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets or sets retention Tag Name to relate it to retention rule. + /// + [JsonProperty(PropertyName = "tagName")] + public string TagName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TagName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TagName"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ScheduleBasedBackupCriteria.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ScheduleBasedBackupCriteria.cs new file mode 100644 index 0000000000000..e600d2e12ca4a --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ScheduleBasedBackupCriteria.cs @@ -0,0 +1,108 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// ScheduleBasedBackupCriteria + /// + /// + /// Schedule based backup criteria + /// + public partial class ScheduleBasedBackupCriteria : BackupCriteria + { + /// + /// Initializes a new instance of the ScheduleBasedBackupCriteria + /// class. + /// + public ScheduleBasedBackupCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduleBasedBackupCriteria + /// class. + /// + /// it contains absolute values like + /// "AllBackup" / "FirstOfDay" / "FirstOfWeek" / "FirstOfMonth" + /// and should be part of AbsoluteMarker enum + /// This is day of the month from 1 to 28 + /// other wise last of month + /// It should be + /// Sunday/Monday/T..../Saturday + /// It should be + /// January/February/....../December + /// List of schedule times for + /// backup + /// It should be + /// First/Second/Third/Fourth/Last + public ScheduleBasedBackupCriteria(IList absoluteCriteria = default(IList), IList daysOfMonth = default(IList), IList daysOfTheWeek = default(IList), IList monthsOfYear = default(IList), IList scheduleTimes = default(IList), IList weeksOfTheMonth = default(IList)) + { + AbsoluteCriteria = absoluteCriteria; + DaysOfMonth = daysOfMonth; + DaysOfTheWeek = daysOfTheWeek; + MonthsOfYear = monthsOfYear; + ScheduleTimes = scheduleTimes; + WeeksOfTheMonth = weeksOfTheMonth; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets it contains absolute values like "AllBackup" / + /// "FirstOfDay" / "FirstOfWeek" / "FirstOfMonth" + /// and should be part of AbsoluteMarker enum + /// + [JsonProperty(PropertyName = "absoluteCriteria")] + public IList AbsoluteCriteria { get; set; } + + /// + /// Gets or sets this is day of the month from 1 to 28 other wise last + /// of month + /// + [JsonProperty(PropertyName = "daysOfMonth")] + public IList DaysOfMonth { get; set; } + + /// + /// Gets or sets it should be Sunday/Monday/T..../Saturday + /// + [JsonProperty(PropertyName = "daysOfTheWeek")] + public IList DaysOfTheWeek { get; set; } + + /// + /// Gets or sets it should be January/February/....../December + /// + [JsonProperty(PropertyName = "monthsOfYear")] + public IList MonthsOfYear { get; set; } + + /// + /// Gets or sets list of schedule times for backup + /// + [JsonProperty(PropertyName = "scheduleTimes")] + public IList ScheduleTimes { get; set; } + + /// + /// Gets or sets it should be First/Second/Third/Fourth/Last + /// + [JsonProperty(PropertyName = "weeksOfTheMonth")] + public IList WeeksOfTheMonth { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ScheduleBasedTriggerContext.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ScheduleBasedTriggerContext.cs new file mode 100644 index 0000000000000..329cc882831d8 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ScheduleBasedTriggerContext.cs @@ -0,0 +1,100 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// ScheduleBasedTriggerContext + /// + /// + /// Schedule based trigger context + /// + public partial class ScheduleBasedTriggerContext : TriggerContext + { + /// + /// Initializes a new instance of the ScheduleBasedTriggerContext + /// class. + /// + public ScheduleBasedTriggerContext() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ScheduleBasedTriggerContext + /// class. + /// + /// Schedule for this backup + /// List of tags that can be applicable + /// for given schedule. + public ScheduleBasedTriggerContext(BackupSchedule schedule, IList taggingCriteria) + { + Schedule = schedule; + TaggingCriteria = taggingCriteria; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets schedule for this backup + /// + [JsonProperty(PropertyName = "schedule")] + public BackupSchedule Schedule { get; set; } + + /// + /// Gets or sets list of tags that can be applicable for given + /// schedule. + /// + [JsonProperty(PropertyName = "taggingCriteria")] + public IList TaggingCriteria { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Schedule == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Schedule"); + } + if (TaggingCriteria == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TaggingCriteria"); + } + if (Schedule != null) + { + Schedule.Validate(); + } + if (TaggingCriteria != null) + { + foreach (var element in TaggingCriteria) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SourceDataStoreType.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SourceDataStoreType.cs new file mode 100644 index 0000000000000..3236546888b66 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SourceDataStoreType.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.DataProtection.Models +{ + + /// + /// Defines values for SourceDataStoreType. + /// + public static class SourceDataStoreType + { + public const string ArchiveStore = "ArchiveStore"; + public const string SnapshotStore = "SnapshotStore"; + public const string VaultStore = "VaultStore"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SourceLifeCycle.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SourceLifeCycle.cs new file mode 100644 index 0000000000000..c660c95941e2d --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SourceLifeCycle.cs @@ -0,0 +1,102 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// SourceLifeCycle + /// + /// + /// Source LifeCycle + /// + public partial class SourceLifeCycle + { + /// + /// Initializes a new instance of the SourceLifeCycle class. + /// + public SourceLifeCycle() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SourceLifeCycle class. + /// + public SourceLifeCycle(DeleteOption deleteAfter, DataStoreInfoBase sourceDataStore, IList targetDataStoreCopySettings = default(IList)) + { + DeleteAfter = deleteAfter; + SourceDataStore = sourceDataStore; + TargetDataStoreCopySettings = targetDataStoreCopySettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "deleteAfter")] + public DeleteOption DeleteAfter { get; set; } + + /// + /// + [JsonProperty(PropertyName = "sourceDataStore")] + public DataStoreInfoBase SourceDataStore { get; set; } + + /// + /// + [JsonProperty(PropertyName = "targetDataStoreCopySettings")] + public IList TargetDataStoreCopySettings { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DeleteAfter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DeleteAfter"); + } + if (SourceDataStore == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceDataStore"); + } + if (DeleteAfter != null) + { + DeleteAfter.Validate(); + } + if (SourceDataStore != null) + { + SourceDataStore.Validate(); + } + if (TargetDataStoreCopySettings != null) + { + foreach (var element in TargetDataStoreCopySettings) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Status.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Status.cs new file mode 100644 index 0000000000000..18de7b766a97a --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/Status.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.DataProtection.Models +{ + + /// + /// Defines values for Status. + /// + public static class Status + { + public const string ConfiguringProtection = "ConfiguringProtection"; + public const string ConfiguringProtectionFailed = "ConfiguringProtectionFailed"; + public const string ProtectionConfigured = "ProtectionConfigured"; + public const string ProtectionStopped = "ProtectionStopped"; + public const string SoftDeleted = "SoftDeleted"; + public const string SoftDeleting = "SoftDeleting"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/StorageSetting.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/StorageSetting.cs new file mode 100644 index 0000000000000..87dc894281986 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/StorageSetting.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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// StorageSetting + /// + /// + /// Storage setting + /// + public partial class StorageSetting + { + /// + /// Initializes a new instance of the StorageSetting class. + /// + public StorageSetting() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageSetting class. + /// + /// Gets or sets the type of the datastore. + /// Possible values include: 'ArchiveStore', 'SnapshotStore', + /// 'VaultStore' + /// Gets or sets the type. Possible values include: + /// 'GeoRedundant', 'LocallyRedundant' + public StorageSetting(string datastoreType = default(string), string type = default(string)) + { + DatastoreType = datastoreType; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of the datastore. Possible values include: + /// 'ArchiveStore', 'SnapshotStore', 'VaultStore' + /// + [JsonProperty(PropertyName = "datastoreType")] + public string DatastoreType { get; set; } + + /// + /// Gets or sets the type. Possible values include: 'GeoRedundant', + /// 'LocallyRedundant' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/StorageSettingStoreTypes.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/StorageSettingStoreTypes.cs new file mode 100644 index 0000000000000..4afcbfc1b7cf5 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/StorageSettingStoreTypes.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.DataProtection.Models +{ + + /// + /// Defines values for StorageSettingStoreTypes. + /// + public static class StorageSettingStoreTypes + { + public const string ArchiveStore = "ArchiveStore"; + public const string SnapshotStore = "SnapshotStore"; + public const string VaultStore = "VaultStore"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/StorageSettingTypes.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/StorageSettingTypes.cs new file mode 100644 index 0000000000000..21048eb605ed2 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/StorageSettingTypes.cs @@ -0,0 +1,22 @@ +// +// 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.DataProtection.Models +{ + + /// + /// Defines values for StorageSettingTypes. + /// + public static class StorageSettingTypes + { + public const string GeoRedundant = "GeoRedundant"; + public const string LocallyRedundant = "LocallyRedundant"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SupportedFeature.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SupportedFeature.cs new file mode 100644 index 0000000000000..636ee0606c8ba --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SupportedFeature.cs @@ -0,0 +1,74 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Elements class for feature request + /// + public partial class SupportedFeature + { + /// + /// Initializes a new instance of the SupportedFeature class. + /// + public SupportedFeature() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SupportedFeature class. + /// + /// support feature type. + /// feature support status. Possible values + /// include: 'Invalid', 'NotSupported', 'AlphaPreview', + /// 'PrivatePreview', 'PublicPreview', 'GenerallyAvailable' + /// support feature + /// type. + public SupportedFeature(string featureName = default(string), string supportStatus = default(string), IList exposureControlledFeatures = default(IList)) + { + FeatureName = featureName; + SupportStatus = supportStatus; + ExposureControlledFeatures = exposureControlledFeatures; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets support feature type. + /// + [JsonProperty(PropertyName = "featureName")] + public string FeatureName { get; set; } + + /// + /// Gets or sets feature support status. Possible values include: + /// 'Invalid', 'NotSupported', 'AlphaPreview', 'PrivatePreview', + /// 'PublicPreview', 'GenerallyAvailable' + /// + [JsonProperty(PropertyName = "supportStatus")] + public string SupportStatus { get; set; } + + /// + /// Gets or sets support feature type. + /// + [JsonProperty(PropertyName = "exposureControlledFeatures")] + public IList ExposureControlledFeatures { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SystemData.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..fd4fc0dcb7a43 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The type of identity that last + /// modified the resource. + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TaggingCriteria.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TaggingCriteria.cs new file mode 100644 index 0000000000000..1ee54a73549af --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TaggingCriteria.cs @@ -0,0 +1,100 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// TaggingCriteria + /// + /// + /// Tagging criteria + /// + public partial class TaggingCriteria + { + /// + /// Initializes a new instance of the TaggingCriteria class. + /// + public TaggingCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TaggingCriteria class. + /// + /// Specifies if tag is default. + /// Retention Tag priority. + /// Retention tag information + /// Criteria which decides whether the tag can + /// be applied to a triggered backup. + public TaggingCriteria(bool isDefault, long taggingPriority, RetentionTag tagInfo, IList criteria = default(IList)) + { + Criteria = criteria; + IsDefault = isDefault; + TaggingPriority = taggingPriority; + TagInfo = tagInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets criteria which decides whether the tag can be applied + /// to a triggered backup. + /// + [JsonProperty(PropertyName = "criteria")] + public IList Criteria { get; set; } + + /// + /// Gets or sets specifies if tag is default. + /// + [JsonProperty(PropertyName = "isDefault")] + public bool IsDefault { get; set; } + + /// + /// Gets or sets retention Tag priority. + /// + [JsonProperty(PropertyName = "taggingPriority")] + public long TaggingPriority { get; set; } + + /// + /// Gets or sets retention tag information + /// + [JsonProperty(PropertyName = "tagInfo")] + public RetentionTag TagInfo { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TagInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TagInfo"); + } + if (TagInfo != null) + { + TagInfo.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TargetCopySetting.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TargetCopySetting.cs new file mode 100644 index 0000000000000..0b67355b8c3b0 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TargetCopySetting.cs @@ -0,0 +1,85 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// TargetCopySetting + /// + /// + /// Target copy settings + /// + public partial class TargetCopySetting + { + /// + /// Initializes a new instance of the TargetCopySetting class. + /// + public TargetCopySetting() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TargetCopySetting class. + /// + /// It can be CustomCopyOption or + /// ImmediateCopyOption. + /// Info of target datastore + public TargetCopySetting(CopyOption copyAfter, DataStoreInfoBase dataStore) + { + CopyAfter = copyAfter; + DataStore = dataStore; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets it can be CustomCopyOption or ImmediateCopyOption. + /// + [JsonProperty(PropertyName = "copyAfter")] + public CopyOption CopyAfter { get; set; } + + /// + /// Gets or sets info of target datastore + /// + [JsonProperty(PropertyName = "dataStore")] + public DataStoreInfoBase DataStore { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CopyAfter == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CopyAfter"); + } + if (DataStore == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataStore"); + } + if (DataStore != null) + { + DataStore.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TargetDetails.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TargetDetails.cs new file mode 100644 index 0000000000000..2f6ff5fc35378 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TargetDetails.cs @@ -0,0 +1,105 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class encapsulating target details, used where the destination is not a + /// datasource + /// + public partial class TargetDetails + { + /// + /// Initializes a new instance of the TargetDetails class. + /// + public TargetDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TargetDetails class. + /// + /// Restore operation may create multiple + /// files inside location pointed by Url + /// Below will be the common prefix for all of them + /// Denotes the target location + /// where the data will be restored, + /// string value for the enum + /// {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. + /// Possible values include: 'Invalid', 'AzureBlobs', + /// 'AzureFiles' + /// Url denoting the restore destination. It can + /// point to container / file share etc + public TargetDetails(string filePrefix, string restoreTargetLocationType, string url) + { + FilePrefix = filePrefix; + RestoreTargetLocationType = restoreTargetLocationType; + Url = url; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets restore operation may create multiple files inside + /// location pointed by Url + /// Below will be the common prefix for all of them + /// + [JsonProperty(PropertyName = "filePrefix")] + public string FilePrefix { get; set; } + + /// + /// Gets or sets denotes the target location where the data will be + /// restored, + /// string value for the enum + /// {Microsoft.Internal.AzureBackup.DataProtection.Common.Interface.RestoreTargetLocationType}. + /// Possible values include: 'Invalid', 'AzureBlobs', 'AzureFiles' + /// + [JsonProperty(PropertyName = "restoreTargetLocationType")] + public string RestoreTargetLocationType { get; set; } + + /// + /// Gets or sets url denoting the restore destination. It can point to + /// container / file share etc + /// + [JsonProperty(PropertyName = "url")] + public string Url { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (FilePrefix == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FilePrefix"); + } + if (RestoreTargetLocationType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RestoreTargetLocationType"); + } + if (Url == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Url"); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TriggerBackupRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TriggerBackupRequest.cs new file mode 100644 index 0000000000000..413048e3f7c91 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TriggerBackupRequest.cs @@ -0,0 +1,74 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// TriggerBackupRequest + /// + /// + /// Trigger backup request + /// + public partial class TriggerBackupRequest + { + /// + /// Initializes a new instance of the TriggerBackupRequest class. + /// + public TriggerBackupRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TriggerBackupRequest class. + /// + /// Name for the Rule of the Policy + /// which needs to be applied for this backup + public TriggerBackupRequest(AdHocBackupRuleOptions backupRuleOptions) + { + BackupRuleOptions = backupRuleOptions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name for the Rule of the Policy which needs to be + /// applied for this backup + /// + [JsonProperty(PropertyName = "backupRuleOptions")] + public AdHocBackupRuleOptions BackupRuleOptions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BackupRuleOptions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BackupRuleOptions"); + } + if (BackupRuleOptions != null) + { + BackupRuleOptions.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TriggerContext.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TriggerContext.cs new file mode 100644 index 0000000000000..1819703da9dba --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/TriggerContext.cs @@ -0,0 +1,38 @@ +// +// 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.DataProtection.Models +{ + using System.Linq; + + /// + /// TriggerContext + /// + /// + /// Trigger context + /// + public partial class TriggerContext + { + /// + /// Initializes a new instance of the TriggerContext class. + /// + public TriggerContext() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/UserFacingError.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/UserFacingError.cs new file mode 100644 index 0000000000000..f624ef6b9b710 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/UserFacingError.cs @@ -0,0 +1,122 @@ +// +// 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.DataProtection.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Error object used by layers that have access to localized content, and + /// propagate that to user + /// + public partial class UserFacingError + { + /// + /// Initializes a new instance of the UserFacingError class. + /// + public UserFacingError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserFacingError class. + /// + /// Unique code for this error + /// Additional related Errors + /// Inner Error + /// Whether the operation will be retryable + /// or not + /// Whether the operation is due to a user + /// error or service error + /// Any key value pairs that can be injected + /// inside error object + /// RecommendedAction � + /// localized. + /// Target of the error. + public UserFacingError(string code = default(string), IList details = default(IList), InnerError innerError = default(InnerError), bool? isRetryable = default(bool?), bool? isUserError = default(bool?), IDictionary properties = default(IDictionary), string message = default(string), IList recommendedAction = default(IList), string target = default(string)) + { + Code = code; + Details = details; + InnerError = innerError; + IsRetryable = isRetryable; + IsUserError = isUserError; + Properties = properties; + Message = message; + RecommendedAction = recommendedAction; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique code for this error + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets additional related Errors + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + /// + /// Gets or sets inner Error + /// + [JsonProperty(PropertyName = "innerError")] + public InnerError InnerError { get; set; } + + /// + /// Gets or sets whether the operation will be retryable or not + /// + [JsonProperty(PropertyName = "isRetryable")] + public bool? IsRetryable { get; set; } + + /// + /// Gets or sets whether the operation is due to a user error or + /// service error + /// + [JsonProperty(PropertyName = "isUserError")] + public bool? IsUserError { get; set; } + + /// + /// Gets or sets any key value pairs that can be injected inside error + /// object + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets recommendedAction � localized. + /// + [JsonProperty(PropertyName = "recommendedAction")] + public IList RecommendedAction { get; set; } + + /// + /// Gets or sets target of the error. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ValidateForBackupRequest.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ValidateForBackupRequest.cs new file mode 100644 index 0000000000000..1760bcbbbd2a9 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ValidateForBackupRequest.cs @@ -0,0 +1,70 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// ValidateForBackupRequest + /// + /// + /// Validate for backup request + /// + public partial class ValidateForBackupRequest + { + /// + /// Initializes a new instance of the ValidateForBackupRequest class. + /// + public ValidateForBackupRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidateForBackupRequest class. + /// + public ValidateForBackupRequest(BackupInstance backupInstance) + { + BackupInstance = backupInstance; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "backupInstance")] + public BackupInstance BackupInstance { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BackupInstance == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BackupInstance"); + } + if (BackupInstance != null) + { + BackupInstance.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ValidateRestoreRequestObject.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ValidateRestoreRequestObject.cs new file mode 100644 index 0000000000000..067b03ccc043b --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/ValidateRestoreRequestObject.cs @@ -0,0 +1,76 @@ +// +// 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.DataProtection.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// ValidateRestoreRequestObject + /// + /// + /// Validate restore request object + /// + public partial class ValidateRestoreRequestObject + { + /// + /// Initializes a new instance of the ValidateRestoreRequestObject + /// class. + /// + public ValidateRestoreRequestObject() + { + RestoreRequestObject = new AzureBackupRestoreRequest(); + CustomInit(); + } + + /// + /// Initializes a new instance of the ValidateRestoreRequestObject + /// class. + /// + /// Gets or sets the restore request + /// object. + public ValidateRestoreRequestObject(AzureBackupRestoreRequest restoreRequestObject) + { + RestoreRequestObject = restoreRequestObject; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the restore request object. + /// + [JsonProperty(PropertyName = "restoreRequestObject")] + public AzureBackupRestoreRequest RestoreRequestObject { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RestoreRequestObject == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RestoreRequestObject"); + } + if (RestoreRequestObject != null) + { + RestoreRequestObject.Validate(); + } + } + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/WeekNumber.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/WeekNumber.cs new file mode 100644 index 0000000000000..600cb4f7e23bf --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Models/WeekNumber.cs @@ -0,0 +1,25 @@ +// +// 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.DataProtection.Models +{ + + /// + /// Defines values for WeekNumber. + /// + public static class WeekNumber + { + public const string First = "First"; + public const string Fourth = "Fourth"; + public const string Last = "Last"; + public const string Second = "Second"; + public const string Third = "Third"; + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationResultOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationResultOperations.cs new file mode 100644 index 0000000000000..df2d09ee7308e --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationResultOperations.cs @@ -0,0 +1,251 @@ +// +// 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.DataProtection +{ + 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; + + /// + /// OperationResultOperations operations. + /// + internal partial class OperationResultOperations : IServiceOperations, IOperationResultOperations + { + /// + /// Initializes a new instance of the OperationResultOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OperationResultOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Gets the operation status for a resource. + /// + /// + /// Gets the operation result for a resource + /// + /// + /// + /// + /// + /// + /// 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 operationId, string location, 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"); + } + if (operationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("operationId", operationId); + tracingParameters.Add("location", location); + 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}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + 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; + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationResultOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationResultOperationsExtensions.cs new file mode 100644 index 0000000000000..2817af1479b1b --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationResultOperationsExtensions.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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OperationResultOperations. + /// + public static partial class OperationResultOperationsExtensions + { + /// + /// Gets the operation status for a resource. + /// + /// + /// Gets the operation result for a resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + public static OperationJobExtendedInfo Get(this IOperationResultOperations operations, string operationId, string location) + { + return operations.GetAsync(operationId, location).GetAwaiter().GetResult(); + } + + /// + /// Gets the operation status for a resource. + /// + /// + /// Gets the operation result for a resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOperationResultOperations operations, string operationId, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(operationId, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Operations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Operations.cs new file mode 100644 index 0000000000000..d03fb04abcdcf --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/Operations.cs @@ -0,0 +1,400 @@ +// +// 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.DataProtection +{ + 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; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Returns the list of available operations. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("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("/") ? "" : "/")), "providers/Microsoft.DataProtection/operations").ToString(); + 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; + } + + /// + /// Returns the list of available operations. + /// + /// + /// 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/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationsExtensions.cs new file mode 100644 index 0000000000000..d58f9b4ef7903 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/OperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Returns the list of available operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Returns the list of available operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the list of available operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Returns the list of available operations. + /// + /// + /// 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 IOperations 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/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointOperations.cs new file mode 100644 index 0000000000000..5503263391d9e --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointOperations.cs @@ -0,0 +1,267 @@ +// +// 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.DataProtection +{ + 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; + + /// + /// RecoveryPointOperations operations. + /// + internal partial class RecoveryPointOperations : IServiceOperations, IRecoveryPointOperations + { + /// + /// Initializes a new instance of the RecoveryPointOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RecoveryPointOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Gets a Recovery Point using recoveryPointId for a Datasource. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// + /// + /// 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, string backupInstanceName, string recoveryPointId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName"); + } + if (recoveryPointId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "recoveryPointId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("backupInstanceName", backupInstanceName); + tracingParameters.Add("recoveryPointId", recoveryPointId); + 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}").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("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName)); + _url = _url.Replace("{recoveryPointId}", System.Uri.EscapeDataString(recoveryPointId)); + 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; + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointOperationsExtensions.cs new file mode 100644 index 0000000000000..deaab0e43d0f2 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointOperationsExtensions.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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for RecoveryPointOperations. + /// + public static partial class RecoveryPointOperationsExtensions + { + /// + /// Gets a Recovery Point using recoveryPointId for a Datasource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// + public static AzureBackupRecoveryPointResource Get(this IRecoveryPointOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, string recoveryPointId) + { + return operations.GetAsync(vaultName, resourceGroupName, backupInstanceName, recoveryPointId).GetAwaiter().GetResult(); + } + + /// + /// Gets a Recovery Point using recoveryPointId for a Datasource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IRecoveryPointOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, string recoveryPointId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, recoveryPointId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperations.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperations.cs new file mode 100644 index 0000000000000..fca08f8457fbc --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperations.cs @@ -0,0 +1,453 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + 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; + + /// + /// RecoveryPointsOperations operations. + /// + internal partial class RecoveryPointsOperations : IServiceOperations, IRecoveryPointsOperations + { + /// + /// Initializes a new instance of the RecoveryPointsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RecoveryPointsOperations(DataProtectionClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DataProtectionClient + /// + public DataProtectionClient Client { get; private set; } + + /// + /// Returns a list of Recovery Points for a DataSource in a vault. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// skipToken Filter. + /// + /// + /// 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>> GetListWithHttpMessagesAsync(string vaultName, string resourceGroupName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 (backupInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupInstanceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("vaultName", vaultName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("backupInstanceName", backupInstanceName); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetList", 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.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints").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("{backupInstanceName}", System.Uri.EscapeDataString(backupInstanceName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + 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; + } + + /// + /// Returns a list of Recovery Points for a DataSource in a vault. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetListNextWithHttpMessagesAsync(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, "GetListNext", 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/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperationsExtensions.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperationsExtensions.cs new file mode 100644 index 0000000000000..f21887bdeadf6 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/RecoveryPointsOperationsExtensions.cs @@ -0,0 +1,118 @@ +// +// 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.DataProtection +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for RecoveryPointsOperations. + /// + public static partial class RecoveryPointsOperationsExtensions + { + /// + /// Returns a list of Recovery Points for a DataSource in a vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// skipToken Filter. + /// + public static IPage GetList(this IRecoveryPointsOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string)) + { + return operations.GetListAsync(vaultName, resourceGroupName, backupInstanceName, odataQuery, skipToken).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of Recovery Points for a DataSource in a vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the backup vault. + /// + /// + /// The name of the resource group where the backup vault is present. + /// + /// + /// The name of the backup instance + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// skipToken Filter. + /// + /// + /// The cancellation token. + /// + public static async Task> GetListAsync(this IRecoveryPointsOperations operations, string vaultName, string resourceGroupName, string backupInstanceName, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetListWithHttpMessagesAsync(vaultName, resourceGroupName, backupInstanceName, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of Recovery Points for a DataSource in a vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage GetListNext(this IRecoveryPointsOperations operations, string nextPageLink) + { + return operations.GetListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of Recovery Points for a DataSource in a vault. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> GetListNextAsync(this IRecoveryPointsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/SdkInfo_DataProtectionClient.cs b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/SdkInfo_DataProtectionClient.cs new file mode 100644 index 0000000000000..0751b89a79457 --- /dev/null +++ b/sdk/dataprotection/Microsoft.Azure.Management.DataProtection/src/Generated/SdkInfo_DataProtectionClient.cs @@ -0,0 +1,40 @@ + +// +// 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.DataProtection +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_DataProtectionClient + { + get + { + return new Tuple[] + { + new Tuple("DataProtection", "BackupInstances", "2021-02-01-preview"), + new Tuple("DataProtection", "BackupPolicies", "2021-02-01-preview"), + new Tuple("DataProtection", "BackupVaults", "2021-02-01-preview"), + new Tuple("DataProtection", "CheckFeatureSupport", "2021-02-01-preview"), + new Tuple("DataProtection", "ExportJobs", "2021-02-01-preview"), + new Tuple("DataProtection", "ExportJobsOperationResult", "2021-02-01-preview"), + new Tuple("DataProtection", "GetOperationResultPatch", "2021-02-01-preview"), + new Tuple("DataProtection", "GetOperationStatus", "2021-02-01-preview"), + new Tuple("DataProtection", "Job", "2021-02-01-preview"), + new Tuple("DataProtection", "Jobs", "2021-02-01-preview"), + new Tuple("DataProtection", "OperationResult", "2021-02-01-preview"), + new Tuple("DataProtection", "Operations", "2021-02-01-preview"), + new Tuple("DataProtection", "RecoveryPoint", "2021-02-01-preview"), + new Tuple("DataProtection", "RecoveryPoints", "2021-02-01-preview"), + }.AsEnumerable(); + } + } + } +}