From f543ab7aefdaf2552dcd5beb77070074413d3955 Mon Sep 17 00:00:00 2001 From: pikumarmsft Date: Mon, 27 Jul 2015 17:39:42 +0530 Subject: [PATCH 1/3] test cases --- .../BackupServices.Tests.csproj | 7 +- .../BackupServicesManagement.csproj | 509 ++++++++++---- .../Generated/BackUpOperations.cs | 2 +- .../BackupServicesManagementClient.cs | 26 +- .../Generated/DataSourceOperations.cs | 414 +++++------ .../DataSourceOperationsExtensions.cs | 116 ++-- .../IBackupServicesManagementClient.cs | 18 +- .../Generated/IDataSourceOperations.cs | 46 +- .../Generated/IJobOperations.cs | 18 +- .../Generated/IRecoveryPointOperations.cs | 2 +- .../Generated/JobOperations.cs | 650 +++++++++--------- .../Generated/JobOperationsExtensions.cs | 44 +- .../CSMRecoveryPointGetOperationResponse.cs | 10 +- .../Generated/OperationStatus.cs | 4 +- .../Generated/ProtectableObjectOperations.cs | 2 +- .../Generated/RecoveryPointOperations.cs | 90 ++- .../RecoveryPointOperationsExtensions.cs | 4 +- .../Generated/RestoreOperations.cs | 2 +- 18 files changed, 1132 insertions(+), 832 deletions(-) diff --git a/src/ResourceManagement/AzureBackup/BackupServices.Tests/BackupServices.Tests.csproj b/src/ResourceManagement/AzureBackup/BackupServices.Tests/BackupServices.Tests.csproj index 3b4a1ad115845..93af4c2bc416b 100644 --- a/src/ResourceManagement/AzureBackup/BackupServices.Tests/BackupServices.Tests.csproj +++ b/src/ResourceManagement/AzureBackup/BackupServices.Tests/BackupServices.Tests.csproj @@ -12,12 +12,11 @@ - - - - + + Code + diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/BackupServicesManagement.csproj b/src/ResourceManagement/AzureBackup/BackupServicesManagement/BackupServicesManagement.csproj index 7d36dd6a9a75e..ee285236871c3 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/BackupServicesManagement.csproj +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/BackupServicesManagement.csproj @@ -33,124 +33,397 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + + + + Code + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + Code + + + Code + + + + + Code + + + Code + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackUpOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackUpOperations.cs index 371da17bd0c7f..3855e22575bb3 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackUpOperations.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackUpOperations.cs @@ -97,7 +97,7 @@ public async Task TriggerBackUpAsync(CustomRequestHeaders cus // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupServicesManagementClient.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupServicesManagementClient.cs index 863b96347672b..55d70145e37a8 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupServicesManagementClient.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupServicesManagementClient.cs @@ -120,6 +120,17 @@ public virtual IContainerOperation Container get { return this._container; } } + private ICSMProtectionPolicyOperations _cSMProtectionPolicy; + + /// + /// Definition of Protection Policy operations for the Azure Backup + /// extension. + /// + public virtual ICSMProtectionPolicyOperations CSMProtectionPolicy + { + get { return this._cSMProtectionPolicy; } + } + private IDataSourceOperations _dataSource; /// @@ -161,17 +172,6 @@ public virtual IProtectableObjectOperations ProtectableObject get { return this._protectableObject; } } - private IProtectionPolicyOperations _protectionPolicy; - - /// - /// Definition of Protection Policy operations for the Azure Backup - /// extension. - /// - public virtual IProtectionPolicyOperations ProtectionPolicy - { - get { return this._protectionPolicy; } - } - private IRecoveryPointOperations _recoveryPoint; /// @@ -202,11 +202,11 @@ public BackupServicesManagementClient() { this._backUp = new BackUpOperations(this); this._container = new ContainerOperation(this); + this._cSMProtectionPolicy = new CSMProtectionPolicyOperations(this); this._dataSource = new DataSourceOperations(this); this._job = new JobOperations(this); this._operationStatus = new OperationStatus(this); this._protectableObject = new ProtectableObjectOperations(this); - this._protectionPolicy = new ProtectionPolicyOperations(this); this._recoveryPoint = new RecoveryPointOperations(this); this._restore = new RestoreOperations(this); this._apiVersion = "2013-03-01"; @@ -311,11 +311,11 @@ public BackupServicesManagementClient(HttpClient httpClient) { this._backUp = new BackUpOperations(this); this._container = new ContainerOperation(this); + this._cSMProtectionPolicy = new CSMProtectionPolicyOperations(this); this._dataSource = new DataSourceOperations(this); this._job = new JobOperations(this); this._operationStatus = new OperationStatus(this); this._protectableObject = new ProtectableObjectOperations(this); - this._protectionPolicy = new ProtectionPolicyOperations(this); this._recoveryPoint = new RecoveryPointOperations(this); this._restore = new RestoreOperations(this); this._apiVersion = "2013-03-01"; diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperations.cs index 854c21ed25edf..793b9517fa760 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperations.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperations.cs @@ -62,210 +62,6 @@ public BackupServicesManagementClient Client get { return this._client; } } - /// - /// Enable protection for given item. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// Required. containerName. - /// - /// - /// Required. itemName. - /// - /// - /// Required. Set protection request input. - /// - /// - /// Cancellation token. - /// - /// - /// The definition of a Operation Response. - /// - public async Task CSMUpdateProtectionAsync(CustomRequestHeaders customRequestHeaders, CustomRequestHeaders containerName, CustomRequestHeaders itemName, CSMUpdateProtectionRequest csmparameters, CancellationToken cancellationToken) - { - // Validate - if (containerName == null) - { - throw new ArgumentNullException("containerName"); - } - if (itemName == null) - { - throw new ArgumentNullException("itemName"); - } - if (csmparameters == null) - { - throw new ArgumentNullException("csmparameters"); - } - if (csmparameters.Properties == null) - { - throw new ArgumentNullException("csmparameters.Properties"); - } - if (csmparameters.Properties.PolicyId == null) - { - throw new ArgumentNullException("csmparameters.Properties.PolicyId"); - } - - // Tracing - bool shouldTrace = TracingAdapter.IsEnabled; - string invocationId = null; - if (shouldTrace) - { - invocationId = TracingAdapter.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("customRequestHeaders", customRequestHeaders); - tracingParameters.Add("containerName", containerName); - tracingParameters.Add("itemName", itemName); - tracingParameters.Add("csmparameters", csmparameters); - TracingAdapter.Enter(invocationId, this, "CSMUpdateProtectionAsync", tracingParameters); - } - - // Construct URL - string url = ""; - url = url + "/Subscriptions/"; - if (this.Client.Credentials.SubscriptionId != null) - { - url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); - } - url = url + "/resourceGroups/"; - url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); - url = url + "/providers/"; - url = url + "Microsoft.Backup"; - url = url + "/"; - url = url + "BackupVault"; - url = url + "/"; - url = url + Uri.EscapeDataString(this.Client.ResourceName); - url = url + "/registeredContainers/"; - url = url + Uri.EscapeDataString(containerName.ToString()); - url = url + "/protectedItems/"; - url = url + Uri.EscapeDataString(itemName.ToString()); - List queryParameters = new List(); - queryParameters.Add("api-version=2014-09-01"); - if (queryParameters.Count > 0) - { - url = url + "?" + string.Join("&", queryParameters); - } - string baseUrl = this.Client.BaseUri.AbsoluteUri; - // Trim '/' character from the end of baseUrl and beginning of url. - if (baseUrl[baseUrl.Length - 1] == '/') - { - baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); - } - if (url[0] == '/') - { - url = url.Substring(1); - } - url = baseUrl + "/" + url; - url = url.Replace(" ", "%20"); - - // Create HTTP transport objects - HttpRequestMessage httpRequest = null; - try - { - httpRequest = new HttpRequestMessage(); - httpRequest.Method = new HttpMethod("PATCH"); - httpRequest.RequestUri = new Uri(url); - - // Set Headers - httpRequest.Headers.Add("Accept-Language", "en-us"); - - // Set Credentials - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); - - // Serialize Request - string requestContent = null; - JToken requestDoc = null; - - JObject cSMUpdateProtectionRequestValue = new JObject(); - requestDoc = cSMUpdateProtectionRequestValue; - - JObject propertiesValue = new JObject(); - cSMUpdateProtectionRequestValue["properties"] = propertiesValue; - - propertiesValue["policyId"] = csmparameters.Properties.PolicyId; - - requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented); - httpRequest.Content = new StringContent(requestContent, Encoding.UTF8); - httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); - - // Send Request - HttpResponseMessage httpResponse = null; - try - { - if (shouldTrace) - { - TracingAdapter.SendRequest(invocationId, httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); - if (shouldTrace) - { - TracingAdapter.ReceiveResponse(invocationId, httpResponse); - } - HttpStatusCode statusCode = httpResponse.StatusCode; - if (statusCode != HttpStatusCode.Accepted) - { - cancellationToken.ThrowIfCancellationRequested(); - CloudException ex = CloudException.Create(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); - if (shouldTrace) - { - TracingAdapter.Error(invocationId, ex); - } - throw ex; - } - - // Create Result - OperationResponse result = null; - // Deserialize Response - if (statusCode == HttpStatusCode.Accepted) - { - cancellationToken.ThrowIfCancellationRequested(); - string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - result = new OperationResponse(); - JToken responseDoc = null; - if (string.IsNullOrEmpty(responseContent) == false) - { - responseDoc = JToken.Parse(responseContent); - } - - if (responseDoc != null && responseDoc.Type != JTokenType.Null) - { - Guid operationIdInstance = Guid.Parse(((string)responseDoc)); - result.OperationId = operationIdInstance; - } - - } - result.StatusCode = statusCode; - if (httpResponse.Headers.Contains("x-ms-client-request-id")) - { - customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); - } - - if (shouldTrace) - { - TracingAdapter.Exit(invocationId, result); - } - return result; - } - finally - { - if (httpResponse != null) - { - httpResponse.Dispose(); - } - } - } - finally - { - if (httpRequest != null) - { - httpRequest.Dispose(); - } - } - } - /// /// Disable protection for given item /// @@ -311,7 +107,7 @@ public async Task DisableProtectionCSMAsync(CustomRequestHead // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); @@ -499,7 +295,7 @@ public async Task EnableProtectionCSMAsync(CustomRequestHeade // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); @@ -675,7 +471,7 @@ public async Task ListCSMAsync(CSMProtect // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); @@ -960,5 +756,209 @@ public async Task ListCSMAsync(CSMProtect } } } + + /// + /// Enable protection for given item. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// Required. containerName. + /// + /// + /// Required. itemName. + /// + /// + /// Required. Set protection request input. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + public async Task UpdateProtectionCSMAsync(CustomRequestHeaders customRequestHeaders, string containerName, string itemName, CSMUpdateProtectionRequest csmparameters, CancellationToken cancellationToken) + { + // Validate + if (containerName == null) + { + throw new ArgumentNullException("containerName"); + } + if (itemName == null) + { + throw new ArgumentNullException("itemName"); + } + if (csmparameters == null) + { + throw new ArgumentNullException("csmparameters"); + } + if (csmparameters.Properties == null) + { + throw new ArgumentNullException("csmparameters.Properties"); + } + if (csmparameters.Properties.PolicyId == null) + { + throw new ArgumentNullException("csmparameters.Properties.PolicyId"); + } + + // Tracing + bool shouldTrace = TracingAdapter.IsEnabled; + string invocationId = null; + if (shouldTrace) + { + invocationId = TracingAdapter.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("customRequestHeaders", customRequestHeaders); + tracingParameters.Add("containerName", containerName); + tracingParameters.Add("itemName", itemName); + tracingParameters.Add("csmparameters", csmparameters); + TracingAdapter.Enter(invocationId, this, "UpdateProtectionCSMAsync", tracingParameters); + } + + // Construct URL + string url = ""; + url = url + "/subscriptions/"; + if (this.Client.Credentials.SubscriptionId != null) + { + url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); + } + url = url + "/resourceGroups/"; + url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); + url = url + "/providers/"; + url = url + "Microsoft.Backup"; + url = url + "/"; + url = url + "BackupVault"; + url = url + "/"; + url = url + Uri.EscapeDataString(this.Client.ResourceName); + url = url + "/registeredContainers/"; + url = url + Uri.EscapeDataString(containerName); + url = url + "/protectedItems/"; + url = url + Uri.EscapeDataString(itemName); + List queryParameters = new List(); + queryParameters.Add("api-version=2014-09-01"); + if (queryParameters.Count > 0) + { + url = url + "?" + string.Join("&", queryParameters); + } + string baseUrl = this.Client.BaseUri.AbsoluteUri; + // Trim '/' character from the end of baseUrl and beginning of url. + if (baseUrl[baseUrl.Length - 1] == '/') + { + baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); + } + if (url[0] == '/') + { + url = url.Substring(1); + } + url = baseUrl + "/" + url; + url = url.Replace(" ", "%20"); + + // Create HTTP transport objects + HttpRequestMessage httpRequest = null; + try + { + httpRequest = new HttpRequestMessage(); + httpRequest.Method = new HttpMethod("PATCH"); + httpRequest.RequestUri = new Uri(url); + + // Set Headers + httpRequest.Headers.Add("Accept-Language", "en-us"); + + // Set Credentials + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); + + // Serialize Request + string requestContent = null; + JToken requestDoc = null; + + JObject cSMUpdateProtectionRequestValue = new JObject(); + requestDoc = cSMUpdateProtectionRequestValue; + + JObject propertiesValue = new JObject(); + cSMUpdateProtectionRequestValue["properties"] = propertiesValue; + + propertiesValue["policyId"] = csmparameters.Properties.PolicyId; + + requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented); + httpRequest.Content = new StringContent(requestContent, Encoding.UTF8); + httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + + // Send Request + HttpResponseMessage httpResponse = null; + try + { + if (shouldTrace) + { + TracingAdapter.SendRequest(invocationId, httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); + if (shouldTrace) + { + TracingAdapter.ReceiveResponse(invocationId, httpResponse); + } + HttpStatusCode statusCode = httpResponse.StatusCode; + if (statusCode != HttpStatusCode.Accepted) + { + cancellationToken.ThrowIfCancellationRequested(); + CloudException ex = CloudException.Create(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); + if (shouldTrace) + { + TracingAdapter.Error(invocationId, ex); + } + throw ex; + } + + // Create Result + OperationResponse result = null; + // Deserialize Response + if (statusCode == HttpStatusCode.Accepted) + { + cancellationToken.ThrowIfCancellationRequested(); + string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + result = new OperationResponse(); + JToken responseDoc = null; + if (string.IsNullOrEmpty(responseContent) == false) + { + responseDoc = JToken.Parse(responseContent); + } + + if (responseDoc != null && responseDoc.Type != JTokenType.Null) + { + Guid operationIdInstance = Guid.Parse(((string)responseDoc)); + result.OperationId = operationIdInstance; + } + + } + result.StatusCode = statusCode; + if (httpResponse.Headers.Contains("x-ms-client-request-id")) + { + customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); + } + + if (shouldTrace) + { + TracingAdapter.Exit(invocationId, result); + } + return result; + } + finally + { + if (httpResponse != null) + { + httpResponse.Dispose(); + } + } + } + finally + { + if (httpRequest != null) + { + httpRequest.Dispose(); + } + } + } } } diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperationsExtensions.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperationsExtensions.cs index d77bed3d706c0..6f2f7aa3c3153 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperationsExtensions.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperationsExtensions.cs @@ -30,64 +30,6 @@ namespace Microsoft.Azure.Management.BackupServices { public static partial class DataSourceOperationsExtensions { - /// - /// Enable protection for given item. - /// - /// - /// Reference to the - /// Microsoft.Azure.Management.BackupServices.IDataSourceOperations. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// Required. containerName. - /// - /// - /// Required. itemName. - /// - /// - /// Required. Set protection request input. - /// - /// - /// The definition of a Operation Response. - /// - public static OperationResponse CSMUpdateProtection(this IDataSourceOperations operations, CustomRequestHeaders customRequestHeaders, CustomRequestHeaders containerName, CustomRequestHeaders itemName, CSMUpdateProtectionRequest csmparameters) - { - return Task.Factory.StartNew((object s) => - { - return ((IDataSourceOperations)s).CSMUpdateProtectionAsync(customRequestHeaders, containerName, itemName, csmparameters); - } - , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Enable protection for given item. - /// - /// - /// Reference to the - /// Microsoft.Azure.Management.BackupServices.IDataSourceOperations. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// Required. containerName. - /// - /// - /// Required. itemName. - /// - /// - /// Required. Set protection request input. - /// - /// - /// The definition of a Operation Response. - /// - public static Task CSMUpdateProtectionAsync(this IDataSourceOperations operations, CustomRequestHeaders customRequestHeaders, CustomRequestHeaders containerName, CustomRequestHeaders itemName, CSMUpdateProtectionRequest csmparameters) - { - return operations.CSMUpdateProtectionAsync(customRequestHeaders, containerName, itemName, csmparameters, CancellationToken.None); - } - /// /// Disable protection for given item /// @@ -243,5 +185,63 @@ public static Task ListCSMAsync(this IDat { return operations.ListCSMAsync(csmparameters, customRequestHeaders, CancellationToken.None); } + + /// + /// Enable protection for given item. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IDataSourceOperations. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// Required. containerName. + /// + /// + /// Required. itemName. + /// + /// + /// Required. Set protection request input. + /// + /// + /// The definition of a Operation Response. + /// + public static OperationResponse UpdateProtectionCSM(this IDataSourceOperations operations, CustomRequestHeaders customRequestHeaders, string containerName, string itemName, CSMUpdateProtectionRequest csmparameters) + { + return Task.Factory.StartNew((object s) => + { + return ((IDataSourceOperations)s).UpdateProtectionCSMAsync(customRequestHeaders, containerName, itemName, csmparameters); + } + , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Enable protection for given item. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IDataSourceOperations. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// Required. containerName. + /// + /// + /// Required. itemName. + /// + /// + /// Required. Set protection request input. + /// + /// + /// The definition of a Operation Response. + /// + public static Task UpdateProtectionCSMAsync(this IDataSourceOperations operations, CustomRequestHeaders customRequestHeaders, string containerName, string itemName, CSMUpdateProtectionRequest csmparameters) + { + return operations.UpdateProtectionCSMAsync(customRequestHeaders, containerName, itemName, csmparameters, CancellationToken.None); + } } } diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupServicesManagementClient.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupServicesManagementClient.cs index d3b1783d10dc3..8cccf7d633b23 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupServicesManagementClient.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupServicesManagementClient.cs @@ -96,6 +96,15 @@ IContainerOperation Container get; } + /// + /// Definition of Protection Policy operations for the Azure Backup + /// extension. + /// + ICSMProtectionPolicyOperations CSMProtectionPolicy + { + get; + } + /// /// Definition of DataSource operations for the Azure Backup extension. /// @@ -129,15 +138,6 @@ IProtectableObjectOperations ProtectableObject get; } - /// - /// Definition of Protection Policy operations for the Azure Backup - /// extension. - /// - IProtectionPolicyOperations ProtectionPolicy - { - get; - } - /// /// Definition of Recovery Point operations for the Azure Backup /// extension. diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IDataSourceOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IDataSourceOperations.cs index a0e8118c1a7b6..5f0dfe95cf9dc 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IDataSourceOperations.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IDataSourceOperations.cs @@ -33,29 +33,6 @@ namespace Microsoft.Azure.Management.BackupServices /// public partial interface IDataSourceOperations { - /// - /// Enable protection for given item. - /// - /// - /// Request header parameters. - /// - /// - /// containerName. - /// - /// - /// itemName. - /// - /// - /// Set protection request input. - /// - /// - /// Cancellation token. - /// - /// - /// The definition of a Operation Response. - /// - Task CSMUpdateProtectionAsync(CustomRequestHeaders customRequestHeaders, CustomRequestHeaders containerName, CustomRequestHeaders itemName, CSMUpdateProtectionRequest csmparameters, CancellationToken cancellationToken); - /// /// Disable protection for given item /// @@ -115,5 +92,28 @@ public partial interface IDataSourceOperations /// The definition of a CSMProtectedItemListOperationResponse. /// Task ListCSMAsync(CSMProtectedItemQueryObject csmparameters, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + + /// + /// Enable protection for given item. + /// + /// + /// Request header parameters. + /// + /// + /// containerName. + /// + /// + /// itemName. + /// + /// + /// Set protection request input. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + Task UpdateProtectionCSMAsync(CustomRequestHeaders customRequestHeaders, string containerName, string itemName, CSMUpdateProtectionRequest csmparameters, CancellationToken cancellationToken); } } diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IJobOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IJobOperations.cs index 79786e5a85b51..476f35f954ca3 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IJobOperations.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IJobOperations.cs @@ -36,8 +36,8 @@ public partial interface IJobOperations /// /// Get details of a particular job. /// - /// - /// Request header parameters. + /// + /// Name of the job whose details should be retrieved. /// /// /// Request header parameters. @@ -46,9 +46,9 @@ public partial interface IJobOperations /// Cancellation token. /// /// - /// The response model for the list jobs operation. + /// Response model for job details operation /// - Task GetAsync(string jobId, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + Task GetAsync(string name, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); /// /// Get the list of all jobs queried by specified filters. @@ -63,15 +63,15 @@ public partial interface IJobOperations /// Cancellation token. /// /// - /// The response model for the list jobs operation. + /// Powershell response object /// - Task ListAsync(JobQueryParameter parameters, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + Task ListAsync(CSMJobQueryObject parameters, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); /// /// Trigger cancellation of a job. /// - /// - /// Id of the job whose details should be retrieved. + /// + /// Name of the job which should be stopped. /// /// /// Custom request headers to make the call. @@ -82,6 +82,6 @@ public partial interface IJobOperations /// /// The definition of a Operation Response. /// - Task StopAsync(string jobId, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + Task StopAsync(string name, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); } } diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IRecoveryPointOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IRecoveryPointOperations.cs index a081c2813cfbf..e9aed7e5f8d81 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IRecoveryPointOperations.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IRecoveryPointOperations.cs @@ -42,7 +42,7 @@ public partial interface IRecoveryPointOperations /// Cancellation token. /// /// - /// The definition of a CSMRecoveryPointOperationResponse. + /// The definition of a CSMRecoveryPointGetOperationResponse. /// Task GetAsync(CustomRequestHeaders customRequestHeaders, string containerName, string itemName, string recoveryPointName, CancellationToken cancellationToken); diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobOperations.cs index 54d440e40f8a7..2c1302c88ca51 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobOperations.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobOperations.cs @@ -64,8 +64,8 @@ public BackupServicesManagementClient Client /// /// Get details of a particular job. /// - /// - /// Optional. Request header parameters. + /// + /// Optional. Name of the job whose details should be retrieved. /// /// /// Optional. Request header parameters. @@ -74,9 +74,9 @@ public BackupServicesManagementClient Client /// Cancellation token. /// /// - /// The response model for the list jobs operation. + /// Response model for job details operation /// - public async Task GetAsync(string jobId, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) + public async Task GetAsync(string name, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) { // Validate @@ -87,14 +87,14 @@ public async Task GetAsync(string jobId, CustomRequestHeaders c { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("jobId", jobId); + tracingParameters.Add("name", name); tracingParameters.Add("customRequestHeaders", customRequestHeaders); TracingAdapter.Enter(invocationId, this, "GetAsync", tracingParameters); } // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); @@ -108,11 +108,10 @@ public async Task GetAsync(string jobId, CustomRequestHeaders c url = url + "/"; url = url + Uri.EscapeDataString(this.Client.ResourceName); url = url + "/jobs/"; - if (jobId != null) + if (name != null) { - url = url + Uri.EscapeDataString(jobId); + url = url + Uri.EscapeDataString(name); } - url = url + "/jobdetails"; List queryParameters = new List(); queryParameters.Add("api-version=2014-09-01"); if (queryParameters.Count > 0) @@ -175,13 +174,13 @@ public async Task GetAsync(string jobId, CustomRequestHeaders c } // Create Result - JobByIdResponse result = null; + CSMJobDetails result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - result = new JobByIdResponse(); + result = new CSMJobDetails(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { @@ -190,203 +189,210 @@ public async Task GetAsync(string jobId, CustomRequestHeaders c if (responseDoc != null && responseDoc.Type != JTokenType.Null) { - JobProperties jobInstance = new JobProperties(); - result.Job = jobInstance; + CSMJobDetailsResponse valueInstance = new CSMJobDetailsResponse(); + result.Value = valueInstance; - JToken tasksListArray = responseDoc["TasksList"]; - if (tasksListArray != null && tasksListArray.Type != JTokenType.Null) + JToken propertiesValue = responseDoc["properties"]; + if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) { - foreach (JToken tasksListValue in ((JArray)tasksListArray)) + CSMJobDetailedProperties propertiesInstance = new CSMJobDetailedProperties(); + valueInstance.JobDetailedProperties = propertiesInstance; + + JToken tasksListArray = propertiesValue["tasksList"]; + if (tasksListArray != null && tasksListArray.Type != JTokenType.Null) { - JobTaskDetails jobTaskDetailsInstance = new JobTaskDetails(); - jobInstance.TasksList.Add(jobTaskDetailsInstance); - - JToken taskIdValue = tasksListValue["TaskId"]; - if (taskIdValue != null && taskIdValue.Type != JTokenType.Null) - { - string taskIdInstance = ((string)taskIdValue); - jobTaskDetailsInstance.TaskId = taskIdInstance; - } - - JToken startTimeValue = tasksListValue["StartTime"]; - if (startTimeValue != null && startTimeValue.Type != JTokenType.Null) - { - DateTime startTimeInstance = ((DateTime)startTimeValue); - jobTaskDetailsInstance.StartTime = startTimeInstance; - } - - JToken endTimeValue = tasksListValue["EndTime"]; - if (endTimeValue != null && endTimeValue.Type != JTokenType.Null) - { - DateTime endTimeInstance = ((DateTime)endTimeValue); - jobTaskDetailsInstance.EndTime = endTimeInstance; - } - - JToken durationValue = tasksListValue["Duration"]; - if (durationValue != null && durationValue.Type != JTokenType.Null) - { - TimeSpan durationInstance = TimeSpan.Parse(((string)durationValue), CultureInfo.InvariantCulture); - jobTaskDetailsInstance.Duration = durationInstance; - } - - JToken statusValue = tasksListValue["Status"]; - if (statusValue != null && statusValue.Type != JTokenType.Null) - { - string statusInstance = ((string)statusValue); - jobTaskDetailsInstance.Status = statusInstance; - } - - JToken instanceIdValue = tasksListValue["InstanceId"]; - if (instanceIdValue != null && instanceIdValue.Type != JTokenType.Null) - { - string instanceIdInstance = ((string)instanceIdValue); - jobTaskDetailsInstance.InstanceId = instanceIdInstance; - } - - JToken nameValue = tasksListValue["Name"]; - if (nameValue != null && nameValue.Type != JTokenType.Null) + foreach (JToken tasksListValue in ((JArray)tasksListArray)) { - string nameInstance = ((string)nameValue); - jobTaskDetailsInstance.Name = nameInstance; + CSMJobTaskDetails cSMJobTaskDetailsInstance = new CSMJobTaskDetails(); + propertiesInstance.TasksList.Add(cSMJobTaskDetailsInstance); + + JToken taskIdValue = tasksListValue["taskId"]; + if (taskIdValue != null && taskIdValue.Type != JTokenType.Null) + { + string taskIdInstance = ((string)taskIdValue); + cSMJobTaskDetailsInstance.TaskId = taskIdInstance; + } + + JToken startTimeValue = tasksListValue["startTime"]; + if (startTimeValue != null && startTimeValue.Type != JTokenType.Null) + { + DateTime startTimeInstance = ((DateTime)startTimeValue); + cSMJobTaskDetailsInstance.StartTime = startTimeInstance; + } + + JToken endTimeValue = tasksListValue["endTime"]; + if (endTimeValue != null && endTimeValue.Type != JTokenType.Null) + { + DateTime endTimeInstance = ((DateTime)endTimeValue); + cSMJobTaskDetailsInstance.EndTime = endTimeInstance; + } + + JToken durationValue = tasksListValue["duration"]; + if (durationValue != null && durationValue.Type != JTokenType.Null) + { + TimeSpan durationInstance = TimeSpan.Parse(((string)durationValue), CultureInfo.InvariantCulture); + cSMJobTaskDetailsInstance.Duration = durationInstance; + } + + JToken statusValue = tasksListValue["status"]; + if (statusValue != null && statusValue.Type != JTokenType.Null) + { + string statusInstance = ((string)statusValue); + cSMJobTaskDetailsInstance.Status = statusInstance; + } + + JToken progressPercentageValue = tasksListValue["progressPercentage"]; + if (progressPercentageValue != null && progressPercentageValue.Type != JTokenType.Null) + { + double progressPercentageInstance = ((double)progressPercentageValue); + cSMJobTaskDetailsInstance.ProgressPercentage = progressPercentageInstance; + } } - - JToken operationInProgressValue = tasksListValue["OperationInProgress"]; - if (operationInProgressValue != null && operationInProgressValue.Type != JTokenType.Null) + } + + JToken propertyBagSequenceElement = ((JToken)propertiesValue["propertyBag"]); + if (propertyBagSequenceElement != null && propertyBagSequenceElement.Type != JTokenType.Null) + { + foreach (JProperty property in propertyBagSequenceElement) { - bool operationInProgressInstance = ((bool)operationInProgressValue); - jobTaskDetailsInstance.OperationInProgress = operationInProgressInstance; + string propertyBagKey = ((string)property.Name); + string propertyBagValue = ((string)property.Value); + propertiesInstance.PropertyBag.Add(propertyBagKey, propertyBagValue); } } - } - - JToken propertyBagSequenceElement = ((JToken)responseDoc["PropertyBag"]); - if (propertyBagSequenceElement != null && propertyBagSequenceElement.Type != JTokenType.Null) - { - foreach (JProperty property in propertyBagSequenceElement) + + JToken progressPercentageValue2 = propertiesValue["progressPercentage"]; + if (progressPercentageValue2 != null && progressPercentageValue2.Type != JTokenType.Null) { - string propertyBagKey = ((string)property.Name); - string propertyBagValue = ((string)property.Value); - jobInstance.PropertyBag.Add(propertyBagKey, propertyBagValue); + double progressPercentageInstance2 = ((double)progressPercentageValue2); + propertiesInstance.ProgressPercentage = progressPercentageInstance2; } - } - - JToken typeValue = responseDoc["Type"]; - if (typeValue != null && typeValue.Type != JTokenType.Null) - { - string typeInstance = ((string)typeValue); - jobInstance.Type = typeInstance; - } - - JToken operationValue = responseDoc["Operation"]; - if (operationValue != null && operationValue.Type != JTokenType.Null) - { - string operationInstance = ((string)operationValue); - jobInstance.Operation = operationInstance; - } - - JToken statusValue2 = responseDoc["Status"]; - if (statusValue2 != null && statusValue2.Type != JTokenType.Null) - { - string statusInstance2 = ((string)statusValue2); - jobInstance.Status = statusInstance2; - } - - JToken startTimestampValue = responseDoc["StartTimestamp"]; - if (startTimestampValue != null && startTimestampValue.Type != JTokenType.Null) - { - DateTime startTimestampInstance = ((DateTime)startTimestampValue); - jobInstance.StartTimestamp = startTimestampInstance; - } - - JToken endTimestampValue = responseDoc["EndTimestamp"]; - if (endTimestampValue != null && endTimestampValue.Type != JTokenType.Null) - { - DateTime endTimestampInstance = ((DateTime)endTimestampValue); - jobInstance.EndTimestamp = endTimestampInstance; - } - - JToken durationValue2 = responseDoc["Duration"]; - if (durationValue2 != null && durationValue2.Type != JTokenType.Null) - { - TimeSpan durationInstance2 = TimeSpan.Parse(((string)durationValue2), CultureInfo.InvariantCulture); - jobInstance.Duration = durationInstance2; - } - - JToken entityFriendlyNameValue = responseDoc["EntityFriendlyName"]; - if (entityFriendlyNameValue != null && entityFriendlyNameValue.Type != JTokenType.Null) - { - string entityFriendlyNameInstance = ((string)entityFriendlyNameValue); - jobInstance.EntityFriendlyName = entityFriendlyNameInstance; - } - - JToken actionsInfoArray = responseDoc["ActionsInfo"]; - if (actionsInfoArray != null && actionsInfoArray.Type != JTokenType.Null) - { - foreach (JToken actionsInfoValue in ((JArray)actionsInfoArray)) + + JToken dynamicErrorMessageValue = propertiesValue["dynamicErrorMessage"]; + if (dynamicErrorMessageValue != null && dynamicErrorMessageValue.Type != JTokenType.Null) { - jobInstance.ActionsInfo.Add(((JobSupportedAction)Enum.Parse(typeof(JobSupportedAction), ((string)actionsInfoValue), true))); + string dynamicErrorMessageInstance = ((string)dynamicErrorMessageValue); + propertiesInstance.DynamicErrorMessage = dynamicErrorMessageInstance; } - } - - JToken errorDetailsArray = responseDoc["ErrorDetails"]; - if (errorDetailsArray != null && errorDetailsArray.Type != JTokenType.Null) - { - foreach (JToken errorDetailsValue in ((JArray)errorDetailsArray)) + + JToken workloadTypeValue = propertiesValue["workloadType"]; + if (workloadTypeValue != null && workloadTypeValue.Type != JTokenType.Null) { - ErrorInfo errorInfoInstance = new ErrorInfo(); - jobInstance.ErrorDetails.Add(errorInfoInstance); - - JToken errorCodeValue = errorDetailsValue["ErrorCode"]; - if (errorCodeValue != null && errorCodeValue.Type != JTokenType.Null) - { - int errorCodeInstance = ((int)errorCodeValue); - errorInfoInstance.ErrorCode = errorCodeInstance; - } - - JToken errorTitleValue = errorDetailsValue["ErrorTitle"]; - if (errorTitleValue != null && errorTitleValue.Type != JTokenType.Null) - { - string errorTitleInstance = ((string)errorTitleValue); - errorInfoInstance.ErrorTitle = errorTitleInstance; - } - - JToken errorStringValue = errorDetailsValue["ErrorString"]; - if (errorStringValue != null && errorStringValue.Type != JTokenType.Null) + string workloadTypeInstance = ((string)workloadTypeValue); + propertiesInstance.WorkloadType = workloadTypeInstance; + } + + JToken operationValue = propertiesValue["operation"]; + if (operationValue != null && operationValue.Type != JTokenType.Null) + { + string operationInstance = ((string)operationValue); + propertiesInstance.Operation = operationInstance; + } + + JToken statusValue2 = propertiesValue["status"]; + if (statusValue2 != null && statusValue2.Type != JTokenType.Null) + { + string statusInstance2 = ((string)statusValue2); + propertiesInstance.Status = statusInstance2; + } + + JToken startTimestampValue = propertiesValue["startTimestamp"]; + if (startTimestampValue != null && startTimestampValue.Type != JTokenType.Null) + { + DateTime startTimestampInstance = ((DateTime)startTimestampValue); + propertiesInstance.StartTimestamp = startTimestampInstance; + } + + JToken endTimestampValue = propertiesValue["endTimestamp"]; + if (endTimestampValue != null && endTimestampValue.Type != JTokenType.Null) + { + DateTime endTimestampInstance = ((DateTime)endTimestampValue); + propertiesInstance.EndTimestamp = endTimestampInstance; + } + + JToken durationValue2 = propertiesValue["duration"]; + if (durationValue2 != null && durationValue2.Type != JTokenType.Null) + { + TimeSpan durationInstance2 = TimeSpan.Parse(((string)durationValue2), CultureInfo.InvariantCulture); + propertiesInstance.Duration = durationInstance2; + } + + JToken entityFriendlyNameValue = propertiesValue["entityFriendlyName"]; + if (entityFriendlyNameValue != null && entityFriendlyNameValue.Type != JTokenType.Null) + { + string entityFriendlyNameInstance = ((string)entityFriendlyNameValue); + propertiesInstance.EntityFriendlyName = entityFriendlyNameInstance; + } + + JToken actionsInfoArray = propertiesValue["actionsInfo"]; + if (actionsInfoArray != null && actionsInfoArray.Type != JTokenType.Null) + { + foreach (JToken actionsInfoValue in ((JArray)actionsInfoArray)) { - string errorStringInstance = ((string)errorStringValue); - errorInfoInstance.ErrorString = errorStringInstance; + propertiesInstance.ActionsInfo.Add(((JobSupportedAction)Enum.Parse(typeof(JobSupportedAction), ((string)actionsInfoValue), true))); } - - JToken recommendationsArray = errorDetailsValue["Recommendations"]; - if (recommendationsArray != null && recommendationsArray.Type != JTokenType.Null) + } + + JToken errorDetailsArray = propertiesValue["errorDetails"]; + if (errorDetailsArray != null && errorDetailsArray.Type != JTokenType.Null) + { + foreach (JToken errorDetailsValue in ((JArray)errorDetailsArray)) { - foreach (JToken recommendationsValue in ((JArray)recommendationsArray)) + CSMJobErrorInfo cSMJobErrorInfoInstance = new CSMJobErrorInfo(); + propertiesInstance.ErrorDetails.Add(cSMJobErrorInfoInstance); + + JToken errorCodeValue = errorDetailsValue["errorCode"]; + if (errorCodeValue != null && errorCodeValue.Type != JTokenType.Null) + { + int errorCodeInstance = ((int)errorCodeValue); + cSMJobErrorInfoInstance.ErrorCode = errorCodeInstance; + } + + JToken errorTitleValue = errorDetailsValue["errorTitle"]; + if (errorTitleValue != null && errorTitleValue.Type != JTokenType.Null) { - errorInfoInstance.Recommendations.Add(((string)recommendationsValue)); + string errorTitleInstance = ((string)errorTitleValue); + cSMJobErrorInfoInstance.ErrorTitle = errorTitleInstance; + } + + JToken errorStringValue = errorDetailsValue["errorString"]; + if (errorStringValue != null && errorStringValue.Type != JTokenType.Null) + { + string errorStringInstance = ((string)errorStringValue); + cSMJobErrorInfoInstance.ErrorString = errorStringInstance; + } + + JToken recommendationsArray = errorDetailsValue["recommendations"]; + if (recommendationsArray != null && recommendationsArray.Type != JTokenType.Null) + { + foreach (JToken recommendationsValue in ((JArray)recommendationsArray)) + { + cSMJobErrorInfoInstance.Recommendations.Add(((string)recommendationsValue)); + } } } } } - JToken instanceIdValue2 = responseDoc["InstanceId"]; - if (instanceIdValue2 != null && instanceIdValue2.Type != JTokenType.Null) + JToken idValue = responseDoc["id"]; + if (idValue != null && idValue.Type != JTokenType.Null) { - string instanceIdInstance2 = ((string)instanceIdValue2); - jobInstance.InstanceId = instanceIdInstance2; + string idInstance = ((string)idValue); + valueInstance.Id = idInstance; } - JToken nameValue2 = responseDoc["Name"]; - if (nameValue2 != null && nameValue2.Type != JTokenType.Null) + JToken nameValue = responseDoc["name"]; + if (nameValue != null && nameValue.Type != JTokenType.Null) { - string nameInstance2 = ((string)nameValue2); - jobInstance.Name = nameInstance2; + string nameInstance = ((string)nameValue); + valueInstance.Name = nameInstance; } - JToken operationInProgressValue2 = responseDoc["OperationInProgress"]; - if (operationInProgressValue2 != null && operationInProgressValue2.Type != JTokenType.Null) + JToken typeValue = responseDoc["type"]; + if (typeValue != null && typeValue.Type != JTokenType.Null) { - bool operationInProgressInstance2 = ((bool)operationInProgressValue2); - jobInstance.OperationInProgress = operationInProgressInstance2; + string typeInstance = ((string)typeValue); + valueInstance.Type = typeInstance; } } @@ -429,9 +435,9 @@ public async Task GetAsync(string jobId, CustomRequestHeaders c /// Cancellation token. /// /// - /// The response model for the list jobs operation. + /// Powershell response object /// - public async Task ListAsync(JobQueryParameter parameters, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) + public async Task ListAsync(CSMJobQueryObject parameters, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) { // Validate @@ -449,7 +455,7 @@ public async Task ListAsync(JobQueryParameter parameters, Custo // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId.ToString()); @@ -465,29 +471,34 @@ public async Task ListAsync(JobQueryParameter parameters, Custo url = url + "/jobs"; List queryParameters = new List(); queryParameters.Add("api-version=2014-09-01"); + List odataFilter = new List(); if (parameters != null && parameters.Status != null) { - queryParameters.Add("Status=" + Uri.EscapeDataString(parameters.Status)); + odataFilter.Add("status eq '" + Uri.EscapeDataString(parameters.Status) + "'"); } - if (parameters != null && parameters.Type != null) + if (parameters != null && parameters.WorkloadType != null) { - queryParameters.Add("Type=" + Uri.EscapeDataString(parameters.Type)); + odataFilter.Add("workloadType eq '" + Uri.EscapeDataString(parameters.WorkloadType) + "'"); } if (parameters != null && parameters.Operation != null) { - queryParameters.Add("Operation=" + Uri.EscapeDataString(parameters.Operation)); + odataFilter.Add("operation eq '" + Uri.EscapeDataString(parameters.Operation) + "'"); } - if (parameters != null && parameters.JobId != null) + if (parameters != null && parameters.Name != null) { - queryParameters.Add("JobId=" + Uri.EscapeDataString(parameters.JobId)); + odataFilter.Add("name eq '" + Uri.EscapeDataString(parameters.Name) + "'"); } if (parameters != null && parameters.StartTime != null) { - queryParameters.Add("StartTime=" + Uri.EscapeDataString(parameters.StartTime)); + odataFilter.Add("startTime eq '" + Uri.EscapeDataString(parameters.StartTime) + "'"); } if (parameters != null && parameters.EndTime != null) { - queryParameters.Add("EndTime=" + Uri.EscapeDataString(parameters.EndTime)); + odataFilter.Add("endTime eq '" + Uri.EscapeDataString(parameters.EndTime) + "'"); + } + if (odataFilter.Count > 0) + { + queryParameters.Add("$filter=" + string.Join(" and ", odataFilter)); } if (queryParameters.Count > 0) { @@ -549,13 +560,13 @@ public async Task ListAsync(JobQueryParameter parameters, Custo } // Create Result - JobListResponse result = null; + CSMJobList result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - result = new JobListResponse(); + result = new CSMJobList(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { @@ -564,150 +575,171 @@ public async Task ListAsync(JobQueryParameter parameters, Custo if (responseDoc != null && responseDoc.Type != JTokenType.Null) { - JobResponse jobsInstance = new JobResponse(); - result.Jobs = jobsInstance; + CSMJobListResponse listInstance = new CSMJobListResponse(); + result.List = listInstance; - JToken objectsArray = responseDoc["Objects"]; - if (objectsArray != null && objectsArray.Type != JTokenType.Null) + JToken valueArray = responseDoc["value"]; + if (valueArray != null && valueArray.Type != JTokenType.Null) { - foreach (JToken objectsValue in ((JArray)objectsArray)) + foreach (JToken valueValue in ((JArray)valueArray)) { - Job jobInstance = new Job(); - jobsInstance.Objects.Add(jobInstance); + CSMJobResponse cSMJobResponseInstance = new CSMJobResponse(); + listInstance.Value.Add(cSMJobResponseInstance); - JToken typeValue = objectsValue["Type"]; - if (typeValue != null && typeValue.Type != JTokenType.Null) + JToken propertiesValue = valueValue["properties"]; + if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) { - string typeInstance = ((string)typeValue); - jobInstance.Type = typeInstance; - } - - JToken operationValue = objectsValue["Operation"]; - if (operationValue != null && operationValue.Type != JTokenType.Null) - { - string operationInstance = ((string)operationValue); - jobInstance.Operation = operationInstance; - } - - JToken statusValue = objectsValue["Status"]; - if (statusValue != null && statusValue.Type != JTokenType.Null) - { - string statusInstance = ((string)statusValue); - jobInstance.Status = statusInstance; - } - - JToken startTimestampValue = objectsValue["StartTimestamp"]; - if (startTimestampValue != null && startTimestampValue.Type != JTokenType.Null) - { - DateTime startTimestampInstance = ((DateTime)startTimestampValue); - jobInstance.StartTimestamp = startTimestampInstance; - } - - JToken endTimestampValue = objectsValue["EndTimestamp"]; - if (endTimestampValue != null && endTimestampValue.Type != JTokenType.Null) - { - DateTime endTimestampInstance = ((DateTime)endTimestampValue); - jobInstance.EndTimestamp = endTimestampInstance; - } - - JToken durationValue = objectsValue["Duration"]; - if (durationValue != null && durationValue.Type != JTokenType.Null) - { - TimeSpan durationInstance = TimeSpan.Parse(((string)durationValue), CultureInfo.InvariantCulture); - jobInstance.Duration = durationInstance; - } - - JToken entityFriendlyNameValue = objectsValue["EntityFriendlyName"]; - if (entityFriendlyNameValue != null && entityFriendlyNameValue.Type != JTokenType.Null) - { - string entityFriendlyNameInstance = ((string)entityFriendlyNameValue); - jobInstance.EntityFriendlyName = entityFriendlyNameInstance; - } - - JToken actionsInfoArray = objectsValue["ActionsInfo"]; - if (actionsInfoArray != null && actionsInfoArray.Type != JTokenType.Null) - { - foreach (JToken actionsInfoValue in ((JArray)actionsInfoArray)) + CSMJobProperties propertiesInstance = new CSMJobProperties(); + cSMJobResponseInstance.Properties = propertiesInstance; + + JToken workloadTypeValue = propertiesValue["workloadType"]; + if (workloadTypeValue != null && workloadTypeValue.Type != JTokenType.Null) { - jobInstance.ActionsInfo.Add(((JobSupportedAction)Enum.Parse(typeof(JobSupportedAction), ((string)actionsInfoValue), true))); + string workloadTypeInstance = ((string)workloadTypeValue); + propertiesInstance.WorkloadType = workloadTypeInstance; } - } - - JToken errorDetailsArray = objectsValue["ErrorDetails"]; - if (errorDetailsArray != null && errorDetailsArray.Type != JTokenType.Null) - { - foreach (JToken errorDetailsValue in ((JArray)errorDetailsArray)) + + JToken operationValue = propertiesValue["operation"]; + if (operationValue != null && operationValue.Type != JTokenType.Null) { - ErrorInfo errorInfoInstance = new ErrorInfo(); - jobInstance.ErrorDetails.Add(errorInfoInstance); - - JToken errorCodeValue = errorDetailsValue["ErrorCode"]; - if (errorCodeValue != null && errorCodeValue.Type != JTokenType.Null) - { - int errorCodeInstance = ((int)errorCodeValue); - errorInfoInstance.ErrorCode = errorCodeInstance; - } - - JToken errorTitleValue = errorDetailsValue["ErrorTitle"]; - if (errorTitleValue != null && errorTitleValue.Type != JTokenType.Null) - { - string errorTitleInstance = ((string)errorTitleValue); - errorInfoInstance.ErrorTitle = errorTitleInstance; - } - - JToken errorStringValue = errorDetailsValue["ErrorString"]; - if (errorStringValue != null && errorStringValue.Type != JTokenType.Null) + string operationInstance = ((string)operationValue); + propertiesInstance.Operation = operationInstance; + } + + JToken statusValue = propertiesValue["status"]; + if (statusValue != null && statusValue.Type != JTokenType.Null) + { + string statusInstance = ((string)statusValue); + propertiesInstance.Status = statusInstance; + } + + JToken startTimestampValue = propertiesValue["startTimestamp"]; + if (startTimestampValue != null && startTimestampValue.Type != JTokenType.Null) + { + DateTime startTimestampInstance = ((DateTime)startTimestampValue); + propertiesInstance.StartTimestamp = startTimestampInstance; + } + + JToken endTimestampValue = propertiesValue["endTimestamp"]; + if (endTimestampValue != null && endTimestampValue.Type != JTokenType.Null) + { + DateTime endTimestampInstance = ((DateTime)endTimestampValue); + propertiesInstance.EndTimestamp = endTimestampInstance; + } + + JToken durationValue = propertiesValue["duration"]; + if (durationValue != null && durationValue.Type != JTokenType.Null) + { + TimeSpan durationInstance = TimeSpan.Parse(((string)durationValue), CultureInfo.InvariantCulture); + propertiesInstance.Duration = durationInstance; + } + + JToken entityFriendlyNameValue = propertiesValue["entityFriendlyName"]; + if (entityFriendlyNameValue != null && entityFriendlyNameValue.Type != JTokenType.Null) + { + string entityFriendlyNameInstance = ((string)entityFriendlyNameValue); + propertiesInstance.EntityFriendlyName = entityFriendlyNameInstance; + } + + JToken actionsInfoArray = propertiesValue["actionsInfo"]; + if (actionsInfoArray != null && actionsInfoArray.Type != JTokenType.Null) + { + foreach (JToken actionsInfoValue in ((JArray)actionsInfoArray)) { - string errorStringInstance = ((string)errorStringValue); - errorInfoInstance.ErrorString = errorStringInstance; + propertiesInstance.ActionsInfo.Add(((JobSupportedAction)Enum.Parse(typeof(JobSupportedAction), ((string)actionsInfoValue), true))); } - - JToken recommendationsArray = errorDetailsValue["Recommendations"]; - if (recommendationsArray != null && recommendationsArray.Type != JTokenType.Null) + } + + JToken errorDetailsArray = propertiesValue["errorDetails"]; + if (errorDetailsArray != null && errorDetailsArray.Type != JTokenType.Null) + { + foreach (JToken errorDetailsValue in ((JArray)errorDetailsArray)) { - foreach (JToken recommendationsValue in ((JArray)recommendationsArray)) + CSMJobErrorInfo cSMJobErrorInfoInstance = new CSMJobErrorInfo(); + propertiesInstance.ErrorDetails.Add(cSMJobErrorInfoInstance); + + JToken errorCodeValue = errorDetailsValue["errorCode"]; + if (errorCodeValue != null && errorCodeValue.Type != JTokenType.Null) + { + int errorCodeInstance = ((int)errorCodeValue); + cSMJobErrorInfoInstance.ErrorCode = errorCodeInstance; + } + + JToken errorTitleValue = errorDetailsValue["errorTitle"]; + if (errorTitleValue != null && errorTitleValue.Type != JTokenType.Null) + { + string errorTitleInstance = ((string)errorTitleValue); + cSMJobErrorInfoInstance.ErrorTitle = errorTitleInstance; + } + + JToken errorStringValue = errorDetailsValue["errorString"]; + if (errorStringValue != null && errorStringValue.Type != JTokenType.Null) + { + string errorStringInstance = ((string)errorStringValue); + cSMJobErrorInfoInstance.ErrorString = errorStringInstance; + } + + JToken recommendationsArray = errorDetailsValue["recommendations"]; + if (recommendationsArray != null && recommendationsArray.Type != JTokenType.Null) { - errorInfoInstance.Recommendations.Add(((string)recommendationsValue)); + foreach (JToken recommendationsValue in ((JArray)recommendationsArray)) + { + cSMJobErrorInfoInstance.Recommendations.Add(((string)recommendationsValue)); + } } } } } - JToken instanceIdValue = objectsValue["InstanceId"]; - if (instanceIdValue != null && instanceIdValue.Type != JTokenType.Null) + JToken idValue = valueValue["id"]; + if (idValue != null && idValue.Type != JTokenType.Null) { - string instanceIdInstance = ((string)instanceIdValue); - jobInstance.InstanceId = instanceIdInstance; + string idInstance = ((string)idValue); + cSMJobResponseInstance.Id = idInstance; } - JToken nameValue = objectsValue["Name"]; + JToken nameValue = valueValue["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { string nameInstance = ((string)nameValue); - jobInstance.Name = nameInstance; + cSMJobResponseInstance.Name = nameInstance; } - JToken operationInProgressValue = objectsValue["OperationInProgress"]; - if (operationInProgressValue != null && operationInProgressValue.Type != JTokenType.Null) + JToken typeValue = valueValue["type"]; + if (typeValue != null && typeValue.Type != JTokenType.Null) { - bool operationInProgressInstance = ((bool)operationInProgressValue); - jobInstance.OperationInProgress = operationInProgressInstance; + string typeInstance = ((string)typeValue); + cSMJobResponseInstance.Type = typeInstance; } } } - JToken resultCountValue = responseDoc["ResultCount"]; - if (resultCountValue != null && resultCountValue.Type != JTokenType.Null) + JToken nextLinkValue = responseDoc["nextLink"]; + if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null) + { + string nextLinkInstance = ((string)nextLinkValue); + listInstance.NextLink = nextLinkInstance; + } + + JToken idValue2 = responseDoc["id"]; + if (idValue2 != null && idValue2.Type != JTokenType.Null) { - int resultCountInstance = ((int)resultCountValue); - jobsInstance.ResultCount = resultCountInstance; + string idInstance2 = ((string)idValue2); + listInstance.Id = idInstance2; + } + + JToken nameValue2 = responseDoc["name"]; + if (nameValue2 != null && nameValue2.Type != JTokenType.Null) + { + string nameInstance2 = ((string)nameValue2); + listInstance.Name = nameInstance2; } - JToken skiptokenValue = responseDoc["Skiptoken"]; - if (skiptokenValue != null && skiptokenValue.Type != JTokenType.Null) + JToken typeValue2 = responseDoc["type"]; + if (typeValue2 != null && typeValue2.Type != JTokenType.Null) { - string skiptokenInstance = ((string)skiptokenValue); - jobsInstance.Skiptoken = skiptokenInstance; + string typeInstance2 = ((string)typeValue2); + listInstance.Type = typeInstance2; } } @@ -740,8 +772,8 @@ public async Task ListAsync(JobQueryParameter parameters, Custo /// /// Trigger cancellation of a job. /// - /// - /// Optional. Id of the job whose details should be retrieved. + /// + /// Optional. Name of the job which should be stopped. /// /// /// Optional. Custom request headers to make the call. @@ -752,7 +784,7 @@ public async Task ListAsync(JobQueryParameter parameters, Custo /// /// The definition of a Operation Response. /// - public async Task StopAsync(string jobId, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) + public async Task StopAsync(string name, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) { // Validate @@ -763,14 +795,14 @@ public async Task StopAsync(string jobId, CustomRequestHeader { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("jobId", jobId); + tracingParameters.Add("name", name); tracingParameters.Add("customRequestHeaders", customRequestHeaders); TracingAdapter.Enter(invocationId, this, "StopAsync", tracingParameters); } // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); @@ -784,9 +816,9 @@ public async Task StopAsync(string jobId, CustomRequestHeader url = url + "/"; url = url + Uri.EscapeDataString(this.Client.ResourceName); url = url + "/jobs/"; - if (jobId != null) + if (name != null) { - url = url + Uri.EscapeDataString(jobId); + url = url + Uri.EscapeDataString(name); } url = url + "/cancel"; List queryParameters = new List(); diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobOperationsExtensions.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobOperationsExtensions.cs index fce3acb088afa..1dedf42868639 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobOperationsExtensions.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobOperationsExtensions.cs @@ -37,20 +37,20 @@ public static partial class JobOperationsExtensions /// Reference to the /// Microsoft.Azure.Management.BackupServices.IJobOperations. /// - /// - /// Optional. Request header parameters. + /// + /// Optional. Name of the job whose details should be retrieved. /// /// /// Optional. Request header parameters. /// /// - /// The response model for the list jobs operation. + /// Response model for job details operation /// - public static JobByIdResponse Get(this IJobOperations operations, string jobId, CustomRequestHeaders customRequestHeaders) + public static CSMJobDetails Get(this IJobOperations operations, string name, CustomRequestHeaders customRequestHeaders) { return Task.Factory.StartNew((object s) => { - return ((IJobOperations)s).GetAsync(jobId, customRequestHeaders); + return ((IJobOperations)s).GetAsync(name, customRequestHeaders); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } @@ -62,18 +62,18 @@ public static JobByIdResponse Get(this IJobOperations operations, string jobId, /// Reference to the /// Microsoft.Azure.Management.BackupServices.IJobOperations. /// - /// - /// Optional. Request header parameters. + /// + /// Optional. Name of the job whose details should be retrieved. /// /// /// Optional. Request header parameters. /// /// - /// The response model for the list jobs operation. + /// Response model for job details operation /// - public static Task GetAsync(this IJobOperations operations, string jobId, CustomRequestHeaders customRequestHeaders) + public static Task GetAsync(this IJobOperations operations, string name, CustomRequestHeaders customRequestHeaders) { - return operations.GetAsync(jobId, customRequestHeaders, CancellationToken.None); + return operations.GetAsync(name, customRequestHeaders, CancellationToken.None); } /// @@ -90,9 +90,9 @@ public static Task GetAsync(this IJobOperations operations, str /// Optional. Request header parameters. /// /// - /// The response model for the list jobs operation. + /// Powershell response object /// - public static JobListResponse List(this IJobOperations operations, JobQueryParameter parameters, CustomRequestHeaders customRequestHeaders) + public static CSMJobList List(this IJobOperations operations, CSMJobQueryObject parameters, CustomRequestHeaders customRequestHeaders) { return Task.Factory.StartNew((object s) => { @@ -115,9 +115,9 @@ public static JobListResponse List(this IJobOperations operations, JobQueryParam /// Optional. Request header parameters. /// /// - /// The response model for the list jobs operation. + /// Powershell response object /// - public static Task ListAsync(this IJobOperations operations, JobQueryParameter parameters, CustomRequestHeaders customRequestHeaders) + public static Task ListAsync(this IJobOperations operations, CSMJobQueryObject parameters, CustomRequestHeaders customRequestHeaders) { return operations.ListAsync(parameters, customRequestHeaders, CancellationToken.None); } @@ -129,8 +129,8 @@ public static Task ListAsync(this IJobOperations operations, Jo /// Reference to the /// Microsoft.Azure.Management.BackupServices.IJobOperations. /// - /// - /// Optional. Id of the job whose details should be retrieved. + /// + /// Optional. Name of the job which should be stopped. /// /// /// Optional. Custom request headers to make the call. @@ -138,11 +138,11 @@ public static Task ListAsync(this IJobOperations operations, Jo /// /// The definition of a Operation Response. /// - public static OperationResponse Stop(this IJobOperations operations, string jobId, CustomRequestHeaders customRequestHeaders) + public static OperationResponse Stop(this IJobOperations operations, string name, CustomRequestHeaders customRequestHeaders) { return Task.Factory.StartNew((object s) => { - return ((IJobOperations)s).StopAsync(jobId, customRequestHeaders); + return ((IJobOperations)s).StopAsync(name, customRequestHeaders); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); } @@ -154,8 +154,8 @@ public static OperationResponse Stop(this IJobOperations operations, string jobI /// Reference to the /// Microsoft.Azure.Management.BackupServices.IJobOperations. /// - /// - /// Optional. Id of the job whose details should be retrieved. + /// + /// Optional. Name of the job which should be stopped. /// /// /// Optional. Custom request headers to make the call. @@ -163,9 +163,9 @@ public static OperationResponse Stop(this IJobOperations operations, string jobI /// /// The definition of a Operation Response. /// - public static Task StopAsync(this IJobOperations operations, string jobId, CustomRequestHeaders customRequestHeaders) + public static Task StopAsync(this IJobOperations operations, string name, CustomRequestHeaders customRequestHeaders) { - return operations.StopAsync(jobId, customRequestHeaders, CancellationToken.None); + return operations.StopAsync(name, customRequestHeaders, CancellationToken.None); } } } diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CSMRecoveryPointGetOperationResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CSMRecoveryPointGetOperationResponse.cs index 0c51bd656fc3d..a32c8f2e776ec 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CSMRecoveryPointGetOperationResponse.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CSMRecoveryPointGetOperationResponse.cs @@ -27,19 +27,19 @@ namespace Microsoft.Azure.Management.BackupServices.Models { /// - /// The definition of a CSMRecoveryPointOperationResponse. + /// The definition of a CSMRecoveryPointGetOperationResponse. /// public partial class CSMRecoveryPointGetOperationResponse : AzureOperationResponse { - private CSMRecoveryPointResponse _value; + private CSMRecoveryPointResponse _cSMRecoveryPointResponse; /// /// Optional. Recovery Point Response /// - public CSMRecoveryPointResponse Value + public CSMRecoveryPointResponse CSMRecoveryPointResponse { - get { return this._value; } - set { this._value = value; } + get { return this._cSMRecoveryPointResponse; } + set { this._cSMRecoveryPointResponse = value; } } /// diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/OperationStatus.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/OperationStatus.cs index 0fbd72697b376..d564f8b601d3b 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/OperationStatus.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/OperationStatus.cs @@ -97,7 +97,7 @@ public async Task CSMGetAsync(string operationId, CustomRequ // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); @@ -110,7 +110,7 @@ public async Task CSMGetAsync(string operationId, CustomRequ url = url + "BackupVault"; url = url + "/"; url = url + Uri.EscapeDataString(this.Client.ResourceName); - url = url + "/operations/"; + url = url + "/operationResults/"; url = url + Uri.EscapeDataString(operationId); List queryParameters = new List(); queryParameters.Add("api-version=2014-09-01"); diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ProtectableObjectOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ProtectableObjectOperations.cs index 11ca16a10697f..e75a0c5377716 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ProtectableObjectOperations.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ProtectableObjectOperations.cs @@ -94,7 +94,7 @@ public async Task ListCSMAsync(CSMItemQueryObject // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RecoveryPointOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RecoveryPointOperations.cs index ff2ff78741cde..cc1d16f63ffbd 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RecoveryPointOperations.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RecoveryPointOperations.cs @@ -79,7 +79,7 @@ public BackupServicesManagementClient Client /// Cancellation token. /// /// - /// The definition of a CSMRecoveryPointOperationResponse. + /// The definition of a CSMRecoveryPointGetOperationResponse. /// public async Task GetAsync(CustomRequestHeaders customRequestHeaders, string containerName, string itemName, string recoveryPointName, CancellationToken cancellationToken) { @@ -101,7 +101,7 @@ public async Task GetAsync(CustomRequestHe // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); @@ -205,61 +205,57 @@ public async Task GetAsync(CustomRequestHe if (responseDoc != null && responseDoc.Type != JTokenType.Null) { - JToken valueValue = responseDoc["value"]; - if (valueValue != null && valueValue.Type != JTokenType.Null) + CSMRecoveryPointResponse cSMRecoveryPointResponseInstance = new CSMRecoveryPointResponse(); + result.CSMRecoveryPointResponse = cSMRecoveryPointResponseInstance; + + JToken propertiesValue = responseDoc["properties"]; + if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) { - CSMRecoveryPointResponse valueInstance = new CSMRecoveryPointResponse(); - result.Value = valueInstance; - - JToken propertiesValue = valueValue["properties"]; - if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) - { - CSMRecoveryPointProperties propertiesInstance = new CSMRecoveryPointProperties(); - valueInstance.Properties = propertiesInstance; - - JToken recoveryPointTypeValue = propertiesValue["recoveryPointType"]; - if (recoveryPointTypeValue != null && recoveryPointTypeValue.Type != JTokenType.Null) - { - string recoveryPointTypeInstance = ((string)recoveryPointTypeValue); - propertiesInstance.RecoveryPointType = recoveryPointTypeInstance; - } - - JToken recoveryPointTimeValue = propertiesValue["recoveryPointTime"]; - if (recoveryPointTimeValue != null && recoveryPointTimeValue.Type != JTokenType.Null) - { - DateTime recoveryPointTimeInstance = ((DateTime)recoveryPointTimeValue); - propertiesInstance.RecoveryPointTime = recoveryPointTimeInstance; - } - - JToken recoveryPointAdditionalInfoValue = propertiesValue["recoveryPointAdditionalInfo"]; - if (recoveryPointAdditionalInfoValue != null && recoveryPointAdditionalInfoValue.Type != JTokenType.Null) - { - string recoveryPointAdditionalInfoInstance = ((string)recoveryPointAdditionalInfoValue); - propertiesInstance.RecoveryPointAdditionalInfo = recoveryPointAdditionalInfoInstance; - } - } + CSMRecoveryPointProperties propertiesInstance = new CSMRecoveryPointProperties(); + cSMRecoveryPointResponseInstance.Properties = propertiesInstance; - JToken idValue = valueValue["id"]; - if (idValue != null && idValue.Type != JTokenType.Null) + JToken recoveryPointTypeValue = propertiesValue["recoveryPointType"]; + if (recoveryPointTypeValue != null && recoveryPointTypeValue.Type != JTokenType.Null) { - string idInstance = ((string)idValue); - valueInstance.Id = idInstance; + string recoveryPointTypeInstance = ((string)recoveryPointTypeValue); + propertiesInstance.RecoveryPointType = recoveryPointTypeInstance; } - JToken nameValue = valueValue["name"]; - if (nameValue != null && nameValue.Type != JTokenType.Null) + JToken recoveryPointTimeValue = propertiesValue["recoveryPointTime"]; + if (recoveryPointTimeValue != null && recoveryPointTimeValue.Type != JTokenType.Null) { - string nameInstance = ((string)nameValue); - valueInstance.Name = nameInstance; + DateTime recoveryPointTimeInstance = ((DateTime)recoveryPointTimeValue); + propertiesInstance.RecoveryPointTime = recoveryPointTimeInstance; } - JToken typeValue = valueValue["type"]; - if (typeValue != null && typeValue.Type != JTokenType.Null) + JToken recoveryPointAdditionalInfoValue = propertiesValue["recoveryPointAdditionalInfo"]; + if (recoveryPointAdditionalInfoValue != null && recoveryPointAdditionalInfoValue.Type != JTokenType.Null) { - string typeInstance = ((string)typeValue); - valueInstance.Type = typeInstance; + string recoveryPointAdditionalInfoInstance = ((string)recoveryPointAdditionalInfoValue); + propertiesInstance.RecoveryPointAdditionalInfo = recoveryPointAdditionalInfoInstance; } } + + JToken idValue = responseDoc["id"]; + if (idValue != null && idValue.Type != JTokenType.Null) + { + string idInstance = ((string)idValue); + cSMRecoveryPointResponseInstance.Id = idInstance; + } + + JToken nameValue = responseDoc["name"]; + if (nameValue != null && nameValue.Type != JTokenType.Null) + { + string nameInstance = ((string)nameValue); + cSMRecoveryPointResponseInstance.Name = nameInstance; + } + + JToken typeValue = responseDoc["type"]; + if (typeValue != null && typeValue.Type != JTokenType.Null) + { + string typeInstance = ((string)typeValue); + cSMRecoveryPointResponseInstance.Type = typeInstance; + } } } @@ -329,7 +325,7 @@ public async Task ListAsync(CustomRequest // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RecoveryPointOperationsExtensions.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RecoveryPointOperationsExtensions.cs index 045a0a3e2e9ed..b4c82e846fc1b 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RecoveryPointOperationsExtensions.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RecoveryPointOperationsExtensions.cs @@ -50,7 +50,7 @@ public static partial class RecoveryPointOperationsExtensions /// Optional. /// /// - /// The definition of a CSMRecoveryPointOperationResponse. + /// The definition of a CSMRecoveryPointGetOperationResponse. /// public static CSMRecoveryPointGetOperationResponse Get(this IRecoveryPointOperations operations, CustomRequestHeaders customRequestHeaders, string containerName, string itemName, string recoveryPointName) { @@ -81,7 +81,7 @@ public static CSMRecoveryPointGetOperationResponse Get(this IRecoveryPointOperat /// Optional. /// /// - /// The definition of a CSMRecoveryPointOperationResponse. + /// The definition of a CSMRecoveryPointGetOperationResponse. /// public static Task GetAsync(this IRecoveryPointOperations operations, CustomRequestHeaders customRequestHeaders, string containerName, string itemName, string recoveryPointName) { diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RestoreOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RestoreOperations.cs index 47e1bb4bb1f14..4df6ae26caa28 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RestoreOperations.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/RestoreOperations.cs @@ -122,7 +122,7 @@ public async Task TriggerResotreAsync(CustomRequestHeaders cu // Construct URL string url = ""; - url = url + "/Subscriptions/"; + url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); From b52422a710b7b1e2a0a6f2890e254402607b616b Mon Sep 17 00:00:00 2001 From: pikumarmsft Date: Fri, 31 Jul 2015 14:21:30 +0530 Subject: [PATCH 2/3] latest changes --- .../BackupServices.Tests.csproj | 5 +- .../ScenarioTests/CSMAzureBackupItem.cs | 165 ++++ .../ScenarioTests/CSMProtectionPolicyTests.cs | 12 +- .../BackupServicesManagement.csproj | 224 +++-- .../BackupServicesManagementClient.cs | 8 +- .../BackupVaultServicesManagementClient.cs | 12 + .../Generated/ContainerOperation.cs | 807 ------------------ .../Generated/ContainerOperationExtensions.cs | 213 ----- .../Generated/DataSourceOperations.cs | 15 +- .../IBackupServicesManagementClient.cs | 2 +- .../IBackupVaultServicesManagementClient.cs | 8 + .../Generated/IContainerOperation.cs | 102 --- .../Generated/JobQueryParameter.cs | 105 --- .../Generated/JobResponse.cs | 92 -- .../Models/DataSourceListResponse.cs | 52 -- .../Models/DataSourceQueryParameter.cs | 72 -- .../Generated/Models/ErrorInfo.cs | 105 --- .../Generated/Models/Job.cs | 143 ---- .../Generated/Models/JobByIdResponse.cs | 53 -- .../Generated/Models/JobListResponse.cs | 52 -- .../Generated/Models/JobProperties.cs | 66 -- .../Generated/Models/JobTaskDetails.cs | 95 --- .../Generated/Models/POQueryParameter.cs | 61 -- .../Models/ProtectableObjectListResponse.cs | 53 -- .../Generated/Models/RecoveryPointInfo.cs | 73 -- .../Models/RecoveryPointInfoResponse.cs | 92 -- .../Models/RecoveryPointListResponse.cs | 52 -- .../Generated/OperationResultResponse.cs | 98 --- .../Generated/ProtectableObjectOperations.cs | 15 +- 29 files changed, 354 insertions(+), 2498 deletions(-) create mode 100644 src/ResourceManagement/AzureBackup/BackupServices.Tests/ScenarioTests/CSMAzureBackupItem.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperation.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperationExtensions.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IContainerOperation.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobQueryParameter.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobResponse.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/DataSourceListResponse.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/DataSourceQueryParameter.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ErrorInfo.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/Job.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobByIdResponse.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobListResponse.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobProperties.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobTaskDetails.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/POQueryParameter.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ProtectableObjectListResponse.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointInfo.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointInfoResponse.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointListResponse.cs delete mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/OperationResultResponse.cs diff --git a/src/ResourceManagement/AzureBackup/BackupServices.Tests/BackupServices.Tests.csproj b/src/ResourceManagement/AzureBackup/BackupServices.Tests/BackupServices.Tests.csproj index fd9028ef7dc43..882a2bdb959ae 100644 --- a/src/ResourceManagement/AzureBackup/BackupServices.Tests/BackupServices.Tests.csproj +++ b/src/ResourceManagement/AzureBackup/BackupServices.Tests/BackupServices.Tests.csproj @@ -9,10 +9,11 @@ - - + + Code + diff --git a/src/ResourceManagement/AzureBackup/BackupServices.Tests/ScenarioTests/CSMAzureBackupItem.cs b/src/ResourceManagement/AzureBackup/BackupServices.Tests/ScenarioTests/CSMAzureBackupItem.cs new file mode 100644 index 0000000000000..892e12288f6b1 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServices.Tests/ScenarioTests/CSMAzureBackupItem.cs @@ -0,0 +1,165 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +using Microsoft.Azure.Management.BackupServices; +using Microsoft.Azure.Management.BackupServices.Models; +using Microsoft.Azure.Test; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace BackupServices.Tests +{ + public class CSMAzureBackupItem : BackupServicesTestsBase + { + [Fact] + public void EnableAzureBackupProtectionTest() + { + using (UndoContext context = UndoContext.Current) + { + var client = GetServiceClient(); + context.Start(); + CSMSetProtectionRequest input = new CSMSetProtectionRequest(); + input.Properties = new CSMSetProtectionRequestProperties(); + input.Properties.PolicyId = ConfigurationManager.AppSettings["PolicyId"]; + string itemName = ConfigurationManager.AppSettings["AzureBackupItemName"]; + string containerName = ConfigurationManager.AppSettings["ContainerName"]; + + var response = client.DataSource.EnableProtectionCSM(GetCustomRequestHeaders(), + containerName, + itemName, + input); + + Assert.Equal(HttpStatusCode.Accepted, response.StatusCode); + } + } + + [Fact] + public void UpdateAzureBackupProtectionTest() + { + using (UndoContext context = UndoContext.Current) + { + var client = GetServiceClient(); + context.Start(); + + CSMUpdateProtectionRequest input = new CSMUpdateProtectionRequest(); + input.Properties = new CSMUpdateProtectionRequestProperties(); + string itemName = ConfigurationManager.AppSettings["AzureBackupItemName"]; + string containerName = ConfigurationManager.AppSettings["ContainerName"]; + input.Properties.PolicyId = string.Empty; + + var response = client.DataSource.UpdateProtectionCSM(GetCustomRequestHeaders(), + containerName, + itemName, + input); + + Assert.Equal(HttpStatusCode.Accepted, response.StatusCode); + } + } + + [Fact] + public void DisableAzureBackupProtectionTest() + { + using (UndoContext context = UndoContext.Current) + { + var client = GetServiceClient(); + context.Start(); + + string itemName = ConfigurationManager.AppSettings["AzureBackupItemName"]; + string containerName = ConfigurationManager.AppSettings["ContainerName"]; + var response = client.DataSource.DisableProtectionCSM(GetCustomRequestHeaders(), + containerName, + itemName); + + Assert.Equal(HttpStatusCode.Accepted, response.StatusCode); + } + } + + [Fact] + public void ListAzureBackupItemPOTest() + { + using (UndoContext context = UndoContext.Current) + { + context.Start(); + + CSMItemQueryObject POQueryParam = new CSMItemQueryObject() + { + Status = null, + Type = null + }; + + var client = GetServiceClient(); + + var response = client.ProtectableObject.ListCSMAsync(POQueryParam, GetCustomRequestHeaders()).Result; + + Assert.True(response.CSMItemListResponse.Value.Count > 0, "Protectable Object Result count can't be less than 1"); + + foreach (var po in response.CSMItemListResponse.Value) + { + Assert.True(!string.IsNullOrEmpty(po.Properties.ContainerId), "ContainerId can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(po.Properties.FriendlyName), "FriendlyName can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(po.Properties.ItemType), "ItemType can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(po.Properties.Status), "Status can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(po.Name), "Name can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(po.Type), "Type can't be null or empty"); + } + + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + } + } + + [Fact] + public void ListAzureBackupItemDSTest() + { + using (UndoContext context = UndoContext.Current) + { + context.Start(); + + CSMProtectedItemQueryObject DSQueryParam = new CSMProtectedItemQueryObject() + { + ProtectionStatus = null, + Status = null, + Type = null + }; + + var client = GetServiceClient(); + + var response = client.DataSource.ListCSMAsync(DSQueryParam, GetCustomRequestHeaders()).Result; + foreach (var ds in response.CSMProtectedItemListResponse.Value) + { + Assert.True(!string.IsNullOrEmpty(ds.Properties.ContainerId), "ContainerId can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(ds.Properties.FriendlyName), "FriendlyName can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(ds.Properties.ItemType), "ItemType can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(ds.Properties.LastBackupJobId), "LastBackupJobId can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(ds.Properties.LastBackupStatus), "LastBackupStatus can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(ds.Properties.ProtectionPolicyId), "ProtectionPolicyId can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(ds.Properties.ProtectionStatus), "ProtectionStatus can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(ds.Properties.RecoveryPointsCount.ToString()), "RecoveryPointsCount can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(ds.Properties.Status), "Status can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(ds.Name), "Name can't be null or empty"); + Assert.True(!string.IsNullOrEmpty(ds.Type), "Type can't be null or empty"); + } + + Assert.Equal(HttpStatusCode.OK, response.StatusCode); + } + } + } +} \ No newline at end of file diff --git a/src/ResourceManagement/AzureBackup/BackupServices.Tests/ScenarioTests/CSMProtectionPolicyTests.cs b/src/ResourceManagement/AzureBackup/BackupServices.Tests/ScenarioTests/CSMProtectionPolicyTests.cs index 0d09bc8425876..fdd496eab07b4 100644 --- a/src/ResourceManagement/AzureBackup/BackupServices.Tests/ScenarioTests/CSMProtectionPolicyTests.cs +++ b/src/ResourceManagement/AzureBackup/BackupServices.Tests/ScenarioTests/CSMProtectionPolicyTests.cs @@ -19,7 +19,7 @@ public void ListProtectionPolicyTest() context.Start(); var client = GetServiceClient(); - var response = client.ProtectionPolicy.List(GetCustomRequestHeaders()); + var response = client.CSMProtectionPolicy.List(GetCustomRequestHeaders()); Assert.True(response.CSMProtectionPolicyListResponse.Value.Count > 0, "Protection Policies Result count can't be less than 1"); @@ -32,12 +32,12 @@ public void ListProtectionPolicyTest() Assert.True(!string.IsNullOrEmpty(ppo.Name), "Policy Name can't be null or empty"); if(ppo.Properties.BackupSchedule.ScheduleRun == "Daily") { - Assert.True(ppo.Properties.LTRRetentionPolicy.DailySchedule == null, "Daily RetentionType can't be null or empty for Daily Schedule"); + Assert.True(ppo.Properties.LtrRetentionPolicy.DailySchedule == null, "Daily RetentionType can't be null or empty for Daily Schedule"); } else { - Assert.True(ppo.Properties.LTRRetentionPolicy.WeeklySchedule == null, "Weekly RetentionType can't be null or empty for Weekly Schedule"); + Assert.True(ppo.Properties.LtrRetentionPolicy.WeeklySchedule == null, "Weekly RetentionType can't be null or empty for Weekly Schedule"); } } @@ -61,7 +61,7 @@ public void AddProtectionPolicyTest() addProtectionPolicyRequest.Properties.BackupSchedule = backupSchedule; addProtectionPolicyRequest.Properties.WorkloadType = ConfigurationManager.AppSettings["WorkloadType"]; addProtectionPolicyRequest.Properties.LtrRetentionPolicy = GetRetentionPolicy(backupSchedule.ScheduleRunTimes); - var response = client.ProtectionPolicy.Add(policyName, addProtectionPolicyRequest, GetCustomRequestHeaders()); + var response = client.CSMProtectionPolicy.Add(policyName, addProtectionPolicyRequest, GetCustomRequestHeaders()); Assert.Equal(HttpStatusCode.OK, response.StatusCode); } @@ -81,7 +81,7 @@ public void UpdateProtectionPolicyTest() string policyName = ConfigurationManager.AppSettings["PolicyName"]; updateProtectionPolicyRequest.Properties.BackupSchedule = backupSchedule; updateProtectionPolicyRequest.Properties.LtrRetentionPolicy = GetRetentionPolicy(backupSchedule.ScheduleRunTimes); - var response = client.ProtectionPolicy.Update(policyName, updateProtectionPolicyRequest, GetCustomRequestHeaders()); + var response = client.CSMProtectionPolicy.Update(policyName, updateProtectionPolicyRequest, GetCustomRequestHeaders()); var isSuccess = (response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Accepted) ? true : false; Assert.Equal(true, isSuccess); } @@ -95,7 +95,7 @@ public void DeleteProtectionPolicyTest() context.Start(); var client = GetServiceClient(); string policyName = ConfigurationManager.AppSettings["PolicyName"]; - var response = client.ProtectionPolicy.Delete(policyName, GetCustomRequestHeaders()); + var response = client.CSMProtectionPolicy.Delete(policyName, GetCustomRequestHeaders()); Assert.Equal(HttpStatusCode.NoContent, response.StatusCode); } diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/BackupServicesManagement.csproj b/src/ResourceManagement/AzureBackup/BackupServicesManagement/BackupServicesManagement.csproj index 2d4aefd09d919..bf45d380063b0 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/BackupServicesManagement.csproj +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/BackupServicesManagement.csproj @@ -51,10 +51,10 @@ Code - + Code - + Code @@ -63,8 +63,12 @@ Code - - + + Code + + + Code + Code @@ -80,23 +84,25 @@ Code - + + Code + + Code - Code Code - + Code - + Code - + Code @@ -114,13 +120,10 @@ Code - + Code - - Code - - + Code @@ -141,12 +144,30 @@ Code - + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + Code - - - Code @@ -168,8 +189,12 @@ Code - - + + Code + + + Code + Code @@ -185,21 +210,45 @@ Code - - - - - - - - - - + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + Code - - + + Code + + + Code + Code @@ -215,11 +264,21 @@ Code - - - - - + + Code + + + Code + + + Code + + + Code + + + Code + Code @@ -241,104 +300,97 @@ Code - - - - + Code - + Code - - - + Code - + Code - - - - + Code - + Code - + Code - + Code - + Code - - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + Code - + + Code + + Code @@ -353,10 +405,9 @@ Code - + Code - Code @@ -369,9 +420,6 @@ Code - - Code - Code @@ -381,11 +429,10 @@ Code - - + Code - + Code @@ -400,12 +447,6 @@ Code - - Code - - - Code - Code @@ -424,7 +465,6 @@ Code - diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupServicesManagementClient.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupServicesManagementClient.cs index 55d70145e37a8..62aa7408b89f8 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupServicesManagementClient.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupServicesManagementClient.cs @@ -110,12 +110,12 @@ public virtual IBackUpOperations BackUp get { return this._backUp; } } - private IContainerOperation _container; + private IContainerOperations _container; /// /// Definition of Container operations for the Azure Backup extension. /// - public virtual IContainerOperation Container + public virtual IContainerOperations Container { get { return this._container; } } @@ -201,7 +201,7 @@ public BackupServicesManagementClient() : base() { this._backUp = new BackUpOperations(this); - this._container = new ContainerOperation(this); + this._container = new ContainerOperations(this); this._cSMProtectionPolicy = new CSMProtectionPolicyOperations(this); this._dataSource = new DataSourceOperations(this); this._job = new JobOperations(this); @@ -310,7 +310,7 @@ public BackupServicesManagementClient(HttpClient httpClient) : base(httpClient) { this._backUp = new BackUpOperations(this); - this._container = new ContainerOperation(this); + this._container = new ContainerOperations(this); this._cSMProtectionPolicy = new CSMProtectionPolicyOperations(this); this._dataSource = new DataSourceOperations(this); this._job = new JobOperations(this); diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupVaultServicesManagementClient.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupVaultServicesManagementClient.cs index b698d817fd9f1..f30b441790cbb 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupVaultServicesManagementClient.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/BackupVaultServicesManagementClient.cs @@ -100,6 +100,16 @@ public string ResourceName set { this._resourceName = value; } } + private IMarsContainerOperations _container; + + /// + /// Definition of Container operations for the Azure Backup extension. + /// + public virtual IMarsContainerOperations Container + { + get { return this._container; } + } + private IVaultOperations _vault; /// @@ -118,6 +128,7 @@ public virtual IVaultOperations Vault public BackupVaultServicesManagementClient() : base() { + this._container = new MarsContainerOperations(this); this._vault = new VaultOperations(this); this._apiVersion = "2013-03-01"; this._longRunningOperationInitialTimeout = -1; @@ -219,6 +230,7 @@ public BackupVaultServicesManagementClient(string resourceName, string resourceG public BackupVaultServicesManagementClient(HttpClient httpClient) : base(httpClient) { + this._container = new MarsContainerOperations(this); this._vault = new VaultOperations(this); this._apiVersion = "2013-03-01"; this._longRunningOperationInitialTimeout = -1; diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperation.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperation.cs deleted file mode 100644 index 242aec6fdc6f2..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperation.cs +++ /dev/null @@ -1,807 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Hyak.Common; -using Microsoft.Azure.Management.BackupServices; -using Microsoft.Azure.Management.BackupServices.Models; -using Newtonsoft.Json.Linq; - -namespace Microsoft.Azure.Management.BackupServices -{ - /// - /// Definition of Container operations for the Azure Backup extension. - /// - internal partial class ContainerOperation : IServiceOperations, IContainerOperation - { - /// - /// Initializes a new instance of the ContainerOperation class. - /// - /// - /// Reference to the service client. - /// - internal ContainerOperation(BackupServicesManagementClient client) - { - this._client = client; - } - - private BackupServicesManagementClient _client; - - /// - /// Gets a reference to the - /// Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient. - /// - public BackupServicesManagementClient Client - { - get { return this._client; } - } - - /// - /// Get the list of all container based on the given query filter - /// string. - /// - /// - /// Optional. Job query parameter string. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// Cancellation token. - /// - /// - /// The definition of a CSMContainerListOperationResponse. - /// - public async Task ListAsync(string queryFilterString, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) - { - // Validate - - // Tracing - bool shouldTrace = TracingAdapter.IsEnabled; - string invocationId = null; - if (shouldTrace) - { - invocationId = TracingAdapter.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("queryFilterString", queryFilterString); - tracingParameters.Add("customRequestHeaders", customRequestHeaders); - TracingAdapter.Enter(invocationId, this, "ListAsync", tracingParameters); - } - - // Construct URL - string url = ""; - url = url + "/Subscriptions/"; - if (this.Client.Credentials.SubscriptionId != null) - { - url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); - } - url = url + "/resourceGroups/"; - url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); - url = url + "/providers/"; - url = url + "Microsoft.Backup"; - url = url + "/"; - url = url + "BackupVault"; - url = url + "/"; - url = url + Uri.EscapeDataString(this.Client.ResourceName); - url = url + "/containers"; - List queryParameters = new List(); - queryParameters.Add("api-version=2014-09-01"); - if (queryFilterString != null) - { - queryParameters.Add("dummy=" + Uri.EscapeDataString(queryFilterString)); - } - if (queryParameters.Count > 0) - { - url = url + "?" + string.Join("&", queryParameters); - } - string baseUrl = this.Client.BaseUri.AbsoluteUri; - // Trim '/' character from the end of baseUrl and beginning of url. - if (baseUrl[baseUrl.Length - 1] == '/') - { - baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); - } - if (url[0] == '/') - { - url = url.Substring(1); - } - url = baseUrl + "/" + url; - url = url.Replace(" ", "%20"); - - // Create HTTP transport objects - HttpRequestMessage httpRequest = null; - try - { - httpRequest = new HttpRequestMessage(); - httpRequest.Method = HttpMethod.Get; - httpRequest.RequestUri = new Uri(url); - - // Set Headers - httpRequest.Headers.Add("Accept-Language", "en-us"); - - // Set Credentials - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); - - // Send Request - HttpResponseMessage httpResponse = null; - try - { - if (shouldTrace) - { - TracingAdapter.SendRequest(invocationId, httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); - if (shouldTrace) - { - TracingAdapter.ReceiveResponse(invocationId, httpResponse); - } - HttpStatusCode statusCode = httpResponse.StatusCode; - if (statusCode != HttpStatusCode.OK) - { - cancellationToken.ThrowIfCancellationRequested(); - CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); - if (shouldTrace) - { - TracingAdapter.Error(invocationId, ex); - } - throw ex; - } - - // Create Result - CSMContainerListOperationResponse result = null; - // Deserialize Response - if (statusCode == HttpStatusCode.OK) - { - cancellationToken.ThrowIfCancellationRequested(); - string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - result = new CSMContainerListOperationResponse(); - JToken responseDoc = null; - if (string.IsNullOrEmpty(responseContent) == false) - { - responseDoc = JToken.Parse(responseContent); - } - - if (responseDoc != null && responseDoc.Type != JTokenType.Null) - { - CSMContainerListResponse cSMContainerListResponseInstance = new CSMContainerListResponse(); - result.CSMContainerListResponse = cSMContainerListResponseInstance; - - JToken valueArray = responseDoc["value"]; - if (valueArray != null && valueArray.Type != JTokenType.Null) - { - foreach (JToken valueValue in ((JArray)valueArray)) - { - CSMContainerResponse cSMContainerResponseInstance = new CSMContainerResponse(); - cSMContainerListResponseInstance.Value.Add(cSMContainerResponseInstance); - - JToken propertiesValue = valueValue["properties"]; - if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) - { - CSMContainerProperties propertiesInstance = new CSMContainerProperties(); - cSMContainerResponseInstance.Properties = propertiesInstance; - - JToken friendlyNameValue = propertiesValue["friendlyName"]; - if (friendlyNameValue != null && friendlyNameValue.Type != JTokenType.Null) - { - string friendlyNameInstance = ((string)friendlyNameValue); - propertiesInstance.FriendlyName = friendlyNameInstance; - } - - JToken statusValue = propertiesValue["status"]; - if (statusValue != null && statusValue.Type != JTokenType.Null) - { - string statusInstance = ((string)statusValue); - propertiesInstance.Status = statusInstance; - } - - JToken healthStatusValue = propertiesValue["healthStatus"]; - if (healthStatusValue != null && healthStatusValue.Type != JTokenType.Null) - { - string healthStatusInstance = ((string)healthStatusValue); - propertiesInstance.HealthStatus = healthStatusInstance; - } - - JToken containerTypeValue = propertiesValue["containerType"]; - if (containerTypeValue != null && containerTypeValue.Type != JTokenType.Null) - { - string containerTypeInstance = ((string)containerTypeValue); - propertiesInstance.ContainerType = containerTypeInstance; - } - - JToken parentContainerIdValue = propertiesValue["parentContainerId"]; - if (parentContainerIdValue != null && parentContainerIdValue.Type != JTokenType.Null) - { - string parentContainerIdInstance = ((string)parentContainerIdValue); - propertiesInstance.ParentContainerId = parentContainerIdInstance; - } - } - - JToken idValue = valueValue["id"]; - if (idValue != null && idValue.Type != JTokenType.Null) - { - string idInstance = ((string)idValue); - cSMContainerResponseInstance.Id = idInstance; - } - - JToken nameValue = valueValue["name"]; - if (nameValue != null && nameValue.Type != JTokenType.Null) - { - string nameInstance = ((string)nameValue); - cSMContainerResponseInstance.Name = nameInstance; - } - - JToken typeValue = valueValue["type"]; - if (typeValue != null && typeValue.Type != JTokenType.Null) - { - string typeInstance = ((string)typeValue); - cSMContainerResponseInstance.Type = typeInstance; - } - } - } - - JToken nextLinkValue = responseDoc["nextLink"]; - if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null) - { - string nextLinkInstance = ((string)nextLinkValue); - cSMContainerListResponseInstance.NextLink = nextLinkInstance; - } - - JToken idValue2 = responseDoc["id"]; - if (idValue2 != null && idValue2.Type != JTokenType.Null) - { - string idInstance2 = ((string)idValue2); - cSMContainerListResponseInstance.Id = idInstance2; - } - - JToken nameValue2 = responseDoc["name"]; - if (nameValue2 != null && nameValue2.Type != JTokenType.Null) - { - string nameInstance2 = ((string)nameValue2); - cSMContainerListResponseInstance.Name = nameInstance2; - } - - JToken typeValue2 = responseDoc["type"]; - if (typeValue2 != null && typeValue2.Type != JTokenType.Null) - { - string typeInstance2 = ((string)typeValue2); - cSMContainerListResponseInstance.Type = typeInstance2; - } - } - - } - result.StatusCode = statusCode; - if (httpResponse.Headers.Contains("x-ms-client-request-id")) - { - customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); - } - - if (shouldTrace) - { - TracingAdapter.Exit(invocationId, result); - } - return result; - } - finally - { - if (httpResponse != null) - { - httpResponse.Dispose(); - } - } - } - finally - { - if (httpRequest != null) - { - httpRequest.Dispose(); - } - } - } - - /// - /// Trigger the Discovery. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// Cancellation token. - /// - /// - /// The definition of a Operation Response. - /// - public async Task RefreshAsync(CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) - { - // Validate - - // Tracing - bool shouldTrace = TracingAdapter.IsEnabled; - string invocationId = null; - if (shouldTrace) - { - invocationId = TracingAdapter.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("customRequestHeaders", customRequestHeaders); - TracingAdapter.Enter(invocationId, this, "RefreshAsync", tracingParameters); - } - - // Construct URL - string url = ""; - url = url + "/Subscriptions/"; - if (this.Client.Credentials.SubscriptionId != null) - { - url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); - } - url = url + "/resourceGroups/"; - url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); - url = url + "/providers/"; - url = url + "Microsoft.Backup"; - url = url + "/"; - url = url + "BackupVault"; - url = url + "/"; - url = url + Uri.EscapeDataString(this.Client.ResourceName); - url = url + "/refreshContainers"; - List queryParameters = new List(); - queryParameters.Add("api-version=2014-09-01"); - if (queryParameters.Count > 0) - { - url = url + "?" + string.Join("&", queryParameters); - } - string baseUrl = this.Client.BaseUri.AbsoluteUri; - // Trim '/' character from the end of baseUrl and beginning of url. - if (baseUrl[baseUrl.Length - 1] == '/') - { - baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); - } - if (url[0] == '/') - { - url = url.Substring(1); - } - url = baseUrl + "/" + url; - url = url.Replace(" ", "%20"); - - // Create HTTP transport objects - HttpRequestMessage httpRequest = null; - try - { - httpRequest = new HttpRequestMessage(); - httpRequest.Method = HttpMethod.Post; - httpRequest.RequestUri = new Uri(url); - - // Set Headers - httpRequest.Headers.Add("Accept-Language", "en-us"); - httpRequest.Headers.Add("x-ms-version", "2013-03-01"); - - // Set Credentials - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); - - // Send Request - HttpResponseMessage httpResponse = null; - try - { - if (shouldTrace) - { - TracingAdapter.SendRequest(invocationId, httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); - if (shouldTrace) - { - TracingAdapter.ReceiveResponse(invocationId, httpResponse); - } - HttpStatusCode statusCode = httpResponse.StatusCode; - if (statusCode != HttpStatusCode.Accepted) - { - cancellationToken.ThrowIfCancellationRequested(); - CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); - if (shouldTrace) - { - TracingAdapter.Error(invocationId, ex); - } - throw ex; - } - - // Create Result - OperationResponse result = null; - // Deserialize Response - if (statusCode == HttpStatusCode.Accepted) - { - cancellationToken.ThrowIfCancellationRequested(); - string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - result = new OperationResponse(); - JToken responseDoc = null; - if (string.IsNullOrEmpty(responseContent) == false) - { - responseDoc = JToken.Parse(responseContent); - } - - if (responseDoc != null && responseDoc.Type != JTokenType.Null) - { - Guid operationIdInstance = Guid.Parse(((string)responseDoc)); - result.OperationId = operationIdInstance; - } - - } - result.StatusCode = statusCode; - if (httpResponse.Headers.Contains("x-ms-client-request-id")) - { - customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); - } - - if (shouldTrace) - { - TracingAdapter.Exit(invocationId, result); - } - return result; - } - finally - { - if (httpResponse != null) - { - httpResponse.Dispose(); - } - } - } - finally - { - if (httpRequest != null) - { - httpRequest.Dispose(); - } - } - } - - /// - /// Register the container. - /// - /// - /// Required. Container to be register. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// Cancellation token. - /// - /// - /// The definition of a Operation Response. - /// - public async Task RegisterAsync(string containerName, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) - { - // Validate - if (containerName == null) - { - throw new ArgumentNullException("containerName"); - } - - // Tracing - bool shouldTrace = TracingAdapter.IsEnabled; - string invocationId = null; - if (shouldTrace) - { - invocationId = TracingAdapter.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("containerName", containerName); - tracingParameters.Add("customRequestHeaders", customRequestHeaders); - TracingAdapter.Enter(invocationId, this, "RegisterAsync", tracingParameters); - } - - // Construct URL - string url = ""; - url = url + "/Subscriptions/"; - if (this.Client.Credentials.SubscriptionId != null) - { - url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); - } - url = url + "/resourceGroups/"; - url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); - url = url + "/providers/"; - url = url + "Microsoft.Backup"; - url = url + "/"; - url = url + "BackupVault"; - url = url + "/"; - url = url + Uri.EscapeDataString(this.Client.ResourceName); - url = url + "//registeredContainers/"; - url = url + Uri.EscapeDataString(containerName); - List queryParameters = new List(); - queryParameters.Add("api-version=2014-09-01"); - if (queryParameters.Count > 0) - { - url = url + "?" + string.Join("&", queryParameters); - } - string baseUrl = this.Client.BaseUri.AbsoluteUri; - // Trim '/' character from the end of baseUrl and beginning of url. - if (baseUrl[baseUrl.Length - 1] == '/') - { - baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); - } - if (url[0] == '/') - { - url = url.Substring(1); - } - url = baseUrl + "/" + url; - url = url.Replace(" ", "%20"); - - // Create HTTP transport objects - HttpRequestMessage httpRequest = null; - try - { - httpRequest = new HttpRequestMessage(); - httpRequest.Method = HttpMethod.Put; - httpRequest.RequestUri = new Uri(url); - - // Set Headers - httpRequest.Headers.Add("Accept-Language", "en-us"); - httpRequest.Headers.Add("x-ms-version", "2013-03-01"); - - // Set Credentials - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); - - // Send Request - HttpResponseMessage httpResponse = null; - try - { - if (shouldTrace) - { - TracingAdapter.SendRequest(invocationId, httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); - if (shouldTrace) - { - TracingAdapter.ReceiveResponse(invocationId, httpResponse); - } - HttpStatusCode statusCode = httpResponse.StatusCode; - if (statusCode != HttpStatusCode.Accepted) - { - cancellationToken.ThrowIfCancellationRequested(); - CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); - if (shouldTrace) - { - TracingAdapter.Error(invocationId, ex); - } - throw ex; - } - - // Create Result - OperationResponse result = null; - // Deserialize Response - if (statusCode == HttpStatusCode.Accepted) - { - cancellationToken.ThrowIfCancellationRequested(); - string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - result = new OperationResponse(); - JToken responseDoc = null; - if (string.IsNullOrEmpty(responseContent) == false) - { - responseDoc = JToken.Parse(responseContent); - } - - if (responseDoc != null && responseDoc.Type != JTokenType.Null) - { - Guid operationIdInstance = Guid.Parse(((string)responseDoc)); - result.OperationId = operationIdInstance; - } - - } - result.StatusCode = statusCode; - if (httpResponse.Headers.Contains("x-ms-client-request-id")) - { - customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); - } - - if (shouldTrace) - { - TracingAdapter.Exit(invocationId, result); - } - return result; - } - finally - { - if (httpResponse != null) - { - httpResponse.Dispose(); - } - } - } - finally - { - if (httpRequest != null) - { - httpRequest.Dispose(); - } - } - } - - /// - /// Unregister the container. - /// - /// - /// Required. Container which we want to unregister. - /// - /// - /// Required. Request header parameters. - /// - /// - /// Cancellation token. - /// - /// - /// The definition of a Operation Response. - /// - public async Task UnregisterAsync(string containerName, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) - { - // Validate - if (containerName == null) - { - throw new ArgumentNullException("containerName"); - } - if (customRequestHeaders == null) - { - throw new ArgumentNullException("customRequestHeaders"); - } - - // Tracing - bool shouldTrace = TracingAdapter.IsEnabled; - string invocationId = null; - if (shouldTrace) - { - invocationId = TracingAdapter.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("containerName", containerName); - tracingParameters.Add("customRequestHeaders", customRequestHeaders); - TracingAdapter.Enter(invocationId, this, "UnregisterAsync", tracingParameters); - } - - // Construct URL - string url = ""; - url = url + "/Subscriptions/"; - if (this.Client.Credentials.SubscriptionId != null) - { - url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); - } - url = url + "/resourceGroups/"; - url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); - url = url + "/providers/"; - url = url + "Microsoft.Backup"; - url = url + "/"; - url = url + "BackupVault"; - url = url + "/registeredContainers/"; - url = url + Uri.EscapeDataString(containerName); - List queryParameters = new List(); - queryParameters.Add("api-version=2014-09-01"); - if (queryParameters.Count > 0) - { - url = url + "?" + string.Join("&", queryParameters); - } - string baseUrl = this.Client.BaseUri.AbsoluteUri; - // Trim '/' character from the end of baseUrl and beginning of url. - if (baseUrl[baseUrl.Length - 1] == '/') - { - baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); - } - if (url[0] == '/') - { - url = url.Substring(1); - } - url = baseUrl + "/" + url; - url = url.Replace(" ", "%20"); - - // Create HTTP transport objects - HttpRequestMessage httpRequest = null; - try - { - httpRequest = new HttpRequestMessage(); - httpRequest.Method = HttpMethod.Delete; - httpRequest.RequestUri = new Uri(url); - - // Set Headers - httpRequest.Headers.Add("Accept-Language", "en-us"); - - // Set Credentials - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); - - // Send Request - HttpResponseMessage httpResponse = null; - try - { - if (shouldTrace) - { - TracingAdapter.SendRequest(invocationId, httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); - if (shouldTrace) - { - TracingAdapter.ReceiveResponse(invocationId, httpResponse); - } - HttpStatusCode statusCode = httpResponse.StatusCode; - if (statusCode != HttpStatusCode.Accepted) - { - cancellationToken.ThrowIfCancellationRequested(); - CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); - if (shouldTrace) - { - TracingAdapter.Error(invocationId, ex); - } - throw ex; - } - - // Create Result - OperationResponse result = null; - // Deserialize Response - if (statusCode == HttpStatusCode.Accepted) - { - cancellationToken.ThrowIfCancellationRequested(); - string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - result = new OperationResponse(); - JToken responseDoc = null; - if (string.IsNullOrEmpty(responseContent) == false) - { - responseDoc = JToken.Parse(responseContent); - } - - if (responseDoc != null && responseDoc.Type != JTokenType.Null) - { - Guid operationIdInstance = Guid.Parse(((string)responseDoc)); - result.OperationId = operationIdInstance; - } - - } - result.StatusCode = statusCode; - if (httpResponse.Headers.Contains("x-ms-client-request-id")) - { - customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); - } - - if (shouldTrace) - { - TracingAdapter.Exit(invocationId, result); - } - return result; - } - finally - { - if (httpResponse != null) - { - httpResponse.Dispose(); - } - } - } - finally - { - if (httpRequest != null) - { - httpRequest.Dispose(); - } - } - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperationExtensions.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperationExtensions.cs deleted file mode 100644 index d7135a2d3eed5..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperationExtensions.cs +++ /dev/null @@ -1,213 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Azure.Management.BackupServices; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices -{ - public static partial class ContainerOperationExtensions - { - /// - /// Get the list of all container based on the given query filter - /// string. - /// - /// - /// Reference to the - /// Microsoft.Azure.Management.BackupServices.IContainerOperation. - /// - /// - /// Optional. Job query parameter string. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// The definition of a CSMContainerListOperationResponse. - /// - public static CSMContainerListOperationResponse List(this IContainerOperation operations, string queryFilterString, CustomRequestHeaders customRequestHeaders) - { - return Task.Factory.StartNew((object s) => - { - return ((IContainerOperation)s).ListAsync(queryFilterString, customRequestHeaders); - } - , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Get the list of all container based on the given query filter - /// string. - /// - /// - /// Reference to the - /// Microsoft.Azure.Management.BackupServices.IContainerOperation. - /// - /// - /// Optional. Job query parameter string. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// The definition of a CSMContainerListOperationResponse. - /// - public static Task ListAsync(this IContainerOperation operations, string queryFilterString, CustomRequestHeaders customRequestHeaders) - { - return operations.ListAsync(queryFilterString, customRequestHeaders, CancellationToken.None); - } - - /// - /// Trigger the Discovery. - /// - /// - /// Reference to the - /// Microsoft.Azure.Management.BackupServices.IContainerOperation. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// The definition of a Operation Response. - /// - public static OperationResponse Refresh(this IContainerOperation operations, CustomRequestHeaders customRequestHeaders) - { - return Task.Factory.StartNew((object s) => - { - return ((IContainerOperation)s).RefreshAsync(customRequestHeaders); - } - , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Trigger the Discovery. - /// - /// - /// Reference to the - /// Microsoft.Azure.Management.BackupServices.IContainerOperation. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// The definition of a Operation Response. - /// - public static Task RefreshAsync(this IContainerOperation operations, CustomRequestHeaders customRequestHeaders) - { - return operations.RefreshAsync(customRequestHeaders, CancellationToken.None); - } - - /// - /// Register the container. - /// - /// - /// Reference to the - /// Microsoft.Azure.Management.BackupServices.IContainerOperation. - /// - /// - /// Required. Container to be register. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// The definition of a Operation Response. - /// - public static OperationResponse Register(this IContainerOperation operations, string containerName, CustomRequestHeaders customRequestHeaders) - { - return Task.Factory.StartNew((object s) => - { - return ((IContainerOperation)s).RegisterAsync(containerName, customRequestHeaders); - } - , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Register the container. - /// - /// - /// Reference to the - /// Microsoft.Azure.Management.BackupServices.IContainerOperation. - /// - /// - /// Required. Container to be register. - /// - /// - /// Optional. Request header parameters. - /// - /// - /// The definition of a Operation Response. - /// - public static Task RegisterAsync(this IContainerOperation operations, string containerName, CustomRequestHeaders customRequestHeaders) - { - return operations.RegisterAsync(containerName, customRequestHeaders, CancellationToken.None); - } - - /// - /// Unregister the container. - /// - /// - /// Reference to the - /// Microsoft.Azure.Management.BackupServices.IContainerOperation. - /// - /// - /// Required. Container which we want to unregister. - /// - /// - /// Required. Request header parameters. - /// - /// - /// The definition of a Operation Response. - /// - public static OperationResponse Unregister(this IContainerOperation operations, string containerName, CustomRequestHeaders customRequestHeaders) - { - return Task.Factory.StartNew((object s) => - { - return ((IContainerOperation)s).UnregisterAsync(containerName, customRequestHeaders); - } - , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Unregister the container. - /// - /// - /// Reference to the - /// Microsoft.Azure.Management.BackupServices.IContainerOperation. - /// - /// - /// Required. Container which we want to unregister. - /// - /// - /// Required. Request header parameters. - /// - /// - /// The definition of a Operation Response. - /// - public static Task UnregisterAsync(this IContainerOperation operations, string containerName, CustomRequestHeaders customRequestHeaders) - { - return operations.UnregisterAsync(containerName, customRequestHeaders, CancellationToken.None); - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperations.cs index 793b9517fa760..7ddacac178fe1 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperations.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/DataSourceOperations.cs @@ -487,17 +487,22 @@ public async Task ListCSMAsync(CSMProtect url = url + "/protectedItems"; List queryParameters = new List(); queryParameters.Add("api-version=2014-09-01"); + List odataFilter = new List(); if (csmparameters != null && csmparameters.ProtectionStatus != null) { - queryParameters.Add("ProtectionStatus -eq " + Uri.EscapeDataString(csmparameters.ProtectionStatus)); + odataFilter.Add("protectionStatus eq '" + Uri.EscapeDataString(csmparameters.ProtectionStatus) + "'"); } if (csmparameters != null && csmparameters.Status != null) { - queryParameters.Add("Status -eq " + Uri.EscapeDataString(csmparameters.Status)); + odataFilter.Add("status eq '" + Uri.EscapeDataString(csmparameters.Status) + "'"); } if (csmparameters != null && csmparameters.Type != null) { - queryParameters.Add("Type -eq " + Uri.EscapeDataString(csmparameters.Type)); + odataFilter.Add("type eq '" + Uri.EscapeDataString(csmparameters.Type) + "'"); + } + if (odataFilter.Count > 0) + { + queryParameters.Add("$filter=" + string.Join(" and ", odataFilter)); } if (queryParameters.Count > 0) { @@ -576,7 +581,7 @@ public async Task ListCSMAsync(CSMProtect CSMProtectedItemListResponse cSMProtectedItemListResponseInstance = new CSMProtectedItemListResponse(); result.CSMProtectedItemListResponse = cSMProtectedItemListResponseInstance; - JToken valueArray = responseDoc["Value"]; + JToken valueArray = responseDoc["value"]; if (valueArray != null && valueArray.Type != JTokenType.Null) { foreach (JToken valueValue in ((JArray)valueArray)) @@ -584,7 +589,7 @@ public async Task ListCSMAsync(CSMProtect CSMProtectedItemResponse cSMProtectedItemResponseInstance = new CSMProtectedItemResponse(); cSMProtectedItemListResponseInstance.Value.Add(cSMProtectedItemResponseInstance); - JToken propertiesValue = valueValue["Properties"]; + JToken propertiesValue = valueValue["properties"]; if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) { CSMProtectedItemProperties propertiesInstance = new CSMProtectedItemProperties(); diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupServicesManagementClient.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupServicesManagementClient.cs index 8cccf7d633b23..c293ff71f17bc 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupServicesManagementClient.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupServicesManagementClient.cs @@ -91,7 +91,7 @@ IBackUpOperations BackUp /// /// Definition of Container operations for the Azure Backup extension. /// - IContainerOperation Container + IContainerOperations Container { get; } diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupVaultServicesManagementClient.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupVaultServicesManagementClient.cs index bd70ba032be59..f2ca337b67976 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupVaultServicesManagementClient.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IBackupVaultServicesManagementClient.cs @@ -80,6 +80,14 @@ string ResourceName get; set; } + /// + /// Definition of Container operations for the Azure Backup extension. + /// + IMarsContainerOperations Container + { + get; + } + /// /// Definition of Vault-related operations for the Azure Backup /// extension. diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IContainerOperation.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IContainerOperation.cs deleted file mode 100644 index 4fc24f26ace03..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IContainerOperation.cs +++ /dev/null @@ -1,102 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Azure.Management.BackupServices; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices -{ - /// - /// Definition of Container operations for the Azure Backup extension. - /// - public partial interface IContainerOperation - { - /// - /// Get the list of all container based on the given query filter - /// string. - /// - /// - /// Job query parameter string. - /// - /// - /// Request header parameters. - /// - /// - /// Cancellation token. - /// - /// - /// The definition of a CSMContainerListOperationResponse. - /// - Task ListAsync(string queryFilterString, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); - - /// - /// Trigger the Discovery. - /// - /// - /// Request header parameters. - /// - /// - /// Cancellation token. - /// - /// - /// The definition of a Operation Response. - /// - Task RefreshAsync(CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); - - /// - /// Register the container. - /// - /// - /// Container to be register. - /// - /// - /// Request header parameters. - /// - /// - /// Cancellation token. - /// - /// - /// The definition of a Operation Response. - /// - Task RegisterAsync(string containerName, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); - - /// - /// Unregister the container. - /// - /// - /// Container which we want to unregister. - /// - /// - /// Request header parameters. - /// - /// - /// Cancellation token. - /// - /// - /// The definition of a Operation Response. - /// - Task UnregisterAsync(string containerName, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobQueryParameter.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobQueryParameter.cs deleted file mode 100644 index 9e32cfecaa09f..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobQueryParameter.cs +++ /dev/null @@ -1,105 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; - -namespace Microsoft.Azure.Management.BackupServices -{ - /// - /// The definition of a JobQueryParameter object. - /// - public partial class JobQueryParameter - { - private string _endTime; - - /// - /// Optional. End time of time range in UTC. - /// - public string EndTime - { - get { return this._endTime; } - set { this._endTime = value; } - } - - private string _jobId; - - /// - /// Optional. JobId of job. - /// - public string JobId - { - get { return this._jobId; } - set { this._jobId = value; } - } - - private string _operation; - - /// - /// Optional. Operation of job. - /// - public string Operation - { - get { return this._operation; } - set { this._operation = value; } - } - - private string _startTime; - - /// - /// Optional. Start time of time range in UTC. - /// - public string StartTime - { - get { return this._startTime; } - set { this._startTime = value; } - } - - private string _status; - - /// - /// Optional. Status of job. - /// - public string Status - { - get { return this._status; } - set { this._status = value; } - } - - private string _type; - - /// - /// Optional. Type of job. - /// - public string Type - { - get { return this._type; } - set { this._type = value; } - } - - /// - /// Initializes a new instance of the JobQueryParameter class. - /// - public JobQueryParameter() - { - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobResponse.cs deleted file mode 100644 index 9d2170619788c..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/JobResponse.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Collections.Generic; -using System.Linq; -using Hyak.Common; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices -{ - /// - /// The definition of a Management List Response. - /// - public partial class JobResponse : ManagementBaseObject, IEnumerable - { - private IList _objects; - - /// - /// Optional. The Objects of the JobResponse. - /// - public IList Objects - { - get { return this._objects; } - set { this._objects = value; } - } - - private int _resultCount; - - /// - /// Optional. The ResultCount of JobResponse. - /// - public int ResultCount - { - get { return this._resultCount; } - set { this._resultCount = value; } - } - - private string _skiptoken; - - /// - /// Optional. The Skiptoken of the JobResponse. - /// - public string Skiptoken - { - get { return this._skiptoken; } - set { this._skiptoken = value; } - } - - /// - /// Initializes a new instance of the JobResponse class. - /// - public JobResponse() - { - this.Objects = new LazyList(); - } - - /// - /// Gets the sequence of Objects. - /// - public IEnumerator GetEnumerator() - { - return this.Objects.GetEnumerator(); - } - - /// - /// Gets the sequence of Objects. - /// - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/DataSourceListResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/DataSourceListResponse.cs deleted file mode 100644 index 3e61c11cc0c2d..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/DataSourceListResponse.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; -using Microsoft.Azure; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The response model for the list DataSource operation. - /// - public partial class DataSourceListResponse : AzureOperationResponse - { - private DataSourceResponse _dataSources; - - /// - /// Optional. The list of DataSource for the resource id. - /// - public DataSourceResponse DataSources - { - get { return this._dataSources; } - set { this._dataSources = value; } - } - - /// - /// Initializes a new instance of the DataSourceListResponse class. - /// - public DataSourceListResponse() - { - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/DataSourceQueryParameter.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/DataSourceQueryParameter.cs deleted file mode 100644 index 2e1466ebe56ec..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/DataSourceQueryParameter.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The definition of a DataSourceQueryParameter object. - /// - public partial class DataSourceQueryParameter - { - private string _protectionStatus; - - /// - /// Optional. Protection Status of item. - /// - public string ProtectionStatus - { - get { return this._protectionStatus; } - set { this._protectionStatus = value; } - } - - private string _status; - - /// - /// Optional. Status of item. - /// - public string Status - { - get { return this._status; } - set { this._status = value; } - } - - private string _type; - - /// - /// Optional. Type of item. - /// - public string Type - { - get { return this._type; } - set { this._type = value; } - } - - /// - /// Initializes a new instance of the DataSourceQueryParameter class. - /// - public DataSourceQueryParameter() - { - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ErrorInfo.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ErrorInfo.cs deleted file mode 100644 index 4c0e09342ff63..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ErrorInfo.cs +++ /dev/null @@ -1,105 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The definition of an ErrorInfo object. - /// - public partial class ErrorInfo - { - private int _errorCode; - - /// - /// Required. Error code for failed job. - /// - public int ErrorCode - { - get { return this._errorCode; } - set { this._errorCode = value; } - } - - private string _errorString; - - /// - /// Required. ErrorString of Job. - /// - public string ErrorString - { - get { return this._errorString; } - set { this._errorString = value; } - } - - private string _errorTitle; - - /// - /// Optional. ErrorTitle of Job. - /// - public string ErrorTitle - { - get { return this._errorTitle; } - set { this._errorTitle = value; } - } - - private IList _recommendations; - - /// - /// Required. Recommendations of Job. - /// - public IList Recommendations - { - get { return this._recommendations; } - set { this._recommendations = value; } - } - - /// - /// Initializes a new instance of the ErrorInfo class. - /// - public ErrorInfo() - { - this.Recommendations = new List(); - } - - /// - /// Initializes a new instance of the ErrorInfo class with required - /// arguments. - /// - public ErrorInfo(int errorCode, string errorString, IList recommendations) - : this() - { - if (errorString == null) - { - throw new ArgumentNullException("errorString"); - } - if (recommendations == null) - { - throw new ArgumentNullException("recommendations"); - } - this.ErrorCode = errorCode; - this.ErrorString = errorString; - this.Recommendations = recommendations; - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/Job.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/Job.cs deleted file mode 100644 index a1567b065ec0d..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/Job.cs +++ /dev/null @@ -1,143 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Collections.Generic; -using System.Linq; -using Hyak.Common; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The definition of a Job object. - /// - public partial class Job : ManagementResponseObject - { - private IList _actionsInfo; - - /// - /// Optional. ActionsInfo of Job. - /// - public IList ActionsInfo - { - get { return this._actionsInfo; } - set { this._actionsInfo = value; } - } - - private TimeSpan _duration; - - /// - /// Optional. Duration of Job. - /// - public TimeSpan Duration - { - get { return this._duration; } - set { this._duration = value; } - } - - private DateTime _endTimestamp; - - /// - /// Optional. EndTimestamp of Job. - /// - public DateTime EndTimestamp - { - get { return this._endTimestamp; } - set { this._endTimestamp = value; } - } - - private string _entityFriendlyName; - - /// - /// Required. EntityFriendlyName of Job. - /// - public string EntityFriendlyName - { - get { return this._entityFriendlyName; } - set { this._entityFriendlyName = value; } - } - - private IList _errorDetails; - - /// - /// Optional. ErrorDetails of Job. - /// - public IList ErrorDetails - { - get { return this._errorDetails; } - set { this._errorDetails = value; } - } - - private string _operation; - - /// - /// Required. Operation of Job. - /// - public string Operation - { - get { return this._operation; } - set { this._operation = value; } - } - - private DateTime _startTimestamp; - - /// - /// Required. StartTimestamp of Job. - /// - public DateTime StartTimestamp - { - get { return this._startTimestamp; } - set { this._startTimestamp = value; } - } - - private string _status; - - /// - /// Required. Status of Job. - /// - public string Status - { - get { return this._status; } - set { this._status = value; } - } - - private string _type; - - /// - /// Required. Type of Job. - /// - public string Type - { - get { return this._type; } - set { this._type = value; } - } - - /// - /// Initializes a new instance of the Job class. - /// - public Job() - { - this.ActionsInfo = new LazyList(); - this.ErrorDetails = new List(); - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobByIdResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobByIdResponse.cs deleted file mode 100644 index db96bc9182a13..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobByIdResponse.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; -using Microsoft.Azure; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The response model for the list jobs operation. - /// - public partial class JobByIdResponse : AzureOperationResponse - { - private JobProperties _job; - - /// - /// Optional. The list of jobs queried by the filters for the resource - /// id. - /// - public JobProperties Job - { - get { return this._job; } - set { this._job = value; } - } - - /// - /// Initializes a new instance of the JobByIdResponse class. - /// - public JobByIdResponse() - { - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobListResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobListResponse.cs deleted file mode 100644 index efcadd7bc587b..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobListResponse.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; -using Microsoft.Azure; -using Microsoft.Azure.Management.BackupServices; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The response model for the list jobs operation. - /// - public partial class JobListResponse : AzureOperationResponse - { - private JobResponse _jobs; - - /// - /// Optional. The list of jobs queried by filters for the resource id. - /// - public JobResponse Jobs - { - get { return this._jobs; } - set { this._jobs = value; } - } - - /// - /// Initializes a new instance of the JobListResponse class. - /// - public JobListResponse() - { - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobProperties.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobProperties.cs deleted file mode 100644 index 8df38346376b8..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobProperties.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Collections.Generic; -using System.Linq; -using Hyak.Common; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The definition of a Management List Response. - /// - public partial class JobProperties : Job - { - private IDictionary _propertyBag; - - /// - /// Optional. PropertyBag of JobProperties. - /// - public IDictionary PropertyBag - { - get { return this._propertyBag; } - set { this._propertyBag = value; } - } - - private IList _tasksList; - - /// - /// Optional. TasksList of JobProperties. - /// - public IList TasksList - { - get { return this._tasksList; } - set { this._tasksList = value; } - } - - /// - /// Initializes a new instance of the JobProperties class. - /// - public JobProperties() - { - this.PropertyBag = new LazyDictionary(); - this.TasksList = new LazyList(); - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobTaskDetails.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobTaskDetails.cs deleted file mode 100644 index 790818e9975ad..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/JobTaskDetails.cs +++ /dev/null @@ -1,95 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The definition of a Management List Response. - /// - public partial class JobTaskDetails : ManagementResponseObject - { - private TimeSpan _duration; - - /// - /// Optional. Duration of Subtask. - /// - public TimeSpan Duration - { - get { return this._duration; } - set { this._duration = value; } - } - - private System.DateTime? _endTime; - - /// - /// Required. EndTime of Subtask. - /// - public System.DateTime? EndTime - { - get { return this._endTime; } - set { this._endTime = value; } - } - - private System.DateTime? _startTime; - - /// - /// Required. StartTime of Subtask. - /// - public System.DateTime? StartTime - { - get { return this._startTime; } - set { this._startTime = value; } - } - - private string _status; - - /// - /// Required. Status of Subtask. - /// - public string Status - { - get { return this._status; } - set { this._status = value; } - } - - private string _taskId; - - /// - /// Required. TaskId of Subtask. - /// - public string TaskId - { - get { return this._taskId; } - set { this._taskId = value; } - } - - /// - /// Initializes a new instance of the JobTaskDetails class. - /// - public JobTaskDetails() - { - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/POQueryParameter.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/POQueryParameter.cs deleted file mode 100644 index 28446055df3f6..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/POQueryParameter.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The definition of a POQueryParameter object. - /// - public partial class POQueryParameter - { - private string _status; - - /// - /// Optional. Status Status of item. - /// - public string Status - { - get { return this._status; } - set { this._status = value; } - } - - private string _type; - - /// - /// Optional. Type of item. - /// - public string Type - { - get { return this._type; } - set { this._type = value; } - } - - /// - /// Initializes a new instance of the POQueryParameter class. - /// - public POQueryParameter() - { - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ProtectableObjectListResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ProtectableObjectListResponse.cs deleted file mode 100644 index 6bc98178c8d8e..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ProtectableObjectListResponse.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; -using Microsoft.Azure; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The response model for the list ProtectableObject operation. - /// - public partial class ProtectableObjectListResponse : AzureOperationResponse - { - private ProtectableObjectResponse _protectableObject; - - /// - /// Optional. The list of ProtectableObject for the resource id. - /// - public ProtectableObjectResponse ProtectableObject - { - get { return this._protectableObject; } - set { this._protectableObject = value; } - } - - /// - /// Initializes a new instance of the ProtectableObjectListResponse - /// class. - /// - public ProtectableObjectListResponse() - { - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointInfo.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointInfo.cs deleted file mode 100644 index 090b2b9e3c62d..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointInfo.cs +++ /dev/null @@ -1,73 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The definition of a RecoveryPoint Info object. - /// - public partial class RecoveryPointInfo : ManagementResponseObject - { - private string _recoveryPointAdditionalInfo; - - /// - /// Optional. RecoveryPointAdditionalInfo of RecoveryPointInfo. - /// - public string RecoveryPointAdditionalInfo - { - get { return this._recoveryPointAdditionalInfo; } - set { this._recoveryPointAdditionalInfo = value; } - } - - private DateTime _recoveryPointTime; - - /// - /// Optional. RecoveryPointTime of RecoveryPointInfo. - /// - public DateTime RecoveryPointTime - { - get { return this._recoveryPointTime; } - set { this._recoveryPointTime = value; } - } - - private string _recoveryPointType; - - /// - /// Optional. RecoveryPointType of RecoveryPointInfo. - /// - public string RecoveryPointType - { - get { return this._recoveryPointType; } - set { this._recoveryPointType = value; } - } - - /// - /// Initializes a new instance of the RecoveryPointInfo class. - /// - public RecoveryPointInfo() - { - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointInfoResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointInfoResponse.cs deleted file mode 100644 index ea03cea8fd8b7..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointInfoResponse.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Collections.Generic; -using System.Linq; -using Hyak.Common; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The definition of a Recovery Point Info Response. - /// - public partial class RecoveryPointInfoResponse : ManagementBaseObject, IEnumerable - { - private IList _objects; - - /// - /// Optional. The definition of List of ProtectionPolicyInfo. - /// - public IList Objects - { - get { return this._objects; } - set { this._objects = value; } - } - - private int _resultCount; - - /// - /// Optional. The definition of ResultCount. - /// - public int ResultCount - { - get { return this._resultCount; } - set { this._resultCount = value; } - } - - private string _skiptoken; - - /// - /// Optional. The definition of Skiptoken. - /// - public string Skiptoken - { - get { return this._skiptoken; } - set { this._skiptoken = value; } - } - - /// - /// Initializes a new instance of the RecoveryPointInfoResponse class. - /// - public RecoveryPointInfoResponse() - { - this.Objects = new LazyList(); - } - - /// - /// Gets the sequence of Objects. - /// - public IEnumerator GetEnumerator() - { - return this.Objects.GetEnumerator(); - } - - /// - /// Gets the sequence of Objects. - /// - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointListResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointListResponse.cs deleted file mode 100644 index 6a98291c8e79d..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/RecoveryPointListResponse.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Linq; -using Microsoft.Azure; -using Microsoft.Azure.Management.BackupServices.Models; - -namespace Microsoft.Azure.Management.BackupServices.Models -{ - /// - /// The response model for the list RecoveryPoints operation. - /// - public partial class RecoveryPointListResponse : AzureOperationResponse - { - private RecoveryPointInfoResponse _recoveryPoints; - - /// - /// Optional. The list of RecoveryPoints for the resource id. - /// - public RecoveryPointInfoResponse RecoveryPoints - { - get { return this._recoveryPoints; } - set { this._recoveryPoints = value; } - } - - /// - /// Initializes a new instance of the RecoveryPointListResponse class. - /// - public RecoveryPointListResponse() - { - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/OperationResultResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/OperationResultResponse.cs deleted file mode 100644 index ef86a43abda8a..0000000000000 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/OperationResultResponse.cs +++ /dev/null @@ -1,98 +0,0 @@ -// -// Copyright (c) Microsoft and contributors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// Warning: This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if the -// code is regenerated. - -using System; -using System.Collections.Generic; -using System.Linq; -using Hyak.Common; -using Microsoft.Azure; - -namespace Microsoft.Azure.Management.BackupServices -{ - /// - /// The definition of a BMSOperationStatusResponse. - /// - public partial class OperationResultResponse : AzureOperationResponse - { - private string _errorCode; - - /// - /// Optional. Error Code - /// - public string ErrorCode - { - get { return this._errorCode; } - set { this._errorCode = value; } - } - - private IList _jobs; - - /// - /// Optional. ID of jobs created by this operation - /// - public IList Jobs - { - get { return this._jobs; } - set { this._jobs = value; } - } - - private string _message; - - /// - /// Optional. Message - /// - public string Message - { - get { return this._message; } - set { this._message = value; } - } - - private string _operationResult; - - /// - /// Optional. Operation Result. - /// - public string OperationResult - { - get { return this._operationResult; } - set { this._operationResult = value; } - } - - private string _operationStatus; - - /// - /// Optional. Operation Status. - /// - public string OperationStatus - { - get { return this._operationStatus; } - set { this._operationStatus = value; } - } - - /// - /// Initializes a new instance of the OperationResultResponse class. - /// - public OperationResultResponse() - { - this.Jobs = new LazyList(); - } - } -} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ProtectableObjectOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ProtectableObjectOperations.cs index e75a0c5377716..8c017e8330537 100644 --- a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ProtectableObjectOperations.cs +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ProtectableObjectOperations.cs @@ -110,8 +110,19 @@ public async Task ListCSMAsync(CSMItemQueryObject url = url + "/items"; List queryParameters = new List(); queryParameters.Add("api-version=2014-09-01"); - queryParameters.Add("Status -eq csmparameters.Status}"); - queryParameters.Add("Type -eq csmparameters.Type}"); + List odataFilter = new List(); + if (csmparameters != null && csmparameters.Status != null) + { + odataFilter.Add("status eq '" + Uri.EscapeDataString(csmparameters.Status) + "'"); + } + if (csmparameters != null && csmparameters.Type != null) + { + odataFilter.Add("itemType eq '" + Uri.EscapeDataString(csmparameters.Type) + "'"); + } + if (odataFilter.Count > 0) + { + queryParameters.Add("$filter=" + string.Join(" and ", odataFilter)); + } if (queryParameters.Count > 0) { url = url + "?" + string.Join("&", queryParameters); From a4f6def18897c8a11cd9382cbf68b6b24b4e063f Mon Sep 17 00:00:00 2001 From: pikumarmsft Date: Fri, 31 Jul 2015 14:31:56 +0530 Subject: [PATCH 3/3] adding more files --- .../Generated/ContainerOperations.cs | 820 +++++++++++++++ .../ContainerOperationsExtensions.cs | 213 ++++ .../Generated/IContainerOperations.cs | 102 ++ .../Generated/IMarsContainerOperations.cs | 112 ++ .../Generated/MarsContainerOperations.cs | 993 ++++++++++++++++++ .../MarsContainerOperationsExtensions.cs | 233 ++++ .../Generated/Models/BackupBaseObject.cs | 39 + .../Generated/Models/BackupBaseResponse.cs | 73 ++ .../Generated/Models/BackupListResponse.cs | 51 + .../CSMUpdateProtectionPolicyRequest.cs | 66 ++ .../Models/ContainerQueryParameters.cs | 69 ++ .../Models/ContainerReregistrationState.cs | 51 + .../Generated/Models/CustomerType.cs | 43 + .../Models/EnableReregistrationRequest.cs | 51 + .../ListMarsContainerOperationResponse.cs | 53 + .../Models/ListMarsContainerResponse.cs | 54 + .../Models/MarsContainerProperties.cs | 105 ++ .../Generated/Models/MarsContainerResponse.cs | 73 ++ .../Generated/Models/MarsContainerType.cs | 33 + 19 files changed, 3234 insertions(+) create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperations.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperationsExtensions.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IContainerOperations.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IMarsContainerOperations.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/MarsContainerOperations.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/MarsContainerOperationsExtensions.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupBaseObject.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupBaseResponse.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupListResponse.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CSMUpdateProtectionPolicyRequest.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ContainerQueryParameters.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ContainerReregistrationState.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CustomerType.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/EnableReregistrationRequest.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ListMarsContainerOperationResponse.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ListMarsContainerResponse.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerProperties.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerResponse.cs create mode 100644 src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerType.cs diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperations.cs new file mode 100644 index 0000000000000..a29ae5ae6dae3 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperations.cs @@ -0,0 +1,820 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Hyak.Common; +using Microsoft.Azure.Management.BackupServices; +using Microsoft.Azure.Management.BackupServices.Models; +using Newtonsoft.Json.Linq; + +namespace Microsoft.Azure.Management.BackupServices +{ + /// + /// Definition of Container operations for the Azure Backup extension. + /// + internal partial class ContainerOperations : IServiceOperations, IContainerOperations + { + /// + /// Initializes a new instance of the ContainerOperations class. + /// + /// + /// Reference to the service client. + /// + internal ContainerOperations(BackupServicesManagementClient client) + { + this._client = client; + } + + private BackupServicesManagementClient _client; + + /// + /// Gets a reference to the + /// Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient. + /// + public BackupServicesManagementClient Client + { + get { return this._client; } + } + + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Optional. Container query parameters. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a CSMContainerListOperationResponse. + /// + public async Task ListAsync(ContainerQueryParameters parameters, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) + { + // Validate + + // Tracing + bool shouldTrace = TracingAdapter.IsEnabled; + string invocationId = null; + if (shouldTrace) + { + invocationId = TracingAdapter.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("customRequestHeaders", customRequestHeaders); + TracingAdapter.Enter(invocationId, this, "ListAsync", tracingParameters); + } + + // Construct URL + string url = ""; + url = url + "/Subscriptions/"; + if (this.Client.Credentials.SubscriptionId != null) + { + url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); + } + url = url + "/resourceGroups/"; + url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); + url = url + "/providers/"; + url = url + "Microsoft.Backup"; + url = url + "/"; + url = url + "BackupVault"; + url = url + "/"; + url = url + Uri.EscapeDataString(this.Client.ResourceName); + url = url + "/containers"; + List queryParameters = new List(); + queryParameters.Add("api-version=2014-09-01"); + List odataFilter = new List(); + if (parameters != null && parameters.ContainerType != null) + { + odataFilter.Add("containerType eq '" + Uri.EscapeDataString(parameters.ContainerType) + "'"); + } + if (parameters != null && parameters.FriendlyName != null) + { + odataFilter.Add("friendlyName eq '" + Uri.EscapeDataString(parameters.FriendlyName) + "'"); + } + if (parameters != null && parameters.Status != null) + { + odataFilter.Add("status eq '" + Uri.EscapeDataString(parameters.Status) + "'"); + } + if (odataFilter.Count > 0) + { + queryParameters.Add("$filter=" + string.Join(" and ", odataFilter)); + } + if (queryParameters.Count > 0) + { + url = url + "?" + string.Join("&", queryParameters); + } + string baseUrl = this.Client.BaseUri.AbsoluteUri; + // Trim '/' character from the end of baseUrl and beginning of url. + if (baseUrl[baseUrl.Length - 1] == '/') + { + baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); + } + if (url[0] == '/') + { + url = url.Substring(1); + } + url = baseUrl + "/" + url; + url = url.Replace(" ", "%20"); + + // Create HTTP transport objects + HttpRequestMessage httpRequest = null; + try + { + httpRequest = new HttpRequestMessage(); + httpRequest.Method = HttpMethod.Get; + httpRequest.RequestUri = new Uri(url); + + // Set Headers + httpRequest.Headers.Add("Accept-Language", "en-us"); + + // Set Credentials + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); + + // Send Request + HttpResponseMessage httpResponse = null; + try + { + if (shouldTrace) + { + TracingAdapter.SendRequest(invocationId, httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); + if (shouldTrace) + { + TracingAdapter.ReceiveResponse(invocationId, httpResponse); + } + HttpStatusCode statusCode = httpResponse.StatusCode; + if (statusCode != HttpStatusCode.OK) + { + cancellationToken.ThrowIfCancellationRequested(); + CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); + if (shouldTrace) + { + TracingAdapter.Error(invocationId, ex); + } + throw ex; + } + + // Create Result + CSMContainerListOperationResponse result = null; + // Deserialize Response + if (statusCode == HttpStatusCode.OK) + { + cancellationToken.ThrowIfCancellationRequested(); + string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + result = new CSMContainerListOperationResponse(); + JToken responseDoc = null; + if (string.IsNullOrEmpty(responseContent) == false) + { + responseDoc = JToken.Parse(responseContent); + } + + if (responseDoc != null && responseDoc.Type != JTokenType.Null) + { + CSMContainerListResponse cSMContainerListResponseInstance = new CSMContainerListResponse(); + result.CSMContainerListResponse = cSMContainerListResponseInstance; + + JToken valueArray = responseDoc["value"]; + if (valueArray != null && valueArray.Type != JTokenType.Null) + { + foreach (JToken valueValue in ((JArray)valueArray)) + { + CSMContainerResponse cSMContainerResponseInstance = new CSMContainerResponse(); + cSMContainerListResponseInstance.Value.Add(cSMContainerResponseInstance); + + JToken propertiesValue = valueValue["properties"]; + if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) + { + CSMContainerProperties propertiesInstance = new CSMContainerProperties(); + cSMContainerResponseInstance.Properties = propertiesInstance; + + JToken friendlyNameValue = propertiesValue["friendlyName"]; + if (friendlyNameValue != null && friendlyNameValue.Type != JTokenType.Null) + { + string friendlyNameInstance = ((string)friendlyNameValue); + propertiesInstance.FriendlyName = friendlyNameInstance; + } + + JToken statusValue = propertiesValue["status"]; + if (statusValue != null && statusValue.Type != JTokenType.Null) + { + string statusInstance = ((string)statusValue); + propertiesInstance.Status = statusInstance; + } + + JToken healthStatusValue = propertiesValue["healthStatus"]; + if (healthStatusValue != null && healthStatusValue.Type != JTokenType.Null) + { + string healthStatusInstance = ((string)healthStatusValue); + propertiesInstance.HealthStatus = healthStatusInstance; + } + + JToken containerTypeValue = propertiesValue["containerType"]; + if (containerTypeValue != null && containerTypeValue.Type != JTokenType.Null) + { + string containerTypeInstance = ((string)containerTypeValue); + propertiesInstance.ContainerType = containerTypeInstance; + } + + JToken parentContainerIdValue = propertiesValue["parentContainerId"]; + if (parentContainerIdValue != null && parentContainerIdValue.Type != JTokenType.Null) + { + string parentContainerIdInstance = ((string)parentContainerIdValue); + propertiesInstance.ParentContainerId = parentContainerIdInstance; + } + } + + JToken idValue = valueValue["id"]; + if (idValue != null && idValue.Type != JTokenType.Null) + { + string idInstance = ((string)idValue); + cSMContainerResponseInstance.Id = idInstance; + } + + JToken nameValue = valueValue["name"]; + if (nameValue != null && nameValue.Type != JTokenType.Null) + { + string nameInstance = ((string)nameValue); + cSMContainerResponseInstance.Name = nameInstance; + } + + JToken typeValue = valueValue["type"]; + if (typeValue != null && typeValue.Type != JTokenType.Null) + { + string typeInstance = ((string)typeValue); + cSMContainerResponseInstance.Type = typeInstance; + } + } + } + + JToken nextLinkValue = responseDoc["nextLink"]; + if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null) + { + string nextLinkInstance = ((string)nextLinkValue); + cSMContainerListResponseInstance.NextLink = nextLinkInstance; + } + + JToken idValue2 = responseDoc["id"]; + if (idValue2 != null && idValue2.Type != JTokenType.Null) + { + string idInstance2 = ((string)idValue2); + cSMContainerListResponseInstance.Id = idInstance2; + } + + JToken nameValue2 = responseDoc["name"]; + if (nameValue2 != null && nameValue2.Type != JTokenType.Null) + { + string nameInstance2 = ((string)nameValue2); + cSMContainerListResponseInstance.Name = nameInstance2; + } + + JToken typeValue2 = responseDoc["type"]; + if (typeValue2 != null && typeValue2.Type != JTokenType.Null) + { + string typeInstance2 = ((string)typeValue2); + cSMContainerListResponseInstance.Type = typeInstance2; + } + } + + } + result.StatusCode = statusCode; + if (httpResponse.Headers.Contains("x-ms-client-request-id")) + { + customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); + } + + if (shouldTrace) + { + TracingAdapter.Exit(invocationId, result); + } + return result; + } + finally + { + if (httpResponse != null) + { + httpResponse.Dispose(); + } + } + } + finally + { + if (httpRequest != null) + { + httpRequest.Dispose(); + } + } + } + + /// + /// Trigger the Discovery. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + public async Task RefreshAsync(CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) + { + // Validate + + // Tracing + bool shouldTrace = TracingAdapter.IsEnabled; + string invocationId = null; + if (shouldTrace) + { + invocationId = TracingAdapter.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("customRequestHeaders", customRequestHeaders); + TracingAdapter.Enter(invocationId, this, "RefreshAsync", tracingParameters); + } + + // Construct URL + string url = ""; + url = url + "/Subscriptions/"; + if (this.Client.Credentials.SubscriptionId != null) + { + url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); + } + url = url + "/resourceGroups/"; + url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); + url = url + "/providers/"; + url = url + "Microsoft.Backup"; + url = url + "/"; + url = url + "BackupVault"; + url = url + "/"; + url = url + Uri.EscapeDataString(this.Client.ResourceName); + url = url + "/refreshContainers"; + List queryParameters = new List(); + queryParameters.Add("api-version=2014-09-01"); + if (queryParameters.Count > 0) + { + url = url + "?" + string.Join("&", queryParameters); + } + string baseUrl = this.Client.BaseUri.AbsoluteUri; + // Trim '/' character from the end of baseUrl and beginning of url. + if (baseUrl[baseUrl.Length - 1] == '/') + { + baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); + } + if (url[0] == '/') + { + url = url.Substring(1); + } + url = baseUrl + "/" + url; + url = url.Replace(" ", "%20"); + + // Create HTTP transport objects + HttpRequestMessage httpRequest = null; + try + { + httpRequest = new HttpRequestMessage(); + httpRequest.Method = HttpMethod.Post; + httpRequest.RequestUri = new Uri(url); + + // Set Headers + httpRequest.Headers.Add("Accept-Language", "en-us"); + httpRequest.Headers.Add("x-ms-version", "2013-03-01"); + + // Set Credentials + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); + + // Send Request + HttpResponseMessage httpResponse = null; + try + { + if (shouldTrace) + { + TracingAdapter.SendRequest(invocationId, httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); + if (shouldTrace) + { + TracingAdapter.ReceiveResponse(invocationId, httpResponse); + } + HttpStatusCode statusCode = httpResponse.StatusCode; + if (statusCode != HttpStatusCode.Accepted) + { + cancellationToken.ThrowIfCancellationRequested(); + CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); + if (shouldTrace) + { + TracingAdapter.Error(invocationId, ex); + } + throw ex; + } + + // Create Result + OperationResponse result = null; + // Deserialize Response + if (statusCode == HttpStatusCode.Accepted) + { + cancellationToken.ThrowIfCancellationRequested(); + string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + result = new OperationResponse(); + JToken responseDoc = null; + if (string.IsNullOrEmpty(responseContent) == false) + { + responseDoc = JToken.Parse(responseContent); + } + + if (responseDoc != null && responseDoc.Type != JTokenType.Null) + { + Guid operationIdInstance = Guid.Parse(((string)responseDoc)); + result.OperationId = operationIdInstance; + } + + } + result.StatusCode = statusCode; + if (httpResponse.Headers.Contains("x-ms-client-request-id")) + { + customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); + } + + if (shouldTrace) + { + TracingAdapter.Exit(invocationId, result); + } + return result; + } + finally + { + if (httpResponse != null) + { + httpResponse.Dispose(); + } + } + } + finally + { + if (httpRequest != null) + { + httpRequest.Dispose(); + } + } + } + + /// + /// Register the container. + /// + /// + /// Required. Container to be register. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + public async Task RegisterAsync(string containerName, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) + { + // Validate + if (containerName == null) + { + throw new ArgumentNullException("containerName"); + } + + // Tracing + bool shouldTrace = TracingAdapter.IsEnabled; + string invocationId = null; + if (shouldTrace) + { + invocationId = TracingAdapter.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("containerName", containerName); + tracingParameters.Add("customRequestHeaders", customRequestHeaders); + TracingAdapter.Enter(invocationId, this, "RegisterAsync", tracingParameters); + } + + // Construct URL + string url = ""; + url = url + "/Subscriptions/"; + if (this.Client.Credentials.SubscriptionId != null) + { + url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); + } + url = url + "/resourceGroups/"; + url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); + url = url + "/providers/"; + url = url + "Microsoft.Backup"; + url = url + "/"; + url = url + "BackupVault"; + url = url + "/"; + url = url + Uri.EscapeDataString(this.Client.ResourceName); + url = url + "/registeredContainers/"; + url = url + Uri.EscapeDataString(containerName); + List queryParameters = new List(); + queryParameters.Add("api-version=2014-09-01"); + if (queryParameters.Count > 0) + { + url = url + "?" + string.Join("&", queryParameters); + } + string baseUrl = this.Client.BaseUri.AbsoluteUri; + // Trim '/' character from the end of baseUrl and beginning of url. + if (baseUrl[baseUrl.Length - 1] == '/') + { + baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); + } + if (url[0] == '/') + { + url = url.Substring(1); + } + url = baseUrl + "/" + url; + url = url.Replace(" ", "%20"); + + // Create HTTP transport objects + HttpRequestMessage httpRequest = null; + try + { + httpRequest = new HttpRequestMessage(); + httpRequest.Method = HttpMethod.Put; + httpRequest.RequestUri = new Uri(url); + + // Set Headers + httpRequest.Headers.Add("Accept-Language", "en-us"); + httpRequest.Headers.Add("x-ms-version", "2013-03-01"); + + // Set Credentials + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); + + // Send Request + HttpResponseMessage httpResponse = null; + try + { + if (shouldTrace) + { + TracingAdapter.SendRequest(invocationId, httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); + if (shouldTrace) + { + TracingAdapter.ReceiveResponse(invocationId, httpResponse); + } + HttpStatusCode statusCode = httpResponse.StatusCode; + if (statusCode != HttpStatusCode.Accepted) + { + cancellationToken.ThrowIfCancellationRequested(); + CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); + if (shouldTrace) + { + TracingAdapter.Error(invocationId, ex); + } + throw ex; + } + + // Create Result + OperationResponse result = null; + // Deserialize Response + if (statusCode == HttpStatusCode.Accepted) + { + cancellationToken.ThrowIfCancellationRequested(); + string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + result = new OperationResponse(); + JToken responseDoc = null; + if (string.IsNullOrEmpty(responseContent) == false) + { + responseDoc = JToken.Parse(responseContent); + } + + if (responseDoc != null && responseDoc.Type != JTokenType.Null) + { + Guid operationIdInstance = Guid.Parse(((string)responseDoc)); + result.OperationId = operationIdInstance; + } + + } + result.StatusCode = statusCode; + if (httpResponse.Headers.Contains("x-ms-client-request-id")) + { + customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); + } + + if (shouldTrace) + { + TracingAdapter.Exit(invocationId, result); + } + return result; + } + finally + { + if (httpResponse != null) + { + httpResponse.Dispose(); + } + } + } + finally + { + if (httpRequest != null) + { + httpRequest.Dispose(); + } + } + } + + /// + /// Unregister the container. + /// + /// + /// Required. Container which we want to unregister. + /// + /// + /// Required. Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + public async Task UnregisterAsync(string containerName, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) + { + // Validate + if (containerName == null) + { + throw new ArgumentNullException("containerName"); + } + if (customRequestHeaders == null) + { + throw new ArgumentNullException("customRequestHeaders"); + } + + // Tracing + bool shouldTrace = TracingAdapter.IsEnabled; + string invocationId = null; + if (shouldTrace) + { + invocationId = TracingAdapter.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("containerName", containerName); + tracingParameters.Add("customRequestHeaders", customRequestHeaders); + TracingAdapter.Enter(invocationId, this, "UnregisterAsync", tracingParameters); + } + + // Construct URL + string url = ""; + url = url + "/Subscriptions/"; + if (this.Client.Credentials.SubscriptionId != null) + { + url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); + } + url = url + "/resourceGroups/"; + url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); + url = url + "/providers/"; + url = url + "Microsoft.Backup"; + url = url + "/"; + url = url + "BackupVault"; + url = url + "/registeredContainers/"; + url = url + Uri.EscapeDataString(containerName); + List queryParameters = new List(); + queryParameters.Add("api-version=2014-09-01"); + if (queryParameters.Count > 0) + { + url = url + "?" + string.Join("&", queryParameters); + } + string baseUrl = this.Client.BaseUri.AbsoluteUri; + // Trim '/' character from the end of baseUrl and beginning of url. + if (baseUrl[baseUrl.Length - 1] == '/') + { + baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); + } + if (url[0] == '/') + { + url = url.Substring(1); + } + url = baseUrl + "/" + url; + url = url.Replace(" ", "%20"); + + // Create HTTP transport objects + HttpRequestMessage httpRequest = null; + try + { + httpRequest = new HttpRequestMessage(); + httpRequest.Method = HttpMethod.Delete; + httpRequest.RequestUri = new Uri(url); + + // Set Headers + httpRequest.Headers.Add("Accept-Language", "en-us"); + + // Set Credentials + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); + + // Send Request + HttpResponseMessage httpResponse = null; + try + { + if (shouldTrace) + { + TracingAdapter.SendRequest(invocationId, httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); + if (shouldTrace) + { + TracingAdapter.ReceiveResponse(invocationId, httpResponse); + } + HttpStatusCode statusCode = httpResponse.StatusCode; + if (statusCode != HttpStatusCode.Accepted) + { + cancellationToken.ThrowIfCancellationRequested(); + CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); + if (shouldTrace) + { + TracingAdapter.Error(invocationId, ex); + } + throw ex; + } + + // Create Result + OperationResponse result = null; + // Deserialize Response + if (statusCode == HttpStatusCode.Accepted) + { + cancellationToken.ThrowIfCancellationRequested(); + string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + result = new OperationResponse(); + JToken responseDoc = null; + if (string.IsNullOrEmpty(responseContent) == false) + { + responseDoc = JToken.Parse(responseContent); + } + + if (responseDoc != null && responseDoc.Type != JTokenType.Null) + { + Guid operationIdInstance = Guid.Parse(((string)responseDoc)); + result.OperationId = operationIdInstance; + } + + } + result.StatusCode = statusCode; + if (httpResponse.Headers.Contains("x-ms-client-request-id")) + { + customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); + } + + if (shouldTrace) + { + TracingAdapter.Exit(invocationId, result); + } + return result; + } + finally + { + if (httpResponse != null) + { + httpResponse.Dispose(); + } + } + } + finally + { + if (httpRequest != null) + { + httpRequest.Dispose(); + } + } + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperationsExtensions.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperationsExtensions.cs new file mode 100644 index 0000000000000..f77ee4ee800a3 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/ContainerOperationsExtensions.cs @@ -0,0 +1,213 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Azure.Management.BackupServices; +using Microsoft.Azure.Management.BackupServices.Models; + +namespace Microsoft.Azure.Management.BackupServices +{ + public static partial class ContainerOperationsExtensions + { + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IContainerOperations. + /// + /// + /// Optional. Container query parameters. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// The definition of a CSMContainerListOperationResponse. + /// + public static CSMContainerListOperationResponse List(this IContainerOperations operations, ContainerQueryParameters parameters, CustomRequestHeaders customRequestHeaders) + { + return Task.Factory.StartNew((object s) => + { + return ((IContainerOperations)s).ListAsync(parameters, customRequestHeaders); + } + , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IContainerOperations. + /// + /// + /// Optional. Container query parameters. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// The definition of a CSMContainerListOperationResponse. + /// + public static Task ListAsync(this IContainerOperations operations, ContainerQueryParameters parameters, CustomRequestHeaders customRequestHeaders) + { + return operations.ListAsync(parameters, customRequestHeaders, CancellationToken.None); + } + + /// + /// Trigger the Discovery. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IContainerOperations. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// The definition of a Operation Response. + /// + public static OperationResponse Refresh(this IContainerOperations operations, CustomRequestHeaders customRequestHeaders) + { + return Task.Factory.StartNew((object s) => + { + return ((IContainerOperations)s).RefreshAsync(customRequestHeaders); + } + , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Trigger the Discovery. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IContainerOperations. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// The definition of a Operation Response. + /// + public static Task RefreshAsync(this IContainerOperations operations, CustomRequestHeaders customRequestHeaders) + { + return operations.RefreshAsync(customRequestHeaders, CancellationToken.None); + } + + /// + /// Register the container. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IContainerOperations. + /// + /// + /// Required. Container to be register. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// The definition of a Operation Response. + /// + public static OperationResponse Register(this IContainerOperations operations, string containerName, CustomRequestHeaders customRequestHeaders) + { + return Task.Factory.StartNew((object s) => + { + return ((IContainerOperations)s).RegisterAsync(containerName, customRequestHeaders); + } + , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Register the container. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IContainerOperations. + /// + /// + /// Required. Container to be register. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// The definition of a Operation Response. + /// + public static Task RegisterAsync(this IContainerOperations operations, string containerName, CustomRequestHeaders customRequestHeaders) + { + return operations.RegisterAsync(containerName, customRequestHeaders, CancellationToken.None); + } + + /// + /// Unregister the container. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IContainerOperations. + /// + /// + /// Required. Container which we want to unregister. + /// + /// + /// Required. Request header parameters. + /// + /// + /// The definition of a Operation Response. + /// + public static OperationResponse Unregister(this IContainerOperations operations, string containerName, CustomRequestHeaders customRequestHeaders) + { + return Task.Factory.StartNew((object s) => + { + return ((IContainerOperations)s).UnregisterAsync(containerName, customRequestHeaders); + } + , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Unregister the container. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IContainerOperations. + /// + /// + /// Required. Container which we want to unregister. + /// + /// + /// Required. Request header parameters. + /// + /// + /// The definition of a Operation Response. + /// + public static Task UnregisterAsync(this IContainerOperations operations, string containerName, CustomRequestHeaders customRequestHeaders) + { + return operations.UnregisterAsync(containerName, customRequestHeaders, CancellationToken.None); + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IContainerOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IContainerOperations.cs new file mode 100644 index 0000000000000..3927dfbd4e035 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IContainerOperations.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Azure.Management.BackupServices; +using Microsoft.Azure.Management.BackupServices.Models; + +namespace Microsoft.Azure.Management.BackupServices +{ + /// + /// Definition of Container operations for the Azure Backup extension. + /// + public partial interface IContainerOperations + { + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Container query parameters. + /// + /// + /// Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a CSMContainerListOperationResponse. + /// + Task ListAsync(ContainerQueryParameters parameters, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + + /// + /// Trigger the Discovery. + /// + /// + /// Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + Task RefreshAsync(CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + + /// + /// Register the container. + /// + /// + /// Container to be register. + /// + /// + /// Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + Task RegisterAsync(string containerName, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + + /// + /// Unregister the container. + /// + /// + /// Container which we want to unregister. + /// + /// + /// Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + Task UnregisterAsync(string containerName, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IMarsContainerOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IMarsContainerOperations.cs new file mode 100644 index 0000000000000..32d4696590d7a --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/IMarsContainerOperations.cs @@ -0,0 +1,112 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Azure.Management.BackupServices; +using Microsoft.Azure.Management.BackupServices.Models; + +namespace Microsoft.Azure.Management.BackupServices +{ + /// + /// Definition of Container operations for the Azure Backup extension. + /// + public partial interface IMarsContainerOperations + { + /// + /// Enable the container reregistration. + /// + /// + /// MARS container ID. + /// + /// + /// Enable Reregistration Request. + /// + /// + /// Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + Task EnableMarsContainerReregistrationAsync(string containerId, EnableReregistrationRequest enableReregistrationRequest, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Type of container. + /// + /// + /// Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// List of Microsoft Azure Recovery Services (MARS) containers. + /// + Task ListMarsContainersByTypeAsync(MarsContainerType containerType, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Type of container. + /// + /// + /// Friendly name of container. + /// + /// + /// Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// List of Microsoft Azure Recovery Services (MARS) containers. + /// + Task ListMarsContainersByTypeAndFriendlyNameAsync(MarsContainerType containerType, string friendlyName, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + + /// + /// Unregister the container. + /// + /// + /// MARS container ID. + /// + /// + /// Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + Task UnregisterMarsContainerAsync(string containerId, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken); + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/MarsContainerOperations.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/MarsContainerOperations.cs new file mode 100644 index 0000000000000..1c210894e11a1 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/MarsContainerOperations.cs @@ -0,0 +1,993 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Hyak.Common; +using Microsoft.Azure.Management.BackupServices; +using Microsoft.Azure.Management.BackupServices.Models; +using Newtonsoft.Json.Linq; + +namespace Microsoft.Azure.Management.BackupServices +{ + /// + /// Definition of Container operations for the Azure Backup extension. + /// + internal partial class MarsContainerOperations : IServiceOperations, IMarsContainerOperations + { + /// + /// Initializes a new instance of the MarsContainerOperations class. + /// + /// + /// Reference to the service client. + /// + internal MarsContainerOperations(BackupVaultServicesManagementClient client) + { + this._client = client; + } + + private BackupVaultServicesManagementClient _client; + + /// + /// Gets a reference to the + /// Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient. + /// + public BackupVaultServicesManagementClient Client + { + get { return this._client; } + } + + /// + /// Enable the container reregistration. + /// + /// + /// Required. MARS container ID. + /// + /// + /// Required. Enable Reregistration Request. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + public async Task EnableMarsContainerReregistrationAsync(string containerId, EnableReregistrationRequest enableReregistrationRequest, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) + { + // Validate + if (containerId == null) + { + throw new ArgumentNullException("containerId"); + } + if (enableReregistrationRequest == null) + { + throw new ArgumentNullException("enableReregistrationRequest"); + } + + // Tracing + bool shouldTrace = TracingAdapter.IsEnabled; + string invocationId = null; + if (shouldTrace) + { + invocationId = TracingAdapter.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("containerId", containerId); + tracingParameters.Add("enableReregistrationRequest", enableReregistrationRequest); + tracingParameters.Add("customRequestHeaders", customRequestHeaders); + TracingAdapter.Enter(invocationId, this, "EnableMarsContainerReregistrationAsync", tracingParameters); + } + + // Construct URL + string url = ""; + url = url + "/Subscriptions/"; + if (this.Client.Credentials.SubscriptionId != null) + { + url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); + } + url = url + "/resourceGroups/"; + url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); + url = url + "/providers/"; + url = url + "Microsoft.Backup"; + url = url + "/"; + url = url + "BackupVault"; + url = url + "/"; + url = url + Uri.EscapeDataString(this.Client.ResourceName); + url = url + "/backupContainers/"; + url = url + Uri.EscapeDataString(containerId); + url = url + "/enableReRegister"; + List queryParameters = new List(); + queryParameters.Add("api-version=2015-03-15"); + if (queryParameters.Count > 0) + { + url = url + "?" + string.Join("&", queryParameters); + } + string baseUrl = this.Client.BaseUri.AbsoluteUri; + // Trim '/' character from the end of baseUrl and beginning of url. + if (baseUrl[baseUrl.Length - 1] == '/') + { + baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); + } + if (url[0] == '/') + { + url = url.Substring(1); + } + url = baseUrl + "/" + url; + url = url.Replace(" ", "%20"); + + // Create HTTP transport objects + HttpRequestMessage httpRequest = null; + try + { + httpRequest = new HttpRequestMessage(); + httpRequest.Method = new HttpMethod("PATCH"); + httpRequest.RequestUri = new Uri(url); + + // Set Headers + httpRequest.Headers.Add("Accept-Language", "en-us"); + httpRequest.Headers.Add("x-ms-client-request-id", customRequestHeaders.ClientRequestId); + + // Set Credentials + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); + + // Serialize Request + string requestContent = null; + JToken requestDoc = null; + + JObject enableReregistrationRequestValue = new JObject(); + requestDoc = enableReregistrationRequestValue; + + if (enableReregistrationRequest.ContainerReregistrationState != null) + { + JObject propertiesValue = new JObject(); + enableReregistrationRequestValue["properties"] = propertiesValue; + + propertiesValue["enableReRegister"] = enableReregistrationRequest.ContainerReregistrationState.EnableReregistration; + } + + requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented); + httpRequest.Content = new StringContent(requestContent, Encoding.UTF8); + httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json"); + + // Send Request + HttpResponseMessage httpResponse = null; + try + { + if (shouldTrace) + { + TracingAdapter.SendRequest(invocationId, httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); + if (shouldTrace) + { + TracingAdapter.ReceiveResponse(invocationId, httpResponse); + } + HttpStatusCode statusCode = httpResponse.StatusCode; + if (statusCode != HttpStatusCode.NoContent) + { + cancellationToken.ThrowIfCancellationRequested(); + CloudException ex = CloudException.Create(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); + if (shouldTrace) + { + TracingAdapter.Error(invocationId, ex); + } + throw ex; + } + + // Create Result + OperationResponse result = null; + // Deserialize Response + if (statusCode == HttpStatusCode.NoContent) + { + cancellationToken.ThrowIfCancellationRequested(); + string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + result = new OperationResponse(); + JToken responseDoc = null; + if (string.IsNullOrEmpty(responseContent) == false) + { + responseDoc = JToken.Parse(responseContent); + } + + if (responseDoc != null && responseDoc.Type != JTokenType.Null) + { + Guid operationIdInstance = Guid.Parse(((string)responseDoc)); + result.OperationId = operationIdInstance; + } + + } + result.StatusCode = statusCode; + + if (shouldTrace) + { + TracingAdapter.Exit(invocationId, result); + } + return result; + } + finally + { + if (httpResponse != null) + { + httpResponse.Dispose(); + } + } + } + finally + { + if (httpRequest != null) + { + httpRequest.Dispose(); + } + } + } + + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Required. Type of container. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// List of Microsoft Azure Recovery Services (MARS) containers. + /// + public async Task ListMarsContainersByTypeAsync(MarsContainerType containerType, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) + { + // Validate + + // Tracing + bool shouldTrace = TracingAdapter.IsEnabled; + string invocationId = null; + if (shouldTrace) + { + invocationId = TracingAdapter.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("containerType", containerType); + tracingParameters.Add("customRequestHeaders", customRequestHeaders); + TracingAdapter.Enter(invocationId, this, "ListMarsContainersByTypeAsync", tracingParameters); + } + + // Construct URL + string url = ""; + url = url + "/Subscriptions/"; + if (this.Client.Credentials.SubscriptionId != null) + { + url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); + } + url = url + "/resourceGroups/"; + url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); + url = url + "/providers/"; + url = url + "Microsoft.Backup"; + url = url + "/"; + url = url + "BackupVault"; + url = url + "/"; + url = url + Uri.EscapeDataString(this.Client.ResourceName); + url = url + "/backupContainers"; + List queryParameters = new List(); + queryParameters.Add("api-version=2015-03-15"); + List odataFilter = new List(); + odataFilter.Add("type eq '" + Uri.EscapeDataString(containerType.ToString()) + "'"); + if (odataFilter.Count > 0) + { + queryParameters.Add("$filter=" + string.Join(null, odataFilter)); + } + if (queryParameters.Count > 0) + { + url = url + "?" + string.Join("&", queryParameters); + } + string baseUrl = this.Client.BaseUri.AbsoluteUri; + // Trim '/' character from the end of baseUrl and beginning of url. + if (baseUrl[baseUrl.Length - 1] == '/') + { + baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); + } + if (url[0] == '/') + { + url = url.Substring(1); + } + url = baseUrl + "/" + url; + url = url.Replace(" ", "%20"); + + // Create HTTP transport objects + HttpRequestMessage httpRequest = null; + try + { + httpRequest = new HttpRequestMessage(); + httpRequest.Method = HttpMethod.Get; + httpRequest.RequestUri = new Uri(url); + + // Set Headers + httpRequest.Headers.Add("Accept-Language", "en-us"); + + // Set Credentials + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); + + // Send Request + HttpResponseMessage httpResponse = null; + try + { + if (shouldTrace) + { + TracingAdapter.SendRequest(invocationId, httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); + if (shouldTrace) + { + TracingAdapter.ReceiveResponse(invocationId, httpResponse); + } + HttpStatusCode statusCode = httpResponse.StatusCode; + if (statusCode != HttpStatusCode.OK) + { + cancellationToken.ThrowIfCancellationRequested(); + CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); + if (shouldTrace) + { + TracingAdapter.Error(invocationId, ex); + } + throw ex; + } + + // Create Result + ListMarsContainerOperationResponse result = null; + // Deserialize Response + if (statusCode == HttpStatusCode.OK) + { + cancellationToken.ThrowIfCancellationRequested(); + string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + result = new ListMarsContainerOperationResponse(); + JToken responseDoc = null; + if (string.IsNullOrEmpty(responseContent) == false) + { + responseDoc = JToken.Parse(responseContent); + } + + if (responseDoc != null && responseDoc.Type != JTokenType.Null) + { + ListMarsContainerResponse listMarsContainerResponseInstance = new ListMarsContainerResponse(); + result.ListMarsContainerResponse = listMarsContainerResponseInstance; + + JToken valueArray = responseDoc["value"]; + if (valueArray != null && valueArray.Type != JTokenType.Null) + { + foreach (JToken valueValue in ((JArray)valueArray)) + { + MarsContainerResponse marsContainerResponseInstance = new MarsContainerResponse(); + listMarsContainerResponseInstance.Value.Add(marsContainerResponseInstance); + + JToken uniqueNameValue = valueValue["uniqueName"]; + if (uniqueNameValue != null && uniqueNameValue.Type != JTokenType.Null) + { + string uniqueNameInstance = ((string)uniqueNameValue); + marsContainerResponseInstance.UniqueName = uniqueNameInstance; + } + + JToken containerTypeValue = valueValue["containerType"]; + if (containerTypeValue != null && containerTypeValue.Type != JTokenType.Null) + { + string containerTypeInstance = ((string)containerTypeValue); + marsContainerResponseInstance.ContainerType = containerTypeInstance; + } + + JToken propertiesValue = valueValue["properties"]; + if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) + { + MarsContainerProperties propertiesInstance = new MarsContainerProperties(); + marsContainerResponseInstance.Properties = propertiesInstance; + + JToken containerIdValue = propertiesValue["containerId"]; + if (containerIdValue != null && containerIdValue.Type != JTokenType.Null) + { + long containerIdInstance = ((long)containerIdValue); + propertiesInstance.ContainerId = containerIdInstance; + } + + JToken friendlyNameValue = propertiesValue["friendlyName"]; + if (friendlyNameValue != null && friendlyNameValue.Type != JTokenType.Null) + { + string friendlyNameInstance = ((string)friendlyNameValue); + propertiesInstance.FriendlyName = friendlyNameInstance; + } + + JToken containerStampIdValue = propertiesValue["containerStampId"]; + if (containerStampIdValue != null && containerStampIdValue.Type != JTokenType.Null) + { + Guid containerStampIdInstance = Guid.Parse(((string)containerStampIdValue)); + propertiesInstance.ContainerStampId = containerStampIdInstance; + } + + JToken containerStampUriValue = propertiesValue["containerStampUri"]; + if (containerStampUriValue != null && containerStampUriValue.Type != JTokenType.Null) + { + string containerStampUriInstance = ((string)containerStampUriValue); + propertiesInstance.ContainerStampUri = containerStampUriInstance; + } + + JToken canReRegisterValue = propertiesValue["canReRegister"]; + if (canReRegisterValue != null && canReRegisterValue.Type != JTokenType.Null) + { + bool canReRegisterInstance = ((bool)canReRegisterValue); + propertiesInstance.CanReRegister = canReRegisterInstance; + } + + JToken customerTypeValue = propertiesValue["customerType"]; + if (customerTypeValue != null && customerTypeValue.Type != JTokenType.Null) + { + string customerTypeInstance = ((string)customerTypeValue); + propertiesInstance.CustomerType = customerTypeInstance; + } + } + + JToken idValue = valueValue["id"]; + if (idValue != null && idValue.Type != JTokenType.Null) + { + string idInstance = ((string)idValue); + marsContainerResponseInstance.Id = idInstance; + } + + JToken nameValue = valueValue["name"]; + if (nameValue != null && nameValue.Type != JTokenType.Null) + { + string nameInstance = ((string)nameValue); + marsContainerResponseInstance.Name = nameInstance; + } + + JToken typeValue = valueValue["type"]; + if (typeValue != null && typeValue.Type != JTokenType.Null) + { + string typeInstance = ((string)typeValue); + marsContainerResponseInstance.Type = typeInstance; + } + } + } + + JToken nextLinkValue = responseDoc["nextLink"]; + if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null) + { + string nextLinkInstance = ((string)nextLinkValue); + listMarsContainerResponseInstance.NextLink = nextLinkInstance; + } + + JToken idValue2 = responseDoc["id"]; + if (idValue2 != null && idValue2.Type != JTokenType.Null) + { + string idInstance2 = ((string)idValue2); + listMarsContainerResponseInstance.Id = idInstance2; + } + + JToken nameValue2 = responseDoc["name"]; + if (nameValue2 != null && nameValue2.Type != JTokenType.Null) + { + string nameInstance2 = ((string)nameValue2); + listMarsContainerResponseInstance.Name = nameInstance2; + } + + JToken typeValue2 = responseDoc["type"]; + if (typeValue2 != null && typeValue2.Type != JTokenType.Null) + { + string typeInstance2 = ((string)typeValue2); + listMarsContainerResponseInstance.Type = typeInstance2; + } + } + + } + result.StatusCode = statusCode; + if (httpResponse.Headers.Contains("x-ms-client-request-id")) + { + customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); + } + + if (shouldTrace) + { + TracingAdapter.Exit(invocationId, result); + } + return result; + } + finally + { + if (httpResponse != null) + { + httpResponse.Dispose(); + } + } + } + finally + { + if (httpRequest != null) + { + httpRequest.Dispose(); + } + } + } + + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Required. Type of container. + /// + /// + /// Required. Friendly name of container. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// List of Microsoft Azure Recovery Services (MARS) containers. + /// + public async Task ListMarsContainersByTypeAndFriendlyNameAsync(MarsContainerType containerType, string friendlyName, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) + { + // Validate + if (friendlyName == null) + { + throw new ArgumentNullException("friendlyName"); + } + + // Tracing + bool shouldTrace = TracingAdapter.IsEnabled; + string invocationId = null; + if (shouldTrace) + { + invocationId = TracingAdapter.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("containerType", containerType); + tracingParameters.Add("friendlyName", friendlyName); + tracingParameters.Add("customRequestHeaders", customRequestHeaders); + TracingAdapter.Enter(invocationId, this, "ListMarsContainersByTypeAndFriendlyNameAsync", tracingParameters); + } + + // Construct URL + string url = ""; + url = url + "/Subscriptions/"; + if (this.Client.Credentials.SubscriptionId != null) + { + url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); + } + url = url + "/resourceGroups/"; + url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); + url = url + "/providers/"; + url = url + "Microsoft.Backup"; + url = url + "/"; + url = url + "BackupVault"; + url = url + "/"; + url = url + Uri.EscapeDataString(this.Client.ResourceName); + url = url + "/backupContainers"; + List queryParameters = new List(); + queryParameters.Add("api-version=2015-03-15"); + List odataFilter = new List(); + odataFilter.Add("type eq '" + Uri.EscapeDataString(containerType.ToString()) + "'"); + odataFilter.Add("friendlyName eq '" + Uri.EscapeDataString(friendlyName) + "'"); + if (odataFilter.Count > 0) + { + queryParameters.Add("$filter=" + string.Join(" and ", odataFilter)); + } + if (queryParameters.Count > 0) + { + url = url + "?" + string.Join("&", queryParameters); + } + string baseUrl = this.Client.BaseUri.AbsoluteUri; + // Trim '/' character from the end of baseUrl and beginning of url. + if (baseUrl[baseUrl.Length - 1] == '/') + { + baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); + } + if (url[0] == '/') + { + url = url.Substring(1); + } + url = baseUrl + "/" + url; + url = url.Replace(" ", "%20"); + + // Create HTTP transport objects + HttpRequestMessage httpRequest = null; + try + { + httpRequest = new HttpRequestMessage(); + httpRequest.Method = HttpMethod.Get; + httpRequest.RequestUri = new Uri(url); + + // Set Headers + httpRequest.Headers.Add("Accept-Language", "en-us"); + + // Set Credentials + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); + + // Send Request + HttpResponseMessage httpResponse = null; + try + { + if (shouldTrace) + { + TracingAdapter.SendRequest(invocationId, httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); + if (shouldTrace) + { + TracingAdapter.ReceiveResponse(invocationId, httpResponse); + } + HttpStatusCode statusCode = httpResponse.StatusCode; + if (statusCode != HttpStatusCode.OK) + { + cancellationToken.ThrowIfCancellationRequested(); + CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); + if (shouldTrace) + { + TracingAdapter.Error(invocationId, ex); + } + throw ex; + } + + // Create Result + ListMarsContainerOperationResponse result = null; + // Deserialize Response + if (statusCode == HttpStatusCode.OK) + { + cancellationToken.ThrowIfCancellationRequested(); + string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + result = new ListMarsContainerOperationResponse(); + JToken responseDoc = null; + if (string.IsNullOrEmpty(responseContent) == false) + { + responseDoc = JToken.Parse(responseContent); + } + + if (responseDoc != null && responseDoc.Type != JTokenType.Null) + { + ListMarsContainerResponse listMarsContainerResponseInstance = new ListMarsContainerResponse(); + result.ListMarsContainerResponse = listMarsContainerResponseInstance; + + JToken valueArray = responseDoc["value"]; + if (valueArray != null && valueArray.Type != JTokenType.Null) + { + foreach (JToken valueValue in ((JArray)valueArray)) + { + MarsContainerResponse marsContainerResponseInstance = new MarsContainerResponse(); + listMarsContainerResponseInstance.Value.Add(marsContainerResponseInstance); + + JToken uniqueNameValue = valueValue["uniqueName"]; + if (uniqueNameValue != null && uniqueNameValue.Type != JTokenType.Null) + { + string uniqueNameInstance = ((string)uniqueNameValue); + marsContainerResponseInstance.UniqueName = uniqueNameInstance; + } + + JToken containerTypeValue = valueValue["containerType"]; + if (containerTypeValue != null && containerTypeValue.Type != JTokenType.Null) + { + string containerTypeInstance = ((string)containerTypeValue); + marsContainerResponseInstance.ContainerType = containerTypeInstance; + } + + JToken propertiesValue = valueValue["properties"]; + if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) + { + MarsContainerProperties propertiesInstance = new MarsContainerProperties(); + marsContainerResponseInstance.Properties = propertiesInstance; + + JToken containerIdValue = propertiesValue["containerId"]; + if (containerIdValue != null && containerIdValue.Type != JTokenType.Null) + { + long containerIdInstance = ((long)containerIdValue); + propertiesInstance.ContainerId = containerIdInstance; + } + + JToken friendlyNameValue = propertiesValue["friendlyName"]; + if (friendlyNameValue != null && friendlyNameValue.Type != JTokenType.Null) + { + string friendlyNameInstance = ((string)friendlyNameValue); + propertiesInstance.FriendlyName = friendlyNameInstance; + } + + JToken containerStampIdValue = propertiesValue["containerStampId"]; + if (containerStampIdValue != null && containerStampIdValue.Type != JTokenType.Null) + { + Guid containerStampIdInstance = Guid.Parse(((string)containerStampIdValue)); + propertiesInstance.ContainerStampId = containerStampIdInstance; + } + + JToken containerStampUriValue = propertiesValue["containerStampUri"]; + if (containerStampUriValue != null && containerStampUriValue.Type != JTokenType.Null) + { + string containerStampUriInstance = ((string)containerStampUriValue); + propertiesInstance.ContainerStampUri = containerStampUriInstance; + } + + JToken canReRegisterValue = propertiesValue["canReRegister"]; + if (canReRegisterValue != null && canReRegisterValue.Type != JTokenType.Null) + { + bool canReRegisterInstance = ((bool)canReRegisterValue); + propertiesInstance.CanReRegister = canReRegisterInstance; + } + + JToken customerTypeValue = propertiesValue["customerType"]; + if (customerTypeValue != null && customerTypeValue.Type != JTokenType.Null) + { + string customerTypeInstance = ((string)customerTypeValue); + propertiesInstance.CustomerType = customerTypeInstance; + } + } + + JToken idValue = valueValue["id"]; + if (idValue != null && idValue.Type != JTokenType.Null) + { + string idInstance = ((string)idValue); + marsContainerResponseInstance.Id = idInstance; + } + + JToken nameValue = valueValue["name"]; + if (nameValue != null && nameValue.Type != JTokenType.Null) + { + string nameInstance = ((string)nameValue); + marsContainerResponseInstance.Name = nameInstance; + } + + JToken typeValue = valueValue["type"]; + if (typeValue != null && typeValue.Type != JTokenType.Null) + { + string typeInstance = ((string)typeValue); + marsContainerResponseInstance.Type = typeInstance; + } + } + } + + JToken nextLinkValue = responseDoc["nextLink"]; + if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null) + { + string nextLinkInstance = ((string)nextLinkValue); + listMarsContainerResponseInstance.NextLink = nextLinkInstance; + } + + JToken idValue2 = responseDoc["id"]; + if (idValue2 != null && idValue2.Type != JTokenType.Null) + { + string idInstance2 = ((string)idValue2); + listMarsContainerResponseInstance.Id = idInstance2; + } + + JToken nameValue2 = responseDoc["name"]; + if (nameValue2 != null && nameValue2.Type != JTokenType.Null) + { + string nameInstance2 = ((string)nameValue2); + listMarsContainerResponseInstance.Name = nameInstance2; + } + + JToken typeValue2 = responseDoc["type"]; + if (typeValue2 != null && typeValue2.Type != JTokenType.Null) + { + string typeInstance2 = ((string)typeValue2); + listMarsContainerResponseInstance.Type = typeInstance2; + } + } + + } + result.StatusCode = statusCode; + if (httpResponse.Headers.Contains("x-ms-client-request-id")) + { + customRequestHeaders.ClientRequestId = httpResponse.Headers.GetValues("x-ms-client-request-id").FirstOrDefault(); + } + + if (shouldTrace) + { + TracingAdapter.Exit(invocationId, result); + } + return result; + } + finally + { + if (httpResponse != null) + { + httpResponse.Dispose(); + } + } + } + finally + { + if (httpRequest != null) + { + httpRequest.Dispose(); + } + } + } + + /// + /// Unregister the container. + /// + /// + /// Required. MARS container ID. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// Cancellation token. + /// + /// + /// The definition of a Operation Response. + /// + public async Task UnregisterMarsContainerAsync(string containerId, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken) + { + // Validate + if (containerId == null) + { + throw new ArgumentNullException("containerId"); + } + + // Tracing + bool shouldTrace = TracingAdapter.IsEnabled; + string invocationId = null; + if (shouldTrace) + { + invocationId = TracingAdapter.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("containerId", containerId); + tracingParameters.Add("customRequestHeaders", customRequestHeaders); + TracingAdapter.Enter(invocationId, this, "UnregisterMarsContainerAsync", tracingParameters); + } + + // Construct URL + string url = ""; + url = url + "/Subscriptions/"; + if (this.Client.Credentials.SubscriptionId != null) + { + url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); + } + url = url + "/resourceGroups/"; + url = url + Uri.EscapeDataString(this.Client.ResourceGroupName); + url = url + "/providers/"; + url = url + "Microsoft.Backup"; + url = url + "/"; + url = url + "BackupVault"; + url = url + "/"; + url = url + Uri.EscapeDataString(this.Client.ResourceName); + url = url + "/backupContainers/"; + url = url + Uri.EscapeDataString(containerId); + url = url + "/UnRegisterContainer"; + List queryParameters = new List(); + queryParameters.Add("api-version=2015-03-15"); + if (queryParameters.Count > 0) + { + url = url + "?" + string.Join("&", queryParameters); + } + string baseUrl = this.Client.BaseUri.AbsoluteUri; + // Trim '/' character from the end of baseUrl and beginning of url. + if (baseUrl[baseUrl.Length - 1] == '/') + { + baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); + } + if (url[0] == '/') + { + url = url.Substring(1); + } + url = baseUrl + "/" + url; + url = url.Replace(" ", "%20"); + + // Create HTTP transport objects + HttpRequestMessage httpRequest = null; + try + { + httpRequest = new HttpRequestMessage(); + httpRequest.Method = HttpMethod.Delete; + httpRequest.RequestUri = new Uri(url); + + // Set Headers + httpRequest.Headers.Add("Accept-Language", "en-us"); + httpRequest.Headers.Add("x-ms-client-request-id", customRequestHeaders.ClientRequestId); + + // Set Credentials + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); + + // Send Request + HttpResponseMessage httpResponse = null; + try + { + if (shouldTrace) + { + TracingAdapter.SendRequest(invocationId, httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); + if (shouldTrace) + { + TracingAdapter.ReceiveResponse(invocationId, httpResponse); + } + HttpStatusCode statusCode = httpResponse.StatusCode; + if (statusCode != HttpStatusCode.NoContent) + { + cancellationToken.ThrowIfCancellationRequested(); + CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); + if (shouldTrace) + { + TracingAdapter.Error(invocationId, ex); + } + throw ex; + } + + // Create Result + OperationResponse result = null; + // Deserialize Response + if (statusCode == HttpStatusCode.NoContent) + { + cancellationToken.ThrowIfCancellationRequested(); + string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + result = new OperationResponse(); + JToken responseDoc = null; + if (string.IsNullOrEmpty(responseContent) == false) + { + responseDoc = JToken.Parse(responseContent); + } + + if (responseDoc != null && responseDoc.Type != JTokenType.Null) + { + Guid operationIdInstance = Guid.Parse(((string)responseDoc)); + result.OperationId = operationIdInstance; + } + + } + result.StatusCode = statusCode; + + if (shouldTrace) + { + TracingAdapter.Exit(invocationId, result); + } + return result; + } + finally + { + if (httpResponse != null) + { + httpResponse.Dispose(); + } + } + } + finally + { + if (httpRequest != null) + { + httpRequest.Dispose(); + } + } + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/MarsContainerOperationsExtensions.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/MarsContainerOperationsExtensions.cs new file mode 100644 index 0000000000000..ae098c0a2dc83 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/MarsContainerOperationsExtensions.cs @@ -0,0 +1,233 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Azure.Management.BackupServices; +using Microsoft.Azure.Management.BackupServices.Models; + +namespace Microsoft.Azure.Management.BackupServices +{ + public static partial class MarsContainerOperationsExtensions + { + /// + /// Enable the container reregistration. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IMarsContainerOperations. + /// + /// + /// Required. MARS container ID. + /// + /// + /// Required. Enable Reregistration Request. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// The definition of a Operation Response. + /// + public static OperationResponse EnableMarsContainerReregistration(this IMarsContainerOperations operations, string containerId, EnableReregistrationRequest enableReregistrationRequest, CustomRequestHeaders customRequestHeaders) + { + return Task.Factory.StartNew((object s) => + { + return ((IMarsContainerOperations)s).EnableMarsContainerReregistrationAsync(containerId, enableReregistrationRequest, customRequestHeaders); + } + , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Enable the container reregistration. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IMarsContainerOperations. + /// + /// + /// Required. MARS container ID. + /// + /// + /// Required. Enable Reregistration Request. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// The definition of a Operation Response. + /// + public static Task EnableMarsContainerReregistrationAsync(this IMarsContainerOperations operations, string containerId, EnableReregistrationRequest enableReregistrationRequest, CustomRequestHeaders customRequestHeaders) + { + return operations.EnableMarsContainerReregistrationAsync(containerId, enableReregistrationRequest, customRequestHeaders, CancellationToken.None); + } + + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IMarsContainerOperations. + /// + /// + /// Required. Type of container. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// List of Microsoft Azure Recovery Services (MARS) containers. + /// + public static ListMarsContainerOperationResponse ListMarsContainersByType(this IMarsContainerOperations operations, MarsContainerType containerType, CustomRequestHeaders customRequestHeaders) + { + return Task.Factory.StartNew((object s) => + { + return ((IMarsContainerOperations)s).ListMarsContainersByTypeAsync(containerType, customRequestHeaders); + } + , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IMarsContainerOperations. + /// + /// + /// Required. Type of container. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// List of Microsoft Azure Recovery Services (MARS) containers. + /// + public static Task ListMarsContainersByTypeAsync(this IMarsContainerOperations operations, MarsContainerType containerType, CustomRequestHeaders customRequestHeaders) + { + return operations.ListMarsContainersByTypeAsync(containerType, customRequestHeaders, CancellationToken.None); + } + + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IMarsContainerOperations. + /// + /// + /// Required. Type of container. + /// + /// + /// Required. Friendly name of container. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// List of Microsoft Azure Recovery Services (MARS) containers. + /// + public static ListMarsContainerOperationResponse ListMarsContainersByTypeAndFriendlyName(this IMarsContainerOperations operations, MarsContainerType containerType, string friendlyName, CustomRequestHeaders customRequestHeaders) + { + return Task.Factory.StartNew((object s) => + { + return ((IMarsContainerOperations)s).ListMarsContainersByTypeAndFriendlyNameAsync(containerType, friendlyName, customRequestHeaders); + } + , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Get the list of all container based on the given query filter + /// string. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IMarsContainerOperations. + /// + /// + /// Required. Type of container. + /// + /// + /// Required. Friendly name of container. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// List of Microsoft Azure Recovery Services (MARS) containers. + /// + public static Task ListMarsContainersByTypeAndFriendlyNameAsync(this IMarsContainerOperations operations, MarsContainerType containerType, string friendlyName, CustomRequestHeaders customRequestHeaders) + { + return operations.ListMarsContainersByTypeAndFriendlyNameAsync(containerType, friendlyName, customRequestHeaders, CancellationToken.None); + } + + /// + /// Unregister the container. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IMarsContainerOperations. + /// + /// + /// Required. MARS container ID. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// The definition of a Operation Response. + /// + public static OperationResponse UnregisterMarsContainer(this IMarsContainerOperations operations, string containerId, CustomRequestHeaders customRequestHeaders) + { + return Task.Factory.StartNew((object s) => + { + return ((IMarsContainerOperations)s).UnregisterMarsContainerAsync(containerId, customRequestHeaders); + } + , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + } + + /// + /// Unregister the container. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.BackupServices.IMarsContainerOperations. + /// + /// + /// Required. MARS container ID. + /// + /// + /// Optional. Request header parameters. + /// + /// + /// The definition of a Operation Response. + /// + public static Task UnregisterMarsContainerAsync(this IMarsContainerOperations operations, string containerId, CustomRequestHeaders customRequestHeaders) + { + return operations.UnregisterMarsContainerAsync(containerId, customRequestHeaders, CancellationToken.None); + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupBaseObject.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupBaseObject.cs new file mode 100644 index 0000000000000..cb4f4ca62c825 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupBaseObject.cs @@ -0,0 +1,39 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + /// + /// The definition of a BackupBaseObject. + /// + public partial class BackupBaseObject + { + /// + /// Initializes a new instance of the BackupBaseObject class. + /// + public BackupBaseObject() + { + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupBaseResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupBaseResponse.cs new file mode 100644 index 0000000000000..a2015df2644ea --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupBaseResponse.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; +using Microsoft.Azure.Management.BackupServices.Models; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + /// + /// The definition of a BackupBaseResponse. + /// + public partial class BackupBaseResponse : BackupBaseObject + { + private string _id; + + /// + /// Optional. ID + /// + public string Id + { + get { return this._id; } + set { this._id = value; } + } + + private string _name; + + /// + /// Optional. Name + /// + public string Name + { + get { return this._name; } + set { this._name = value; } + } + + private string _type; + + /// + /// Optional. Type + /// + public string Type + { + get { return this._type; } + set { this._type = value; } + } + + /// + /// Initializes a new instance of the BackupBaseResponse class. + /// + public BackupBaseResponse() + { + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupListResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupListResponse.cs new file mode 100644 index 0000000000000..71eed8b1f6d57 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/BackupListResponse.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; +using Microsoft.Azure.Management.BackupServices.Models; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + /// + /// The definition of a BackupListResponse. + /// + public partial class BackupListResponse : BackupBaseResponse + { + private string _nextLink; + + /// + /// Optional. Next Link + /// + public string NextLink + { + get { return this._nextLink; } + set { this._nextLink = value; } + } + + /// + /// Initializes a new instance of the BackupListResponse class. + /// + public BackupListResponse() + { + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CSMUpdateProtectionPolicyRequest.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CSMUpdateProtectionPolicyRequest.cs new file mode 100644 index 0000000000000..347067a7bd9c1 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CSMUpdateProtectionPolicyRequest.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; +using Microsoft.Azure.Management.BackupServices.Models; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + /// + /// The definition of a CSMUpdateProtectionPolicyRequest Request. + /// + public partial class CSMUpdateProtectionPolicyRequest : CSMBaseRequest + { + private CSMUpdateProtectionPolicyRequestProperties _properties; + + /// + /// Required. CSMUpdateProtectionPolicy Request Properties + /// + public CSMUpdateProtectionPolicyRequestProperties Properties + { + get { return this._properties; } + set { this._properties = value; } + } + + /// + /// Initializes a new instance of the CSMUpdateProtectionPolicyRequest + /// class. + /// + public CSMUpdateProtectionPolicyRequest() + { + } + + /// + /// Initializes a new instance of the CSMUpdateProtectionPolicyRequest + /// class with required arguments. + /// + public CSMUpdateProtectionPolicyRequest(CSMUpdateProtectionPolicyRequestProperties properties) + : this() + { + if (properties == null) + { + throw new ArgumentNullException("properties"); + } + this.Properties = properties; + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ContainerQueryParameters.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ContainerQueryParameters.cs new file mode 100644 index 0000000000000..341642ac7d125 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ContainerQueryParameters.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + public partial class ContainerQueryParameters + { + private string _containerType; + + /// + /// Optional. + /// + public string ContainerType + { + get { return this._containerType; } + set { this._containerType = value; } + } + + private string _friendlyName; + + /// + /// Optional. + /// + public string FriendlyName + { + get { return this._friendlyName; } + set { this._friendlyName = value; } + } + + private string _status; + + /// + /// Optional. + /// + public string Status + { + get { return this._status; } + set { this._status = value; } + } + + /// + /// Initializes a new instance of the ContainerQueryParameters class. + /// + public ContainerQueryParameters() + { + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ContainerReregistrationState.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ContainerReregistrationState.cs new file mode 100644 index 0000000000000..6f5f427999282 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ContainerReregistrationState.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + /// + /// The definition of a ContainerReregistrationState. + /// + public partial class ContainerReregistrationState + { + private bool _enableReregistration; + + /// + /// Optional. Flag to enable container reregistration. + /// + public bool EnableReregistration + { + get { return this._enableReregistration; } + set { this._enableReregistration = value; } + } + + /// + /// Initializes a new instance of the ContainerReregistrationState + /// class. + /// + public ContainerReregistrationState() + { + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CustomerType.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CustomerType.cs new file mode 100644 index 0000000000000..815e5ce48e570 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/CustomerType.cs @@ -0,0 +1,43 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + public enum CustomerType + { + Invalid = 0, + + OBS = 1, + + SBS = 2, + + DPM = 4, + + InMage = 8, + + ManagedContainer = 16, + + SqlPaaS = 32, + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/EnableReregistrationRequest.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/EnableReregistrationRequest.cs new file mode 100644 index 0000000000000..f9d6e230a6a91 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/EnableReregistrationRequest.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; +using Microsoft.Azure.Management.BackupServices.Models; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + /// + /// Enable MARS Container Reregistration. + /// + public partial class EnableReregistrationRequest + { + private ContainerReregistrationState _containerReregistrationState; + + /// + /// Optional. MARS Container Reregistration State. + /// + public ContainerReregistrationState ContainerReregistrationState + { + get { return this._containerReregistrationState; } + set { this._containerReregistrationState = value; } + } + + /// + /// Initializes a new instance of the EnableReregistrationRequest class. + /// + public EnableReregistrationRequest() + { + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ListMarsContainerOperationResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ListMarsContainerOperationResponse.cs new file mode 100644 index 0000000000000..e9cf9fa2659af --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ListMarsContainerOperationResponse.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; +using Microsoft.Azure; +using Microsoft.Azure.Management.BackupServices.Models; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + /// + /// List of Microsoft Azure Recovery Services (MARS) containers. + /// + public partial class ListMarsContainerOperationResponse : AzureOperationResponse + { + private ListMarsContainerResponse _listMarsContainerResponse; + + /// + /// Optional. MARS Container List Response. + /// + public ListMarsContainerResponse ListMarsContainerResponse + { + get { return this._listMarsContainerResponse; } + set { this._listMarsContainerResponse = value; } + } + + /// + /// Initializes a new instance of the + /// ListMarsContainerOperationResponse class. + /// + public ListMarsContainerOperationResponse() + { + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ListMarsContainerResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ListMarsContainerResponse.cs new file mode 100644 index 0000000000000..fa4d5ff91c525 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/ListMarsContainerResponse.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Collections.Generic; +using System.Linq; +using Hyak.Common; +using Microsoft.Azure.Management.BackupServices.Models; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + /// + /// The definition of a ListMarsContainerResponse. + /// + public partial class ListMarsContainerResponse : BackupListResponse + { + private IList _value; + + /// + /// Optional. List of MARS container responses. + /// + public IList Value + { + get { return this._value; } + set { this._value = value; } + } + + /// + /// Initializes a new instance of the ListMarsContainerResponse class. + /// + public ListMarsContainerResponse() + { + this.Value = new LazyList(); + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerProperties.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerProperties.cs new file mode 100644 index 0000000000000..5c51e5b97bcd3 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerProperties.cs @@ -0,0 +1,105 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + /// + /// The definition of MarsContainerProperties. + /// + public partial class MarsContainerProperties + { + private bool _canReRegister; + + /// + /// Optional. MARS Container Re-registrablity Flag + /// + public bool CanReRegister + { + get { return this._canReRegister; } + set { this._canReRegister = value; } + } + + private long _containerId; + + /// + /// Optional. MARS Container ID + /// + public long ContainerId + { + get { return this._containerId; } + set { this._containerId = value; } + } + + private Guid _containerStampId; + + /// + /// Optional. MARS Container Stamp ID + /// + public Guid ContainerStampId + { + get { return this._containerStampId; } + set { this._containerStampId = value; } + } + + private string _containerStampUri; + + /// + /// Optional. MARS Container Stamp URI + /// + public string ContainerStampUri + { + get { return this._containerStampUri; } + set { this._containerStampUri = value; } + } + + private string _customerType; + + /// + /// Optional. MARS Container Customer Type + /// + public string CustomerType + { + get { return this._customerType; } + set { this._customerType = value; } + } + + private string _friendlyName; + + /// + /// Optional. MARS Container Friendly Name + /// + public string FriendlyName + { + get { return this._friendlyName; } + set { this._friendlyName = value; } + } + + /// + /// Initializes a new instance of the MarsContainerProperties class. + /// + public MarsContainerProperties() + { + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerResponse.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerResponse.cs new file mode 100644 index 0000000000000..641f922fa6ec5 --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerResponse.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; +using Microsoft.Azure.Management.BackupServices.Models; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + /// + /// The definition of a MarsContainerResponse. + /// + public partial class MarsContainerResponse : BackupBaseResponse + { + private string _containerType; + + /// + /// Optional. MARS Container Friendly Name + /// + public string ContainerType + { + get { return this._containerType; } + set { this._containerType = value; } + } + + private MarsContainerProperties _properties; + + /// + /// Optional. MARS Container Properties + /// + public MarsContainerProperties Properties + { + get { return this._properties; } + set { this._properties = value; } + } + + private string _uniqueName; + + /// + /// Optional. MARS Container Unique Name + /// + public string UniqueName + { + get { return this._uniqueName; } + set { this._uniqueName = value; } + } + + /// + /// Initializes a new instance of the MarsContainerResponse class. + /// + public MarsContainerResponse() + { + } + } +} diff --git a/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerType.cs b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerType.cs new file mode 100644 index 0000000000000..7630803e3ea1e --- /dev/null +++ b/src/ResourceManagement/AzureBackup/BackupServicesManagement/Generated/Models/MarsContainerType.cs @@ -0,0 +1,33 @@ +// +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// + +// Warning: This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if the +// code is regenerated. + +using System; +using System.Linq; + +namespace Microsoft.Azure.Management.BackupServices.Models +{ + public enum MarsContainerType + { + Invalid = 0, + + Machine = 1, + } +}