diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AccessControlRecordsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AccessControlRecordsOperations.cs new file mode 100644 index 000000000000..fb9f9e312a4c --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AccessControlRecordsOperations.cs @@ -0,0 +1,939 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AccessControlRecordsOperations operations. + /// + internal partial class AccessControlRecordsOperations : IServiceOperations, IAccessControlRecordsOperations + { + /// + /// Initializes a new instance of the AccessControlRecordsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessControlRecordsOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the access control records in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManager", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified access control record name. + /// + /// + /// Name of access control record to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string accessControlRecordName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (accessControlRecordName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessControlRecordName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("accessControlRecordName", accessControlRecordName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}").ToString(); + _url = _url.Replace("{accessControlRecordName}", System.Uri.EscapeDataString(accessControlRecordName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or Updates an access control record. + /// + /// + /// The name of the access control record. + /// + /// + /// The access control record to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string accessControlRecordName, AccessControlRecord accessControlRecord, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(accessControlRecordName, accessControlRecord, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the access control record. + /// + /// + /// The name of the access control record to delete. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string accessControlRecordName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(accessControlRecordName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or Updates an access control record. + /// + /// + /// The name of the access control record. + /// + /// + /// The access control record to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string accessControlRecordName, AccessControlRecord accessControlRecord, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (accessControlRecordName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessControlRecordName"); + } + if (accessControlRecord == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessControlRecord"); + } + if (accessControlRecord != null) + { + accessControlRecord.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("accessControlRecordName", accessControlRecordName); + tracingParameters.Add("accessControlRecord", accessControlRecord); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}").ToString(); + _url = _url.Replace("{accessControlRecordName}", System.Uri.EscapeDataString(accessControlRecordName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(accessControlRecord != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(accessControlRecord, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the access control record. + /// + /// + /// The name of the access control record to delete. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string accessControlRecordName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (accessControlRecordName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessControlRecordName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("accessControlRecordName", accessControlRecordName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}").ToString(); + _url = _url.Replace("{accessControlRecordName}", System.Uri.EscapeDataString(accessControlRecordName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AccessControlRecordsOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AccessControlRecordsOperationsExtensions.cs new file mode 100644 index 000000000000..94cac62fcef7 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AccessControlRecordsOperationsExtensions.cs @@ -0,0 +1,303 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AccessControlRecordsOperations. + /// + public static partial class AccessControlRecordsOperationsExtensions + { + /// + /// Retrieves all the access control records in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByManager(this IAccessControlRecordsOperations operations, string resourceGroupName, string managerName) + { + return operations.ListByManagerAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the access control records in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerAsync(this IAccessControlRecordsOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified access control record name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of access control record to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static AccessControlRecord Get(this IAccessControlRecordsOperations operations, string accessControlRecordName, string resourceGroupName, string managerName) + { + return operations.GetAsync(accessControlRecordName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified access control record name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of access control record to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAccessControlRecordsOperations operations, string accessControlRecordName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(accessControlRecordName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or Updates an access control record. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the access control record. + /// + /// + /// The access control record to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static AccessControlRecord CreateOrUpdate(this IAccessControlRecordsOperations operations, string accessControlRecordName, AccessControlRecord accessControlRecord, string resourceGroupName, string managerName) + { + return operations.CreateOrUpdateAsync(accessControlRecordName, accessControlRecord, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or Updates an access control record. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the access control record. + /// + /// + /// The access control record to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IAccessControlRecordsOperations operations, string accessControlRecordName, AccessControlRecord accessControlRecord, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(accessControlRecordName, accessControlRecord, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the access control record. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the access control record to delete. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IAccessControlRecordsOperations operations, string accessControlRecordName, string resourceGroupName, string managerName) + { + operations.DeleteAsync(accessControlRecordName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the access control record. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the access control record to delete. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAccessControlRecordsOperations operations, string accessControlRecordName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(accessControlRecordName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or Updates an access control record. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the access control record. + /// + /// + /// The access control record to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static AccessControlRecord BeginCreateOrUpdate(this IAccessControlRecordsOperations operations, string accessControlRecordName, AccessControlRecord accessControlRecord, string resourceGroupName, string managerName) + { + return operations.BeginCreateOrUpdateAsync(accessControlRecordName, accessControlRecord, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or Updates an access control record. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the access control record. + /// + /// + /// The access control record to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IAccessControlRecordsOperations operations, string accessControlRecordName, AccessControlRecord accessControlRecord, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(accessControlRecordName, accessControlRecord, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the access control record. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the access control record to delete. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDelete(this IAccessControlRecordsOperations operations, string accessControlRecordName, string resourceGroupName, string managerName) + { + operations.BeginDeleteAsync(accessControlRecordName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the access control record. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the access control record to delete. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IAccessControlRecordsOperations operations, string accessControlRecordName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(accessControlRecordName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AlertsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AlertsOperations.cs new file mode 100644 index 000000000000..c137035a4dfd --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AlertsOperations.cs @@ -0,0 +1,844 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AlertsOperations operations. + /// + internal partial class AlertsOperations : IServiceOperations, IAlertsOperations + { + /// + /// Initializes a new instance of the AlertsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AlertsOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the alerts in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManager", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/alerts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Clear the alerts. + /// + /// + /// The clear alert request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task ClearWithHttpMessagesAsync(ClearAlertRequest request, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (request == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "request"); + } + if (request != null) + { + request.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("request", request); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Clear", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/clearAlerts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(request != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(request, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Sends a test alert email. + /// + /// + /// The device name. + /// + /// + /// The send test alert email request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task SendTestEmailWithHttpMessagesAsync(string deviceName, SendTestAlertEmailRequest request, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (request == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "request"); + } + if (request != null) + { + request.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("request", request); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SendTestEmail", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/sendTestAlertEmail").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(request != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(request, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the alerts in a manager. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AlertsOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AlertsOperationsExtensions.cs new file mode 100644 index 000000000000..ae2d00923997 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AlertsOperationsExtensions.cs @@ -0,0 +1,198 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AlertsOperations. + /// + public static partial class AlertsOperationsExtensions + { + /// + /// Retrieves all the alerts in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByManager(this IAlertsOperations operations, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByManagerAsync(resourceGroupName, managerName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the alerts in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerAsync(this IAlertsOperations operations, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerWithHttpMessagesAsync(resourceGroupName, managerName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Clear the alerts. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The clear alert request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Clear(this IAlertsOperations operations, ClearAlertRequest request, string resourceGroupName, string managerName) + { + operations.ClearAsync(request, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Clear the alerts. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The clear alert request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task ClearAsync(this IAlertsOperations operations, ClearAlertRequest request, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ClearWithHttpMessagesAsync(request, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Sends a test alert email. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The send test alert email request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void SendTestEmail(this IAlertsOperations operations, string deviceName, SendTestAlertEmailRequest request, string resourceGroupName, string managerName) + { + operations.SendTestEmailAsync(deviceName, request, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Sends a test alert email. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The send test alert email request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task SendTestEmailAsync(this IAlertsOperations operations, string deviceName, SendTestAlertEmailRequest request, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SendTestEmailWithHttpMessagesAsync(deviceName, request, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves all the alerts in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByManagerNext(this IAlertsOperations operations, string nextPageLink) + { + return operations.ListByManagerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the alerts in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerNextAsync(this IAlertsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AvailableProviderOperationsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AvailableProviderOperationsOperations.cs new file mode 100644 index 000000000000..ffffa59550ec --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AvailableProviderOperationsOperations.cs @@ -0,0 +1,390 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AvailableProviderOperationsOperations operations. + /// + internal partial class AvailableProviderOperationsOperations : IServiceOperations, IAvailableProviderOperationsOperations + { + /// + /// Initializes a new instance of the AvailableProviderOperationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AvailableProviderOperationsOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// List of AvailableProviderOperations + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.StorSimple/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List of AvailableProviderOperations + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AvailableProviderOperationsOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AvailableProviderOperationsOperationsExtensions.cs new file mode 100644 index 000000000000..b10d9d418832 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/AvailableProviderOperationsOperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AvailableProviderOperationsOperations. + /// + public static partial class AvailableProviderOperationsOperationsExtensions + { + /// + /// List of AvailableProviderOperations + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IAvailableProviderOperationsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List of AvailableProviderOperations + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAvailableProviderOperationsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List of AvailableProviderOperations + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAvailableProviderOperationsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List of AvailableProviderOperations + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IAvailableProviderOperationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupScheduleGroupsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupScheduleGroupsOperations.cs new file mode 100644 index 000000000000..a2e50222ab19 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupScheduleGroupsOperations.cs @@ -0,0 +1,981 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BackupScheduleGroupsOperations operations. + /// + internal partial class BackupScheduleGroupsOperations : IServiceOperations, IBackupScheduleGroupsOperations + { + /// + /// Initializes a new instance of the BackupScheduleGroupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BackupScheduleGroupsOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the backup schedule groups in a device. + /// + /// + /// The name of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDevice", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupScheduleGroups").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified backup schedule group name. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string deviceName, string scheduleGroupName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (scheduleGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("scheduleGroupName", scheduleGroupName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupScheduleGroups/{scheduleGroupName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{scheduleGroupName}", System.Uri.EscapeDataString(scheduleGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or Updates the backup schedule Group. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The schedule group to be created + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string scheduleGroupName, BackupScheduleGroup scheduleGroup, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, scheduleGroupName, scheduleGroup, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the backup schedule group. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string deviceName, string scheduleGroupName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(deviceName, scheduleGroupName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or Updates the backup schedule Group. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The schedule group to be created + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string scheduleGroupName, BackupScheduleGroup scheduleGroup, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (scheduleGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleGroupName"); + } + if (scheduleGroup == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleGroup"); + } + if (scheduleGroup != null) + { + scheduleGroup.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("scheduleGroupName", scheduleGroupName); + tracingParameters.Add("scheduleGroup", scheduleGroup); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupScheduleGroups/{scheduleGroupName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{scheduleGroupName}", System.Uri.EscapeDataString(scheduleGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(scheduleGroup != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(scheduleGroup, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the backup schedule group. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string deviceName, string scheduleGroupName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (scheduleGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("scheduleGroupName", scheduleGroupName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupScheduleGroups/{scheduleGroupName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{scheduleGroupName}", System.Uri.EscapeDataString(scheduleGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupScheduleGroupsOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupScheduleGroupsOperationsExtensions.cs new file mode 100644 index 000000000000..a575a3b13cd0 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupScheduleGroupsOperationsExtensions.cs @@ -0,0 +1,339 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BackupScheduleGroupsOperations. + /// + public static partial class BackupScheduleGroupsOperationsExtensions + { + /// + /// Retrieves all the backup schedule groups in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByDevice(this IBackupScheduleGroupsOperations operations, string deviceName, string resourceGroupName, string managerName) + { + return operations.ListByDeviceAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the backup schedule groups in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDeviceAsync(this IBackupScheduleGroupsOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDeviceWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified backup schedule group name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static BackupScheduleGroup Get(this IBackupScheduleGroupsOperations operations, string deviceName, string scheduleGroupName, string resourceGroupName, string managerName) + { + return operations.GetAsync(deviceName, scheduleGroupName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified backup schedule group name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBackupScheduleGroupsOperations operations, string deviceName, string scheduleGroupName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(deviceName, scheduleGroupName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or Updates the backup schedule Group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The schedule group to be created + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static BackupScheduleGroup CreateOrUpdate(this IBackupScheduleGroupsOperations operations, string deviceName, string scheduleGroupName, BackupScheduleGroup scheduleGroup, string resourceGroupName, string managerName) + { + return operations.CreateOrUpdateAsync(deviceName, scheduleGroupName, scheduleGroup, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or Updates the backup schedule Group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The schedule group to be created + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IBackupScheduleGroupsOperations operations, string deviceName, string scheduleGroupName, BackupScheduleGroup scheduleGroup, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(deviceName, scheduleGroupName, scheduleGroup, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the backup schedule group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IBackupScheduleGroupsOperations operations, string deviceName, string scheduleGroupName, string resourceGroupName, string managerName) + { + operations.DeleteAsync(deviceName, scheduleGroupName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the backup schedule group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBackupScheduleGroupsOperations operations, string deviceName, string scheduleGroupName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(deviceName, scheduleGroupName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or Updates the backup schedule Group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The schedule group to be created + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static BackupScheduleGroup BeginCreateOrUpdate(this IBackupScheduleGroupsOperations operations, string deviceName, string scheduleGroupName, BackupScheduleGroup scheduleGroup, string resourceGroupName, string managerName) + { + return operations.BeginCreateOrUpdateAsync(deviceName, scheduleGroupName, scheduleGroup, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or Updates the backup schedule Group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The schedule group to be created + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IBackupScheduleGroupsOperations operations, string deviceName, string scheduleGroupName, BackupScheduleGroup scheduleGroup, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, scheduleGroupName, scheduleGroup, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the backup schedule group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDelete(this IBackupScheduleGroupsOperations operations, string deviceName, string scheduleGroupName, string resourceGroupName, string managerName) + { + operations.BeginDeleteAsync(deviceName, scheduleGroupName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the backup schedule group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IBackupScheduleGroupsOperations operations, string deviceName, string scheduleGroupName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(deviceName, scheduleGroupName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupsOperations.cs new file mode 100644 index 000000000000..f35fe1798ff9 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupsOperations.cs @@ -0,0 +1,1325 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BackupsOperations operations. + /// + internal partial class BackupsOperations : IServiceOperations, IBackupsOperations + { + /// + /// Initializes a new instance of the BackupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BackupsOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the backups in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManager", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/backups").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the backups in a device. Can be used to get the backups for + /// failover also. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Set to true if you need backups which can be used for failover. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), bool? forFailover = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("forFailover", forFailover); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDevice", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backups").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (forFailover != null) + { + _queryParameters.Add(string.Format("forFailover={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(forFailover, Client.SerializationSettings).Trim('"')))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the backup. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string deviceName, string backupName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(deviceName, backupName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Clones the given backup element to a new disk or share with given details. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The backup element name. + /// + /// + /// The clone request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task CloneWithHttpMessagesAsync(string deviceName, string backupName, string elementName, CloneRequest cloneRequest, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCloneWithHttpMessagesAsync(deviceName, backupName, elementName, cloneRequest, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the backup. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string deviceName, string backupName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (backupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("backupName", backupName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backups/{backupName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Clones the given backup element to a new disk or share with given details. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The backup element name. + /// + /// + /// The clone request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginCloneWithHttpMessagesAsync(string deviceName, string backupName, string elementName, CloneRequest cloneRequest, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (backupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "backupName"); + } + if (elementName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "elementName"); + } + if (cloneRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloneRequest"); + } + if (cloneRequest != null) + { + cloneRequest.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("backupName", backupName); + tracingParameters.Add("elementName", elementName); + tracingParameters.Add("cloneRequest", cloneRequest); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginClone", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backups/{backupName}/elements/{elementName}/clone").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{backupName}", System.Uri.EscapeDataString(backupName)); + _url = _url.Replace("{elementName}", System.Uri.EscapeDataString(elementName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(cloneRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(cloneRequest, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the backups in a manager. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the backups in a device. Can be used to get the backups for + /// failover also. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDeviceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDeviceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupsOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupsOperationsExtensions.cs new file mode 100644 index 000000000000..20dac565db9e --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/BackupsOperationsExtensions.cs @@ -0,0 +1,422 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BackupsOperations. + /// + public static partial class BackupsOperationsExtensions + { + /// + /// Retrieves all the backups in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByManager(this IBackupsOperations operations, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByManagerAsync(resourceGroupName, managerName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the backups in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerAsync(this IBackupsOperations operations, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerWithHttpMessagesAsync(resourceGroupName, managerName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves all the backups in a device. Can be used to get the backups for + /// failover also. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Set to true if you need backups which can be used for failover. + /// + public static IPage ListByDevice(this IBackupsOperations operations, string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), bool? forFailover = default(bool?)) + { + return operations.ListByDeviceAsync(deviceName, resourceGroupName, managerName, odataQuery, forFailover).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the backups in a device. Can be used to get the backups for + /// failover also. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Set to true if you need backups which can be used for failover. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDeviceAsync(this IBackupsOperations operations, string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), bool? forFailover = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDeviceWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, odataQuery, forFailover, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IBackupsOperations operations, string deviceName, string backupName, string resourceGroupName, string managerName) + { + operations.DeleteAsync(deviceName, backupName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBackupsOperations operations, string deviceName, string backupName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(deviceName, backupName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Clones the given backup element to a new disk or share with given details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The backup element name. + /// + /// + /// The clone request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Clone(this IBackupsOperations operations, string deviceName, string backupName, string elementName, CloneRequest cloneRequest, string resourceGroupName, string managerName) + { + operations.CloneAsync(deviceName, backupName, elementName, cloneRequest, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Clones the given backup element to a new disk or share with given details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The backup element name. + /// + /// + /// The clone request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CloneAsync(this IBackupsOperations operations, string deviceName, string backupName, string elementName, CloneRequest cloneRequest, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CloneWithHttpMessagesAsync(deviceName, backupName, elementName, cloneRequest, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes the backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDelete(this IBackupsOperations operations, string deviceName, string backupName, string resourceGroupName, string managerName) + { + operations.BeginDeleteAsync(deviceName, backupName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the backup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IBackupsOperations operations, string deviceName, string backupName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(deviceName, backupName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Clones the given backup element to a new disk or share with given details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The backup element name. + /// + /// + /// The clone request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginClone(this IBackupsOperations operations, string deviceName, string backupName, string elementName, CloneRequest cloneRequest, string resourceGroupName, string managerName) + { + operations.BeginCloneAsync(deviceName, backupName, elementName, cloneRequest, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Clones the given backup element to a new disk or share with given details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The backup element name. + /// + /// + /// The clone request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCloneAsync(this IBackupsOperations operations, string deviceName, string backupName, string elementName, CloneRequest cloneRequest, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginCloneWithHttpMessagesAsync(deviceName, backupName, elementName, cloneRequest, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves all the backups in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByManagerNext(this IBackupsOperations operations, string nextPageLink) + { + return operations.ListByManagerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the backups in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerNextAsync(this IBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves all the backups in a device. Can be used to get the backups for + /// failover also. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDeviceNext(this IBackupsOperations operations, string nextPageLink) + { + return operations.ListByDeviceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the backups in a device. Can be used to get the backups for + /// failover also. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDeviceNextAsync(this IBackupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDeviceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ChapSettingsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ChapSettingsOperations.cs new file mode 100644 index 000000000000..b8b07b985fda --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ChapSettingsOperations.cs @@ -0,0 +1,981 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ChapSettingsOperations operations. + /// + internal partial class ChapSettingsOperations : IServiceOperations, IChapSettingsOperations + { + /// + /// Initializes a new instance of the ChapSettingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ChapSettingsOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the chap settings in a device. + /// + /// + /// The name of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDevice", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/chapSettings").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified chap setting name. + /// + /// + /// The device name. + /// + /// + /// The user name of chap to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string deviceName, string chapUserName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (chapUserName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "chapUserName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("chapUserName", chapUserName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/chapSettings/{chapUserName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{chapUserName}", System.Uri.EscapeDataString(chapUserName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the chap setting. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The chap setting to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string chapUserName, ChapSettings chapSetting, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, chapUserName, chapSetting, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the chap setting. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string deviceName, string chapUserName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(deviceName, chapUserName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates the chap setting. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The chap setting to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string chapUserName, ChapSettings chapSetting, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (chapUserName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "chapUserName"); + } + if (chapSetting == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "chapSetting"); + } + if (chapSetting != null) + { + chapSetting.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("chapUserName", chapUserName); + tracingParameters.Add("chapSetting", chapSetting); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/chapSettings/{chapUserName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{chapUserName}", System.Uri.EscapeDataString(chapUserName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(chapSetting != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(chapSetting, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the chap setting. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string deviceName, string chapUserName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (chapUserName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "chapUserName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("chapUserName", chapUserName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/chapSettings/{chapUserName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{chapUserName}", System.Uri.EscapeDataString(chapUserName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ChapSettingsOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ChapSettingsOperationsExtensions.cs new file mode 100644 index 000000000000..2790b64d685a --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ChapSettingsOperationsExtensions.cs @@ -0,0 +1,339 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ChapSettingsOperations. + /// + public static partial class ChapSettingsOperationsExtensions + { + /// + /// Retrieves all the chap settings in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByDevice(this IChapSettingsOperations operations, string deviceName, string resourceGroupName, string managerName) + { + return operations.ListByDeviceAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the chap settings in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDeviceAsync(this IChapSettingsOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDeviceWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified chap setting name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The user name of chap to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static ChapSettings Get(this IChapSettingsOperations operations, string deviceName, string chapUserName, string resourceGroupName, string managerName) + { + return operations.GetAsync(deviceName, chapUserName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified chap setting name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The user name of chap to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IChapSettingsOperations operations, string deviceName, string chapUserName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(deviceName, chapUserName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the chap setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The chap setting to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static ChapSettings CreateOrUpdate(this IChapSettingsOperations operations, string deviceName, string chapUserName, ChapSettings chapSetting, string resourceGroupName, string managerName) + { + return operations.CreateOrUpdateAsync(deviceName, chapUserName, chapSetting, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the chap setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The chap setting to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IChapSettingsOperations operations, string deviceName, string chapUserName, ChapSettings chapSetting, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(deviceName, chapUserName, chapSetting, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the chap setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IChapSettingsOperations operations, string deviceName, string chapUserName, string resourceGroupName, string managerName) + { + operations.DeleteAsync(deviceName, chapUserName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the chap setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IChapSettingsOperations operations, string deviceName, string chapUserName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(deviceName, chapUserName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates the chap setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The chap setting to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static ChapSettings BeginCreateOrUpdate(this IChapSettingsOperations operations, string deviceName, string chapUserName, ChapSettings chapSetting, string resourceGroupName, string managerName) + { + return operations.BeginCreateOrUpdateAsync(deviceName, chapUserName, chapSetting, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the chap setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The chap setting to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IChapSettingsOperations operations, string deviceName, string chapUserName, ChapSettings chapSetting, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, chapUserName, chapSetting, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the chap setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDelete(this IChapSettingsOperations operations, string deviceName, string chapUserName, string resourceGroupName, string managerName) + { + operations.BeginDeleteAsync(deviceName, chapUserName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the chap setting. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IChapSettingsOperations operations, string deviceName, string chapUserName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(deviceName, chapUserName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/DevicesOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/DevicesOperations.cs new file mode 100644 index 000000000000..d194e5206f7c --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/DevicesOperations.cs @@ -0,0 +1,4038 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DevicesOperations operations. + /// + internal partial class DevicesOperations : IServiceOperations, IDevicesOperations + { + /// + /// Initializes a new instance of the DevicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DevicesOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the devices in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to the + /// device. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManager", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified device name. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to the + /// device. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Patches the device. + /// + /// + /// The device Name. + /// + /// + /// Patch representation of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> PatchWithHttpMessagesAsync(string deviceName, DevicePatch devicePatch, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginPatchWithHttpMessagesAsync(deviceName, devicePatch, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the alert settings of the specified device name. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetAlertSettingsWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetAlertSettings", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/alertSettings/default").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the alert settings + /// + /// + /// The device name. + /// + /// + /// The alert settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateAlertSettingsWithHttpMessagesAsync(string deviceName, AlertSettings alertSettings, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateAlertSettingsWithHttpMessagesAsync(deviceName, alertSettings, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deactivates the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeactivateWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeactivateWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Downloads updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DownloadUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDownloadUpdatesWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Fails over the device to another device. + /// + /// + /// The device name. + /// + /// + /// The failover request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task FailoverWithHttpMessagesAsync(string deviceName, FailoverRequest failoverRequest, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginFailoverWithHttpMessagesAsync(deviceName, failoverRequest, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves all the devices which can be used as failover targets for the + /// given device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to the + /// device. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListFailoverTargetWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListFailoverTarget", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/failoverTargets").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Installs the updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task InstallUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginInstallUpdatesWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the device metrics. + /// + /// + /// The name of the appliance. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricsWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/metrics").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves metric definition of all metrics aggregated at device. + /// + /// + /// The name of the appliance. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricDefinitionWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetricDefinition", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/metricsDefinitions").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the network settings of the specified device name. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetNetworkSettingsWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetNetworkSettings", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/networkSettings/default").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Scans for updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ScanForUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginScanForUpdatesWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates the security settings. + /// + /// + /// The device name. + /// + /// + /// The security settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task CreateOrUpdateSecuritySettingsWithHttpMessagesAsync(string deviceName, SecuritySettings securitySettings, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginCreateOrUpdateSecuritySettingsWithHttpMessagesAsync(deviceName, securitySettings, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns the time settings of the specified device name. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetTimeSettingsWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetTimeSettings", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/timeSettings/default").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the update summary of the specified device name. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetUpdateSummaryWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetUpdateSummary", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/updateSummary/default").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Patches the device. + /// + /// + /// The device Name. + /// + /// + /// Patch representation of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginPatchWithHttpMessagesAsync(string deviceName, DevicePatch devicePatch, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (devicePatch == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "devicePatch"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("devicePatch", devicePatch); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginPatch", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(devicePatch != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(devicePatch, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the alert settings + /// + /// + /// The device name. + /// + /// + /// The alert settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateAlertSettingsWithHttpMessagesAsync(string deviceName, AlertSettings alertSettings, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (alertSettings == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "alertSettings"); + } + if (alertSettings != null) + { + alertSettings.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("alertSettings", alertSettings); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateAlertSettings", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/alertSettings/default").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(alertSettings != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(alertSettings, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deactivates the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeactivateWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeactivate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/deactivate").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Downloads updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDownloadUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDownloadUpdates", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/download").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Fails over the device to another device. + /// + /// + /// The device name. + /// + /// + /// The failover request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginFailoverWithHttpMessagesAsync(string deviceName, FailoverRequest failoverRequest, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (failoverRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "failoverRequest"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("failoverRequest", failoverRequest); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginFailover", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/failover").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(failoverRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(failoverRequest, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Installs the updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginInstallUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginInstallUpdates", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/install").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Scans for updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginScanForUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginScanForUpdates", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/scanForUpdates").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the security settings. + /// + /// + /// The device name. + /// + /// + /// The security settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginCreateOrUpdateSecuritySettingsWithHttpMessagesAsync(string deviceName, SecuritySettings securitySettings, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (securitySettings == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "securitySettings"); + } + if (securitySettings != null) + { + securitySettings.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("securitySettings", securitySettings); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateSecuritySettings", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/securitySettings/default/update").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(securitySettings != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(securitySettings, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/DevicesOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/DevicesOperationsExtensions.cs new file mode 100644 index 000000000000..0af0a3521dac --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/DevicesOperationsExtensions.cs @@ -0,0 +1,1302 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DevicesOperations. + /// + public static partial class DevicesOperationsExtensions + { + /// + /// Retrieves all the devices in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to the + /// device. + /// + public static IEnumerable ListByManager(this IDevicesOperations operations, string resourceGroupName, string managerName, string expand = default(string)) + { + return operations.ListByManagerAsync(resourceGroupName, managerName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the devices in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to the + /// device. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerAsync(this IDevicesOperations operations, string resourceGroupName, string managerName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerWithHttpMessagesAsync(resourceGroupName, managerName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified device name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to the + /// device. + /// + public static Device Get(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, string expand = default(string)) + { + return operations.GetAsync(deviceName, resourceGroupName, managerName, expand).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified device name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to the + /// device. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + operations.DeleteAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Patches the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device Name. + /// + /// + /// Patch representation of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static Device Patch(this IDevicesOperations operations, string deviceName, DevicePatch devicePatch, string resourceGroupName, string managerName) + { + return operations.PatchAsync(deviceName, devicePatch, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Patches the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device Name. + /// + /// + /// Patch representation of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task PatchAsync(this IDevicesOperations operations, string deviceName, DevicePatch devicePatch, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PatchWithHttpMessagesAsync(deviceName, devicePatch, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the alert settings of the specified device name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static AlertSettings GetAlertSettings(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + return operations.GetAlertSettingsAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the alert settings of the specified device name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAlertSettingsAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAlertSettingsWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the alert settings + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The alert settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static AlertSettings CreateOrUpdateAlertSettings(this IDevicesOperations operations, string deviceName, AlertSettings alertSettings, string resourceGroupName, string managerName) + { + return operations.CreateOrUpdateAlertSettingsAsync(deviceName, alertSettings, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the alert settings + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The alert settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAlertSettingsAsync(this IDevicesOperations operations, string deviceName, AlertSettings alertSettings, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateAlertSettingsWithHttpMessagesAsync(deviceName, alertSettings, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deactivates the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Deactivate(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + operations.DeactivateAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deactivates the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeactivateAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeactivateWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Downloads updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void DownloadUpdates(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + operations.DownloadUpdatesAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Downloads updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DownloadUpdatesAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DownloadUpdatesWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Fails over the device to another device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The failover request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Failover(this IDevicesOperations operations, string deviceName, FailoverRequest failoverRequest, string resourceGroupName, string managerName) + { + operations.FailoverAsync(deviceName, failoverRequest, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Fails over the device to another device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The failover request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task FailoverAsync(this IDevicesOperations operations, string deviceName, FailoverRequest failoverRequest, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.FailoverWithHttpMessagesAsync(deviceName, failoverRequest, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves all the devices which can be used as failover targets for the + /// given device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to the + /// device. + /// + public static IEnumerable ListFailoverTarget(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, string expand = default(string)) + { + return operations.ListFailoverTargetAsync(deviceName, resourceGroupName, managerName, expand).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the devices which can be used as failover targets for the + /// given device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to the + /// device. + /// + /// + /// The cancellation token. + /// + public static async Task> ListFailoverTargetAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListFailoverTargetWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Installs the updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void InstallUpdates(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + operations.InstallUpdatesAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Installs the updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task InstallUpdatesAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.InstallUpdatesWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves the device metrics. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the appliance. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + public static IEnumerable ListMetrics(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListMetricsAsync(deviceName, resourceGroupName, managerName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Retrieves the device metrics. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the appliance. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricsAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricsWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves metric definition of all metrics aggregated at device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the appliance. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListMetricDefinition(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + return operations.ListMetricDefinitionAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves metric definition of all metrics aggregated at device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the appliance. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricDefinitionAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricDefinitionWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the network settings of the specified device name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static NetworkSettings GetNetworkSettings(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + return operations.GetNetworkSettingsAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the network settings of the specified device name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetNetworkSettingsAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetNetworkSettingsWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Scans for updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void ScanForUpdates(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + operations.ScanForUpdatesAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Scans for updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task ScanForUpdatesAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ScanForUpdatesWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates the security settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The security settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void CreateOrUpdateSecuritySettings(this IDevicesOperations operations, string deviceName, SecuritySettings securitySettings, string resourceGroupName, string managerName) + { + operations.CreateOrUpdateSecuritySettingsAsync(deviceName, securitySettings, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the security settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The security settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateSecuritySettingsAsync(this IDevicesOperations operations, string deviceName, SecuritySettings securitySettings, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CreateOrUpdateSecuritySettingsWithHttpMessagesAsync(deviceName, securitySettings, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns the time settings of the specified device name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static TimeSettings GetTimeSettings(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + return operations.GetTimeSettingsAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the time settings of the specified device name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetTimeSettingsAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetTimeSettingsWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the update summary of the specified device name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static Updates GetUpdateSummary(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + return operations.GetUpdateSummaryAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the update summary of the specified device name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetUpdateSummaryAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetUpdateSummaryWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDelete(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + operations.BeginDeleteAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Patches the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device Name. + /// + /// + /// Patch representation of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static Device BeginPatch(this IDevicesOperations operations, string deviceName, DevicePatch devicePatch, string resourceGroupName, string managerName) + { + return operations.BeginPatchAsync(deviceName, devicePatch, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Patches the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device Name. + /// + /// + /// Patch representation of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginPatchAsync(this IDevicesOperations operations, string deviceName, DevicePatch devicePatch, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginPatchWithHttpMessagesAsync(deviceName, devicePatch, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the alert settings + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The alert settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static AlertSettings BeginCreateOrUpdateAlertSettings(this IDevicesOperations operations, string deviceName, AlertSettings alertSettings, string resourceGroupName, string managerName) + { + return operations.BeginCreateOrUpdateAlertSettingsAsync(deviceName, alertSettings, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the alert settings + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The alert settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAlertSettingsAsync(this IDevicesOperations operations, string deviceName, AlertSettings alertSettings, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateAlertSettingsWithHttpMessagesAsync(deviceName, alertSettings, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deactivates the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDeactivate(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + operations.BeginDeactivateAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deactivates the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeactivateAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeactivateWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Downloads updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDownloadUpdates(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + operations.BeginDownloadUpdatesAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Downloads updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDownloadUpdatesAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDownloadUpdatesWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Fails over the device to another device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The failover request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginFailover(this IDevicesOperations operations, string deviceName, FailoverRequest failoverRequest, string resourceGroupName, string managerName) + { + operations.BeginFailoverAsync(deviceName, failoverRequest, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Fails over the device to another device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The failover request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginFailoverAsync(this IDevicesOperations operations, string deviceName, FailoverRequest failoverRequest, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginFailoverWithHttpMessagesAsync(deviceName, failoverRequest, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Installs the updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginInstallUpdates(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + operations.BeginInstallUpdatesAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Installs the updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginInstallUpdatesAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginInstallUpdatesWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Scans for updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginScanForUpdates(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + operations.BeginScanForUpdatesAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Scans for updates on the device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginScanForUpdatesAsync(this IDevicesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginScanForUpdatesWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates the security settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The security settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginCreateOrUpdateSecuritySettings(this IDevicesOperations operations, string deviceName, SecuritySettings securitySettings, string resourceGroupName, string managerName) + { + operations.BeginCreateOrUpdateSecuritySettingsAsync(deviceName, securitySettings, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the security settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The security settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateSecuritySettingsAsync(this IDevicesOperations operations, string deviceName, SecuritySettings securitySettings, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginCreateOrUpdateSecuritySettingsWithHttpMessagesAsync(deviceName, securitySettings, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileServersOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileServersOperations.cs new file mode 100644 index 000000000000..e8a3d8262f03 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileServersOperations.cs @@ -0,0 +1,1863 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FileServersOperations operations. + /// + internal partial class FileServersOperations : IServiceOperations, IFileServersOperations + { + /// + /// Initializes a new instance of the FileServersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FileServersOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the file servers in a device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDevice", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified file server name. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the file server. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string fileServerName, FileServer fileServer, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, fileServerName, fileServer, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the file server. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(deviceName, fileServerName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Backup the file server now. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task BackupNowWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginBackupNowWithHttpMessagesAsync(deviceName, fileServerName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the file server metrics. + /// + /// + /// The name of the device. + /// + /// + /// The name of the file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricsWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/metrics").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves metric definitions of all metrics aggregated at the file server. + /// + /// + /// The name of the device. + /// + /// + /// The name of the file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricDefinitionWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetricDefinition", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/metricsDefinitions").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the file servers in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManager", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/fileservers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the file server. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string fileServerName, FileServer fileServer, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (fileServer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServer"); + } + if (fileServer != null) + { + fileServer.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("fileServer", fileServer); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(fileServer != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(fileServer, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the file server. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Backup the file server now. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginBackupNowWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginBackupNow", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/backup").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileServersOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileServersOperationsExtensions.cs new file mode 100644 index 000000000000..85995efdb31c --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileServersOperationsExtensions.cs @@ -0,0 +1,588 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FileServersOperations. + /// + public static partial class FileServersOperationsExtensions + { + /// + /// Retrieves all the file servers in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByDevice(this IFileServersOperations operations, string deviceName, string resourceGroupName, string managerName) + { + return operations.ListByDeviceAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the file servers in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDeviceAsync(this IFileServersOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDeviceWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified file server name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static FileServer Get(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName) + { + return operations.GetAsync(deviceName, fileServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified file server name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(deviceName, fileServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static FileServer CreateOrUpdate(this IFileServersOperations operations, string deviceName, string fileServerName, FileServer fileServer, string resourceGroupName, string managerName) + { + return operations.CreateOrUpdateAsync(deviceName, fileServerName, fileServer, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IFileServersOperations operations, string deviceName, string fileServerName, FileServer fileServer, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(deviceName, fileServerName, fileServer, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName) + { + operations.DeleteAsync(deviceName, fileServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(deviceName, fileServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Backup the file server now. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BackupNow(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName) + { + operations.BackupNowAsync(deviceName, fileServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Backup the file server now. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BackupNowAsync(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BackupNowWithHttpMessagesAsync(deviceName, fileServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the file server metrics. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + public static IEnumerable ListMetrics(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListMetricsAsync(deviceName, fileServerName, resourceGroupName, managerName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets the file server metrics. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricsAsync(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricsWithHttpMessagesAsync(deviceName, fileServerName, resourceGroupName, managerName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves metric definitions of all metrics aggregated at the file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListMetricDefinition(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName) + { + return operations.ListMetricDefinitionAsync(deviceName, fileServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves metric definitions of all metrics aggregated at the file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the device. + /// + /// + /// The name of the file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricDefinitionAsync(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricDefinitionWithHttpMessagesAsync(deviceName, fileServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves all the file servers in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByManager(this IFileServersOperations operations, string resourceGroupName, string managerName) + { + return operations.ListByManagerAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the file servers in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerAsync(this IFileServersOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static FileServer BeginCreateOrUpdate(this IFileServersOperations operations, string deviceName, string fileServerName, FileServer fileServer, string resourceGroupName, string managerName) + { + return operations.BeginCreateOrUpdateAsync(deviceName, fileServerName, fileServer, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IFileServersOperations operations, string deviceName, string fileServerName, FileServer fileServer, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, fileServerName, fileServer, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDelete(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName) + { + operations.BeginDeleteAsync(deviceName, fileServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(deviceName, fileServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Backup the file server now. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginBackupNow(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName) + { + operations.BeginBackupNowAsync(deviceName, fileServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Backup the file server now. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginBackupNowAsync(this IFileServersOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginBackupNowWithHttpMessagesAsync(deviceName, fileServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileSharesOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileSharesOperations.cs new file mode 100644 index 000000000000..1322038811af --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileSharesOperations.cs @@ -0,0 +1,1705 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FileSharesOperations operations. + /// + internal partial class FileSharesOperations : IServiceOperations, IFileSharesOperations + { + /// + /// Initializes a new instance of the FileSharesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FileSharesOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the file shares in a file server. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByFileServerWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByFileServer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified file share name. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("shareName", shareName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares/{shareName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the file share. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The file share. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, FileShare fileShare, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, fileServerName, shareName, fileShare, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the file share. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share Name + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(deviceName, fileServerName, shareName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the file share metrics + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricsWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("shareName", shareName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares/{shareName}/metrics").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves metric definitions of all metrics aggregated at the file share. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricDefinitionWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("shareName", shareName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetricDefinition", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares/{shareName}/metricsDefinitions").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the file shares in a device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDevice", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/shares").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the file share. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The file share. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, FileShare fileShare, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (fileShare == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileShare"); + } + if (fileShare != null) + { + fileShare.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("shareName", shareName); + tracingParameters.Add("fileShare", fileShare); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares/{shareName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(fileShare != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(fileShare, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the file share. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share Name + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (fileServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fileServerName"); + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("fileServerName", fileServerName); + tracingParameters.Add("shareName", shareName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/fileservers/{fileServerName}/shares/{shareName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{fileServerName}", System.Uri.EscapeDataString(fileServerName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileSharesOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileSharesOperationsExtensions.cs new file mode 100644 index 000000000000..43cdde34b0bd --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/FileSharesOperationsExtensions.cs @@ -0,0 +1,544 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FileSharesOperations. + /// + public static partial class FileSharesOperationsExtensions + { + /// + /// Retrieves all the file shares in a file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByFileServer(this IFileSharesOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName) + { + return operations.ListByFileServerAsync(deviceName, fileServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the file shares in a file server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByFileServerAsync(this IFileSharesOperations operations, string deviceName, string fileServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByFileServerWithHttpMessagesAsync(deviceName, fileServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified file share name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static FileShare Get(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName) + { + return operations.GetAsync(deviceName, fileServerName, shareName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified file share name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(deviceName, fileServerName, shareName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the file share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The file share. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static FileShare CreateOrUpdate(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, FileShare fileShare, string resourceGroupName, string managerName) + { + return operations.CreateOrUpdateAsync(deviceName, fileServerName, shareName, fileShare, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the file share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The file share. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, FileShare fileShare, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(deviceName, fileServerName, shareName, fileShare, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the file share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share Name + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName) + { + operations.DeleteAsync(deviceName, fileServerName, shareName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the file share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share Name + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(deviceName, fileServerName, shareName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the file share metrics + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + public static IEnumerable ListMetrics(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListMetricsAsync(deviceName, fileServerName, shareName, resourceGroupName, managerName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets the file share metrics + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricsAsync(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricsWithHttpMessagesAsync(deviceName, fileServerName, shareName, resourceGroupName, managerName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves metric definitions of all metrics aggregated at the file share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListMetricDefinition(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName) + { + return operations.ListMetricDefinitionAsync(deviceName, fileServerName, shareName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves metric definitions of all metrics aggregated at the file share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricDefinitionAsync(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricDefinitionWithHttpMessagesAsync(deviceName, fileServerName, shareName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves all the file shares in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByDevice(this IFileSharesOperations operations, string deviceName, string resourceGroupName, string managerName) + { + return operations.ListByDeviceAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the file shares in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDeviceAsync(this IFileSharesOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDeviceWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the file share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The file share. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static FileShare BeginCreateOrUpdate(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, FileShare fileShare, string resourceGroupName, string managerName) + { + return operations.BeginCreateOrUpdateAsync(deviceName, fileServerName, shareName, fileShare, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the file share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The file share. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, FileShare fileShare, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, fileServerName, shareName, fileShare, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the file share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share Name + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDelete(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName) + { + operations.BeginDeleteAsync(deviceName, fileServerName, shareName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the file share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share Name + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IFileSharesOperations operations, string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(deviceName, fileServerName, shareName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IAccessControlRecordsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IAccessControlRecordsOperations.cs new file mode 100644 index 000000000000..700bd581d13d --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IAccessControlRecordsOperations.cs @@ -0,0 +1,192 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AccessControlRecordsOperations operations. + /// + public partial interface IAccessControlRecordsOperations + { + /// + /// Retrieves all the access control records in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified access control record name. + /// + /// + /// Name of access control record to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string accessControlRecordName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or Updates an access control record. + /// + /// + /// The name of the access control record. + /// + /// + /// The access control record to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string accessControlRecordName, AccessControlRecord accessControlRecord, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the access control record. + /// + /// + /// The name of the access control record to delete. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string accessControlRecordName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or Updates an access control record. + /// + /// + /// The name of the access control record. + /// + /// + /// The access control record to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string accessControlRecordName, AccessControlRecord accessControlRecord, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the access control record. + /// + /// + /// The name of the access control record to delete. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string accessControlRecordName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IAlertsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IAlertsOperations.cs new file mode 100644 index 000000000000..84b94aa155a6 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IAlertsOperations.cs @@ -0,0 +1,131 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AlertsOperations operations. + /// + public partial interface IAlertsOperations + { + /// + /// Retrieves all the alerts in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Clear the alerts. + /// + /// + /// The clear alert request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ClearWithHttpMessagesAsync(ClearAlertRequest request, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Sends a test alert email. + /// + /// + /// The device name. + /// + /// + /// The send test alert email request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task SendTestEmailWithHttpMessagesAsync(string deviceName, SendTestAlertEmailRequest request, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the alerts in a manager. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IAvailableProviderOperationsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IAvailableProviderOperationsOperations.cs new file mode 100644 index 000000000000..abf5e2559ed3 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IAvailableProviderOperationsOperations.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AvailableProviderOperationsOperations operations. + /// + public partial interface IAvailableProviderOperationsOperations + { + /// + /// List of AvailableProviderOperations + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of AvailableProviderOperations + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IBackupScheduleGroupsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IBackupScheduleGroupsOperations.cs new file mode 100644 index 000000000000..eebcfd3a4f69 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IBackupScheduleGroupsOperations.cs @@ -0,0 +1,210 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BackupScheduleGroupsOperations operations. + /// + public partial interface IBackupScheduleGroupsOperations + { + /// + /// Retrieves all the backup schedule groups in a device. + /// + /// + /// The name of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified backup schedule group name. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string deviceName, string scheduleGroupName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or Updates the backup schedule Group. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The schedule group to be created + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string scheduleGroupName, BackupScheduleGroup scheduleGroup, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the backup schedule group. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string deviceName, string scheduleGroupName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or Updates the backup schedule Group. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The schedule group to be created + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string scheduleGroupName, BackupScheduleGroup scheduleGroup, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the backup schedule group. + /// + /// + /// The name of the device. + /// + /// + /// The name of the schedule group. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string deviceName, string scheduleGroupName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IBackupsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IBackupsOperations.cs new file mode 100644 index 000000000000..9e9b7e76ed60 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IBackupsOperations.cs @@ -0,0 +1,262 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BackupsOperations operations. + /// + public partial interface IBackupsOperations + { + /// + /// Retrieves all the backups in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the backups in a device. Can be used to get the + /// backups for failover also. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Set to true if you need backups which can be used for failover. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), bool? forFailover = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the backup. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string deviceName, string backupName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Clones the given backup element to a new disk or share with given + /// details. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The backup element name. + /// + /// + /// The clone request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task CloneWithHttpMessagesAsync(string deviceName, string backupName, string elementName, CloneRequest cloneRequest, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the backup. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string deviceName, string backupName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Clones the given backup element to a new disk or share with given + /// details. + /// + /// + /// The device name. + /// + /// + /// The backup name. + /// + /// + /// The backup element name. + /// + /// + /// The clone request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginCloneWithHttpMessagesAsync(string deviceName, string backupName, string elementName, CloneRequest cloneRequest, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the backups in a manager. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the backups in a device. Can be used to get the + /// backups for failover also. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDeviceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IChapSettingsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IChapSettingsOperations.cs new file mode 100644 index 000000000000..652226002cda --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IChapSettingsOperations.cs @@ -0,0 +1,210 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ChapSettingsOperations operations. + /// + public partial interface IChapSettingsOperations + { + /// + /// Retrieves all the chap settings in a device. + /// + /// + /// The name of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified chap setting name. + /// + /// + /// The device name. + /// + /// + /// The user name of chap to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string deviceName, string chapUserName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the chap setting. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The chap setting to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string chapUserName, ChapSettings chapSetting, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the chap setting. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string deviceName, string chapUserName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the chap setting. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The chap setting to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string chapUserName, ChapSettings chapSetting, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the chap setting. + /// + /// + /// The device name. + /// + /// + /// The chap user name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string deviceName, string chapUserName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IDevicesOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IDevicesOperations.cs new file mode 100644 index 000000000000..a732caf596ff --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IDevicesOperations.cs @@ -0,0 +1,779 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DevicesOperations operations. + /// + public partial interface IDevicesOperations + { + /// + /// Retrieves all the devices in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to + /// the device. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified device name. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to + /// the device. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patches the device. + /// + /// + /// The device Name. + /// + /// + /// Patch representation of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> PatchWithHttpMessagesAsync(string deviceName, DevicePatch devicePatch, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the alert settings of the specified device name. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetAlertSettingsWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the alert settings + /// + /// + /// The device name. + /// + /// + /// The alert settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateAlertSettingsWithHttpMessagesAsync(string deviceName, AlertSettings alertSettings, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deactivates the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeactivateWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Downloads updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DownloadUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Fails over the device to another device. + /// + /// + /// The device name. + /// + /// + /// The failover request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task FailoverWithHttpMessagesAsync(string deviceName, FailoverRequest failoverRequest, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the devices which can be used as failover targets for + /// the given device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Specify $expand=details to populate additional fields related to + /// the device. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListFailoverTargetWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Installs the updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task InstallUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves the device metrics. + /// + /// + /// The name of the appliance. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricsWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves metric definition of all metrics aggregated at device. + /// + /// + /// The name of the appliance. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricDefinitionWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the network settings of the specified device name. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetNetworkSettingsWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Scans for updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ScanForUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the security settings. + /// + /// + /// The device name. + /// + /// + /// The security settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task CreateOrUpdateSecuritySettingsWithHttpMessagesAsync(string deviceName, SecuritySettings securitySettings, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the time settings of the specified device name. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetTimeSettingsWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the update summary of the specified device name. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetUpdateSummaryWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patches the device. + /// + /// + /// The device Name. + /// + /// + /// Patch representation of the device. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginPatchWithHttpMessagesAsync(string deviceName, DevicePatch devicePatch, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the alert settings + /// + /// + /// The device name. + /// + /// + /// The alert settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateAlertSettingsWithHttpMessagesAsync(string deviceName, AlertSettings alertSettings, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deactivates the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeactivateWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Downloads updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDownloadUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Fails over the device to another device. + /// + /// + /// The device name. + /// + /// + /// The failover request. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginFailoverWithHttpMessagesAsync(string deviceName, FailoverRequest failoverRequest, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Installs the updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginInstallUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Scans for updates on the device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginScanForUpdatesWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the security settings. + /// + /// + /// The device name. + /// + /// + /// The security settings. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginCreateOrUpdateSecuritySettingsWithHttpMessagesAsync(string deviceName, SecuritySettings securitySettings, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IFileServersOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IFileServersOperations.cs new file mode 100644 index 000000000000..9a9ec4c0fe5b --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IFileServersOperations.cs @@ -0,0 +1,358 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FileServersOperations operations. + /// + public partial interface IFileServersOperations + { + /// + /// Retrieves all the file servers in a device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified file server name. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the file server. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string fileServerName, FileServer fileServer, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the file server. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Backup the file server now. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BackupNowWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the file server metrics. + /// + /// + /// The name of the device. + /// + /// + /// The name of the file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricsWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves metric definitions of all metrics aggregated at the file + /// server. + /// + /// + /// The name of the device. + /// + /// + /// The name of the file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricDefinitionWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the file servers in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the file server. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string fileServerName, FileServer fileServer, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the file server. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Backup the file server now. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginBackupNowWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IFileSharesOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IFileSharesOperations.cs new file mode 100644 index 000000000000..8c7cee956d8e --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IFileSharesOperations.cs @@ -0,0 +1,329 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FileSharesOperations operations. + /// + public partial interface IFileSharesOperations + { + /// + /// Retrieves all the file shares in a file server. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByFileServerWithHttpMessagesAsync(string deviceName, string fileServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified file share name. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the file share. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The file share. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, FileShare fileShare, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the file share. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share Name + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the file share metrics + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricsWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves metric definitions of all metrics aggregated at the file + /// share. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricDefinitionWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the file shares in a device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the file share. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share name. + /// + /// + /// The file share. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, FileShare fileShare, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the file share. + /// + /// + /// The device name. + /// + /// + /// The file server name. + /// + /// + /// The file share Name + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string deviceName, string fileServerName, string shareName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IIscsiDisksOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IIscsiDisksOperations.cs new file mode 100644 index 000000000000..550d1d24a20e --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IIscsiDisksOperations.cs @@ -0,0 +1,329 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IscsiDisksOperations operations. + /// + public partial interface IIscsiDisksOperations + { + /// + /// Retrieves all the iSCSI disks in a device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the disks in a iSCSI server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByIscsiServerWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified iSCSI disk name. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the iSCSI disk. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The iSCSI disk. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, ISCSIDisk iscsiDisk, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the iSCSI disk. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the iSCSI disk metrics + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricsWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves metric definitions for all metric aggregated at the iSCSI + /// disk. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricDefinitionWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the iSCSI disk. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The iSCSI disk. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, ISCSIDisk iscsiDisk, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the iSCSI disk. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IIscsiServersOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IIscsiServersOperations.cs new file mode 100644 index 000000000000..135068c3f224 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IIscsiServersOperations.cs @@ -0,0 +1,358 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IscsiServersOperations operations. + /// + public partial interface IIscsiServersOperations + { + /// + /// Retrieves all the iSCSI in a device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified iSCSI server name. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the iSCSI server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string iscsiServerName, ISCSIServer iscsiServer, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the iSCSI server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Backup the iSCSI server now. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BackupNowWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the iSCSI server metrics + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricsWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves metric definitions for all metrics aggregated at iSCSI + /// server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricDefinitionWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the iSCSI servers in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the iSCSI server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string iscsiServerName, ISCSIServer iscsiServer, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the iSCSI server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Backup the iSCSI server now. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginBackupNowWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IJobsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IJobsOperations.cs new file mode 100644 index 000000000000..c7cd308cb4f1 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IJobsOperations.cs @@ -0,0 +1,162 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// JobsOperations operations. + /// + public partial interface IJobsOperations + { + /// + /// Retrieves all the jobs in a device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified job name. + /// + /// + /// The device name. + /// + /// + /// The job name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string deviceName, string jobName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the jobs in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the jobs in a device. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDeviceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the jobs in a manager. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IManagersOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IManagersOperations.cs new file mode 100644 index 000000000000..2664f5852b91 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IManagersOperations.cs @@ -0,0 +1,413 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagersOperations operations. + /// + public partial interface IManagersOperations + { + /// + /// Retrieves all the managers in a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all the managers in a resource group. + /// + /// + /// The resource group name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified manager name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the manager. + /// + /// + /// The manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(Manager manager, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the StorSimple Manager. + /// + /// + /// The manager update parameters. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(ManagerPatch parameters, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Upload Vault Cred Certificate. + /// Returns UploadCertificateResponse + /// + /// + /// Certificate Name + /// + /// + /// UploadCertificateRequest Request + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UploadRegistrationCertificateWithHttpMessagesAsync(string certificateName, UploadCertificateRequest uploadCertificateRequestrequest, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the encryption settings of the manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetEncryptionSettingsWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the extended information of the specified manager name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetExtendedInfoWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates the extended info of the manager. + /// + /// + /// The manager extended information. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateExtendedInfoWithHttpMessagesAsync(ManagerExtendedInfo managerExtendedInfo, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the extended info of the manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteExtendedInfoWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the extended info of the manager. + /// + /// + /// The manager extended information. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Pass the ETag of ExtendedInfo fetched from GET call + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateExtendedInfoWithHttpMessagesAsync(ManagerExtendedInfo managerExtendedInfo, string resourceGroupName, string managerName, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the symmetric encryption key of the manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetEncryptionKeyWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the manager metrics + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves metric definition of all metrics aggregated at manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListMetricDefinitionWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IStorSimpleManagementClient.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IStorSimpleManagementClient.cs new file mode 100644 index 000000000000..d18d2bc47317 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IStorSimpleManagementClient.cs @@ -0,0 +1,147 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// + public partial interface IStorSimpleManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The api version + /// + string ApiVersion { get; } + + /// + /// The subscription id + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IManagersOperations. + /// + IManagersOperations Managers { get; } + + /// + /// Gets the IAvailableProviderOperationsOperations. + /// + IAvailableProviderOperationsOperations AvailableProviderOperations { get; } + + /// + /// Gets the IAccessControlRecordsOperations. + /// + IAccessControlRecordsOperations AccessControlRecords { get; } + + /// + /// Gets the IAlertsOperations. + /// + IAlertsOperations Alerts { get; } + + /// + /// Gets the IBackupsOperations. + /// + IBackupsOperations Backups { get; } + + /// + /// Gets the IDevicesOperations. + /// + IDevicesOperations Devices { get; } + + /// + /// Gets the IBackupScheduleGroupsOperations. + /// + IBackupScheduleGroupsOperations BackupScheduleGroups { get; } + + /// + /// Gets the IChapSettingsOperations. + /// + IChapSettingsOperations ChapSettings { get; } + + /// + /// Gets the IIscsiDisksOperations. + /// + IIscsiDisksOperations IscsiDisks { get; } + + /// + /// Gets the IFileServersOperations. + /// + IFileServersOperations FileServers { get; } + + /// + /// Gets the IFileSharesOperations. + /// + IFileSharesOperations FileShares { get; } + + /// + /// Gets the IIscsiServersOperations. + /// + IIscsiServersOperations IscsiServers { get; } + + /// + /// Gets the IJobsOperations. + /// + IJobsOperations Jobs { get; } + + /// + /// Gets the IStorageAccountCredentialsOperations. + /// + IStorageAccountCredentialsOperations StorageAccountCredentials { get; } + + /// + /// Gets the IStorageDomainsOperations. + /// + IStorageDomainsOperations StorageDomains { get; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IStorageAccountCredentialsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IStorageAccountCredentialsOperations.cs new file mode 100644 index 000000000000..5e3f7f43ae94 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IStorageAccountCredentialsOperations.cs @@ -0,0 +1,193 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// StorageAccountCredentialsOperations operations. + /// + public partial interface IStorageAccountCredentialsOperations + { + /// + /// Retrieves all the storage account credentials in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified storage account credential + /// name. + /// + /// + /// The name of storage account credential to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string credentialName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the storage account credential + /// + /// + /// The credential name. + /// + /// + /// The storage account credential to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string credentialName, StorageAccountCredential storageAccount, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the storage account credential + /// + /// + /// The name of the storage account credential. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string credentialName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the storage account credential + /// + /// + /// The credential name. + /// + /// + /// The storage account credential to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string credentialName, StorageAccountCredential storageAccount, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the storage account credential + /// + /// + /// The name of the storage account credential. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string credentialName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IStorageDomainsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IStorageDomainsOperations.cs new file mode 100644 index 000000000000..022c6ae43a41 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IStorageDomainsOperations.cs @@ -0,0 +1,192 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// StorageDomainsOperations operations. + /// + public partial interface IStorageDomainsOperations + { + /// + /// Retrieves all the storage domains in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the properties of the specified storage domain name. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string storageDomainName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the storage domain. + /// + /// + /// The storage domain name. + /// + /// + /// The storageDomain. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string storageDomainName, StorageDomain storageDomain, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the storage domain. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string storageDomainName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the storage domain. + /// + /// + /// The storage domain name. + /// + /// + /// The storageDomain. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string storageDomainName, StorageDomain storageDomain, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the storage domain. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string storageDomainName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiDisksOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiDisksOperations.cs new file mode 100644 index 000000000000..e4b91eca8e25 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiDisksOperations.cs @@ -0,0 +1,1705 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IscsiDisksOperations operations. + /// + internal partial class IscsiDisksOperations : IServiceOperations, IIscsiDisksOperations + { + /// + /// Initializes a new instance of the IscsiDisksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IscsiDisksOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the iSCSI disks in a device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDevice", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/disks").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the disks in a iSCSI server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByIscsiServerWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByIscsiServer", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified iSCSI disk name. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("diskName", diskName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks/{diskName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the iSCSI disk. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The iSCSI disk. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, ISCSIDisk iscsiDisk, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, iscsiServerName, diskName, iscsiDisk, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the iSCSI disk. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(deviceName, iscsiServerName, diskName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the iSCSI disk metrics + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricsWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("diskName", diskName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks/{diskName}/metrics").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves metric definitions for all metric aggregated at the iSCSI disk. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricDefinitionWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("diskName", diskName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetricDefinition", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks/{diskName}/metricsDefinitions").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the iSCSI disk. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The iSCSI disk. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, ISCSIDisk iscsiDisk, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + if (iscsiDisk == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiDisk"); + } + if (iscsiDisk != null) + { + iscsiDisk.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("diskName", diskName); + tracingParameters.Add("iscsiDisk", iscsiDisk); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks/{diskName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(iscsiDisk != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iscsiDisk, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the iSCSI disk. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (diskName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("diskName", diskName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/disks/{diskName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{diskName}", System.Uri.EscapeDataString(diskName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiDisksOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiDisksOperationsExtensions.cs new file mode 100644 index 000000000000..109c40bee9f4 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiDisksOperationsExtensions.cs @@ -0,0 +1,544 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for IscsiDisksOperations. + /// + public static partial class IscsiDisksOperationsExtensions + { + /// + /// Retrieves all the iSCSI disks in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByDevice(this IIscsiDisksOperations operations, string deviceName, string resourceGroupName, string managerName) + { + return operations.ListByDeviceAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the iSCSI disks in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDeviceAsync(this IIscsiDisksOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDeviceWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves all the disks in a iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByIscsiServer(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName) + { + return operations.ListByIscsiServerAsync(deviceName, iscsiServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the disks in a iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByIscsiServerAsync(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByIscsiServerWithHttpMessagesAsync(deviceName, iscsiServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified iSCSI disk name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static ISCSIDisk Get(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName) + { + return operations.GetAsync(deviceName, iscsiServerName, diskName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified iSCSI disk name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(deviceName, iscsiServerName, diskName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the iSCSI disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The iSCSI disk. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static ISCSIDisk CreateOrUpdate(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, ISCSIDisk iscsiDisk, string resourceGroupName, string managerName) + { + return operations.CreateOrUpdateAsync(deviceName, iscsiServerName, diskName, iscsiDisk, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the iSCSI disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The iSCSI disk. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, ISCSIDisk iscsiDisk, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(deviceName, iscsiServerName, diskName, iscsiDisk, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the iSCSI disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName) + { + operations.DeleteAsync(deviceName, iscsiServerName, diskName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the iSCSI disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(deviceName, iscsiServerName, diskName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the iSCSI disk metrics + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + public static IEnumerable ListMetrics(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListMetricsAsync(deviceName, iscsiServerName, diskName, resourceGroupName, managerName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets the iSCSI disk metrics + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricsAsync(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricsWithHttpMessagesAsync(deviceName, iscsiServerName, diskName, resourceGroupName, managerName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves metric definitions for all metric aggregated at the iSCSI disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListMetricDefinition(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName) + { + return operations.ListMetricDefinitionAsync(deviceName, iscsiServerName, diskName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves metric definitions for all metric aggregated at the iSCSI disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricDefinitionAsync(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricDefinitionWithHttpMessagesAsync(deviceName, iscsiServerName, diskName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the iSCSI disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The iSCSI disk. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static ISCSIDisk BeginCreateOrUpdate(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, ISCSIDisk iscsiDisk, string resourceGroupName, string managerName) + { + return operations.BeginCreateOrUpdateAsync(deviceName, iscsiServerName, diskName, iscsiDisk, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the iSCSI disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The iSCSI disk. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, ISCSIDisk iscsiDisk, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, iscsiServerName, diskName, iscsiDisk, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the iSCSI disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDelete(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName) + { + operations.BeginDeleteAsync(deviceName, iscsiServerName, diskName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the iSCSI disk. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The disk name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IIscsiDisksOperations operations, string deviceName, string iscsiServerName, string diskName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(deviceName, iscsiServerName, diskName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiServersOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiServersOperations.cs new file mode 100644 index 000000000000..0bcc30824c86 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiServersOperations.cs @@ -0,0 +1,1863 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IscsiServersOperations operations. + /// + internal partial class IscsiServersOperations : IServiceOperations, IIscsiServersOperations + { + /// + /// Initializes a new instance of the IscsiServersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IscsiServersOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the iSCSI in a device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDevice", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified iSCSI server name. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the iSCSI server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string deviceName, string iscsiServerName, ISCSIServer iscsiServer, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, iscsiServerName, iscsiServer, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the iSCSI server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(deviceName, iscsiServerName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Backup the iSCSI server now. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task BackupNowWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginBackupNowWithHttpMessagesAsync(deviceName, iscsiServerName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the iSCSI server metrics + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricsWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/metrics").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves metric definitions for all metrics aggregated at iSCSI server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricDefinitionWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetricDefinition", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/metricsDefinitions").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the iSCSI servers in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManager", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/iscsiservers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the iSCSI server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string deviceName, string iscsiServerName, ISCSIServer iscsiServer, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (iscsiServer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServer"); + } + if (iscsiServer != null) + { + iscsiServer.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("iscsiServer", iscsiServer); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(iscsiServer != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iscsiServer, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the iSCSI server. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Backup the iSCSI server now. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginBackupNowWithHttpMessagesAsync(string deviceName, string iscsiServerName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (iscsiServerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiServerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("iscsiServerName", iscsiServerName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginBackupNow", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/iscsiservers/{iscsiServerName}/backup").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{iscsiServerName}", System.Uri.EscapeDataString(iscsiServerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiServersOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiServersOperationsExtensions.cs new file mode 100644 index 000000000000..141f5f7218ed --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/IscsiServersOperationsExtensions.cs @@ -0,0 +1,588 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for IscsiServersOperations. + /// + public static partial class IscsiServersOperationsExtensions + { + /// + /// Retrieves all the iSCSI in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByDevice(this IIscsiServersOperations operations, string deviceName, string resourceGroupName, string managerName) + { + return operations.ListByDeviceAsync(deviceName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the iSCSI in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDeviceAsync(this IIscsiServersOperations operations, string deviceName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDeviceWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified iSCSI server name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static ISCSIServer Get(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName) + { + return operations.GetAsync(deviceName, iscsiServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified iSCSI server name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(deviceName, iscsiServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static ISCSIServer CreateOrUpdate(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, ISCSIServer iscsiServer, string resourceGroupName, string managerName) + { + return operations.CreateOrUpdateAsync(deviceName, iscsiServerName, iscsiServer, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, ISCSIServer iscsiServer, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(deviceName, iscsiServerName, iscsiServer, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName) + { + operations.DeleteAsync(deviceName, iscsiServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(deviceName, iscsiServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Backup the iSCSI server now. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BackupNow(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName) + { + operations.BackupNowAsync(deviceName, iscsiServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Backup the iSCSI server now. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BackupNowAsync(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BackupNowWithHttpMessagesAsync(deviceName, iscsiServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the iSCSI server metrics + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + public static IEnumerable ListMetrics(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListMetricsAsync(deviceName, iscsiServerName, resourceGroupName, managerName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets the iSCSI server metrics + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricsAsync(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricsWithHttpMessagesAsync(deviceName, iscsiServerName, resourceGroupName, managerName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves metric definitions for all metrics aggregated at iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListMetricDefinition(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName) + { + return operations.ListMetricDefinitionAsync(deviceName, iscsiServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves metric definitions for all metrics aggregated at iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricDefinitionAsync(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricDefinitionWithHttpMessagesAsync(deviceName, iscsiServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves all the iSCSI servers in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByManager(this IIscsiServersOperations operations, string resourceGroupName, string managerName) + { + return operations.ListByManagerAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the iSCSI servers in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerAsync(this IIscsiServersOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static ISCSIServer BeginCreateOrUpdate(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, ISCSIServer iscsiServer, string resourceGroupName, string managerName) + { + return operations.BeginCreateOrUpdateAsync(deviceName, iscsiServerName, iscsiServer, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The iSCSI server. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, ISCSIServer iscsiServer, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(deviceName, iscsiServerName, iscsiServer, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDelete(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName) + { + operations.BeginDeleteAsync(deviceName, iscsiServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the iSCSI server. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(deviceName, iscsiServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Backup the iSCSI server now. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginBackupNow(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName) + { + operations.BeginBackupNowAsync(deviceName, iscsiServerName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Backup the iSCSI server now. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The iSCSI server name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginBackupNowAsync(this IIscsiServersOperations operations, string deviceName, string iscsiServerName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginBackupNowWithHttpMessagesAsync(deviceName, iscsiServerName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/JobsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/JobsOperations.cs new file mode 100644 index 000000000000..854944fb3767 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/JobsOperations.cs @@ -0,0 +1,1048 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// JobsOperations operations. + /// + internal partial class JobsOperations : IServiceOperations, IJobsOperations + { + /// + /// Initializes a new instance of the JobsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal JobsOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the jobs in a device. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDeviceWithHttpMessagesAsync(string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDevice", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/jobs").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified job name. + /// + /// + /// The device name. + /// + /// + /// The job name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string deviceName, string jobName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (deviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "deviceName"); + } + if (jobName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "jobName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("deviceName", deviceName); + tracingParameters.Add("jobName", jobName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/jobs/{jobName}").ToString(); + _url = _url.Replace("{deviceName}", System.Uri.EscapeDataString(deviceName)); + _url = _url.Replace("{jobName}", System.Uri.EscapeDataString(jobName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the jobs in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManager", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/jobs").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the jobs in a device. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDeviceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDeviceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the jobs in a manager. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManagerNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/JobsOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/JobsOperationsExtensions.cs new file mode 100644 index 000000000000..b42361609c91 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/JobsOperationsExtensions.cs @@ -0,0 +1,244 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for JobsOperations. + /// + public static partial class JobsOperationsExtensions + { + /// + /// Retrieves all the jobs in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByDevice(this IJobsOperations operations, string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByDeviceAsync(deviceName, resourceGroupName, managerName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the jobs in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDeviceAsync(this IJobsOperations operations, string deviceName, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDeviceWithHttpMessagesAsync(deviceName, resourceGroupName, managerName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified job name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The job name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static Job Get(this IJobsOperations operations, string deviceName, string jobName, string resourceGroupName, string managerName) + { + return operations.GetAsync(deviceName, jobName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified job name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The device name. + /// + /// + /// The job name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IJobsOperations operations, string deviceName, string jobName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(deviceName, jobName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves all the jobs in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByManager(this IJobsOperations operations, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByManagerAsync(resourceGroupName, managerName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the jobs in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerAsync(this IJobsOperations operations, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerWithHttpMessagesAsync(resourceGroupName, managerName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves all the jobs in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDeviceNext(this IJobsOperations operations, string nextPageLink) + { + return operations.ListByDeviceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the jobs in a device. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDeviceNextAsync(this IJobsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDeviceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves all the jobs in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByManagerNext(this IJobsOperations operations, string nextPageLink) + { + return operations.ListByManagerNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the jobs in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerNextAsync(this IJobsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ManagersOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ManagersOperations.cs new file mode 100644 index 000000000000..d7c942174731 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ManagersOperations.cs @@ -0,0 +1,3132 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagersOperations operations. + /// + internal partial class ManagersOperations : IServiceOperations, IManagersOperations + { + /// + /// Initializes a new instance of the ManagersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagersOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the managers in a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.StorSimple/managers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all the managers in a resource group. + /// + /// + /// The resource group name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified manager name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the manager. + /// + /// + /// The manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(Manager manager, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (manager == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "manager"); + } + if (manager != null) + { + manager.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("manager", manager); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(manager != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(manager, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the StorSimple Manager. + /// + /// + /// The manager update parameters. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(ManagerPatch parameters, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Upload Vault Cred Certificate. + /// Returns UploadCertificateResponse + /// + /// + /// Certificate Name + /// + /// + /// UploadCertificateRequest Request + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UploadRegistrationCertificateWithHttpMessagesAsync(string certificateName, UploadCertificateRequest uploadCertificateRequestrequest, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (certificateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + } + if (uploadCertificateRequestrequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "uploadCertificateRequestrequest"); + } + if (uploadCertificateRequestrequest != null) + { + uploadCertificateRequestrequest.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("certificateName", certificateName); + tracingParameters.Add("uploadCertificateRequestrequest", uploadCertificateRequestrequest); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UploadRegistrationCertificate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/certificates/{certificateName}").ToString(); + _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(uploadCertificateRequestrequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(uploadCertificateRequestrequest, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the encryption settings of the manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetEncryptionSettingsWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetEncryptionSettings", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/encryptionSettings/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the extended information of the specified manager name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetExtendedInfoWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetExtendedInfo", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates the extended info of the manager. + /// + /// + /// The manager extended information. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateExtendedInfoWithHttpMessagesAsync(ManagerExtendedInfo managerExtendedInfo, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (managerExtendedInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerExtendedInfo"); + } + if (managerExtendedInfo != null) + { + managerExtendedInfo.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("managerExtendedInfo", managerExtendedInfo); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateExtendedInfo", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(managerExtendedInfo != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(managerExtendedInfo, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the extended info of the manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteExtendedInfoWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteExtendedInfo", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the extended info of the manager. + /// + /// + /// The manager extended information. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Pass the ETag of ExtendedInfo fetched from GET call + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateExtendedInfoWithHttpMessagesAsync(ManagerExtendedInfo managerExtendedInfo, string resourceGroupName, string managerName, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (managerExtendedInfo == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerExtendedInfo"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (ifMatch == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("managerExtendedInfo", managerExtendedInfo); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateExtendedInfo", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/extendedInformation/vaultExtendedInfo").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(managerExtendedInfo != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(managerExtendedInfo, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the symmetric encryption key of the manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetEncryptionKeyWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetEncryptionKey", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/getEncryptionKey").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the manager metrics + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricsWithHttpMessagesAsync(string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetrics", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/metrics").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves metric definition of all metrics aggregated at manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListMetricDefinitionWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListMetricDefinition", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/metricsDefinitions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ManagersOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ManagersOperationsExtensions.cs new file mode 100644 index 000000000000..c5b9fdabd40f --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/ManagersOperationsExtensions.cs @@ -0,0 +1,654 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagersOperations. + /// + public static partial class ManagersOperationsExtensions + { + /// + /// Retrieves all the managers in a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable List(this IManagersOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the managers in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IManagersOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves all the managers in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + public static IEnumerable ListByResourceGroup(this IManagersOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the managers in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IManagersOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified manager name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static Manager Get(this IManagersOperations operations, string resourceGroupName, string managerName) + { + return operations.GetAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified manager name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagersOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static Manager CreateOrUpdate(this IManagersOperations operations, Manager manager, string resourceGroupName, string managerName) + { + return operations.CreateOrUpdateAsync(manager, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagersOperations operations, Manager manager, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(manager, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IManagersOperations operations, string resourceGroupName, string managerName) + { + operations.DeleteAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IManagersOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates the StorSimple Manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The manager update parameters. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static Manager Update(this IManagersOperations operations, ManagerPatch parameters, string resourceGroupName, string managerName) + { + return operations.UpdateAsync(parameters, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Updates the StorSimple Manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The manager update parameters. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IManagersOperations operations, ManagerPatch parameters, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(parameters, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Upload Vault Cred Certificate. + /// Returns UploadCertificateResponse + /// + /// + /// The operations group for this extension method. + /// + /// + /// Certificate Name + /// + /// + /// UploadCertificateRequest Request + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static UploadCertificateResponse UploadRegistrationCertificate(this IManagersOperations operations, string certificateName, UploadCertificateRequest uploadCertificateRequestrequest, string resourceGroupName, string managerName) + { + return operations.UploadRegistrationCertificateAsync(certificateName, uploadCertificateRequestrequest, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Upload Vault Cred Certificate. + /// Returns UploadCertificateResponse + /// + /// + /// The operations group for this extension method. + /// + /// + /// Certificate Name + /// + /// + /// UploadCertificateRequest Request + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task UploadRegistrationCertificateAsync(this IManagersOperations operations, string certificateName, UploadCertificateRequest uploadCertificateRequestrequest, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UploadRegistrationCertificateWithHttpMessagesAsync(certificateName, uploadCertificateRequestrequest, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the encryption settings of the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static EncryptionSettings GetEncryptionSettings(this IManagersOperations operations, string resourceGroupName, string managerName) + { + return operations.GetEncryptionSettingsAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the encryption settings of the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetEncryptionSettingsAsync(this IManagersOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetEncryptionSettingsWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the extended information of the specified manager name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static ManagerExtendedInfo GetExtendedInfo(this IManagersOperations operations, string resourceGroupName, string managerName) + { + return operations.GetExtendedInfoAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the extended information of the specified manager name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetExtendedInfoAsync(this IManagersOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetExtendedInfoWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates the extended info of the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The manager extended information. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static ManagerExtendedInfo CreateExtendedInfo(this IManagersOperations operations, ManagerExtendedInfo managerExtendedInfo, string resourceGroupName, string managerName) + { + return operations.CreateExtendedInfoAsync(managerExtendedInfo, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates the extended info of the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The manager extended information. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateExtendedInfoAsync(this IManagersOperations operations, ManagerExtendedInfo managerExtendedInfo, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateExtendedInfoWithHttpMessagesAsync(managerExtendedInfo, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the extended info of the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void DeleteExtendedInfo(this IManagersOperations operations, string resourceGroupName, string managerName) + { + operations.DeleteExtendedInfoAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the extended info of the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteExtendedInfoAsync(this IManagersOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteExtendedInfoWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates the extended info of the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The manager extended information. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Pass the ETag of ExtendedInfo fetched from GET call + /// + public static ManagerExtendedInfo UpdateExtendedInfo(this IManagersOperations operations, ManagerExtendedInfo managerExtendedInfo, string resourceGroupName, string managerName, string ifMatch) + { + return operations.UpdateExtendedInfoAsync(managerExtendedInfo, resourceGroupName, managerName, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Updates the extended info of the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The manager extended information. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Pass the ETag of ExtendedInfo fetched from GET call + /// + /// + /// The cancellation token. + /// + public static async Task UpdateExtendedInfoAsync(this IManagersOperations operations, ManagerExtendedInfo managerExtendedInfo, string resourceGroupName, string managerName, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateExtendedInfoWithHttpMessagesAsync(managerExtendedInfo, resourceGroupName, managerName, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the symmetric encryption key of the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static SymmetricEncryptedSecret GetEncryptionKey(this IManagersOperations operations, string resourceGroupName, string managerName) + { + return operations.GetEncryptionKeyAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the symmetric encryption key of the manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetEncryptionKeyAsync(this IManagersOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetEncryptionKeyWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the manager metrics + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + public static IEnumerable ListMetrics(this IManagersOperations operations, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListMetricsAsync(resourceGroupName, managerName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets the manager metrics + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricsAsync(this IManagersOperations operations, string resourceGroupName, string managerName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricsWithHttpMessagesAsync(resourceGroupName, managerName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves metric definition of all metrics aggregated at manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListMetricDefinition(this IManagersOperations operations, string resourceGroupName, string managerName) + { + return operations.ListMetricDefinitionAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves metric definition of all metrics aggregated at manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListMetricDefinitionAsync(this IManagersOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMetricDefinitionWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AccessControlRecord.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AccessControlRecord.cs new file mode 100644 index 000000000000..6c00630f033d --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AccessControlRecord.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The access control record + /// + [Rest.Serialization.JsonTransformation] + public partial class AccessControlRecord : BaseModel + { + /// + /// Initializes a new instance of the AccessControlRecord class. + /// + public AccessControlRecord() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessControlRecord class. + /// + /// The Iscsi initiator name (IQN) + /// The identifier. + /// The name. + /// The type. + public AccessControlRecord(string initiatorName, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + InitiatorName = initiatorName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Iscsi initiator name (IQN) + /// + [JsonProperty(PropertyName = "properties.initiatorName")] + public string InitiatorName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (InitiatorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "InitiatorName"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Alert.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Alert.cs new file mode 100644 index 000000000000..3f80e1475e91 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Alert.cs @@ -0,0 +1,198 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Alert class + /// + [Rest.Serialization.JsonTransformation] + public partial class Alert : BaseModel + { + /// + /// Initializes a new instance of the Alert class. + /// + public Alert() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Alert class. + /// + /// Title of the alert + /// Device or Resource alert. Possible values + /// include: 'Resource', 'Device' + /// Type of the alert + /// UTC time at which the alert + /// appeared + /// UTC time at which the alert + /// appeared on the source + /// Source at which the alert was cleared + /// Severity of the alert. Possible values + /// include: 'Informational', 'Warning', 'Critical' + /// Current status of the alert. Possible values + /// include: 'Active', 'Cleared' + /// The identifier. + /// The name. + /// The type. + /// UTC time at which the alert got + /// cleared + /// UTC time at which the alert was + /// cleared on the source + /// Recommendation for acting on the + /// alert + /// Reason for resolving the + /// alert + /// ErrorDetails of the alert + /// Other information about the + /// alert + public Alert(string title, AlertScope scope, string alertType, System.DateTime appearedAtTime, System.DateTime appearedAtSourceTime, AlertSource source, AlertSeverity severity, AlertStatus status, string id = default(string), string name = default(string), string type = default(string), System.DateTime? clearedAtTime = default(System.DateTime?), System.DateTime? clearedAtSourceTime = default(System.DateTime?), string recommendation = default(string), string resolutionReason = default(string), AlertErrorDetails errorDetails = default(AlertErrorDetails), IDictionary detailedInformation = default(IDictionary)) + : base(id, name, type) + { + Title = title; + Scope = scope; + AlertType = alertType; + AppearedAtTime = appearedAtTime; + AppearedAtSourceTime = appearedAtSourceTime; + ClearedAtTime = clearedAtTime; + ClearedAtSourceTime = clearedAtSourceTime; + Source = source; + Recommendation = recommendation; + ResolutionReason = resolutionReason; + Severity = severity; + Status = status; + ErrorDetails = errorDetails; + DetailedInformation = detailedInformation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets title of the alert + /// + [JsonProperty(PropertyName = "properties.title")] + public string Title { get; set; } + + /// + /// Gets or sets device or Resource alert. Possible values include: + /// 'Resource', 'Device' + /// + [JsonProperty(PropertyName = "properties.scope")] + public AlertScope Scope { get; set; } + + /// + /// Gets or sets type of the alert + /// + [JsonProperty(PropertyName = "properties.alertType")] + public string AlertType { get; set; } + + /// + /// Gets or sets UTC time at which the alert appeared + /// + [JsonProperty(PropertyName = "properties.appearedAtTime")] + public System.DateTime AppearedAtTime { get; set; } + + /// + /// Gets or sets UTC time at which the alert appeared on the source + /// + [JsonProperty(PropertyName = "properties.appearedAtSourceTime")] + public System.DateTime AppearedAtSourceTime { get; set; } + + /// + /// Gets or sets UTC time at which the alert got cleared + /// + [JsonProperty(PropertyName = "properties.clearedAtTime")] + public System.DateTime? ClearedAtTime { get; set; } + + /// + /// Gets or sets UTC time at which the alert was cleared on the source + /// + [JsonProperty(PropertyName = "properties.clearedAtSourceTime")] + public System.DateTime? ClearedAtSourceTime { get; set; } + + /// + /// Gets or sets source at which the alert was cleared + /// + [JsonProperty(PropertyName = "properties.source")] + public AlertSource Source { get; set; } + + /// + /// Gets or sets recommendation for acting on the alert + /// + [JsonProperty(PropertyName = "properties.recommendation")] + public string Recommendation { get; set; } + + /// + /// Gets or sets reason for resolving the alert + /// + [JsonProperty(PropertyName = "properties.resolutionReason")] + public string ResolutionReason { get; set; } + + /// + /// Gets or sets severity of the alert. Possible values include: + /// 'Informational', 'Warning', 'Critical' + /// + [JsonProperty(PropertyName = "properties.severity")] + public AlertSeverity Severity { get; set; } + + /// + /// Gets or sets current status of the alert. Possible values include: + /// 'Active', 'Cleared' + /// + [JsonProperty(PropertyName = "properties.status")] + public AlertStatus Status { get; set; } + + /// + /// Gets or sets errorDetails of the alert + /// + [JsonProperty(PropertyName = "properties.errorDetails")] + public AlertErrorDetails ErrorDetails { get; set; } + + /// + /// Gets or sets other information about the alert + /// + [JsonProperty(PropertyName = "properties.detailedInformation")] + public IDictionary DetailedInformation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Title == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Title"); + } + if (AlertType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AlertType"); + } + if (Source == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Source"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertEmailNotificationStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertEmailNotificationStatus.cs new file mode 100644 index 000000000000..fa1541ae22ff --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertEmailNotificationStatus.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AlertEmailNotificationStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AlertEmailNotificationStatus + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class AlertEmailNotificationStatusEnumExtension + { + internal static string ToSerializedValue(this AlertEmailNotificationStatus? value) + { + return value == null ? null : ((AlertEmailNotificationStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AlertEmailNotificationStatus value) + { + switch( value ) + { + case AlertEmailNotificationStatus.Enabled: + return "Enabled"; + case AlertEmailNotificationStatus.Disabled: + return "Disabled"; + } + return null; + } + + internal static AlertEmailNotificationStatus? ParseAlertEmailNotificationStatus(this string value) + { + switch( value ) + { + case "Enabled": + return AlertEmailNotificationStatus.Enabled; + case "Disabled": + return AlertEmailNotificationStatus.Disabled; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertErrorDetails.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertErrorDetails.cs new file mode 100644 index 000000000000..0c0f646bec15 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertErrorDetails.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error details for the alert + /// + public partial class AlertErrorDetails + { + /// + /// Initializes a new instance of the AlertErrorDetails class. + /// + public AlertErrorDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertErrorDetails class. + /// + /// Error code. + /// Error Message + /// Number of occurrences. + public AlertErrorDetails(string errorCode = default(string), string errorMessage = default(string), int? occurences = default(int?)) + { + ErrorCode = errorCode; + ErrorMessage = errorMessage; + Occurences = occurences; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error code. + /// + [JsonProperty(PropertyName = "errorCode")] + public string ErrorCode { get; set; } + + /// + /// Gets or sets error Message + /// + [JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage { get; set; } + + /// + /// Gets or sets number of occurrences. + /// + [JsonProperty(PropertyName = "occurences")] + public int? Occurences { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertFilter.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertFilter.cs new file mode 100644 index 000000000000..4d8462658d25 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertFilter.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Filters that can be specified on the alert + /// + public partial class AlertFilter + { + /// + /// Initializes a new instance of the AlertFilter class. + /// + public AlertFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertFilter class. + /// + /// Status of the alert. Possible values include: + /// 'Active', 'Cleared' + /// Severity of the alert. Possible values + /// include: 'Informational', 'Warning', 'Critical' + /// Source of the alert. Possible values + /// include: 'Resource', 'Device' + /// Source name of the alert + /// UTC time on which the alert + /// appeared + public AlertFilter(AlertStatus? status = default(AlertStatus?), AlertSeverity? severity = default(AlertSeverity?), AlertSourceType? sourceType = default(AlertSourceType?), string sourceName = default(string), System.DateTime? appearedOnTime = default(System.DateTime?)) + { + Status = status; + Severity = severity; + SourceType = sourceType; + SourceName = sourceName; + AppearedOnTime = appearedOnTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets status of the alert. Possible values include: + /// 'Active', 'Cleared' + /// + [JsonProperty(PropertyName = "status")] + public AlertStatus? Status { get; set; } + + /// + /// Gets or sets severity of the alert. Possible values include: + /// 'Informational', 'Warning', 'Critical' + /// + [JsonProperty(PropertyName = "severity")] + public AlertSeverity? Severity { get; set; } + + /// + /// Gets or sets source of the alert. Possible values include: + /// 'Resource', 'Device' + /// + [JsonProperty(PropertyName = "sourceType")] + public AlertSourceType? SourceType { get; set; } + + /// + /// Gets or sets source name of the alert + /// + [JsonProperty(PropertyName = "sourceName")] + public string SourceName { get; set; } + + /// + /// Gets or sets UTC time on which the alert appeared + /// + [JsonProperty(PropertyName = "appearedOnTime")] + public System.DateTime? AppearedOnTime { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertScope.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertScope.cs new file mode 100644 index 000000000000..26e6b99e67d5 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertScope.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AlertScope. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AlertScope + { + [EnumMember(Value = "Resource")] + Resource, + [EnumMember(Value = "Device")] + Device + } + internal static class AlertScopeEnumExtension + { + internal static string ToSerializedValue(this AlertScope? value) + { + return value == null ? null : ((AlertScope)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AlertScope value) + { + switch( value ) + { + case AlertScope.Resource: + return "Resource"; + case AlertScope.Device: + return "Device"; + } + return null; + } + + internal static AlertScope? ParseAlertScope(this string value) + { + switch( value ) + { + case "Resource": + return AlertScope.Resource; + case "Device": + return AlertScope.Device; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSettings.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSettings.cs new file mode 100644 index 000000000000..2e42313031c6 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSettings.cs @@ -0,0 +1,113 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// AlertSettings on the device which represents how alerts will be + /// processed + /// + [Rest.Serialization.JsonTransformation] + public partial class AlertSettings : BaseModel + { + /// + /// Initializes a new instance of the AlertSettings class. + /// + public AlertSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertSettings class. + /// + /// Value indicating whether + /// user/admins will receive emails when an alert condition occurs on + /// the system. Possible values include: 'Enabled', 'Disabled' + /// Value indicating whether + /// service owners will receive emails when an alert condition occurs + /// on the system. Applicable only if emailNotification flag is + /// Enabled. Possible values include: 'Enabled', 'Disabled' + /// Culture setting to be used + /// while building alert emails. For eg: "en-US" + /// The identifier. + /// The name. + /// The type. + /// List of email addresses + /// (apart from admin/co-admin of subscription) to whom the alert + /// emails need to be sent + public AlertSettings(AlertEmailNotificationStatus emailNotification, ServiceOwnersAlertNotificationStatus notificationToServiceOwners, string alertNotificationCulture, string id = default(string), string name = default(string), string type = default(string), IList additionalRecipientEmailList = default(IList)) + : base(id, name, type) + { + EmailNotification = emailNotification; + NotificationToServiceOwners = notificationToServiceOwners; + AlertNotificationCulture = alertNotificationCulture; + AdditionalRecipientEmailList = additionalRecipientEmailList; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets value indicating whether user/admins will receive + /// emails when an alert condition occurs on the system. Possible + /// values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.emailNotification")] + public AlertEmailNotificationStatus EmailNotification { get; set; } + + /// + /// Gets or sets value indicating whether service owners will receive + /// emails when an alert condition occurs on the system. Applicable + /// only if emailNotification flag is Enabled. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.notificationToServiceOwners")] + public ServiceOwnersAlertNotificationStatus NotificationToServiceOwners { get; set; } + + /// + /// Gets or sets culture setting to be used while building alert + /// emails. For eg: "en-US" + /// + [JsonProperty(PropertyName = "properties.alertNotificationCulture")] + public string AlertNotificationCulture { get; set; } + + /// + /// Gets or sets list of email addresses (apart from admin/co-admin of + /// subscription) to whom the alert emails need to be sent + /// + [JsonProperty(PropertyName = "properties.additionalRecipientEmailList")] + public IList AdditionalRecipientEmailList { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AlertNotificationCulture == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AlertNotificationCulture"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSeverity.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSeverity.cs new file mode 100644 index 000000000000..7d357f7f0d38 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSeverity.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AlertSeverity. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AlertSeverity + { + [EnumMember(Value = "Informational")] + Informational, + [EnumMember(Value = "Warning")] + Warning, + [EnumMember(Value = "Critical")] + Critical + } + internal static class AlertSeverityEnumExtension + { + internal static string ToSerializedValue(this AlertSeverity? value) + { + return value == null ? null : ((AlertSeverity)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AlertSeverity value) + { + switch( value ) + { + case AlertSeverity.Informational: + return "Informational"; + case AlertSeverity.Warning: + return "Warning"; + case AlertSeverity.Critical: + return "Critical"; + } + return null; + } + + internal static AlertSeverity? ParseAlertSeverity(this string value) + { + switch( value ) + { + case "Informational": + return AlertSeverity.Informational; + case "Warning": + return AlertSeverity.Warning; + case "Critical": + return AlertSeverity.Critical; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSource.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSource.cs new file mode 100644 index 000000000000..63187ea5a7d9 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSource.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// source at which the alert can be raised + /// + public partial class AlertSource + { + /// + /// Initializes a new instance of the AlertSource class. + /// + public AlertSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertSource class. + /// + /// Name of the source. + /// The time zone. + /// Source type of the alert. Possible + /// values include: 'Resource', 'Device' + public AlertSource(string name = default(string), string timeZone = default(string), AlertSourceType? alertSourceType = default(AlertSourceType?)) + { + Name = name; + TimeZone = timeZone; + AlertSourceType = alertSourceType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the source. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the time zone. + /// + [JsonProperty(PropertyName = "timeZone")] + public string TimeZone { get; set; } + + /// + /// Gets or sets source type of the alert. Possible values include: + /// 'Resource', 'Device' + /// + [JsonProperty(PropertyName = "alertSourceType")] + public AlertSourceType? AlertSourceType { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSourceType.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSourceType.cs new file mode 100644 index 000000000000..c9c69ff7ddfc --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertSourceType.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AlertSourceType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AlertSourceType + { + [EnumMember(Value = "Resource")] + Resource, + [EnumMember(Value = "Device")] + Device + } + internal static class AlertSourceTypeEnumExtension + { + internal static string ToSerializedValue(this AlertSourceType? value) + { + return value == null ? null : ((AlertSourceType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AlertSourceType value) + { + switch( value ) + { + case AlertSourceType.Resource: + return "Resource"; + case AlertSourceType.Device: + return "Device"; + } + return null; + } + + internal static AlertSourceType? ParseAlertSourceType(this string value) + { + switch( value ) + { + case "Resource": + return AlertSourceType.Resource; + case "Device": + return AlertSourceType.Device; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertStatus.cs new file mode 100644 index 000000000000..6f12df0266f5 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AlertStatus.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AlertStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AlertStatus + { + [EnumMember(Value = "Active")] + Active, + [EnumMember(Value = "Cleared")] + Cleared + } + internal static class AlertStatusEnumExtension + { + internal static string ToSerializedValue(this AlertStatus? value) + { + return value == null ? null : ((AlertStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AlertStatus value) + { + switch( value ) + { + case AlertStatus.Active: + return "Active"; + case AlertStatus.Cleared: + return "Cleared"; + } + return null; + } + + internal static AlertStatus? ParseAlertStatus(this string value) + { + switch( value ) + { + case "Active": + return AlertStatus.Active; + case "Cleared": + return AlertStatus.Cleared; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AsymmetricEncryptedSecret.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AsymmetricEncryptedSecret.cs new file mode 100644 index 000000000000..bbf5c1bdf4b8 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AsymmetricEncryptedSecret.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// This class can be used as the Type for any secret entity represented as + /// Password, CertThumbprint, Algorithm. This class is intended to be used + /// when the secret is encrypted with an asymmetric key pair. The + /// encryptionAlgorithm field is mainly for future usage to potentially + /// allow different entities encrypted using different algorithms. + /// + public partial class AsymmetricEncryptedSecret + { + /// + /// Initializes a new instance of the AsymmetricEncryptedSecret class. + /// + public AsymmetricEncryptedSecret() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AsymmetricEncryptedSecret class. + /// + /// The value of the secret itself. If the secret + /// is in plaintext then EncryptionAlgorithm will be none and + /// EncryptionCertThumbprint will be null. + /// Algorithm used to encrypt + /// "Value". Possible values include: 'None', 'AES256', + /// 'RSAES_PKCS1_v_1_5' + /// Thumbprint + /// certificate that was used to encrypt "Value" + public AsymmetricEncryptedSecret(string value, EncryptionAlgorithm encryptionAlgorithm, string encryptionCertificateThumbprint = default(string)) + { + Value = value; + EncryptionCertificateThumbprint = encryptionCertificateThumbprint; + EncryptionAlgorithm = encryptionAlgorithm; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the value of the secret itself. If the secret is in + /// plaintext then EncryptionAlgorithm will be none and + /// EncryptionCertThumbprint will be null. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets thumbprint certificate that was used to encrypt + /// "Value" + /// + [JsonProperty(PropertyName = "encryptionCertificateThumbprint")] + public string EncryptionCertificateThumbprint { get; set; } + + /// + /// Gets or sets algorithm used to encrypt "Value". Possible values + /// include: 'None', 'AES256', 'RSAES_PKCS1_v_1_5' + /// + [JsonProperty(PropertyName = "encryptionAlgorithm")] + public EncryptionAlgorithm EncryptionAlgorithm { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AuthType.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AuthType.cs new file mode 100644 index 000000000000..710bf36ef6a3 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AuthType.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for AuthType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AuthType + { + [EnumMember(Value = "Invalid")] + Invalid, + [EnumMember(Value = "AccessControlService")] + AccessControlService, + [EnumMember(Value = "AzureActiveDirectory")] + AzureActiveDirectory + } + internal static class AuthTypeEnumExtension + { + internal static string ToSerializedValue(this AuthType? value) + { + return value == null ? null : ((AuthType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this AuthType value) + { + switch( value ) + { + case AuthType.Invalid: + return "Invalid"; + case AuthType.AccessControlService: + return "AccessControlService"; + case AuthType.AzureActiveDirectory: + return "AzureActiveDirectory"; + } + return null; + } + + internal static AuthType? ParseAuthType(this string value) + { + switch( value ) + { + case "Invalid": + return AuthType.Invalid; + case "AccessControlService": + return AuthType.AccessControlService; + case "AzureActiveDirectory": + return AuthType.AzureActiveDirectory; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AvailableProviderOperation.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AvailableProviderOperation.cs new file mode 100644 index 000000000000..25459c22f7cf --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AvailableProviderOperation.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class represents provider operation + /// + public partial class AvailableProviderOperation + { + /// + /// Initializes a new instance of the AvailableProviderOperation class. + /// + public AvailableProviderOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableProviderOperation class. + /// + /// Gets or sets the name of the operation being + /// performed on this particular object + /// Return value format: + /// "{resourceProviderNamespace}/{resourceType}/{read|write|deletion|action}" + /// Eg: Microsoft.StorSimple/managers/devices/fileServers/read + /// Microsoft.StorSimple/managers/devices/alerts/clearAlerts/action + /// Gets or sets Display information + /// Contains the localized display information for this particular + /// operation/action + /// Gets or sets Origin + /// The intended executor of the operation; governs the display of the + /// operation in the RBAC UX and the audit logs UX. + /// Default value is “user,system” + /// Gets or sets Properties + /// Reserved for future use + public AvailableProviderOperation(string name = default(string), AvailableProviderOperationDisplay display = default(AvailableProviderOperationDisplay), string origin = default(string), object properties = default(object)) + { + Name = name; + Display = display; + Origin = origin; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the operation being performed on this + /// particular object + /// Return value format: + /// "{resourceProviderNamespace}/{resourceType}/{read|write|deletion|action}" + /// Eg: Microsoft.StorSimple/managers/devices/fileServers/read + /// Microsoft.StorSimple/managers/devices/alerts/clearAlerts/action + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets Display information + /// Contains the localized display information for this particular + /// operation/action + /// + [JsonProperty(PropertyName = "display")] + public AvailableProviderOperationDisplay Display { get; set; } + + /// + /// Gets or sets Origin + /// The intended executor of the operation; governs the display of the + /// operation in the RBAC UX and the audit logs UX. + /// Default value is “user,system” + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + /// + /// Gets or sets Properties + /// Reserved for future use + /// + [JsonProperty(PropertyName = "properties")] + public object Properties { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AvailableProviderOperationDisplay.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AvailableProviderOperationDisplay.cs new file mode 100644 index 000000000000..9c9eb6bb880b --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/AvailableProviderOperationDisplay.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains the localized display information for this particular + /// operation / action. + /// These value will be used by several clients for + /// (1) custom role definitions for RBAC; + /// (2) complex query filters for the event service; and (3) audit history + /// / records for management operations. + /// + public partial class AvailableProviderOperationDisplay + { + /// + /// Initializes a new instance of the AvailableProviderOperationDisplay + /// class. + /// + public AvailableProviderOperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AvailableProviderOperationDisplay + /// class. + /// + /// Gets or sets Provider + /// The localized friendly form of the resource provider name – it is + /// expected to also include the publisher/company responsible. + /// It should use Title Casing and begin with “Microsoft” for 1st party + /// services. + /// Gets or sets Resource + /// The localized friendly form of the resource type related to this + /// action/operation – it should match the public documentation for the + /// resource provider. + /// It should use Title Casing – for examples, please refer to the + /// “name” section. + /// Gets or sets Operation + /// The localized friendly name for the operation, as it should be + /// shown to the user. + /// It should be concise (to fit in drop downs) but clear (i.e. + /// self-documenting). It should use Title Casing and include the + /// entity/resource to which it applies. + /// Gets or sets Description + /// The localized friendly description for the operation, as it should + /// be shown to the user. + /// It should be thorough, yet concise – it will be used in tool tips + /// and detailed views. + public AvailableProviderOperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets Provider + /// The localized friendly form of the resource provider name – it is + /// expected to also include the publisher/company responsible. + /// It should use Title Casing and begin with “Microsoft” for 1st party + /// services. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets Resource + /// The localized friendly form of the resource type related to this + /// action/operation – it should match the public documentation for the + /// resource provider. + /// It should use Title Casing – for examples, please refer to the + /// “name” section. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets Operation + /// The localized friendly name for the operation, as it should be + /// shown to the user. + /// It should be concise (to fit in drop downs) but clear (i.e. + /// self-documenting). It should use Title Casing and include the + /// entity/resource to which it applies. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets Description + /// The localized friendly description for the operation, as it should + /// be shown to the user. + /// It should be thorough, yet concise – it will be used in tool tips + /// and detailed views. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Backup.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Backup.cs new file mode 100644 index 000000000000..452f5a9ffb6a --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Backup.cs @@ -0,0 +1,151 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The backup. + /// + [Rest.Serialization.JsonTransformation] + public partial class Backup : BaseModel + { + /// + /// Initializes a new instance of the Backup class. + /// + public Backup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Backup class. + /// + /// The backup size in bytes. + /// Indicates how the backup was initiated + /// "Manual | Scheduled". Possible values include: 'Manual', + /// 'Scheduled' + /// The Device Identifier. + /// The backup elements. + /// The identifier. + /// The name. + /// The type. + /// The path id of the target FileServer or + /// IscsiServer for which the backup was taken. + /// Type of target, FileServer or + /// IscsiServer + /// The time when the backup was + /// created. + /// The time when the backup will + /// expire. + public Backup(long sizeInBytes, InitiatedBy initiatedBy, string deviceId, IList elements, string id = default(string), string name = default(string), string type = default(string), string targetId = default(string), string targetType = default(string), System.DateTime? createdTime = default(System.DateTime?), System.DateTime? expirationTime = default(System.DateTime?)) + : base(id, name, type) + { + TargetId = targetId; + TargetType = targetType; + SizeInBytes = sizeInBytes; + CreatedTime = createdTime; + ExpirationTime = expirationTime; + InitiatedBy = initiatedBy; + DeviceId = deviceId; + Elements = elements; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the path id of the target FileServer or IscsiServer + /// for which the backup was taken. + /// + [JsonProperty(PropertyName = "properties.targetId")] + public string TargetId { get; set; } + + /// + /// Gets or sets type of target, FileServer or IscsiServer + /// + [JsonProperty(PropertyName = "properties.targetType")] + public string TargetType { get; set; } + + /// + /// Gets or sets the backup size in bytes. + /// + [JsonProperty(PropertyName = "properties.sizeInBytes")] + public long SizeInBytes { get; set; } + + /// + /// Gets or sets the time when the backup was created. + /// + [JsonProperty(PropertyName = "properties.createdTime")] + public System.DateTime? CreatedTime { get; set; } + + /// + /// Gets or sets the time when the backup will expire. + /// + [JsonProperty(PropertyName = "properties.expirationTime")] + public System.DateTime? ExpirationTime { get; set; } + + /// + /// Gets or sets indicates how the backup was initiated "Manual | + /// Scheduled". Possible values include: 'Manual', 'Scheduled' + /// + [JsonProperty(PropertyName = "properties.initiatedBy")] + public InitiatedBy InitiatedBy { get; set; } + + /// + /// Gets or sets the Device Identifier. + /// + [JsonProperty(PropertyName = "properties.deviceId")] + public string DeviceId { get; set; } + + /// + /// Gets or sets the backup elements. + /// + [JsonProperty(PropertyName = "properties.elements")] + public IList Elements { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DeviceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DeviceId"); + } + if (Elements == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Elements"); + } + if (Elements != null) + { + foreach (var element in Elements) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BackupElement.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BackupElement.cs new file mode 100644 index 000000000000..47c21021e666 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BackupElement.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class represents BackupElement + /// + [Rest.Serialization.JsonTransformation] + public partial class BackupElement : BaseModel + { + /// + /// Initializes a new instance of the BackupElement class. + /// + public BackupElement() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupElement class. + /// + /// The size in bytes. + /// The name of the endpoint. + /// The data policy of backed up endpoint. + /// Possible values include: 'Invalid', 'Local', 'Tiered', + /// 'Cloud' + /// The identifier. + /// The name. + /// The type. + public BackupElement(long sizeInBytes, string endpointName, DataPolicy dataPolicy, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + SizeInBytes = sizeInBytes; + EndpointName = endpointName; + DataPolicy = dataPolicy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the size in bytes. + /// + [JsonProperty(PropertyName = "properties.sizeInBytes")] + public long SizeInBytes { get; set; } + + /// + /// Gets or sets the name of the endpoint. + /// + [JsonProperty(PropertyName = "properties.endpointName")] + public string EndpointName { get; set; } + + /// + /// Gets or sets the data policy of backed up endpoint. Possible values + /// include: 'Invalid', 'Local', 'Tiered', 'Cloud' + /// + [JsonProperty(PropertyName = "properties.dataPolicy")] + public DataPolicy DataPolicy { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EndpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EndpointName"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BackupFilter.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BackupFilter.cs new file mode 100644 index 000000000000..7ad2d3fcf90e --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BackupFilter.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Backup OData filter class + /// + public partial class BackupFilter + { + /// + /// Initializes a new instance of the BackupFilter class. + /// + public BackupFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupFilter class. + /// + /// Gets or sets InitiatedBy. Possible values + /// include: 'Manual', 'Scheduled' + /// Gets or sets CreatedTime + public BackupFilter(InitiatedBy? initiatedBy = default(InitiatedBy?), System.DateTime? createdTime = default(System.DateTime?)) + { + InitiatedBy = initiatedBy; + CreatedTime = createdTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets InitiatedBy. Possible values include: 'Manual', + /// 'Scheduled' + /// + [JsonProperty(PropertyName = "initiatedBy")] + public InitiatedBy? InitiatedBy { get; set; } + + /// + /// Gets or sets CreatedTime + /// + [JsonProperty(PropertyName = "createdTime")] + public System.DateTime? CreatedTime { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BackupScheduleGroup.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BackupScheduleGroup.cs new file mode 100644 index 000000000000..82ccc3301f45 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BackupScheduleGroup.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Backup Schedule Group + /// + [Rest.Serialization.JsonTransformation] + public partial class BackupScheduleGroup : BaseModel + { + /// + /// Initializes a new instance of the BackupScheduleGroup class. + /// + public BackupScheduleGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackupScheduleGroup class. + /// + /// The start time. When this field is + /// specified we will generate Default GrandFather Father Son Backup + /// Schedules. + /// The identifier. + /// The name. + /// The type. + public BackupScheduleGroup(Time startTime, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + StartTime = startTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the start time. When this field is specified we will + /// generate Default GrandFather Father Son Backup Schedules. + /// + [JsonProperty(PropertyName = "properties.startTime")] + public Time StartTime { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StartTime == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StartTime"); + } + if (StartTime != null) + { + StartTime.Validate(); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BaseModel.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BaseModel.cs new file mode 100644 index 000000000000..9e69493316a4 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/BaseModel.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Base class for models + /// + public partial class BaseModel + { + /// + /// Initializes a new instance of the BaseModel class. + /// + public BaseModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BaseModel class. + /// + /// The identifier. + /// The name. + /// The type. + public BaseModel(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ChapSettings.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ChapSettings.cs new file mode 100644 index 000000000000..e80ff7f52013 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ChapSettings.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Challenge-Handshake Authentication Protocol (CHAP) setting + /// + [Rest.Serialization.JsonTransformation] + public partial class ChapSettings : BaseModel + { + /// + /// Initializes a new instance of the ChapSettings class. + /// + public ChapSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ChapSettings class. + /// + /// The chap password. + /// The identifier. + /// The name. + /// The type. + public ChapSettings(AsymmetricEncryptedSecret password, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the chap password. + /// + [JsonProperty(PropertyName = "properties.password")] + public AsymmetricEncryptedSecret Password { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Password == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Password"); + } + if (Password != null) + { + Password.Validate(); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ClearAlertRequest.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ClearAlertRequest.cs new file mode 100644 index 000000000000..66216f572ef1 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ClearAlertRequest.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Request for clearing the alert + /// + public partial class ClearAlertRequest + { + /// + /// Initializes a new instance of the ClearAlertRequest class. + /// + public ClearAlertRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ClearAlertRequest class. + /// + /// List of alert Ids to be cleared + /// Resolution message while clearing + /// the request + public ClearAlertRequest(IList alerts, string resolutionMessage = default(string)) + { + ResolutionMessage = resolutionMessage; + Alerts = alerts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resolution message while clearing the request + /// + [JsonProperty(PropertyName = "resolutionMessage")] + public string ResolutionMessage { get; set; } + + /// + /// Gets or sets list of alert Ids to be cleared + /// + [JsonProperty(PropertyName = "alerts")] + public IList Alerts { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Alerts == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Alerts"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/CloneRequest.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/CloneRequest.cs new file mode 100644 index 000000000000..cbf1c3795bf0 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/CloneRequest.cs @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Clone Job Request Model. + /// + [Rest.Serialization.JsonTransformation] + public partial class CloneRequest + { + /// + /// Initializes a new instance of the CloneRequest class. + /// + public CloneRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloneRequest class. + /// + /// DeviceId of the device which will act + /// as the Clone target + /// Access point Id on which clone + /// job will performed. + /// Name of new endpoint which will + /// created as part of clone job. + /// Share Object. + /// Disk Object + public CloneRequest(string targetDeviceId, string targetAccessPointId, string newEndpointName, FileShare share = default(FileShare), ISCSIDisk disk = default(ISCSIDisk)) + { + TargetDeviceId = targetDeviceId; + TargetAccessPointId = targetAccessPointId; + NewEndpointName = newEndpointName; + Share = share; + Disk = disk; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets deviceId of the device which will act as the Clone + /// target + /// + [JsonProperty(PropertyName = "properties.targetDeviceId")] + public string TargetDeviceId { get; set; } + + /// + /// Gets or sets access point Id on which clone job will performed. + /// + [JsonProperty(PropertyName = "properties.targetAccessPointId")] + public string TargetAccessPointId { get; set; } + + /// + /// Gets or sets name of new endpoint which will created as part of + /// clone job. + /// + [JsonProperty(PropertyName = "properties.newEndpointName")] + public string NewEndpointName { get; set; } + + /// + /// Gets or sets share Object. + /// + [JsonProperty(PropertyName = "properties.share")] + public FileShare Share { get; set; } + + /// + /// Gets or sets disk Object + /// + [JsonProperty(PropertyName = "properties.disk")] + public ISCSIDisk Disk { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TargetDeviceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TargetDeviceId"); + } + if (TargetAccessPointId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TargetAccessPointId"); + } + if (NewEndpointName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "NewEndpointName"); + } + if (Share != null) + { + Share.Validate(); + } + if (Disk != null) + { + Disk.Validate(); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/CloudType.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/CloudType.cs new file mode 100644 index 000000000000..3a047d96d8d3 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/CloudType.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for CloudType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum CloudType + { + [EnumMember(Value = "Azure")] + Azure, + [EnumMember(Value = "S3")] + S3, + [EnumMember(Value = "S3_RRS")] + S3RRS, + [EnumMember(Value = "OpenStack")] + OpenStack, + [EnumMember(Value = "HP")] + HP + } + internal static class CloudTypeEnumExtension + { + internal static string ToSerializedValue(this CloudType? value) + { + return value == null ? null : ((CloudType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this CloudType value) + { + switch( value ) + { + case CloudType.Azure: + return "Azure"; + case CloudType.S3: + return "S3"; + case CloudType.S3RRS: + return "S3_RRS"; + case CloudType.OpenStack: + return "OpenStack"; + case CloudType.HP: + return "HP"; + } + return null; + } + + internal static CloudType? ParseCloudType(this string value) + { + switch( value ) + { + case "Azure": + return CloudType.Azure; + case "S3": + return CloudType.S3; + case "S3_RRS": + return CloudType.S3RRS; + case "OpenStack": + return CloudType.OpenStack; + case "HP": + return CloudType.HP; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ContractVersions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ContractVersions.cs new file mode 100644 index 000000000000..52ddb7a0809a --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ContractVersions.cs @@ -0,0 +1,222 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ContractVersions. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ContractVersions + { + [EnumMember(Value = "InvalidVersion")] + InvalidVersion, + [EnumMember(Value = "V2011_09")] + V201109, + [EnumMember(Value = "V2012_02")] + V201202, + [EnumMember(Value = "V2012_05")] + V201205, + [EnumMember(Value = "V2012_12")] + V201212, + [EnumMember(Value = "V2013_04")] + V201304, + [EnumMember(Value = "V2013_10")] + V201310, + [EnumMember(Value = "V2013_11")] + V201311, + [EnumMember(Value = "V2014_04")] + V201404, + [EnumMember(Value = "V2014_06")] + V201406, + [EnumMember(Value = "V2014_07")] + V201407, + [EnumMember(Value = "V2014_09")] + V201409, + [EnumMember(Value = "V2014_10")] + V201410, + [EnumMember(Value = "V2014_12")] + V201412, + [EnumMember(Value = "V2015_01")] + V201501, + [EnumMember(Value = "V2015_02")] + V201502, + [EnumMember(Value = "V2015_04")] + V201504, + [EnumMember(Value = "V2015_05")] + V201505, + [EnumMember(Value = "V2015_06")] + V201506, + [EnumMember(Value = "V2015_07")] + V201507, + [EnumMember(Value = "V2015_08")] + V201508, + [EnumMember(Value = "V2015_10")] + V201510, + [EnumMember(Value = "V2015_12")] + V201512, + [EnumMember(Value = "V2016_01")] + V201601, + [EnumMember(Value = "V2016_02")] + V201602, + [EnumMember(Value = "V2016_04")] + V201604, + [EnumMember(Value = "V2016_05")] + V201605, + [EnumMember(Value = "V2016_07")] + V201607, + [EnumMember(Value = "V2016_08")] + V201608 + } + internal static class ContractVersionsEnumExtension + { + internal static string ToSerializedValue(this ContractVersions? value) + { + return value == null ? null : ((ContractVersions)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ContractVersions value) + { + switch( value ) + { + case ContractVersions.InvalidVersion: + return "InvalidVersion"; + case ContractVersions.V201109: + return "V2011_09"; + case ContractVersions.V201202: + return "V2012_02"; + case ContractVersions.V201205: + return "V2012_05"; + case ContractVersions.V201212: + return "V2012_12"; + case ContractVersions.V201304: + return "V2013_04"; + case ContractVersions.V201310: + return "V2013_10"; + case ContractVersions.V201311: + return "V2013_11"; + case ContractVersions.V201404: + return "V2014_04"; + case ContractVersions.V201406: + return "V2014_06"; + case ContractVersions.V201407: + return "V2014_07"; + case ContractVersions.V201409: + return "V2014_09"; + case ContractVersions.V201410: + return "V2014_10"; + case ContractVersions.V201412: + return "V2014_12"; + case ContractVersions.V201501: + return "V2015_01"; + case ContractVersions.V201502: + return "V2015_02"; + case ContractVersions.V201504: + return "V2015_04"; + case ContractVersions.V201505: + return "V2015_05"; + case ContractVersions.V201506: + return "V2015_06"; + case ContractVersions.V201507: + return "V2015_07"; + case ContractVersions.V201508: + return "V2015_08"; + case ContractVersions.V201510: + return "V2015_10"; + case ContractVersions.V201512: + return "V2015_12"; + case ContractVersions.V201601: + return "V2016_01"; + case ContractVersions.V201602: + return "V2016_02"; + case ContractVersions.V201604: + return "V2016_04"; + case ContractVersions.V201605: + return "V2016_05"; + case ContractVersions.V201607: + return "V2016_07"; + case ContractVersions.V201608: + return "V2016_08"; + } + return null; + } + + internal static ContractVersions? ParseContractVersions(this string value) + { + switch( value ) + { + case "InvalidVersion": + return ContractVersions.InvalidVersion; + case "V2011_09": + return ContractVersions.V201109; + case "V2012_02": + return ContractVersions.V201202; + case "V2012_05": + return ContractVersions.V201205; + case "V2012_12": + return ContractVersions.V201212; + case "V2013_04": + return ContractVersions.V201304; + case "V2013_10": + return ContractVersions.V201310; + case "V2013_11": + return ContractVersions.V201311; + case "V2014_04": + return ContractVersions.V201404; + case "V2014_06": + return ContractVersions.V201406; + case "V2014_07": + return ContractVersions.V201407; + case "V2014_09": + return ContractVersions.V201409; + case "V2014_10": + return ContractVersions.V201410; + case "V2014_12": + return ContractVersions.V201412; + case "V2015_01": + return ContractVersions.V201501; + case "V2015_02": + return ContractVersions.V201502; + case "V2015_04": + return ContractVersions.V201504; + case "V2015_05": + return ContractVersions.V201505; + case "V2015_06": + return ContractVersions.V201506; + case "V2015_07": + return ContractVersions.V201507; + case "V2015_08": + return ContractVersions.V201508; + case "V2015_10": + return ContractVersions.V201510; + case "V2015_12": + return ContractVersions.V201512; + case "V2016_01": + return ContractVersions.V201601; + case "V2016_02": + return ContractVersions.V201602; + case "V2016_04": + return ContractVersions.V201604; + case "V2016_05": + return ContractVersions.V201605; + case "V2016_07": + return ContractVersions.V201607; + case "V2016_08": + return ContractVersions.V201608; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DataPolicy.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DataPolicy.cs new file mode 100644 index 000000000000..ce68f246e69c --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DataPolicy.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DataPolicy. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DataPolicy + { + [EnumMember(Value = "Invalid")] + Invalid, + [EnumMember(Value = "Local")] + Local, + [EnumMember(Value = "Tiered")] + Tiered, + [EnumMember(Value = "Cloud")] + Cloud + } + internal static class DataPolicyEnumExtension + { + internal static string ToSerializedValue(this DataPolicy? value) + { + return value == null ? null : ((DataPolicy)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DataPolicy value) + { + switch( value ) + { + case DataPolicy.Invalid: + return "Invalid"; + case DataPolicy.Local: + return "Local"; + case DataPolicy.Tiered: + return "Tiered"; + case DataPolicy.Cloud: + return "Cloud"; + } + return null; + } + + internal static DataPolicy? ParseDataPolicy(this string value) + { + switch( value ) + { + case "Invalid": + return DataPolicy.Invalid; + case "Local": + return DataPolicy.Local; + case "Tiered": + return DataPolicy.Tiered; + case "Cloud": + return DataPolicy.Cloud; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Device.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Device.cs new file mode 100644 index 000000000000..fb37f1ac41e6 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Device.cs @@ -0,0 +1,193 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a StorSimple device object along with its properties + /// + [Rest.Serialization.JsonTransformation] + public partial class Device : BaseModel + { + /// + /// Initializes a new instance of the Device class. + /// + public Device() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Device class. + /// + /// The identifier. + /// The name. + /// The type. + /// The UTC time at which the device was + /// activated + /// Operations that are allowed + /// on the device based on its current state + /// Language culture setting on the device. For + /// eg: "en-US" + /// Device can be configured either as + /// FileServer or IscsiServer + /// Short description given for the + /// device + /// Fully qualified name of the domain to + /// which the device is attached + /// Version number of the software + /// running on the device + /// Friendly name for the software + /// version + /// "Complete" if the device + /// has been successfully registered as File/IscsiServer and the + /// creation of share/volume is complete, "Pending" if the device is + /// only registered but the creation of share/volume is complete is + /// still pending. Possible values include: 'Complete', + /// 'Pending' + /// Name of the device model + /// Current status of the device. Possible values + /// include: 'Unknown', 'Online', 'Offline', 'RequiresAttention', + /// 'MaintenanceMode', 'Creating', 'Provisioning', 'Deleted', + /// 'ReadyToSetup', 'Deactivated', 'Deactivating' + /// Type of the device. Possible values + /// include: 'Invalid', 'Appliance', 'VirtualAppliance', + /// 'Series9000OnPremVirtualAppliance', 'Series9000VirtualAppliance', + /// 'Series9000PhysicalAppliance' + /// subclass containing more storage-related + /// information about the device. This field will be populated only if + /// the get call is made with $expand = details. + public Device(string id = default(string), string name = default(string), string type = default(string), System.DateTime? activationTime = default(System.DateTime?), IList allowedDeviceOperations = default(IList), string culture = default(string), IList deviceCapabilities = default(IList), string deviceDescription = default(string), string domainName = default(string), string deviceSoftwareVersion = default(string), string friendlySoftwareName = default(string), DeviceConfigurationStatus? deviceConfigurationStatus = default(DeviceConfigurationStatus?), string modelDescription = default(string), DeviceStatus? status = default(DeviceStatus?), DeviceType? deviceType = default(DeviceType?), DeviceDetails details = default(DeviceDetails)) + : base(id, name, type) + { + ActivationTime = activationTime; + AllowedDeviceOperations = allowedDeviceOperations; + Culture = culture; + DeviceCapabilities = deviceCapabilities; + DeviceDescription = deviceDescription; + DomainName = domainName; + DeviceSoftwareVersion = deviceSoftwareVersion; + FriendlySoftwareName = friendlySoftwareName; + DeviceConfigurationStatus = deviceConfigurationStatus; + ModelDescription = modelDescription; + Status = status; + DeviceType = deviceType; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the UTC time at which the device was activated + /// + [JsonProperty(PropertyName = "properties.activationTime")] + public System.DateTime? ActivationTime { get; set; } + + /// + /// Gets or sets operations that are allowed on the device based on its + /// current state + /// + [JsonProperty(PropertyName = "properties.allowedDeviceOperations")] + public IList AllowedDeviceOperations { get; set; } + + /// + /// Gets or sets language culture setting on the device. For eg: + /// "en-US" + /// + [JsonProperty(PropertyName = "properties.culture")] + public string Culture { get; set; } + + /// + /// Gets or sets device can be configured either as FileServer or + /// IscsiServer + /// + [JsonProperty(PropertyName = "properties.deviceCapabilities")] + public IList DeviceCapabilities { get; set; } + + /// + /// Gets or sets short description given for the device + /// + [JsonProperty(PropertyName = "properties.deviceDescription")] + public string DeviceDescription { get; set; } + + /// + /// Gets or sets fully qualified name of the domain to which the device + /// is attached + /// + [JsonProperty(PropertyName = "properties.domainName")] + public string DomainName { get; set; } + + /// + /// Gets or sets version number of the software running on the device + /// + [JsonProperty(PropertyName = "properties.deviceSoftwareVersion")] + public string DeviceSoftwareVersion { get; set; } + + /// + /// Gets or sets friendly name for the software version + /// + [JsonProperty(PropertyName = "properties.friendlySoftwareName")] + public string FriendlySoftwareName { get; set; } + + /// + /// Gets or sets "Complete" if the device has been successfully + /// registered as File/IscsiServer and the creation of share/volume is + /// complete, "Pending" if the device is only registered but the + /// creation of share/volume is complete is still pending. Possible + /// values include: 'Complete', 'Pending' + /// + [JsonProperty(PropertyName = "properties.deviceConfigurationStatus")] + public DeviceConfigurationStatus? DeviceConfigurationStatus { get; set; } + + /// + /// Gets or sets name of the device model + /// + [JsonProperty(PropertyName = "properties.modelDescription")] + public string ModelDescription { get; set; } + + /// + /// Gets or sets current status of the device. Possible values include: + /// 'Unknown', 'Online', 'Offline', 'RequiresAttention', + /// 'MaintenanceMode', 'Creating', 'Provisioning', 'Deleted', + /// 'ReadyToSetup', 'Deactivated', 'Deactivating' + /// + [JsonProperty(PropertyName = "properties.status")] + public DeviceStatus? Status { get; set; } + + /// + /// Gets or sets type of the device. Possible values include: + /// 'Invalid', 'Appliance', 'VirtualAppliance', + /// 'Series9000OnPremVirtualAppliance', 'Series9000VirtualAppliance', + /// 'Series9000PhysicalAppliance' + /// + [JsonProperty(PropertyName = "properties.type")] + public DeviceType? DeviceType { get; set; } + + /// + /// Gets or sets subclass containing more storage-related information + /// about the device. This field will be populated only if the get call + /// is made with $expand = details. + /// + [JsonProperty(PropertyName = "properties.details")] + public DeviceDetails Details { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceConfigurationStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceConfigurationStatus.cs new file mode 100644 index 000000000000..091dc11641fc --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceConfigurationStatus.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DeviceConfigurationStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DeviceConfigurationStatus + { + [EnumMember(Value = "Complete")] + Complete, + [EnumMember(Value = "Pending")] + Pending + } + internal static class DeviceConfigurationStatusEnumExtension + { + internal static string ToSerializedValue(this DeviceConfigurationStatus? value) + { + return value == null ? null : ((DeviceConfigurationStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DeviceConfigurationStatus value) + { + switch( value ) + { + case DeviceConfigurationStatus.Complete: + return "Complete"; + case DeviceConfigurationStatus.Pending: + return "Pending"; + } + return null; + } + + internal static DeviceConfigurationStatus? ParseDeviceConfigurationStatus(this string value) + { + switch( value ) + { + case "Complete": + return DeviceConfigurationStatus.Complete; + case "Pending": + return DeviceConfigurationStatus.Pending; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceDetails.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceDetails.cs new file mode 100644 index 000000000000..cab977c34ad2 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceDetails.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class containing more granular details about the device + /// + public partial class DeviceDetails + { + /// + /// Initializes a new instance of the DeviceDetails class. + /// + public DeviceDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeviceDetails class. + /// + /// Total number of endpoints that are + /// currently on the device ( i.e. number of shares on FileServer or + /// number of volumes on IscsiServer) + /// Total storage available on the + /// device in bytes. + /// Total local storage capacity + /// in device in bytes. + /// Storage in bytes that has + /// been provisioned on the device including both local and + /// cloud + /// Storage in bytes that + /// has been provisioned locally on the device + /// Storage that is being currently + /// used in bytes including both local and cloud + /// Local Storage that is being + /// currently used in bytes + /// Total size taken up by backups + /// in bytes + /// Total pending available + /// storage on the device in bytes + /// Local pending storage + /// available on the device in bytes + public DeviceDetails(int? endpointCount = default(int?), long? totalStorageInBytes = default(long?), long? totalLocalStorageInBytes = default(long?), long? provisionedStorageInBytes = default(long?), long? provisionedLocalStorageInBytes = default(long?), long? usingStorageInBytes = default(long?), long? usingLocalStorageInBytes = default(long?), long? totalBackupSizeInBytes = default(long?), long? availableStorageInBytes = default(long?), long? availableLocalStorageInBytes = default(long?)) + { + EndpointCount = endpointCount; + TotalStorageInBytes = totalStorageInBytes; + TotalLocalStorageInBytes = totalLocalStorageInBytes; + ProvisionedStorageInBytes = provisionedStorageInBytes; + ProvisionedLocalStorageInBytes = provisionedLocalStorageInBytes; + UsingStorageInBytes = usingStorageInBytes; + UsingLocalStorageInBytes = usingLocalStorageInBytes; + TotalBackupSizeInBytes = totalBackupSizeInBytes; + AvailableStorageInBytes = availableStorageInBytes; + AvailableLocalStorageInBytes = availableLocalStorageInBytes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets total number of endpoints that are currently on the + /// device ( i.e. number of shares on FileServer or number of volumes + /// on IscsiServer) + /// + [JsonProperty(PropertyName = "endpointCount")] + public int? EndpointCount { get; set; } + + /// + /// Gets or sets total storage available on the device in bytes. + /// + [JsonProperty(PropertyName = "totalStorageInBytes")] + public long? TotalStorageInBytes { get; set; } + + /// + /// Gets or sets total local storage capacity in device in bytes. + /// + [JsonProperty(PropertyName = "totalLocalStorageInBytes")] + public long? TotalLocalStorageInBytes { get; set; } + + /// + /// Gets or sets storage in bytes that has been provisioned on the + /// device including both local and cloud + /// + [JsonProperty(PropertyName = "provisionedStorageInBytes")] + public long? ProvisionedStorageInBytes { get; set; } + + /// + /// Gets or sets storage in bytes that has been provisioned locally on + /// the device + /// + [JsonProperty(PropertyName = "provisionedLocalStorageInBytes")] + public long? ProvisionedLocalStorageInBytes { get; set; } + + /// + /// Gets or sets storage that is being currently used in bytes + /// including both local and cloud + /// + [JsonProperty(PropertyName = "usingStorageInBytes")] + public long? UsingStorageInBytes { get; set; } + + /// + /// Gets or sets local Storage that is being currently used in bytes + /// + [JsonProperty(PropertyName = "usingLocalStorageInBytes")] + public long? UsingLocalStorageInBytes { get; set; } + + /// + /// Gets or sets total size taken up by backups in bytes + /// + [JsonProperty(PropertyName = "totalBackupSizeInBytes")] + public long? TotalBackupSizeInBytes { get; set; } + + /// + /// Gets or sets total pending available storage on the device in bytes + /// + [JsonProperty(PropertyName = "availableStorageInBytes")] + public long? AvailableStorageInBytes { get; set; } + + /// + /// Gets or sets local pending storage available on the device in bytes + /// + [JsonProperty(PropertyName = "availableLocalStorageInBytes")] + public long? AvailableLocalStorageInBytes { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceOperation.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceOperation.cs new file mode 100644 index 000000000000..16f167aee99d --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceOperation.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DeviceOperation. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DeviceOperation + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "Delete")] + Delete, + [EnumMember(Value = "DeleteWithWarning")] + DeleteWithWarning, + [EnumMember(Value = "DRSource")] + DRSource, + [EnumMember(Value = "DRTarget")] + DRTarget, + [EnumMember(Value = "Browsable")] + Browsable, + [EnumMember(Value = "ReadOnlyForDR")] + ReadOnlyForDR, + [EnumMember(Value = "Deactivate")] + Deactivate + } + internal static class DeviceOperationEnumExtension + { + internal static string ToSerializedValue(this DeviceOperation? value) + { + return value == null ? null : ((DeviceOperation)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DeviceOperation value) + { + switch( value ) + { + case DeviceOperation.None: + return "None"; + case DeviceOperation.Delete: + return "Delete"; + case DeviceOperation.DeleteWithWarning: + return "DeleteWithWarning"; + case DeviceOperation.DRSource: + return "DRSource"; + case DeviceOperation.DRTarget: + return "DRTarget"; + case DeviceOperation.Browsable: + return "Browsable"; + case DeviceOperation.ReadOnlyForDR: + return "ReadOnlyForDR"; + case DeviceOperation.Deactivate: + return "Deactivate"; + } + return null; + } + + internal static DeviceOperation? ParseDeviceOperation(this string value) + { + switch( value ) + { + case "None": + return DeviceOperation.None; + case "Delete": + return DeviceOperation.Delete; + case "DeleteWithWarning": + return DeviceOperation.DeleteWithWarning; + case "DRSource": + return DeviceOperation.DRSource; + case "DRTarget": + return DeviceOperation.DRTarget; + case "Browsable": + return DeviceOperation.Browsable; + case "ReadOnlyForDR": + return DeviceOperation.ReadOnlyForDR; + case "Deactivate": + return DeviceOperation.Deactivate; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DevicePatch.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DevicePatch.cs new file mode 100644 index 000000000000..e2b67a34ab5e --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DevicePatch.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class that represents the Input for the PATCH call on Device. Currently + /// the only patchable property on device is "DeviceDescription" + /// + public partial class DevicePatch + { + /// + /// Initializes a new instance of the DevicePatch class. + /// + public DevicePatch() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DevicePatch class. + /// + /// Short description given for the + /// device + public DevicePatch(string deviceDescription = default(string)) + { + DeviceDescription = deviceDescription; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets short description given for the device + /// + [JsonProperty(PropertyName = "deviceDescription")] + public string DeviceDescription { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceStatus.cs new file mode 100644 index 000000000000..e5b9c6b879fd --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceStatus.cs @@ -0,0 +1,114 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DeviceStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DeviceStatus + { + [EnumMember(Value = "Unknown")] + Unknown, + [EnumMember(Value = "Online")] + Online, + [EnumMember(Value = "Offline")] + Offline, + [EnumMember(Value = "RequiresAttention")] + RequiresAttention, + [EnumMember(Value = "MaintenanceMode")] + MaintenanceMode, + [EnumMember(Value = "Creating")] + Creating, + [EnumMember(Value = "Provisioning")] + Provisioning, + [EnumMember(Value = "Deleted")] + Deleted, + [EnumMember(Value = "ReadyToSetup")] + ReadyToSetup, + [EnumMember(Value = "Deactivated")] + Deactivated, + [EnumMember(Value = "Deactivating")] + Deactivating + } + internal static class DeviceStatusEnumExtension + { + internal static string ToSerializedValue(this DeviceStatus? value) + { + return value == null ? null : ((DeviceStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DeviceStatus value) + { + switch( value ) + { + case DeviceStatus.Unknown: + return "Unknown"; + case DeviceStatus.Online: + return "Online"; + case DeviceStatus.Offline: + return "Offline"; + case DeviceStatus.RequiresAttention: + return "RequiresAttention"; + case DeviceStatus.MaintenanceMode: + return "MaintenanceMode"; + case DeviceStatus.Creating: + return "Creating"; + case DeviceStatus.Provisioning: + return "Provisioning"; + case DeviceStatus.Deleted: + return "Deleted"; + case DeviceStatus.ReadyToSetup: + return "ReadyToSetup"; + case DeviceStatus.Deactivated: + return "Deactivated"; + case DeviceStatus.Deactivating: + return "Deactivating"; + } + return null; + } + + internal static DeviceStatus? ParseDeviceStatus(this string value) + { + switch( value ) + { + case "Unknown": + return DeviceStatus.Unknown; + case "Online": + return DeviceStatus.Online; + case "Offline": + return DeviceStatus.Offline; + case "RequiresAttention": + return DeviceStatus.RequiresAttention; + case "MaintenanceMode": + return DeviceStatus.MaintenanceMode; + case "Creating": + return DeviceStatus.Creating; + case "Provisioning": + return DeviceStatus.Provisioning; + case "Deleted": + return DeviceStatus.Deleted; + case "ReadyToSetup": + return DeviceStatus.ReadyToSetup; + case "Deactivated": + return DeviceStatus.Deactivated; + case "Deactivating": + return DeviceStatus.Deactivating; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceType.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceType.cs new file mode 100644 index 000000000000..dff29f48eac8 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DeviceType.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DeviceType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DeviceType + { + [EnumMember(Value = "Invalid")] + Invalid, + [EnumMember(Value = "Appliance")] + Appliance, + [EnumMember(Value = "VirtualAppliance")] + VirtualAppliance, + [EnumMember(Value = "Series9000OnPremVirtualAppliance")] + Series9000OnPremVirtualAppliance, + [EnumMember(Value = "Series9000VirtualAppliance")] + Series9000VirtualAppliance, + [EnumMember(Value = "Series9000PhysicalAppliance")] + Series9000PhysicalAppliance + } + internal static class DeviceTypeEnumExtension + { + internal static string ToSerializedValue(this DeviceType? value) + { + return value == null ? null : ((DeviceType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DeviceType value) + { + switch( value ) + { + case DeviceType.Invalid: + return "Invalid"; + case DeviceType.Appliance: + return "Appliance"; + case DeviceType.VirtualAppliance: + return "VirtualAppliance"; + case DeviceType.Series9000OnPremVirtualAppliance: + return "Series9000OnPremVirtualAppliance"; + case DeviceType.Series9000VirtualAppliance: + return "Series9000VirtualAppliance"; + case DeviceType.Series9000PhysicalAppliance: + return "Series9000PhysicalAppliance"; + } + return null; + } + + internal static DeviceType? ParseDeviceType(this string value) + { + switch( value ) + { + case "Invalid": + return DeviceType.Invalid; + case "Appliance": + return DeviceType.Appliance; + case "VirtualAppliance": + return DeviceType.VirtualAppliance; + case "Series9000OnPremVirtualAppliance": + return DeviceType.Series9000OnPremVirtualAppliance; + case "Series9000VirtualAppliance": + return DeviceType.Series9000VirtualAppliance; + case "Series9000PhysicalAppliance": + return DeviceType.Series9000PhysicalAppliance; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DhcpStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DhcpStatus.cs new file mode 100644 index 000000000000..b0884e4f62a1 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DhcpStatus.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DhcpStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DhcpStatus + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class DhcpStatusEnumExtension + { + internal static string ToSerializedValue(this DhcpStatus? value) + { + return value == null ? null : ((DhcpStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DhcpStatus value) + { + switch( value ) + { + case DhcpStatus.Enabled: + return "Enabled"; + case DhcpStatus.Disabled: + return "Disabled"; + } + return null; + } + + internal static DhcpStatus? ParseDhcpStatus(this string value) + { + switch( value ) + { + case "Enabled": + return DhcpStatus.Enabled; + case "Disabled": + return DhcpStatus.Disabled; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DiskStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DiskStatus.cs new file mode 100644 index 000000000000..43d8b7af2e58 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DiskStatus.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DiskStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DiskStatus + { + [EnumMember(Value = "Online")] + Online, + [EnumMember(Value = "Offline")] + Offline + } + internal static class DiskStatusEnumExtension + { + internal static string ToSerializedValue(this DiskStatus? value) + { + return value == null ? null : ((DiskStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DiskStatus value) + { + switch( value ) + { + case DiskStatus.Online: + return "Online"; + case DiskStatus.Offline: + return "Offline"; + } + return null; + } + + internal static DiskStatus? ParseDiskStatus(this string value) + { + switch( value ) + { + case "Online": + return DiskStatus.Online; + case "Offline": + return DiskStatus.Offline; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DownloadPhase.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DownloadPhase.cs new file mode 100644 index 000000000000..1a7532e49763 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/DownloadPhase.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DownloadPhase. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DownloadPhase + { + [EnumMember(Value = "Unknown")] + Unknown, + [EnumMember(Value = "Initializing")] + Initializing, + [EnumMember(Value = "Downloading")] + Downloading, + [EnumMember(Value = "Verifying")] + Verifying + } + internal static class DownloadPhaseEnumExtension + { + internal static string ToSerializedValue(this DownloadPhase? value) + { + return value == null ? null : ((DownloadPhase)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DownloadPhase value) + { + switch( value ) + { + case DownloadPhase.Unknown: + return "Unknown"; + case DownloadPhase.Initializing: + return "Initializing"; + case DownloadPhase.Downloading: + return "Downloading"; + case DownloadPhase.Verifying: + return "Verifying"; + } + return null; + } + + internal static DownloadPhase? ParseDownloadPhase(this string value) + { + switch( value ) + { + case "Unknown": + return DownloadPhase.Unknown; + case "Initializing": + return DownloadPhase.Initializing; + case "Downloading": + return DownloadPhase.Downloading; + case "Verifying": + return DownloadPhase.Verifying; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/EncryptionAlgorithm.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/EncryptionAlgorithm.cs new file mode 100644 index 000000000000..c8a65cc6d707 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/EncryptionAlgorithm.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for EncryptionAlgorithm. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EncryptionAlgorithm + { + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "AES256")] + AES256, + [EnumMember(Value = "RSAES_PKCS1_v_1_5")] + RSAESPKCS1V15 + } + internal static class EncryptionAlgorithmEnumExtension + { + internal static string ToSerializedValue(this EncryptionAlgorithm? value) + { + return value == null ? null : ((EncryptionAlgorithm)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this EncryptionAlgorithm value) + { + switch( value ) + { + case EncryptionAlgorithm.None: + return "None"; + case EncryptionAlgorithm.AES256: + return "AES256"; + case EncryptionAlgorithm.RSAESPKCS1V15: + return "RSAES_PKCS1_v_1_5"; + } + return null; + } + + internal static EncryptionAlgorithm? ParseEncryptionAlgorithm(this string value) + { + switch( value ) + { + case "None": + return EncryptionAlgorithm.None; + case "AES256": + return EncryptionAlgorithm.AES256; + case "RSAES_PKCS1_v_1_5": + return EncryptionAlgorithm.RSAESPKCS1V15; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/EncryptionSettings.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/EncryptionSettings.cs new file mode 100644 index 000000000000..070758cd742c --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/EncryptionSettings.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The EncryptionSettings + /// + [Rest.Serialization.JsonTransformation] + public partial class EncryptionSettings : BaseModel + { + /// + /// Initializes a new instance of the EncryptionSettings class. + /// + public EncryptionSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EncryptionSettings class. + /// + /// The encryption status which + /// indicates if encryption is enabled or not. Possible values include: + /// 'Enabled', 'Disabled' + /// The key rollover status which + /// indicates if key rollover is required or not. If secrets encryption + /// has been upgraded, then it requires key rollover. Possible values + /// include: 'Required', 'NotRequired' + /// The identifier. + /// The name. + /// The type. + public EncryptionSettings(EncryptionStatus encryptionStatus, KeyRolloverStatus keyRolloverStatus, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + EncryptionStatus = encryptionStatus; + KeyRolloverStatus = keyRolloverStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the encryption status which indicates if encryption is + /// enabled or not. Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.encryptionStatus")] + public EncryptionStatus EncryptionStatus { get; set; } + + /// + /// Gets or sets the key rollover status which indicates if key + /// rollover is required or not. If secrets encryption has been + /// upgraded, then it requires key rollover. Possible values include: + /// 'Required', 'NotRequired' + /// + [JsonProperty(PropertyName = "properties.keyRolloverStatus")] + public KeyRolloverStatus KeyRolloverStatus { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/EncryptionStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/EncryptionStatus.cs new file mode 100644 index 000000000000..1f6e80e1db5e --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/EncryptionStatus.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for EncryptionStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EncryptionStatus + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class EncryptionStatusEnumExtension + { + internal static string ToSerializedValue(this EncryptionStatus? value) + { + return value == null ? null : ((EncryptionStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this EncryptionStatus value) + { + switch( value ) + { + case EncryptionStatus.Enabled: + return "Enabled"; + case EncryptionStatus.Disabled: + return "Disabled"; + } + return null; + } + + internal static EncryptionStatus? ParseEncryptionStatus(this string value) + { + switch( value ) + { + case "Enabled": + return EncryptionStatus.Enabled; + case "Disabled": + return EncryptionStatus.Disabled; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Error.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Error.cs new file mode 100644 index 000000000000..0e099e137152 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Error.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class Error + { + /// + /// Initializes a new instance of the Error class. + /// + public Error() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Error class. + /// + public Error(string errorCode, Message message, IList values = default(IList)) + { + ErrorCode = errorCode; + Message = message; + Values = values; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "errorCode")] + public string ErrorCode { get; set; } + + /// + /// + [JsonProperty(PropertyName = "message")] + public Message Message { get; set; } + + /// + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ErrorCode == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ErrorCode"); + } + if (Message == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Message"); + } + if (Values != null) + { + foreach (var element in Values) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ErrorException.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ErrorException.cs new file mode 100644 index 000000000000..21c7cadd532c --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ErrorException.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with Error information. + /// + public partial class ErrorException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public Error Body { get; set; } + + /// + /// Initializes a new instance of the ErrorException class. + /// + public ErrorException() + { + } + + /// + /// Initializes a new instance of the ErrorException class. + /// + /// The exception message. + public ErrorException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorException class. + /// + /// The exception message. + /// Inner exception. + public ErrorException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/FailoverRequest.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/FailoverRequest.cs new file mode 100644 index 000000000000..83d572f129ac --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/FailoverRequest.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Failover request object. + /// + public partial class FailoverRequest + { + /// + /// Initializes a new instance of the FailoverRequest class. + /// + public FailoverRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FailoverRequest class. + /// + public FailoverRequest(IList accesspointIds = default(IList), string targetDeviceId = default(string), bool? skipValidation = default(bool?), bool? keepSourceDevice = default(bool?)) + { + AccesspointIds = accesspointIds; + TargetDeviceId = targetDeviceId; + SkipValidation = skipValidation; + KeepSourceDevice = keepSourceDevice; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "accesspointIds")] + public IList AccesspointIds { get; set; } + + /// + /// + [JsonProperty(PropertyName = "targetDeviceId")] + public string TargetDeviceId { get; set; } + + /// + /// + [JsonProperty(PropertyName = "skipValidation")] + public bool? SkipValidation { get; set; } + + /// + /// + [JsonProperty(PropertyName = "keepSourceDevice")] + public bool? KeepSourceDevice { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/FileServer.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/FileServer.cs new file mode 100644 index 000000000000..f1660d9ced36 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/FileServer.cs @@ -0,0 +1,104 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The file server. + /// + [Rest.Serialization.JsonTransformation] + public partial class FileServer : BaseModel + { + /// + /// Initializes a new instance of the FileServer class. + /// + public FileServer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileServer class. + /// + /// Domain of the file server + /// The storage domain id. + /// The backup policy id. + /// The identifier. + /// The name. + /// The type. + /// The description of the file + /// server + public FileServer(string domainName, string storageDomainId, string backupScheduleGroupId, string id = default(string), string name = default(string), string type = default(string), string description = default(string)) + : base(id, name, type) + { + DomainName = domainName; + StorageDomainId = storageDomainId; + BackupScheduleGroupId = backupScheduleGroupId; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets domain of the file server + /// + [JsonProperty(PropertyName = "properties.domainName")] + public string DomainName { get; set; } + + /// + /// Gets or sets the storage domain id. + /// + [JsonProperty(PropertyName = "properties.storageDomainId")] + public string StorageDomainId { get; set; } + + /// + /// Gets or sets the backup policy id. + /// + [JsonProperty(PropertyName = "properties.backupScheduleGroupId")] + public string BackupScheduleGroupId { get; set; } + + /// + /// Gets or sets the description of the file server + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DomainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DomainName"); + } + if (StorageDomainId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageDomainId"); + } + if (BackupScheduleGroupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BackupScheduleGroupId"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/FileShare.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/FileShare.cs new file mode 100644 index 000000000000..e29c6098db97 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/FileShare.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The File Share. + /// + [Rest.Serialization.JsonTransformation] + public partial class FileShare : BaseModel + { + /// + /// Initializes a new instance of the FileShare class. + /// + public FileShare() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileShare class. + /// + /// The Share Status. Possible values + /// include: 'Online', 'Offline' + /// The data policy. Possible values include: + /// 'Invalid', 'Local', 'Tiered', 'Cloud' + /// The user/group who will have full + /// permission in this share. Active directory email address. Example: + /// xyz@contoso.com or Contoso\xyz. + /// The total provisioned + /// capacity in Bytes + /// The monitoring status. Possible + /// values include: 'Enabled', 'Disabled' + /// The identifier. + /// The name. + /// The type. + /// Description for file share + /// The used capacity in + /// Bytes. + /// The local used capacity in + /// Bytes. + public FileShare(ShareStatus shareStatus, DataPolicy dataPolicy, string adminUser, long provisionedCapacityInBytes, MonitoringStatus monitoringStatus, string id = default(string), string name = default(string), string type = default(string), string description = default(string), long? usedCapacityInBytes = default(long?), long? localUsedCapacityInBytes = default(long?)) + : base(id, name, type) + { + Description = description; + ShareStatus = shareStatus; + DataPolicy = dataPolicy; + AdminUser = adminUser; + ProvisionedCapacityInBytes = provisionedCapacityInBytes; + UsedCapacityInBytes = usedCapacityInBytes; + LocalUsedCapacityInBytes = localUsedCapacityInBytes; + MonitoringStatus = monitoringStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets description for file share + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Share Status. Possible values include: 'Online', + /// 'Offline' + /// + [JsonProperty(PropertyName = "properties.shareStatus")] + public ShareStatus ShareStatus { get; set; } + + /// + /// Gets or sets the data policy. Possible values include: 'Invalid', + /// 'Local', 'Tiered', 'Cloud' + /// + [JsonProperty(PropertyName = "properties.dataPolicy")] + public DataPolicy DataPolicy { get; set; } + + /// + /// Gets or sets the user/group who will have full permission in this + /// share. Active directory email address. Example: xyz@contoso.com or + /// Contoso\xyz. + /// + [JsonProperty(PropertyName = "properties.adminUser")] + public string AdminUser { get; set; } + + /// + /// Gets or sets the total provisioned capacity in Bytes + /// + [JsonProperty(PropertyName = "properties.provisionedCapacityInBytes")] + public long ProvisionedCapacityInBytes { get; set; } + + /// + /// Gets the used capacity in Bytes. + /// + [JsonProperty(PropertyName = "properties.usedCapacityInBytes")] + public long? UsedCapacityInBytes { get; private set; } + + /// + /// Gets the local used capacity in Bytes. + /// + [JsonProperty(PropertyName = "properties.localUsedCapacityInBytes")] + public long? LocalUsedCapacityInBytes { get; private set; } + + /// + /// Gets or sets the monitoring status. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.monitoringStatus")] + public MonitoringStatus MonitoringStatus { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AdminUser == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AdminUser"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/IPConfig.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/IPConfig.cs new file mode 100644 index 000000000000..7ce847c4a8d4 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/IPConfig.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details related to the IP address configuration + /// + public partial class IPConfig + { + /// + /// Initializes a new instance of the IPConfig class. + /// + public IPConfig() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IPConfig class. + /// + /// The IP address of the network adapter, + /// either ipv4 or ipv6. + /// The gateway of the network adapter. + /// The prefix length of the network + /// adapter. + public IPConfig(string ipAddress, string gateway, int? prefixLength = default(int?)) + { + IpAddress = ipAddress; + PrefixLength = prefixLength; + Gateway = gateway; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the IP address of the network adapter, either ipv4 or + /// ipv6. + /// + [JsonProperty(PropertyName = "ipAddress")] + public string IpAddress { get; set; } + + /// + /// Gets or sets the prefix length of the network adapter. + /// + [JsonProperty(PropertyName = "prefixLength")] + public int? PrefixLength { get; set; } + + /// + /// Gets or sets the gateway of the network adapter. + /// + [JsonProperty(PropertyName = "gateway")] + public string Gateway { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (IpAddress == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "IpAddress"); + } + if (Gateway == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Gateway"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ISCSIDisk.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ISCSIDisk.cs new file mode 100644 index 000000000000..2cd92815d81d --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ISCSIDisk.cs @@ -0,0 +1,139 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The iSCSI disk. + /// + [Rest.Serialization.JsonTransformation] + public partial class ISCSIDisk : BaseModel + { + /// + /// Initializes a new instance of the ISCSIDisk class. + /// + public ISCSIDisk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ISCSIDisk class. + /// + /// The disk status. Possible values include: + /// 'Online', 'Offline' + /// The access control + /// records. + /// The data policy. Possible values include: + /// 'Invalid', 'Local', 'Tiered', 'Cloud' + /// The provisioned capacity + /// in bytes. + /// The monitoring. Possible values + /// include: 'Enabled', 'Disabled' + /// The identifier. + /// The name. + /// The type. + /// The description. + /// The used capacity in + /// bytes. + /// The local used capacity in + /// bytes. + public ISCSIDisk(DiskStatus diskStatus, IList accessControlRecords, DataPolicy dataPolicy, long provisionedCapacityInBytes, MonitoringStatus monitoringStatus, string id = default(string), string name = default(string), string type = default(string), string description = default(string), long? usedCapacityInBytes = default(long?), long? localUsedCapacityInBytes = default(long?)) + : base(id, name, type) + { + Description = description; + DiskStatus = diskStatus; + AccessControlRecords = accessControlRecords; + DataPolicy = dataPolicy; + ProvisionedCapacityInBytes = provisionedCapacityInBytes; + UsedCapacityInBytes = usedCapacityInBytes; + LocalUsedCapacityInBytes = localUsedCapacityInBytes; + MonitoringStatus = monitoringStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the disk status. Possible values include: 'Online', + /// 'Offline' + /// + [JsonProperty(PropertyName = "properties.diskStatus")] + public DiskStatus DiskStatus { get; set; } + + /// + /// Gets or sets the access control records. + /// + [JsonProperty(PropertyName = "properties.accessControlRecords")] + public IList AccessControlRecords { get; set; } + + /// + /// Gets or sets the data policy. Possible values include: 'Invalid', + /// 'Local', 'Tiered', 'Cloud' + /// + [JsonProperty(PropertyName = "properties.dataPolicy")] + public DataPolicy DataPolicy { get; set; } + + /// + /// Gets or sets the provisioned capacity in bytes. + /// + [JsonProperty(PropertyName = "properties.provisionedCapacityInBytes")] + public long ProvisionedCapacityInBytes { get; set; } + + /// + /// Gets the used capacity in bytes. + /// + [JsonProperty(PropertyName = "properties.usedCapacityInBytes")] + public long? UsedCapacityInBytes { get; private set; } + + /// + /// Gets the local used capacity in bytes. + /// + [JsonProperty(PropertyName = "properties.localUsedCapacityInBytes")] + public long? LocalUsedCapacityInBytes { get; private set; } + + /// + /// Gets or sets the monitoring. Possible values include: 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "properties.monitoringStatus")] + public MonitoringStatus MonitoringStatus { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AccessControlRecords == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AccessControlRecords"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ISCSIServer.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ISCSIServer.cs new file mode 100644 index 000000000000..1e7235ada6f0 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ISCSIServer.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The iSCSI server. + /// + [Rest.Serialization.JsonTransformation] + public partial class ISCSIServer : BaseModel + { + /// + /// Initializes a new instance of the ISCSIServer class. + /// + public ISCSIServer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ISCSIServer class. + /// + /// The storage domain id. + /// The backup policy id. + /// The identifier. + /// The name. + /// The type. + /// The description. + /// The chap id. + /// The reverse chap id. + public ISCSIServer(string storageDomainId, string backupScheduleGroupId, string id = default(string), string name = default(string), string type = default(string), string description = default(string), string chapId = default(string), string reverseChapId = default(string)) + : base(id, name, type) + { + StorageDomainId = storageDomainId; + BackupScheduleGroupId = backupScheduleGroupId; + Description = description; + ChapId = chapId; + ReverseChapId = reverseChapId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the storage domain id. + /// + [JsonProperty(PropertyName = "properties.storageDomainId")] + public string StorageDomainId { get; set; } + + /// + /// Gets or sets the backup policy id. + /// + [JsonProperty(PropertyName = "properties.backupScheduleGroupId")] + public string BackupScheduleGroupId { get; set; } + + /// + /// Gets or sets the description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the chap id. + /// + [JsonProperty(PropertyName = "properties.chapId")] + public string ChapId { get; set; } + + /// + /// Gets or sets the reverse chap id. + /// + [JsonProperty(PropertyName = "properties.reverseChapId")] + public string ReverseChapId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageDomainId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageDomainId"); + } + if (BackupScheduleGroupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BackupScheduleGroupId"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/InitiatedBy.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/InitiatedBy.cs new file mode 100644 index 000000000000..814c74876666 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/InitiatedBy.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for InitiatedBy. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum InitiatedBy + { + [EnumMember(Value = "Manual")] + Manual, + [EnumMember(Value = "Scheduled")] + Scheduled + } + internal static class InitiatedByEnumExtension + { + internal static string ToSerializedValue(this InitiatedBy? value) + { + return value == null ? null : ((InitiatedBy)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this InitiatedBy value) + { + switch( value ) + { + case InitiatedBy.Manual: + return "Manual"; + case InitiatedBy.Scheduled: + return "Scheduled"; + } + return null; + } + + internal static InitiatedBy? ParseInitiatedBy(this string value) + { + switch( value ) + { + case "Manual": + return InitiatedBy.Manual; + case "Scheduled": + return InitiatedBy.Scheduled; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Item.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Item.cs new file mode 100644 index 000000000000..77eee2c8bf36 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Item.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class Item + { + /// + /// Initializes a new instance of the Item class. + /// + public Item() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Item class. + /// + public Item(string key, string value) + { + Key = key; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "key")] + public string Key { get; set; } + + /// + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Key == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Key"); + } + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Job.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Job.cs new file mode 100644 index 000000000000..fff4c23e010f --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Job.cs @@ -0,0 +1,238 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Job. + /// + [Rest.Serialization.JsonTransformation] + public partial class Job : BaseModel + { + /// + /// Initializes a new instance of the Job class. + /// + public Job() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Job class. + /// + /// Current status of the job. Possible values + /// include: 'Invalid', 'Running', 'Succeeded', 'Failed', 'Canceled', + /// 'Paused', 'Scheduled' + /// The percentage of the job that is + /// already complete + /// Type of the job. Possible values include: + /// 'Backup', 'Clone', 'Failover', 'DownloadUpdates', + /// 'InstallUpdates' + /// The identifier. + /// The name. + /// The type. + /// The UTC time at which the job was + /// started + /// The UTC time at which the job + /// completed + /// The Error details. + /// Id of the object that is created by the + /// job + /// The entity identifier for which the job + /// ran. + /// The entity type for which the job + /// ran. + /// The job stages. + /// The device id in which the job is currently + /// running + /// Represents whether the job is + /// cancellable or not + /// stats properties for the job + /// The target type of the backup. Possible + /// values include: 'FileServer', 'DiskServer' + /// The source device identifier of the + /// failover job. + /// The time of the backup used for the + /// failover. + /// The download progress. + /// The install progress. + public Job(JobStatus status, int percentComplete, JobType jobType, string id = default(string), string name = default(string), string type = default(string), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), JobErrorDetails error = default(JobErrorDetails), string targetId = default(string), string entityId = default(string), string entityType = default(string), IList jobStages = default(IList), string deviceId = default(string), bool? isCancellable = default(bool?), JobStats stats = default(JobStats), TargetType? targetType = default(TargetType?), string sourceDeviceId = default(string), System.DateTime? backupPointInTime = default(System.DateTime?), UpdateDownloadProgress downloadProgress = default(UpdateDownloadProgress), UpdateInstallProgress installProgress = default(UpdateInstallProgress)) + : base(id, name, type) + { + Status = status; + StartTime = startTime; + EndTime = endTime; + PercentComplete = percentComplete; + Error = error; + JobType = jobType; + TargetId = targetId; + EntityId = entityId; + EntityType = entityType; + JobStages = jobStages; + DeviceId = deviceId; + IsCancellable = isCancellable; + Stats = stats; + TargetType = targetType; + SourceDeviceId = sourceDeviceId; + BackupPointInTime = backupPointInTime; + DownloadProgress = downloadProgress; + InstallProgress = installProgress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current status of the job. Possible values include: + /// 'Invalid', 'Running', 'Succeeded', 'Failed', 'Canceled', 'Paused', + /// 'Scheduled' + /// + [JsonProperty(PropertyName = "status")] + public JobStatus Status { get; set; } + + /// + /// Gets or sets the UTC time at which the job was started + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// Gets or sets the UTC time at which the job completed + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets the percentage of the job that is already complete + /// + [JsonProperty(PropertyName = "percentComplete")] + public int PercentComplete { get; set; } + + /// + /// Gets or sets the Error details. + /// + [JsonProperty(PropertyName = "error")] + public JobErrorDetails Error { get; set; } + + /// + /// Gets or sets type of the job. Possible values include: 'Backup', + /// 'Clone', 'Failover', 'DownloadUpdates', 'InstallUpdates' + /// + [JsonProperty(PropertyName = "properties.jobType")] + public JobType JobType { get; set; } + + /// + /// Gets or sets id of the object that is created by the job + /// + [JsonProperty(PropertyName = "properties.targetId")] + public string TargetId { get; set; } + + /// + /// Gets or sets the entity identifier for which the job ran. + /// + [JsonProperty(PropertyName = "properties.entityId")] + public string EntityId { get; set; } + + /// + /// Gets or sets the entity type for which the job ran. + /// + [JsonProperty(PropertyName = "properties.entityType")] + public string EntityType { get; set; } + + /// + /// Gets or sets the job stages. + /// + [JsonProperty(PropertyName = "properties.jobStages")] + public IList JobStages { get; set; } + + /// + /// Gets or sets the device id in which the job is currently running + /// + [JsonProperty(PropertyName = "properties.deviceId")] + public string DeviceId { get; set; } + + /// + /// Gets or sets represents whether the job is cancellable or not + /// + [JsonProperty(PropertyName = "properties.isCancellable")] + public bool? IsCancellable { get; set; } + + /// + /// Gets or sets stats properties for the job + /// + [JsonProperty(PropertyName = "properties.stats")] + public JobStats Stats { get; set; } + + /// + /// Gets or sets the target type of the backup. Possible values + /// include: 'FileServer', 'DiskServer' + /// + [JsonProperty(PropertyName = "properties.targetType")] + public TargetType? TargetType { get; set; } + + /// + /// Gets or sets the source device identifier of the failover job. + /// + [JsonProperty(PropertyName = "properties.sourceDeviceId")] + public string SourceDeviceId { get; set; } + + /// + /// Gets or sets the time of the backup used for the failover. + /// + [JsonProperty(PropertyName = "properties.backupPointInTime")] + public System.DateTime? BackupPointInTime { get; set; } + + /// + /// Gets or sets the download progress. + /// + [JsonProperty(PropertyName = "properties.downloadProgress")] + public UpdateDownloadProgress DownloadProgress { get; set; } + + /// + /// Gets or sets the install progress. + /// + [JsonProperty(PropertyName = "properties.installProgress")] + public UpdateInstallProgress InstallProgress { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Error != null) + { + Error.Validate(); + } + if (JobStages != null) + { + foreach (var element in JobStages) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobErrorDetails.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobErrorDetails.cs new file mode 100644 index 000000000000..08d01e217e15 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobErrorDetails.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The job error information containing List of JobErrorItem. + /// + public partial class JobErrorDetails + { + /// + /// Initializes a new instance of the JobErrorDetails class. + /// + public JobErrorDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobErrorDetails class. + /// + /// The code intended for programmatic + /// access + /// The message intended to describe the error in + /// detail + /// The error details. + public JobErrorDetails(string code, string message, IList errorDetails = default(IList)) + { + ErrorDetails = errorDetails; + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error details. + /// + [JsonProperty(PropertyName = "errorDetails")] + public IList ErrorDetails { get; set; } + + /// + /// Gets or sets the code intended for programmatic access + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the message intended to describe the error in detail + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Code == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Code"); + } + if (Message == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Message"); + } + if (ErrorDetails != null) + { + foreach (var element in ErrorDetails) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobErrorItem.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobErrorItem.cs new file mode 100644 index 000000000000..ae06fd38c8b8 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobErrorItem.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The job error items. + /// + public partial class JobErrorItem + { + /// + /// Initializes a new instance of the JobErrorItem class. + /// + public JobErrorItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobErrorItem class. + /// + /// The code intended for programmatic + /// access + /// The message intended to describe the error in + /// detail + /// The recommended actions. + public JobErrorItem(string code, string message, IList recommendations = default(IList)) + { + Recommendations = recommendations; + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the recommended actions. + /// + [JsonProperty(PropertyName = "recommendations")] + public IList Recommendations { get; set; } + + /// + /// Gets or sets the code intended for programmatic access + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets the message intended to describe the error in detail + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Code == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Code"); + } + if (Message == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Message"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobFilter.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobFilter.cs new file mode 100644 index 000000000000..ee0e4749e034 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobFilter.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Filters that can be specified for the job + /// + public partial class JobFilter + { + /// + /// Initializes a new instance of the JobFilter class. + /// + public JobFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobFilter class. + /// + /// The job type. Possible values include: + /// 'Backup', 'Clone', 'Failover', 'DownloadUpdates', + /// 'InstallUpdates' + /// The job status. Possible values include: + /// 'Invalid', 'Running', 'Succeeded', 'Failed', 'Canceled', 'Paused', + /// 'Scheduled' + /// The start time of the job. + public JobFilter(JobType jobType, JobStatus status, System.DateTime? startTime = default(System.DateTime?)) + { + JobType = jobType; + Status = status; + StartTime = startTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the job type. Possible values include: 'Backup', + /// 'Clone', 'Failover', 'DownloadUpdates', 'InstallUpdates' + /// + [JsonProperty(PropertyName = "jobType")] + public JobType JobType { get; set; } + + /// + /// Gets or sets the job status. Possible values include: 'Invalid', + /// 'Running', 'Succeeded', 'Failed', 'Canceled', 'Paused', 'Scheduled' + /// + [JsonProperty(PropertyName = "status")] + public JobStatus Status { get; set; } + + /// + /// Gets or sets the start time of the job. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobStage.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobStage.cs new file mode 100644 index 000000000000..792038411ab8 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobStage.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains details about the multiple job stages of a job + /// + public partial class JobStage + { + /// + /// Initializes a new instance of the JobStage class. + /// + public JobStage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobStage class. + /// + /// The stage status. Possible values + /// include: 'Invalid', 'Running', 'Succeeded', 'Failed', 'Canceled', + /// 'Paused', 'Scheduled' + /// The message of the job stage. + /// The details of the stage. + /// The error code of the stage if any. + public JobStage(JobStatus stageStatus, string message = default(string), string detail = default(string), string errorCode = default(string)) + { + Message = message; + StageStatus = stageStatus; + Detail = detail; + ErrorCode = errorCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the message of the job stage. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the stage status. Possible values include: 'Invalid', + /// 'Running', 'Succeeded', 'Failed', 'Canceled', 'Paused', 'Scheduled' + /// + [JsonProperty(PropertyName = "stageStatus")] + public JobStatus StageStatus { get; set; } + + /// + /// Gets or sets the details of the stage. + /// + [JsonProperty(PropertyName = "detail")] + public string Detail { get; set; } + + /// + /// Gets or sets the error code of the stage if any. + /// + [JsonProperty(PropertyName = "errorCode")] + public string ErrorCode { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobStats.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobStats.cs new file mode 100644 index 000000000000..d20b82562965 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobStats.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Stats that are available for all jobs in common + /// + public partial class JobStats + { + /// + /// Initializes a new instance of the JobStats class. + /// + public JobStats() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JobStats class. + /// + /// Completed work item + /// count. + /// Total work item count. + /// The estimated time + /// remaining. + public JobStats(int? completedWorkItemCount = default(int?), int? totalWorkItemCount = default(int?), int? estimatedTimeRemaining = default(int?)) + { + CompletedWorkItemCount = completedWorkItemCount; + TotalWorkItemCount = totalWorkItemCount; + EstimatedTimeRemaining = estimatedTimeRemaining; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets completed work item count. + /// + [JsonProperty(PropertyName = "completedWorkItemCount")] + public int? CompletedWorkItemCount { get; set; } + + /// + /// Gets or sets total work item count. + /// + [JsonProperty(PropertyName = "totalWorkItemCount")] + public int? TotalWorkItemCount { get; set; } + + /// + /// Gets or sets the estimated time remaining. + /// + [JsonProperty(PropertyName = "estimatedTimeRemaining")] + public int? EstimatedTimeRemaining { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobStatus.cs new file mode 100644 index 000000000000..98be015475b1 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobStatus.cs @@ -0,0 +1,90 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for JobStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum JobStatus + { + [EnumMember(Value = "Invalid")] + Invalid, + [EnumMember(Value = "Running")] + Running, + [EnumMember(Value = "Succeeded")] + Succeeded, + [EnumMember(Value = "Failed")] + Failed, + [EnumMember(Value = "Canceled")] + Canceled, + [EnumMember(Value = "Paused")] + Paused, + [EnumMember(Value = "Scheduled")] + Scheduled + } + internal static class JobStatusEnumExtension + { + internal static string ToSerializedValue(this JobStatus? value) + { + return value == null ? null : ((JobStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this JobStatus value) + { + switch( value ) + { + case JobStatus.Invalid: + return "Invalid"; + case JobStatus.Running: + return "Running"; + case JobStatus.Succeeded: + return "Succeeded"; + case JobStatus.Failed: + return "Failed"; + case JobStatus.Canceled: + return "Canceled"; + case JobStatus.Paused: + return "Paused"; + case JobStatus.Scheduled: + return "Scheduled"; + } + return null; + } + + internal static JobStatus? ParseJobStatus(this string value) + { + switch( value ) + { + case "Invalid": + return JobStatus.Invalid; + case "Running": + return JobStatus.Running; + case "Succeeded": + return JobStatus.Succeeded; + case "Failed": + return JobStatus.Failed; + case "Canceled": + return JobStatus.Canceled; + case "Paused": + return JobStatus.Paused; + case "Scheduled": + return JobStatus.Scheduled; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobType.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobType.cs new file mode 100644 index 000000000000..5a1094a612bb --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/JobType.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for JobType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum JobType + { + [EnumMember(Value = "Backup")] + Backup, + [EnumMember(Value = "Clone")] + Clone, + [EnumMember(Value = "Failover")] + Failover, + [EnumMember(Value = "DownloadUpdates")] + DownloadUpdates, + [EnumMember(Value = "InstallUpdates")] + InstallUpdates + } + internal static class JobTypeEnumExtension + { + internal static string ToSerializedValue(this JobType? value) + { + return value == null ? null : ((JobType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this JobType value) + { + switch( value ) + { + case JobType.Backup: + return "Backup"; + case JobType.Clone: + return "Clone"; + case JobType.Failover: + return "Failover"; + case JobType.DownloadUpdates: + return "DownloadUpdates"; + case JobType.InstallUpdates: + return "InstallUpdates"; + } + return null; + } + + internal static JobType? ParseJobType(this string value) + { + switch( value ) + { + case "Backup": + return JobType.Backup; + case "Clone": + return JobType.Clone; + case "Failover": + return JobType.Failover; + case "DownloadUpdates": + return JobType.DownloadUpdates; + case "InstallUpdates": + return JobType.InstallUpdates; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/KeyRolloverStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/KeyRolloverStatus.cs new file mode 100644 index 000000000000..af42a95c803e --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/KeyRolloverStatus.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for KeyRolloverStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum KeyRolloverStatus + { + [EnumMember(Value = "Required")] + Required, + [EnumMember(Value = "NotRequired")] + NotRequired + } + internal static class KeyRolloverStatusEnumExtension + { + internal static string ToSerializedValue(this KeyRolloverStatus? value) + { + return value == null ? null : ((KeyRolloverStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this KeyRolloverStatus value) + { + switch( value ) + { + case KeyRolloverStatus.Required: + return "Required"; + case KeyRolloverStatus.NotRequired: + return "NotRequired"; + } + return null; + } + + internal static KeyRolloverStatus? ParseKeyRolloverStatus(this string value) + { + switch( value ) + { + case "Required": + return KeyRolloverStatus.Required; + case "NotRequired": + return KeyRolloverStatus.NotRequired; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Manager.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Manager.cs new file mode 100644 index 000000000000..c2b48c53c015 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Manager.cs @@ -0,0 +1,110 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The StorSimple Manager + /// + [Rest.Serialization.JsonTransformation] + public partial class Manager : Resource + { + /// + /// Initializes a new instance of the Manager class. + /// + public Manager() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Manager class. + /// + /// The Geo location of the Manager + /// The Resource Id + /// The Resource Name + /// The Resource type + /// Tags attached to the Manager + /// Specifies if the Manager is + /// Garda or Helsinki + /// Specifies the state of the resource + /// as it is getting provisioned. Value of "Succeeded" means the + /// Manager was successfully created + /// ETag of the Manager + public Manager(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ManagerIntrinsicSettings cisIntrinsicSettings = default(ManagerIntrinsicSettings), string provisioningState = default(string), string etag = default(string)) + : base(location, id, name, type, tags) + { + CisIntrinsicSettings = cisIntrinsicSettings; + ProvisioningState = provisioningState; + Etag = etag; + CustomInit(); + } + /// + /// Static constructor for Manager class. + /// + static Manager() + { + Sku = new ManagerSku(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies if the Manager is Garda or Helsinki + /// + [JsonProperty(PropertyName = "properties.cisIntrinsicSettings")] + public ManagerIntrinsicSettings CisIntrinsicSettings { get; set; } + + /// + /// Gets specifies the state of the resource as it is getting + /// provisioned. Value of "Succeeded" means the Manager was + /// successfully created + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets eTag of the Manager + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + /// + /// Specifies the Sku + /// + [JsonProperty(PropertyName = "properties.sku")] + public static ManagerSku Sku { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (CisIntrinsicSettings != null) + { + CisIntrinsicSettings.Validate(); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerExtendedInfo.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerExtendedInfo.cs new file mode 100644 index 000000000000..9134668317b5 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerExtendedInfo.cs @@ -0,0 +1,136 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The extended info of the manager. + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagerExtendedInfo : BaseModel + { + /// + /// Initializes a new instance of the ManagerExtendedInfo class. + /// + public ManagerExtendedInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagerExtendedInfo class. + /// + /// Represents the CIK of the + /// resource + /// Represents the encryption algorithm used to + /// encrypt the other keys. None - if EncryptionKey is saved in plain + /// text format. AlgorithmName - if encryption is used + /// The identifier. + /// The name. + /// The type. + /// Represents the version of the ExtendedInfo + /// object being persisted + /// Represents the CEK of the + /// resource + /// Represents the Cert + /// thumbprint that was used to encrypt the CEK + /// Represents the portal + /// thumbprint which can be used optionally to encrypt the entire data + /// before storing it. + /// ETag of the Resource + public ManagerExtendedInfo(string integrityKey, string algorithm, string id = default(string), string name = default(string), string type = default(string), string version = default(string), string encryptionKey = default(string), string encryptionKeyThumbprint = default(string), string portalCertificateThumbprint = default(string), string etag = default(string)) + : base(id, name, type) + { + Version = version; + IntegrityKey = integrityKey; + EncryptionKey = encryptionKey; + EncryptionKeyThumbprint = encryptionKeyThumbprint; + PortalCertificateThumbprint = portalCertificateThumbprint; + Algorithm = algorithm; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets represents the version of the ExtendedInfo object + /// being persisted + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; set; } + + /// + /// Gets or sets represents the CIK of the resource + /// + [JsonProperty(PropertyName = "properties.integrityKey")] + public string IntegrityKey { get; set; } + + /// + /// Gets or sets represents the CEK of the resource + /// + [JsonProperty(PropertyName = "properties.encryptionKey")] + public string EncryptionKey { get; set; } + + /// + /// Gets or sets represents the Cert thumbprint that was used to + /// encrypt the CEK + /// + [JsonProperty(PropertyName = "properties.encryptionKeyThumbprint")] + public string EncryptionKeyThumbprint { get; set; } + + /// + /// Gets or sets represents the portal thumbprint which can be used + /// optionally to encrypt the entire data before storing it. + /// + [JsonProperty(PropertyName = "properties.portalCertificateThumbprint")] + public string PortalCertificateThumbprint { get; set; } + + /// + /// Gets or sets represents the encryption algorithm used to encrypt + /// the other keys. None - if EncryptionKey is saved in plain text + /// format. AlgorithmName - if encryption is used + /// + [JsonProperty(PropertyName = "properties.algorithm")] + public string Algorithm { get; set; } + + /// + /// Gets or sets eTag of the Resource + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (IntegrityKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "IntegrityKey"); + } + if (Algorithm == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Algorithm"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerIntrinsicSettings.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerIntrinsicSettings.cs new file mode 100644 index 000000000000..356dbb8426fb --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerIntrinsicSettings.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Intrinsic settings which refers to the type of the StorSimple manager + /// + public partial class ManagerIntrinsicSettings + { + /// + /// Initializes a new instance of the ManagerIntrinsicSettings class. + /// + public ManagerIntrinsicSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagerIntrinsicSettings class. + /// + /// Refers to the type of the StorSimple Manager. + /// Possible values include: 'GardaV1', 'HelsinkiV1' + public ManagerIntrinsicSettings(ManagerType type) + { + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets refers to the type of the StorSimple Manager. Possible + /// values include: 'GardaV1', 'HelsinkiV1' + /// + [JsonProperty(PropertyName = "type")] + public ManagerType Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerPatch.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerPatch.cs new file mode 100644 index 000000000000..563f63d657e9 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerPatch.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The StorSimple Manager patch. + /// + public partial class ManagerPatch + { + /// + /// Initializes a new instance of the ManagerPatch class. + /// + public ManagerPatch() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagerPatch class. + /// + /// The tags attached to the StorSimple + /// Manager. + public ManagerPatch(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tags attached to the StorSimple Manager. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerSku.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerSku.cs new file mode 100644 index 000000000000..f848c23a1097 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerSku.cs @@ -0,0 +1,49 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Sku. + /// + public partial class ManagerSku + { + /// + /// Initializes a new instance of the ManagerSku class. + /// + public ManagerSku() + { + CustomInit(); + } + + /// + /// Static constructor for ManagerSku class. + /// + static ManagerSku() + { + Name = "Standard"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Refers to the sku name which should be "Standard" + /// + [JsonProperty(PropertyName = "name")] + public static string Name { get; private set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerType.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerType.cs new file mode 100644 index 000000000000..96e03e2ccdc6 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ManagerType.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ManagerType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ManagerType + { + [EnumMember(Value = "GardaV1")] + GardaV1, + [EnumMember(Value = "HelsinkiV1")] + HelsinkiV1 + } + internal static class ManagerTypeEnumExtension + { + internal static string ToSerializedValue(this ManagerType? value) + { + return value == null ? null : ((ManagerType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ManagerType value) + { + switch( value ) + { + case ManagerType.GardaV1: + return "GardaV1"; + case ManagerType.HelsinkiV1: + return "HelsinkiV1"; + } + return null; + } + + internal static ManagerType? ParseManagerType(this string value) + { + switch( value ) + { + case "GardaV1": + return ManagerType.GardaV1; + case "HelsinkiV1": + return ManagerType.HelsinkiV1; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Message.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Message.cs new file mode 100644 index 000000000000..307e6a01fdd6 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Message.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class Message + { + /// + /// Initializes a new instance of the Message class. + /// + public Message() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Message class. + /// + public Message(string language = default(string), string value = default(string)) + { + Language = language; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "language")] + public string Language { get; set; } + + /// + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricAggregationType.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricAggregationType.cs new file mode 100644 index 000000000000..e537594a96b5 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricAggregationType.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for MetricAggregationType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum MetricAggregationType + { + [EnumMember(Value = "Average")] + Average, + [EnumMember(Value = "Last")] + Last, + [EnumMember(Value = "Maximum")] + Maximum, + [EnumMember(Value = "Minimum")] + Minimum, + [EnumMember(Value = "None")] + None, + [EnumMember(Value = "Total")] + Total + } + internal static class MetricAggregationTypeEnumExtension + { + internal static string ToSerializedValue(this MetricAggregationType? value) + { + return value == null ? null : ((MetricAggregationType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this MetricAggregationType value) + { + switch( value ) + { + case MetricAggregationType.Average: + return "Average"; + case MetricAggregationType.Last: + return "Last"; + case MetricAggregationType.Maximum: + return "Maximum"; + case MetricAggregationType.Minimum: + return "Minimum"; + case MetricAggregationType.None: + return "None"; + case MetricAggregationType.Total: + return "Total"; + } + return null; + } + + internal static MetricAggregationType? ParseMetricAggregationType(this string value) + { + switch( value ) + { + case "Average": + return MetricAggregationType.Average; + case "Last": + return MetricAggregationType.Last; + case "Maximum": + return MetricAggregationType.Maximum; + case "Minimum": + return MetricAggregationType.Minimum; + case "None": + return MetricAggregationType.None; + case "Total": + return MetricAggregationType.Total; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricAvailablity.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricAvailablity.cs new file mode 100644 index 000000000000..5ef97e90b96d --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricAvailablity.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metric availability specifies the time grain (aggregation interval or + /// frequency) and the retention period for that time grain + /// + public partial class MetricAvailablity + { + /// + /// Initializes a new instance of the MetricAvailablity class. + /// + public MetricAvailablity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricAvailablity class. + /// + /// The time grain, specifies the aggregation + /// interval for the metric. + /// The retention period for the metric at the + /// specified timegrain + public MetricAvailablity(string timeGrain, string retention) + { + TimeGrain = timeGrain; + Retention = retention; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the time grain, specifies the aggregation interval for + /// the metric. + /// + [JsonProperty(PropertyName = "timeGrain")] + public string TimeGrain { get; set; } + + /// + /// Gets or sets the retention period for the metric at the specified + /// timegrain + /// + [JsonProperty(PropertyName = "retention")] + public string Retention { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TimeGrain == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TimeGrain"); + } + if (Retention == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Retention"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricData.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricData.cs new file mode 100644 index 000000000000..a77530cf820b --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricData.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The metric data. + /// + public partial class MetricData + { + /// + /// Initializes a new instance of the MetricData class. + /// + public MetricData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricData class. + /// + /// The time when the metric data is + /// fetched + /// The sum of all the samples available in the given + /// instance of time for the specific metric data + /// The count of samples of the metric data + /// available for the given instance + /// The average of all sample for the given + /// instance + /// The minimum of all samples available + /// The maximum of all samples available + public MetricData(System.DateTime timeStamp, double sum, int count, double average, double minimum, double maximum) + { + TimeStamp = timeStamp; + Sum = sum; + Count = count; + Average = average; + Minimum = minimum; + Maximum = maximum; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the time when the metric data is fetched + /// + [JsonProperty(PropertyName = "timeStamp")] + public System.DateTime TimeStamp { get; set; } + + /// + /// Gets or sets the sum of all the samples available in the given + /// instance of time for the specific metric data + /// + [JsonProperty(PropertyName = "sum")] + public double Sum { get; set; } + + /// + /// Gets or sets the count of samples of the metric data available for + /// the given instance + /// + [JsonProperty(PropertyName = "count")] + public int Count { get; set; } + + /// + /// Gets or sets the average of all sample for the given instance + /// + [JsonProperty(PropertyName = "average")] + public double Average { get; set; } + + /// + /// Gets or sets the minimum of all samples available + /// + [JsonProperty(PropertyName = "minimum")] + public double Minimum { get; set; } + + /// + /// Gets or sets the maximum of all samples available + /// + [JsonProperty(PropertyName = "maximum")] + public double Maximum { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricDefinition.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricDefinition.cs new file mode 100644 index 000000000000..8ac6bc7c40b9 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricDefinition.cs @@ -0,0 +1,162 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Monitoring metric definition represents the metadata of the metrics. + /// + public partial class MetricDefinition + { + /// + /// Initializes a new instance of the MetricDefinition class. + /// + public MetricDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricDefinition class. + /// + /// The metric name + /// The metric unit. Possible values include: + /// 'Bytes', 'BytesPerSecond', 'Count', 'CountPerSecond', 'Percent', + /// 'Seconds' + /// The metric aggregation type. + /// Possible values include: 'Average', 'Last', 'Maximum', 'Minimum', + /// 'None', 'Total' + /// The metric source id + /// The available metric + /// granularities + /// The supported dimensions + /// The metric definition type + public MetricDefinition(MetricName name, MetricUnit unit, MetricAggregationType primaryAggregationType, string resourceId, IList metricAvailabilities, IList dimensions, string type) + { + Name = name; + Unit = unit; + PrimaryAggregationType = primaryAggregationType; + ResourceId = resourceId; + MetricAvailabilities = metricAvailabilities; + Dimensions = dimensions; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metric name + /// + [JsonProperty(PropertyName = "name")] + public MetricName Name { get; set; } + + /// + /// Gets or sets the metric unit. Possible values include: 'Bytes', + /// 'BytesPerSecond', 'Count', 'CountPerSecond', 'Percent', 'Seconds' + /// + [JsonProperty(PropertyName = "unit")] + public MetricUnit Unit { get; set; } + + /// + /// Gets or sets the metric aggregation type. Possible values include: + /// 'Average', 'Last', 'Maximum', 'Minimum', 'None', 'Total' + /// + [JsonProperty(PropertyName = "primaryAggregationType")] + public MetricAggregationType PrimaryAggregationType { get; set; } + + /// + /// Gets or sets the metric source id + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets the available metric granularities + /// + [JsonProperty(PropertyName = "metricAvailabilities")] + public IList MetricAvailabilities { get; set; } + + /// + /// Gets or sets the supported dimensions + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Gets or sets the metric definition type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (ResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); + } + if (MetricAvailabilities == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MetricAvailabilities"); + } + if (Dimensions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Dimensions"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + if (Name != null) + { + Name.Validate(); + } + if (MetricAvailabilities != null) + { + foreach (var element in MetricAvailabilities) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Dimensions != null) + { + foreach (var element1 in Dimensions) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricDimension.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricDimension.cs new file mode 100644 index 000000000000..a291e6b7afd5 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricDimension.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metric dimension + /// + public partial class MetricDimension + { + /// + /// Initializes a new instance of the MetricDimension class. + /// + public MetricDimension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricDimension class. + /// + /// Metric dimension name + /// Metric dimension values + public MetricDimension(string name, string value) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets metric dimension name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets metric dimension values + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricFilter.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricFilter.cs new file mode 100644 index 000000000000..03f041cfb2ba --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricFilter.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// class representing the filters to be passed while fetching metrics + /// + public partial class MetricFilter + { + /// + /// Initializes a new instance of the MetricFilter class. + /// + public MetricFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricFilter class. + /// + /// filter for name property + /// starttime for fetching metrics + /// endtime for fetching metrics + /// timegrain of the metrics + public MetricFilter(MetricNameFilter name = default(MetricNameFilter), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), string timeGrain = default(string)) + { + Name = name; + StartTime = startTime; + EndTime = endTime; + TimeGrain = timeGrain; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets filter for name property + /// + [JsonProperty(PropertyName = "name")] + public MetricNameFilter Name { get; set; } + + /// + /// Gets or sets starttime for fetching metrics + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// Gets or sets endtime for fetching metrics + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets timegrain of the metrics + /// + [JsonProperty(PropertyName = "timeGrain")] + public string TimeGrain { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricName.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricName.cs new file mode 100644 index 000000000000..58bf192b78be --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricName.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The name of the metric + /// + public partial class MetricName + { + /// + /// Initializes a new instance of the MetricName class. + /// + public MetricName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricName class. + /// + /// Name of the metric + /// Localized name of the metric + public MetricName(string value, string localizedValue) + { + Value = value; + LocalizedValue = localizedValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the metric + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets localized name of the metric + /// + [JsonProperty(PropertyName = "localizedValue")] + public string LocalizedValue { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + if (LocalizedValue == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "LocalizedValue"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricNameFilter.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricNameFilter.cs new file mode 100644 index 000000000000..80179b157187 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricNameFilter.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class representing the name filter to be passed while fetching metrics + /// + public partial class MetricNameFilter + { + /// + /// Initializes a new instance of the MetricNameFilter class. + /// + public MetricNameFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricNameFilter class. + /// + /// The value. + public MetricNameFilter(string value = default(string)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the value. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricUnit.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricUnit.cs new file mode 100644 index 000000000000..fea8dfe81fec --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MetricUnit.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for MetricUnit. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum MetricUnit + { + [EnumMember(Value = "Bytes")] + Bytes, + [EnumMember(Value = "BytesPerSecond")] + BytesPerSecond, + [EnumMember(Value = "Count")] + Count, + [EnumMember(Value = "CountPerSecond")] + CountPerSecond, + [EnumMember(Value = "Percent")] + Percent, + [EnumMember(Value = "Seconds")] + Seconds + } + internal static class MetricUnitEnumExtension + { + internal static string ToSerializedValue(this MetricUnit? value) + { + return value == null ? null : ((MetricUnit)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this MetricUnit value) + { + switch( value ) + { + case MetricUnit.Bytes: + return "Bytes"; + case MetricUnit.BytesPerSecond: + return "BytesPerSecond"; + case MetricUnit.Count: + return "Count"; + case MetricUnit.CountPerSecond: + return "CountPerSecond"; + case MetricUnit.Percent: + return "Percent"; + case MetricUnit.Seconds: + return "Seconds"; + } + return null; + } + + internal static MetricUnit? ParseMetricUnit(this string value) + { + switch( value ) + { + case "Bytes": + return MetricUnit.Bytes; + case "BytesPerSecond": + return MetricUnit.BytesPerSecond; + case "Count": + return MetricUnit.Count; + case "CountPerSecond": + return MetricUnit.CountPerSecond; + case "Percent": + return MetricUnit.Percent; + case "Seconds": + return MetricUnit.Seconds; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Metrics.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Metrics.cs new file mode 100644 index 000000000000..057923131601 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Metrics.cs @@ -0,0 +1,194 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Monitoring metric + /// + public partial class Metrics + { + /// + /// Initializes a new instance of the Metrics class. + /// + public Metrics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Metrics class. + /// + /// The id of metric source + /// The metric start time + /// The metric end time + /// The time grain, time grain indicates + /// frequency of the metric data + /// The metric aggregation type. + /// Possible values include: 'Average', 'Last', 'Maximum', 'Minimum', + /// 'None', 'Total' + /// The name of the metrics + /// The Metric dimension which indicates the + /// source of the metric + /// The unit of the metric data. Possible values + /// include: 'Bytes', 'BytesPerSecond', 'Count', 'CountPerSecond', + /// 'Percent', 'Seconds' + /// The Type of the metric data + /// The metric data + public Metrics(string resourceId, System.DateTime startTime, System.DateTime endTime, string timeGrain, MetricAggregationType primaryAggregation, MetricName name, IList dimensions, MetricUnit unit, string type, IList values) + { + ResourceId = resourceId; + StartTime = startTime; + EndTime = endTime; + TimeGrain = timeGrain; + PrimaryAggregation = primaryAggregation; + Name = name; + Dimensions = dimensions; + Unit = unit; + Type = type; + Values = values; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the id of metric source + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets the metric start time + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime StartTime { get; set; } + + /// + /// Gets or sets the metric end time + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime EndTime { get; set; } + + /// + /// Gets or sets the time grain, time grain indicates frequency of the + /// metric data + /// + [JsonProperty(PropertyName = "timeGrain")] + public string TimeGrain { get; set; } + + /// + /// Gets or sets the metric aggregation type. Possible values include: + /// 'Average', 'Last', 'Maximum', 'Minimum', 'None', 'Total' + /// + [JsonProperty(PropertyName = "primaryAggregation")] + public MetricAggregationType PrimaryAggregation { get; set; } + + /// + /// Gets or sets the name of the metrics + /// + [JsonProperty(PropertyName = "name")] + public MetricName Name { get; set; } + + /// + /// Gets or sets the Metric dimension which indicates the source of the + /// metric + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Gets or sets the unit of the metric data. Possible values include: + /// 'Bytes', 'BytesPerSecond', 'Count', 'CountPerSecond', 'Percent', + /// 'Seconds' + /// + [JsonProperty(PropertyName = "unit")] + public MetricUnit Unit { get; set; } + + /// + /// Gets or sets the Type of the metric data + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the metric data + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); + } + if (TimeGrain == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TimeGrain"); + } + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Dimensions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Dimensions"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + if (Values == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Values"); + } + if (Name != null) + { + Name.Validate(); + } + if (Dimensions != null) + { + foreach (var element in Dimensions) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Values != null) + { + foreach (var element1 in Values) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MonitoringStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MonitoringStatus.cs new file mode 100644 index 000000000000..c3fec8bc69be --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/MonitoringStatus.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for MonitoringStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum MonitoringStatus + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class MonitoringStatusEnumExtension + { + internal static string ToSerializedValue(this MonitoringStatus? value) + { + return value == null ? null : ((MonitoringStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this MonitoringStatus value) + { + switch( value ) + { + case MonitoringStatus.Enabled: + return "Enabled"; + case MonitoringStatus.Disabled: + return "Disabled"; + } + return null; + } + + internal static MonitoringStatus? ParseMonitoringStatus(this string value) + { + switch( value ) + { + case "Enabled": + return MonitoringStatus.Enabled; + case "Disabled": + return MonitoringStatus.Disabled; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/NetworkAdapter.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/NetworkAdapter.cs new file mode 100644 index 000000000000..7ee301f102cd --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/NetworkAdapter.cs @@ -0,0 +1,110 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a networkAdapter in a particular node. + /// + public partial class NetworkAdapter + { + /// + /// Initializes a new instance of the NetworkAdapter class. + /// + public NetworkAdapter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkAdapter class. + /// + /// The name of the network + /// adapter. + /// Represents state of DHCP. Possible values + /// include: 'Enabled', 'Disabled' + /// The ipv4 configuration of the network + /// adapter. + /// The ipv6 configuration of the network + /// adapter. + /// The speed of the network adapter. + public NetworkAdapter(string networkAdapterName, DhcpStatus dhcpStatus, IPConfig iPv4Info = default(IPConfig), IPConfig iPv6Info = default(IPConfig), long? linkSpeed = default(long?)) + { + NetworkAdapterName = networkAdapterName; + IPv4Info = iPv4Info; + IPv6Info = iPv6Info; + DhcpStatus = dhcpStatus; + LinkSpeed = linkSpeed; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the network adapter. + /// + [JsonProperty(PropertyName = "networkAdapterName")] + public string NetworkAdapterName { get; set; } + + /// + /// Gets or sets the ipv4 configuration of the network adapter. + /// + [JsonProperty(PropertyName = "iPv4Info")] + public IPConfig IPv4Info { get; set; } + + /// + /// Gets or sets the ipv6 configuration of the network adapter. + /// + [JsonProperty(PropertyName = "iPv6Info")] + public IPConfig IPv6Info { get; set; } + + /// + /// Gets or sets represents state of DHCP. Possible values include: + /// 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "dhcpStatus")] + public DhcpStatus DhcpStatus { get; set; } + + /// + /// Gets or sets the speed of the network adapter. + /// + [JsonProperty(PropertyName = "linkSpeed")] + public long? LinkSpeed { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (NetworkAdapterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "NetworkAdapterName"); + } + if (IPv4Info != null) + { + IPv4Info.Validate(); + } + if (IPv6Info != null) + { + IPv6Info.Validate(); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/NetworkSettings.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/NetworkSettings.cs new file mode 100644 index 000000000000..af194202178a --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/NetworkSettings.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The NetworkSettings of a device + /// + [Rest.Serialization.JsonTransformation] + public partial class NetworkSettings : BaseModel + { + /// + /// Initializes a new instance of the NetworkSettings class. + /// + public NetworkSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkSettings class. + /// + /// The Primary DNS server for the + /// device + /// The NetworkAdapters under each node of + /// the device. + /// The identifier. + /// The name. + /// The type. + /// The secondary DNS server for the + /// device + public NetworkSettings(string primaryDnsServer, IList nodeNetworks, string id = default(string), string name = default(string), string type = default(string), string secondaryDnsServer = default(string)) + : base(id, name, type) + { + PrimaryDnsServer = primaryDnsServer; + SecondaryDnsServer = secondaryDnsServer; + NodeNetworks = nodeNetworks; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Primary DNS server for the device + /// + [JsonProperty(PropertyName = "properties.primaryDnsServer")] + public string PrimaryDnsServer { get; set; } + + /// + /// Gets or sets the secondary DNS server for the device + /// + [JsonProperty(PropertyName = "properties.secondaryDnsServer")] + public string SecondaryDnsServer { get; set; } + + /// + /// Gets or sets the NetworkAdapters under each node of the device. + /// + [JsonProperty(PropertyName = "properties.nodeNetworks")] + public IList NodeNetworks { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrimaryDnsServer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrimaryDnsServer"); + } + if (NodeNetworks == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "NodeNetworks"); + } + if (NodeNetworks != null) + { + foreach (var element in NodeNetworks) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/NodeNetwork.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/NodeNetwork.cs new file mode 100644 index 000000000000..e3097aab02ca --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/NodeNetwork.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a single node in a device. + /// + public partial class NodeNetwork + { + /// + /// Initializes a new instance of the NodeNetwork class. + /// + public NodeNetwork() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NodeNetwork class. + /// + /// The array of network adapters in the + /// node. + public NodeNetwork(IList networkAdapters) + { + NetworkAdapters = networkAdapters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the array of network adapters in the node. + /// + [JsonProperty(PropertyName = "networkAdapters")] + public IList NetworkAdapters { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (NetworkAdapters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "NetworkAdapters"); + } + if (NetworkAdapters != null) + { + foreach (var element in NetworkAdapters) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Page.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..839ab10b82a9 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Page1.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Page1.cs new file mode 100644 index 000000000000..b39c185f412a --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Page1.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page1 : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Resource.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..9375dfd1b212 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Resource.cs @@ -0,0 +1,100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Azure Resource. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// The Geo location of the Manager + /// The Resource Id + /// The Resource Name + /// The Resource type + /// Tags attached to the Manager + public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the Resource Name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the Resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the Geo location of the Manager + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets tags attached to the Manager + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SecuritySettings.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SecuritySettings.cs new file mode 100644 index 000000000000..f257c8eb7ece --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SecuritySettings.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SecuritySettings of a device + /// + [Rest.Serialization.JsonTransformation] + public partial class SecuritySettings : BaseModel + { + /// + /// Initializes a new instance of the SecuritySettings class. + /// + public SecuritySettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecuritySettings class. + /// + /// Device administrator password as + /// an encrypted string (encrypted using RSA PKCS #1) is used to log + /// into the local web UI of the device. Actual password could have at + /// least 8 characters that are a combination of uppercase, lowercase, + /// numeric, and special characters + /// The identifier. + /// The name. + /// The type. + public SecuritySettings(AsymmetricEncryptedSecret deviceAdminPassword, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + DeviceAdminPassword = deviceAdminPassword; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets device administrator password as an encrypted string + /// (encrypted using RSA PKCS #1) is used to log into the local web UI + /// of the device. Actual password could have at least 8 characters + /// that are a combination of uppercase, lowercase, numeric, and + /// special characters + /// + [JsonProperty(PropertyName = "properties.deviceAdminPassword")] + public AsymmetricEncryptedSecret DeviceAdminPassword { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DeviceAdminPassword == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DeviceAdminPassword"); + } + if (DeviceAdminPassword != null) + { + DeviceAdminPassword.Validate(); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SendTestAlertEmailRequest.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SendTestAlertEmailRequest.cs new file mode 100644 index 000000000000..a168cbf3969d --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SendTestAlertEmailRequest.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Request for sending test alert email + /// + public partial class SendTestAlertEmailRequest + { + /// + /// Initializes a new instance of the SendTestAlertEmailRequest class. + /// + public SendTestAlertEmailRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SendTestAlertEmailRequest class. + /// + /// List of emails to send the test + /// alerts + public SendTestAlertEmailRequest(IList emailList) + { + EmailList = emailList; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of emails to send the test alerts + /// + [JsonProperty(PropertyName = "emailList")] + public IList EmailList { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EmailList == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EmailList"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ServiceOwnersAlertNotificationStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ServiceOwnersAlertNotificationStatus.cs new file mode 100644 index 000000000000..7d4b4b520253 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ServiceOwnersAlertNotificationStatus.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ServiceOwnersAlertNotificationStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ServiceOwnersAlertNotificationStatus + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class ServiceOwnersAlertNotificationStatusEnumExtension + { + internal static string ToSerializedValue(this ServiceOwnersAlertNotificationStatus? value) + { + return value == null ? null : ((ServiceOwnersAlertNotificationStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ServiceOwnersAlertNotificationStatus value) + { + switch( value ) + { + case ServiceOwnersAlertNotificationStatus.Enabled: + return "Enabled"; + case ServiceOwnersAlertNotificationStatus.Disabled: + return "Disabled"; + } + return null; + } + + internal static ServiceOwnersAlertNotificationStatus? ParseServiceOwnersAlertNotificationStatus(this string value) + { + switch( value ) + { + case "Enabled": + return ServiceOwnersAlertNotificationStatus.Enabled; + case "Disabled": + return ServiceOwnersAlertNotificationStatus.Disabled; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ShareStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ShareStatus.cs new file mode 100644 index 000000000000..f109e69810b3 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/ShareStatus.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ShareStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ShareStatus + { + [EnumMember(Value = "Online")] + Online, + [EnumMember(Value = "Offline")] + Offline + } + internal static class ShareStatusEnumExtension + { + internal static string ToSerializedValue(this ShareStatus? value) + { + return value == null ? null : ((ShareStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ShareStatus value) + { + switch( value ) + { + case ShareStatus.Online: + return "Online"; + case ShareStatus.Offline: + return "Offline"; + } + return null; + } + + internal static ShareStatus? ParseShareStatus(this string value) + { + switch( value ) + { + case "Online": + return ShareStatus.Online; + case "Offline": + return ShareStatus.Offline; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SslStatus.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SslStatus.cs new file mode 100644 index 000000000000..f298f67216d3 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SslStatus.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SslStatus. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SslStatus + { + [EnumMember(Value = "Enabled")] + Enabled, + [EnumMember(Value = "Disabled")] + Disabled + } + internal static class SslStatusEnumExtension + { + internal static string ToSerializedValue(this SslStatus? value) + { + return value == null ? null : ((SslStatus)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SslStatus value) + { + switch( value ) + { + case SslStatus.Enabled: + return "Enabled"; + case SslStatus.Disabled: + return "Disabled"; + } + return null; + } + + internal static SslStatus? ParseSslStatus(this string value) + { + switch( value ) + { + case "Enabled": + return SslStatus.Enabled; + case "Disabled": + return SslStatus.Disabled; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/StorageAccountCredential.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/StorageAccountCredential.cs new file mode 100644 index 000000000000..46020dc59e19 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/StorageAccountCredential.cs @@ -0,0 +1,124 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The storage account credential + /// + [Rest.Serialization.JsonTransformation] + public partial class StorageAccountCredential : BaseModel + { + /// + /// Initializes a new instance of the StorageAccountCredential class. + /// + public StorageAccountCredential() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageAccountCredential class. + /// + /// The cloud service provider. Possible values + /// include: 'Azure', 'S3', 'S3_RRS', 'OpenStack', 'HP' + /// The storage endpoint + /// The storage account login + /// SSL needs to be enabled or not. Possible + /// values include: 'Enabled', 'Disabled' + /// The identifier. + /// The name. + /// The type. + /// The storage account's geo location + /// The details of the storage account + /// password + public StorageAccountCredential(CloudType cloudType, string endPoint, string login, SslStatus enableSSL, string id = default(string), string name = default(string), string type = default(string), string location = default(string), AsymmetricEncryptedSecret accessKey = default(AsymmetricEncryptedSecret)) + : base(id, name, type) + { + CloudType = cloudType; + EndPoint = endPoint; + Login = login; + Location = location; + EnableSSL = enableSSL; + AccessKey = accessKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the cloud service provider. Possible values include: + /// 'Azure', 'S3', 'S3_RRS', 'OpenStack', 'HP' + /// + [JsonProperty(PropertyName = "properties.cloudType")] + public CloudType CloudType { get; set; } + + /// + /// Gets or sets the storage endpoint + /// + [JsonProperty(PropertyName = "properties.endPoint")] + public string EndPoint { get; set; } + + /// + /// Gets or sets the storage account login + /// + [JsonProperty(PropertyName = "properties.login")] + public string Login { get; set; } + + /// + /// Gets or sets the storage account's geo location + /// + [JsonProperty(PropertyName = "properties.location")] + public string Location { get; set; } + + /// + /// Gets or sets SSL needs to be enabled or not. Possible values + /// include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.enableSSL")] + public SslStatus EnableSSL { get; set; } + + /// + /// Gets or sets the details of the storage account password + /// + [JsonProperty(PropertyName = "properties.accessKey")] + public AsymmetricEncryptedSecret AccessKey { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EndPoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EndPoint"); + } + if (Login == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Login"); + } + if (AccessKey != null) + { + AccessKey.Validate(); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/StorageDomain.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/StorageDomain.cs new file mode 100644 index 000000000000..8737673fa078 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/StorageDomain.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The storage domain. + /// + [Rest.Serialization.JsonTransformation] + public partial class StorageDomain : BaseModel + { + /// + /// Initializes a new instance of the StorageDomain class. + /// + public StorageDomain() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StorageDomain class. + /// + /// The storage account + /// credentials. + /// The encryption status "Enabled | + /// Disabled". Possible values include: 'Enabled', 'Disabled' + /// The identifier. + /// The name. + /// The type. + /// The encryption key used to encrypt the + /// data. This is a user secret. + public StorageDomain(IList storageAccountCredentialIds, EncryptionStatus encryptionStatus, string id = default(string), string name = default(string), string type = default(string), AsymmetricEncryptedSecret encryptionKey = default(AsymmetricEncryptedSecret)) + : base(id, name, type) + { + StorageAccountCredentialIds = storageAccountCredentialIds; + EncryptionKey = encryptionKey; + EncryptionStatus = encryptionStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the storage account credentials. + /// + [JsonProperty(PropertyName = "properties.storageAccountCredentialIds")] + public IList StorageAccountCredentialIds { get; set; } + + /// + /// Gets or sets the encryption key used to encrypt the data. This is a + /// user secret. + /// + [JsonProperty(PropertyName = "properties.encryptionKey")] + public AsymmetricEncryptedSecret EncryptionKey { get; set; } + + /// + /// Gets or sets the encryption status "Enabled | Disabled". Possible + /// values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.encryptionStatus")] + public EncryptionStatus EncryptionStatus { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StorageAccountCredentialIds == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "StorageAccountCredentialIds"); + } + if (EncryptionKey != null) + { + EncryptionKey.Validate(); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SupportedDeviceCapabilities.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SupportedDeviceCapabilities.cs new file mode 100644 index 000000000000..ed9a29ed110e --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SupportedDeviceCapabilities.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for SupportedDeviceCapabilities. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SupportedDeviceCapabilities + { + [EnumMember(Value = "Invalid")] + Invalid, + [EnumMember(Value = "FileServer")] + FileServer, + [EnumMember(Value = "IscsiServer")] + IscsiServer + } + internal static class SupportedDeviceCapabilitiesEnumExtension + { + internal static string ToSerializedValue(this SupportedDeviceCapabilities? value) + { + return value == null ? null : ((SupportedDeviceCapabilities)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SupportedDeviceCapabilities value) + { + switch( value ) + { + case SupportedDeviceCapabilities.Invalid: + return "Invalid"; + case SupportedDeviceCapabilities.FileServer: + return "FileServer"; + case SupportedDeviceCapabilities.IscsiServer: + return "IscsiServer"; + } + return null; + } + + internal static SupportedDeviceCapabilities? ParseSupportedDeviceCapabilities(this string value) + { + switch( value ) + { + case "Invalid": + return SupportedDeviceCapabilities.Invalid; + case "FileServer": + return SupportedDeviceCapabilities.FileServer; + case "IscsiServer": + return SupportedDeviceCapabilities.IscsiServer; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SymmetricEncryptedSecret.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SymmetricEncryptedSecret.cs new file mode 100644 index 000000000000..414553eb3d93 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/SymmetricEncryptedSecret.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// This class can be used as the Type for any secret entity represented as + /// Value, ValueCertificateThumbprint, EncryptionAlgorithm. In this case, + /// "Value" is a secret and the "valueThumbprint" represents the + /// certificate thumbprint of the value. The algorithm field is mainly for + /// future usage to potentially allow different entities encrypted using + /// different algorithms. + /// + public partial class SymmetricEncryptedSecret + { + /// + /// Initializes a new instance of the SymmetricEncryptedSecret class. + /// + public SymmetricEncryptedSecret() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SymmetricEncryptedSecret class. + /// + /// The value of the secret itself. If the secret + /// is in plaintext or null then EncryptionAlgorithm will be + /// none + /// Algorithm used to encrypt + /// "Value". Possible values include: 'None', 'AES256', + /// 'RSAES_PKCS1_v_1_5' + /// Thumbprint cert that was + /// used to encrypt "Value" + public SymmetricEncryptedSecret(string value, EncryptionAlgorithm encryptionAlgorithm, string valueCertificateThumbprint = default(string)) + { + Value = value; + ValueCertificateThumbprint = valueCertificateThumbprint; + EncryptionAlgorithm = encryptionAlgorithm; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the value of the secret itself. If the secret is in + /// plaintext or null then EncryptionAlgorithm will be none + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets thumbprint cert that was used to encrypt "Value" + /// + [JsonProperty(PropertyName = "valueCertificateThumbprint")] + public string ValueCertificateThumbprint { get; set; } + + /// + /// Gets or sets algorithm used to encrypt "Value". Possible values + /// include: 'None', 'AES256', 'RSAES_PKCS1_v_1_5' + /// + [JsonProperty(PropertyName = "encryptionAlgorithm")] + public EncryptionAlgorithm EncryptionAlgorithm { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/TargetType.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/TargetType.cs new file mode 100644 index 000000000000..aef5b0a96792 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/TargetType.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for TargetType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum TargetType + { + [EnumMember(Value = "FileServer")] + FileServer, + [EnumMember(Value = "DiskServer")] + DiskServer + } + internal static class TargetTypeEnumExtension + { + internal static string ToSerializedValue(this TargetType? value) + { + return value == null ? null : ((TargetType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this TargetType value) + { + switch( value ) + { + case TargetType.FileServer: + return "FileServer"; + case TargetType.DiskServer: + return "DiskServer"; + } + return null; + } + + internal static TargetType? ParseTargetType(this string value) + { + switch( value ) + { + case "FileServer": + return TargetType.FileServer; + case "DiskServer": + return TargetType.DiskServer; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Time.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Time.cs new file mode 100644 index 000000000000..c390d0e98814 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Time.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Time. + /// + public partial class Time + { + /// + /// Initializes a new instance of the Time class. + /// + public Time() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Time class. + /// + /// The hour. + /// The minute. + public Time(int hour, int minute) + { + Hour = hour; + Minute = minute; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the hour. + /// + [JsonProperty(PropertyName = "hour")] + public int Hour { get; set; } + + /// + /// Gets or sets the minute. + /// + [JsonProperty(PropertyName = "minute")] + public int Minute { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Hour > 23) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Hour", 23); + } + if (Hour < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Hour", 0); + } + if (Minute > 59) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Minute", 59); + } + if (Minute < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Minute", 0); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/TimeSettings.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/TimeSettings.cs new file mode 100644 index 000000000000..d2254de001fb --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/TimeSettings.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The TimeSettings of a device + /// + [Rest.Serialization.JsonTransformation] + public partial class TimeSettings : BaseModel + { + /// + /// Initializes a new instance of the TimeSettings class. + /// + public TimeSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimeSettings class. + /// + /// The timezone of device, like '(UTC -06:00) + /// Central America' + /// The primary Network Time Protocol + /// (NTP) server name, like 'time.windows.com'. + /// The identifier. + /// The name. + /// The type. + /// The secondary Network Time + /// Protocol (NTP) server name, like 'time.contoso.com'. It's + /// optional. + public TimeSettings(string timeZone, string primaryTimeServer, string id = default(string), string name = default(string), string type = default(string), string secondaryTimeServer = default(string)) + : base(id, name, type) + { + TimeZone = timeZone; + PrimaryTimeServer = primaryTimeServer; + SecondaryTimeServer = secondaryTimeServer; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the timezone of device, like '(UTC -06:00) Central + /// America' + /// + [JsonProperty(PropertyName = "properties.timeZone")] + public string TimeZone { get; set; } + + /// + /// Gets or sets the primary Network Time Protocol (NTP) server name, + /// like 'time.windows.com'. + /// + [JsonProperty(PropertyName = "properties.primaryTimeServer")] + public string PrimaryTimeServer { get; set; } + + /// + /// Gets or sets the secondary Network Time Protocol (NTP) server name, + /// like 'time.contoso.com'. It's optional. + /// + [JsonProperty(PropertyName = "properties.secondaryTimeServer")] + public string SecondaryTimeServer { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TimeZone == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TimeZone"); + } + if (PrimaryTimeServer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrimaryTimeServer"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UpdateDownloadProgress.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UpdateDownloadProgress.cs new file mode 100644 index 000000000000..37b145dcacb0 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UpdateDownloadProgress.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// details available during the download + /// + public partial class UpdateDownloadProgress + { + /// + /// Initializes a new instance of the UpdateDownloadProgress class. + /// + public UpdateDownloadProgress() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateDownloadProgress class. + /// + /// The download phase. Possible values + /// include: 'Unknown', 'Initializing', 'Downloading', + /// 'Verifying' + /// Percentage of completion. + /// Total bytes to download. + /// Total bytes downloaded. + /// Number of updates to + /// download. + /// Number of updates + /// downloaded. + public UpdateDownloadProgress(DownloadPhase? downloadPhase = default(DownloadPhase?), int? percentComplete = default(int?), double? totalBytesToDownload = default(double?), double? totalBytesDownloaded = default(double?), int? numberOfUpdatesToDownload = default(int?), int? numberOfUpdatesDownloaded = default(int?)) + { + DownloadPhase = downloadPhase; + PercentComplete = percentComplete; + TotalBytesToDownload = totalBytesToDownload; + TotalBytesDownloaded = totalBytesDownloaded; + NumberOfUpdatesToDownload = numberOfUpdatesToDownload; + NumberOfUpdatesDownloaded = numberOfUpdatesDownloaded; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the download phase. Possible values include: + /// 'Unknown', 'Initializing', 'Downloading', 'Verifying' + /// + [JsonProperty(PropertyName = "downloadPhase")] + public DownloadPhase? DownloadPhase { get; set; } + + /// + /// Gets or sets percentage of completion. + /// + [JsonProperty(PropertyName = "percentComplete")] + public int? PercentComplete { get; set; } + + /// + /// Gets or sets total bytes to download. + /// + [JsonProperty(PropertyName = "totalBytesToDownload")] + public double? TotalBytesToDownload { get; set; } + + /// + /// Gets or sets total bytes downloaded. + /// + [JsonProperty(PropertyName = "totalBytesDownloaded")] + public double? TotalBytesDownloaded { get; set; } + + /// + /// Gets or sets number of updates to download. + /// + [JsonProperty(PropertyName = "numberOfUpdatesToDownload")] + public int? NumberOfUpdatesToDownload { get; set; } + + /// + /// Gets or sets number of updates downloaded. + /// + [JsonProperty(PropertyName = "numberOfUpdatesDownloaded")] + public int? NumberOfUpdatesDownloaded { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UpdateInstallProgress.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UpdateInstallProgress.cs new file mode 100644 index 000000000000..ddb784c2eece --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UpdateInstallProgress.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Class representing the progress during installation of updates + /// + public partial class UpdateInstallProgress + { + /// + /// Initializes a new instance of the UpdateInstallProgress class. + /// + public UpdateInstallProgress() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateInstallProgress class. + /// + /// Percentage of completion. + /// Number of updates to + /// install. + /// Number of updates + /// installed. + public UpdateInstallProgress(int? percentComplete = default(int?), int? numberOfUpdatesToInstall = default(int?), int? numberOfUpdatesInstalled = default(int?)) + { + PercentComplete = percentComplete; + NumberOfUpdatesToInstall = numberOfUpdatesToInstall; + NumberOfUpdatesInstalled = numberOfUpdatesInstalled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets percentage of completion. + /// + [JsonProperty(PropertyName = "percentComplete")] + public int? PercentComplete { get; set; } + + /// + /// Gets or sets number of updates to install. + /// + [JsonProperty(PropertyName = "numberOfUpdatesToInstall")] + public int? NumberOfUpdatesToInstall { get; set; } + + /// + /// Gets or sets number of updates installed. + /// + [JsonProperty(PropertyName = "numberOfUpdatesInstalled")] + public int? NumberOfUpdatesInstalled { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UpdateOperation.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UpdateOperation.cs new file mode 100644 index 000000000000..ec0808cc0a83 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UpdateOperation.cs @@ -0,0 +1,72 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for UpdateOperation. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum UpdateOperation + { + [EnumMember(Value = "Idle")] + Idle, + [EnumMember(Value = "Scanning")] + Scanning, + [EnumMember(Value = "Downloading")] + Downloading, + [EnumMember(Value = "Installing")] + Installing + } + internal static class UpdateOperationEnumExtension + { + internal static string ToSerializedValue(this UpdateOperation? value) + { + return value == null ? null : ((UpdateOperation)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this UpdateOperation value) + { + switch( value ) + { + case UpdateOperation.Idle: + return "Idle"; + case UpdateOperation.Scanning: + return "Scanning"; + case UpdateOperation.Downloading: + return "Downloading"; + case UpdateOperation.Installing: + return "Installing"; + } + return null; + } + + internal static UpdateOperation? ParseUpdateOperation(this string value) + { + switch( value ) + { + case "Idle": + return UpdateOperation.Idle; + case "Scanning": + return UpdateOperation.Scanning; + case "Downloading": + return UpdateOperation.Downloading; + case "Installing": + return UpdateOperation.Installing; + } + return null; + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Updates.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Updates.cs new file mode 100644 index 000000000000..46b6805e0183 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/Updates.cs @@ -0,0 +1,202 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The updates profile + /// + [Rest.Serialization.JsonTransformation] + public partial class Updates : BaseModel + { + /// + /// Initializes a new instance of the Updates class. + /// + public Updates() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Updates class. + /// + /// The identifier. + /// The name. + /// The type. + /// The current Device version. + /// The last time when the device + /// did an update scan. + /// Set to true if regular + /// updates were detected for the current version of the + /// device. + /// Set to true if + /// RegularUpdatesAvailable is true and if at least one of the + /// updateItems detected has needs a reboot to install. + /// The total number of + /// items pending for download. + /// The total number of items + /// pending for install. + /// The current update operation. Possible values + /// include: 'Idle', 'Scanning', 'Downloading', 'Installing' + /// The time when the last scan job + /// was completed (success|cancelled|failed) on the device. + /// The time when the last + /// Download job was completed (success|cancelled|failed) on the + /// device. + /// The time when the last + /// Install job was completed (success|cancelled|failed) on the + /// device. + /// If a download is in progress, + /// this field contains the JobId of that particular download + /// job + /// If an install is in progress, + /// this field contains the JobId of that particular install + /// job + /// The time when the currently + /// running scan (if any) started + /// The time when the + /// currently running download (if any) started + /// The time when the + /// currently running install (if any) started + public Updates(string id = default(string), string name = default(string), string type = default(string), string deviceVersion = default(string), System.DateTime? deviceLastScannedTime = default(System.DateTime?), bool? regularUpdatesAvailable = default(bool?), bool? rebootRequiredForInstall = default(bool?), int? totalItemsPendingForDownload = default(int?), int? totalItemsPendingForInstall = default(int?), UpdateOperation? status = default(UpdateOperation?), System.DateTime? lastCompletedScanTime = default(System.DateTime?), System.DateTime? lastCompletedDownloadJobTime = default(System.DateTime?), System.DateTime? lastCompletedInstallJobTime = default(System.DateTime?), string inProgressDownloadJobId = default(string), string inProgressInstallJobId = default(string), System.DateTime? inProgressScanStartedTime = default(System.DateTime?), System.DateTime? inProgressDownloadJobStartedTime = default(System.DateTime?), System.DateTime? inProgressInstallJobStartedTime = default(System.DateTime?)) + : base(id, name, type) + { + DeviceVersion = deviceVersion; + DeviceLastScannedTime = deviceLastScannedTime; + RegularUpdatesAvailable = regularUpdatesAvailable; + RebootRequiredForInstall = rebootRequiredForInstall; + TotalItemsPendingForDownload = totalItemsPendingForDownload; + TotalItemsPendingForInstall = totalItemsPendingForInstall; + Status = status; + LastCompletedScanTime = lastCompletedScanTime; + LastCompletedDownloadJobTime = lastCompletedDownloadJobTime; + LastCompletedInstallJobTime = lastCompletedInstallJobTime; + InProgressDownloadJobId = inProgressDownloadJobId; + InProgressInstallJobId = inProgressInstallJobId; + InProgressScanStartedTime = inProgressScanStartedTime; + InProgressDownloadJobStartedTime = inProgressDownloadJobStartedTime; + InProgressInstallJobStartedTime = inProgressInstallJobStartedTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the current Device version. + /// + [JsonProperty(PropertyName = "properties.deviceVersion")] + public string DeviceVersion { get; set; } + + /// + /// Gets or sets the last time when the device did an update scan. + /// + [JsonProperty(PropertyName = "properties.deviceLastScannedTime")] + public System.DateTime? DeviceLastScannedTime { get; set; } + + /// + /// Gets or sets set to true if regular updates were detected for the + /// current version of the device. + /// + [JsonProperty(PropertyName = "properties.regularUpdatesAvailable")] + public bool? RegularUpdatesAvailable { get; set; } + + /// + /// Gets or sets set to true if RegularUpdatesAvailable is true and if + /// at least one of the updateItems detected has needs a reboot to + /// install. + /// + [JsonProperty(PropertyName = "properties.rebootRequiredForInstall")] + public bool? RebootRequiredForInstall { get; set; } + + /// + /// Gets or sets the total number of items pending for download. + /// + [JsonProperty(PropertyName = "properties.totalItemsPendingForDownload")] + public int? TotalItemsPendingForDownload { get; set; } + + /// + /// Gets or sets the total number of items pending for install. + /// + [JsonProperty(PropertyName = "properties.totalItemsPendingForInstall")] + public int? TotalItemsPendingForInstall { get; set; } + + /// + /// Gets or sets the current update operation. Possible values include: + /// 'Idle', 'Scanning', 'Downloading', 'Installing' + /// + [JsonProperty(PropertyName = "properties.status")] + public UpdateOperation? Status { get; set; } + + /// + /// Gets or sets the time when the last scan job was completed + /// (success|cancelled|failed) on the device. + /// + [JsonProperty(PropertyName = "properties.lastCompletedScanTime")] + public System.DateTime? LastCompletedScanTime { get; set; } + + /// + /// Gets or sets the time when the last Download job was completed + /// (success|cancelled|failed) on the device. + /// + [JsonProperty(PropertyName = "properties.lastCompletedDownloadJobTime")] + public System.DateTime? LastCompletedDownloadJobTime { get; set; } + + /// + /// Gets or sets the time when the last Install job was completed + /// (success|cancelled|failed) on the device. + /// + [JsonProperty(PropertyName = "properties.lastCompletedInstallJobTime")] + public System.DateTime? LastCompletedInstallJobTime { get; set; } + + /// + /// Gets or sets if a download is in progress, this field contains the + /// JobId of that particular download job + /// + [JsonProperty(PropertyName = "properties.inProgressDownloadJobId")] + public string InProgressDownloadJobId { get; set; } + + /// + /// Gets or sets if an install is in progress, this field contains the + /// JobId of that particular install job + /// + [JsonProperty(PropertyName = "properties.inProgressInstallJobId")] + public string InProgressInstallJobId { get; set; } + + /// + /// Gets or sets the time when the currently running scan (if any) + /// started + /// + [JsonProperty(PropertyName = "properties.inProgressScanStartedTime")] + public System.DateTime? InProgressScanStartedTime { get; set; } + + /// + /// Gets or sets the time when the currently running download (if any) + /// started + /// + [JsonProperty(PropertyName = "properties.inProgressDownloadJobStartedTime")] + public System.DateTime? InProgressDownloadJobStartedTime { get; set; } + + /// + /// Gets or sets the time when the currently running install (if any) + /// started + /// + [JsonProperty(PropertyName = "properties.inProgressInstallJobStartedTime")] + public System.DateTime? InProgressInstallJobStartedTime { get; set; } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UploadCertificateRequest.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UploadCertificateRequest.cs new file mode 100644 index 000000000000..643121585c75 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UploadCertificateRequest.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Upload Certificate Request to IDM + /// + [Rest.Serialization.JsonTransformation] + public partial class UploadCertificateRequest + { + /// + /// Initializes a new instance of the UploadCertificateRequest class. + /// + public UploadCertificateRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UploadCertificateRequest class. + /// + /// Gets or sets the base64 encoded + /// certificate raw data string + /// Specify the Authentication type. Possible + /// values include: 'Invalid', 'AccessControlService', + /// 'AzureActiveDirectory' + /// Gets ContractVersion. Possible values + /// include: 'InvalidVersion', 'V2011_09', 'V2012_02', 'V2012_05', + /// 'V2012_12', 'V2013_04', 'V2013_10', 'V2013_11', 'V2014_04', + /// 'V2014_06', 'V2014_07', 'V2014_09', 'V2014_10', 'V2014_12', + /// 'V2015_01', 'V2015_02', 'V2015_04', 'V2015_05', 'V2015_06', + /// 'V2015_07', 'V2015_08', 'V2015_10', 'V2015_12', 'V2016_01', + /// 'V2016_02', 'V2016_04', 'V2016_05', 'V2016_07', 'V2016_08' + public UploadCertificateRequest(string certificate, AuthType? authType = default(AuthType?), ContractVersions? contractVersion = default(ContractVersions?)) + { + AuthType = authType; + Certificate = certificate; + ContractVersion = contractVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specify the Authentication type. Possible values + /// include: 'Invalid', 'AccessControlService', 'AzureActiveDirectory' + /// + [JsonProperty(PropertyName = "properties.authType")] + public AuthType? AuthType { get; set; } + + /// + /// Gets or sets the base64 encoded certificate raw data string + /// + [JsonProperty(PropertyName = "properties.certificate")] + public string Certificate { get; set; } + + /// + /// Gets ContractVersion. Possible values include: 'InvalidVersion', + /// 'V2011_09', 'V2012_02', 'V2012_05', 'V2012_12', 'V2013_04', + /// 'V2013_10', 'V2013_11', 'V2014_04', 'V2014_06', 'V2014_07', + /// 'V2014_09', 'V2014_10', 'V2014_12', 'V2015_01', 'V2015_02', + /// 'V2015_04', 'V2015_05', 'V2015_06', 'V2015_07', 'V2015_08', + /// 'V2015_10', 'V2015_12', 'V2016_01', 'V2016_02', 'V2016_04', + /// 'V2016_05', 'V2016_07', 'V2016_08' + /// + [JsonProperty(PropertyName = "contractVersion")] + public ContractVersions? ContractVersion { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Certificate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Certificate"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UploadCertificateResponse.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UploadCertificateResponse.cs new file mode 100644 index 000000000000..b5cbd3309a6a --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/Models/UploadCertificateResponse.cs @@ -0,0 +1,219 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Upload Certificate Response from IDM + /// + [Rest.Serialization.JsonTransformation] + public partial class UploadCertificateResponse : BaseModel + { + /// + /// Initializes a new instance of the UploadCertificateResponse class. + /// + public UploadCertificateResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UploadCertificateResponse class. + /// + /// Gets or sets the base64 encoded + /// certificate raw data string + /// Gets or Sets the ResourceId + /// AAD tenant authority + /// AAD tenant Id + /// AAD service principal + /// clientId + /// AAD service principal + /// ObjectId + /// Azure Management + /// Endpoint Audience + /// Certificate Subject Name + /// Certificate Validity start Date + /// time + /// Certificate Validity End Date time + /// Certificate thumbprint + /// Certificate friendly name + /// Certificate issuer + /// The identifier. + /// The name. + /// The type. + /// Specify the Authentication type. Possible + /// values include: 'Invalid', 'AccessControlService', + /// 'AzureActiveDirectory' + public UploadCertificateResponse(string certificate, long resourceId, string aadAuthority, string aadTenantId, string servicePrincipalClientId, string servicePrincipalObjectId, string azureManagementEndpointAudience, string subject, System.DateTime validFrom, System.DateTime validTo, string thumbprint, string friendlyName, string issuer, string id = default(string), string name = default(string), string type = default(string), AuthType? authType = default(AuthType?)) + : base(id, name, type) + { + AuthType = authType; + Certificate = certificate; + ResourceId = resourceId; + AadAuthority = aadAuthority; + AadTenantId = aadTenantId; + ServicePrincipalClientId = servicePrincipalClientId; + ServicePrincipalObjectId = servicePrincipalObjectId; + AzureManagementEndpointAudience = azureManagementEndpointAudience; + Subject = subject; + ValidFrom = validFrom; + ValidTo = validTo; + Thumbprint = thumbprint; + FriendlyName = friendlyName; + Issuer = issuer; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specify the Authentication type. Possible values + /// include: 'Invalid', 'AccessControlService', 'AzureActiveDirectory' + /// + [JsonProperty(PropertyName = "properties.authType")] + public AuthType? AuthType { get; set; } + + /// + /// Gets or sets the base64 encoded certificate raw data string + /// + [JsonProperty(PropertyName = "properties.certificate")] + public string Certificate { get; set; } + + /// + /// Gets or Sets the ResourceId + /// + [JsonProperty(PropertyName = "properties.resourceId")] + public long ResourceId { get; set; } + + /// + /// Gets or sets AAD tenant authority + /// + [JsonProperty(PropertyName = "properties.aadAuthority")] + public string AadAuthority { get; set; } + + /// + /// Gets or sets AAD tenant Id + /// + [JsonProperty(PropertyName = "properties.aadTenantId")] + public string AadTenantId { get; set; } + + /// + /// Gets or sets AAD service principal clientId + /// + [JsonProperty(PropertyName = "properties.servicePrincipalClientId")] + public string ServicePrincipalClientId { get; set; } + + /// + /// Gets or sets AAD service principal ObjectId + /// + [JsonProperty(PropertyName = "properties.servicePrincipalObjectId")] + public string ServicePrincipalObjectId { get; set; } + + /// + /// Gets or sets azure Management Endpoint Audience + /// + [JsonProperty(PropertyName = "properties.azureManagementEndpointAudience")] + public string AzureManagementEndpointAudience { get; set; } + + /// + /// Gets or sets certificate Subject Name + /// + [JsonProperty(PropertyName = "properties.subject")] + public string Subject { get; set; } + + /// + /// Gets or sets certificate Validity start Date time + /// + [JsonProperty(PropertyName = "properties.validFrom")] + public System.DateTime ValidFrom { get; set; } + + /// + /// Gets or sets certificate Validity End Date time + /// + [JsonProperty(PropertyName = "properties.validTo")] + public System.DateTime ValidTo { get; set; } + + /// + /// Gets or sets certificate thumbprint + /// + [JsonProperty(PropertyName = "properties.thumbprint")] + public string Thumbprint { get; set; } + + /// + /// Gets or sets certificate friendly name + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; set; } + + /// + /// Gets or sets certificate issuer + /// + [JsonProperty(PropertyName = "properties.issuer")] + public string Issuer { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Certificate == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Certificate"); + } + if (AadAuthority == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AadAuthority"); + } + if (AadTenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AadTenantId"); + } + if (ServicePrincipalClientId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServicePrincipalClientId"); + } + if (ServicePrincipalObjectId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ServicePrincipalObjectId"); + } + if (AzureManagementEndpointAudience == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AzureManagementEndpointAudience"); + } + if (Subject == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Subject"); + } + if (Thumbprint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Thumbprint"); + } + if (FriendlyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FriendlyName"); + } + if (Issuer == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Issuer"); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/SdkInfo_StorSimpleManagementClient.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/SdkInfo_StorSimpleManagementClient.cs new file mode 100644 index 000000000000..4636e9b5432f --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/SdkInfo_StorSimpleManagementClient.cs @@ -0,0 +1,41 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_StorSimpleManagementClient + { + get + { + return new Tuple[] + { + new Tuple("StorSimple", "AccessControlRecords", "2016-10-01"), + new Tuple("StorSimple", "Alerts", "2016-10-01"), + new Tuple("StorSimple", "AvailableProviderOperations", "2016-10-01"), + new Tuple("StorSimple", "BackupScheduleGroups", "2016-10-01"), + new Tuple("StorSimple", "Backups", "2016-10-01"), + new Tuple("StorSimple", "ChapSettings", "2016-10-01"), + new Tuple("StorSimple", "Devices", "2016-10-01"), + new Tuple("StorSimple", "FileServers", "2016-10-01"), + new Tuple("StorSimple", "FileShares", "2016-10-01"), + new Tuple("StorSimple", "IscsiDisks", "2016-10-01"), + new Tuple("StorSimple", "IscsiServers", "2016-10-01"), + new Tuple("StorSimple", "Jobs", "2016-10-01"), + new Tuple("StorSimple", "Managers", "2016-10-01"), + new Tuple("StorSimple", "StorageAccountCredentials", "2016-10-01"), + new Tuple("StorSimple", "StorageDomains", "2016-10-01"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorSimpleManagementClient.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorSimpleManagementClient.cs new file mode 100644 index 000000000000..28aa2d0de547 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorSimpleManagementClient.cs @@ -0,0 +1,441 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + public partial class StorSimpleManagementClient : ServiceClient, IStorSimpleManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// The api version + /// + public string ApiVersion { get; private set; } + + /// + /// The subscription id + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IManagersOperations. + /// + public virtual IManagersOperations Managers { get; private set; } + + /// + /// Gets the IAvailableProviderOperationsOperations. + /// + public virtual IAvailableProviderOperationsOperations AvailableProviderOperations { get; private set; } + + /// + /// Gets the IAccessControlRecordsOperations. + /// + public virtual IAccessControlRecordsOperations AccessControlRecords { get; private set; } + + /// + /// Gets the IAlertsOperations. + /// + public virtual IAlertsOperations Alerts { get; private set; } + + /// + /// Gets the IBackupsOperations. + /// + public virtual IBackupsOperations Backups { get; private set; } + + /// + /// Gets the IDevicesOperations. + /// + public virtual IDevicesOperations Devices { get; private set; } + + /// + /// Gets the IBackupScheduleGroupsOperations. + /// + public virtual IBackupScheduleGroupsOperations BackupScheduleGroups { get; private set; } + + /// + /// Gets the IChapSettingsOperations. + /// + public virtual IChapSettingsOperations ChapSettings { get; private set; } + + /// + /// Gets the IIscsiDisksOperations. + /// + public virtual IIscsiDisksOperations IscsiDisks { get; private set; } + + /// + /// Gets the IFileServersOperations. + /// + public virtual IFileServersOperations FileServers { get; private set; } + + /// + /// Gets the IFileSharesOperations. + /// + public virtual IFileSharesOperations FileShares { get; private set; } + + /// + /// Gets the IIscsiServersOperations. + /// + public virtual IIscsiServersOperations IscsiServers { get; private set; } + + /// + /// Gets the IJobsOperations. + /// + public virtual IJobsOperations Jobs { get; private set; } + + /// + /// Gets the IStorageAccountCredentialsOperations. + /// + public virtual IStorageAccountCredentialsOperations StorageAccountCredentials { get; private set; } + + /// + /// Gets the IStorageDomainsOperations. + /// + public virtual IStorageDomainsOperations StorageDomains { get; private set; } + + /// + /// Initializes a new instance of the StorSimpleManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling StorSimpleManagementClient.Dispose(). False: will not dispose provided httpClient + protected StorSimpleManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the StorSimpleManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected StorSimpleManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the StorSimpleManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected StorSimpleManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the StorSimpleManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected StorSimpleManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the StorSimpleManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected StorSimpleManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the StorSimpleManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public StorSimpleManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the StorSimpleManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling StorSimpleManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public StorSimpleManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the StorSimpleManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public StorSimpleManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the StorSimpleManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public StorSimpleManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the StorSimpleManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public StorSimpleManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + Managers = new ManagersOperations(this); + AvailableProviderOperations = new AvailableProviderOperationsOperations(this); + AccessControlRecords = new AccessControlRecordsOperations(this); + Alerts = new AlertsOperations(this); + Backups = new BackupsOperations(this); + Devices = new DevicesOperations(this); + BackupScheduleGroups = new BackupScheduleGroupsOperations(this); + ChapSettings = new ChapSettingsOperations(this); + IscsiDisks = new IscsiDisksOperations(this); + FileServers = new FileServersOperations(this); + FileShares = new FileSharesOperations(this); + IscsiServers = new IscsiServersOperations(this); + Jobs = new JobsOperations(this); + StorageAccountCredentials = new StorageAccountCredentialsOperations(this); + StorageDomains = new StorageDomainsOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2016-10-01"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageAccountCredentialsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageAccountCredentialsOperations.cs new file mode 100644 index 000000000000..7187432e85a5 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageAccountCredentialsOperations.cs @@ -0,0 +1,939 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// StorageAccountCredentialsOperations operations. + /// + internal partial class StorageAccountCredentialsOperations : IServiceOperations, IStorageAccountCredentialsOperations + { + /// + /// Initializes a new instance of the StorageAccountCredentialsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal StorageAccountCredentialsOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the storage account credentials in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManager", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified storage account credential name. + /// + /// + /// The name of storage account credential to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string credentialName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (credentialName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "credentialName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("credentialName", credentialName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials/{credentialName}").ToString(); + _url = _url.Replace("{credentialName}", System.Uri.EscapeDataString(credentialName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the storage account credential + /// + /// + /// The credential name. + /// + /// + /// The storage account credential to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string credentialName, StorageAccountCredential storageAccount, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(credentialName, storageAccount, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the storage account credential + /// + /// + /// The name of the storage account credential. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string credentialName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(credentialName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates the storage account credential + /// + /// + /// The credential name. + /// + /// + /// The storage account credential to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string credentialName, StorageAccountCredential storageAccount, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (credentialName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "credentialName"); + } + if (storageAccount == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageAccount"); + } + if (storageAccount != null) + { + storageAccount.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("credentialName", credentialName); + tracingParameters.Add("storageAccount", storageAccount); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials/{credentialName}").ToString(); + _url = _url.Replace("{credentialName}", System.Uri.EscapeDataString(credentialName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(storageAccount != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(storageAccount, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the storage account credential + /// + /// + /// The name of the storage account credential. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string credentialName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (credentialName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "credentialName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("credentialName", credentialName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials/{credentialName}").ToString(); + _url = _url.Replace("{credentialName}", System.Uri.EscapeDataString(credentialName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageAccountCredentialsOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageAccountCredentialsOperationsExtensions.cs new file mode 100644 index 000000000000..91a845df7e48 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageAccountCredentialsOperationsExtensions.cs @@ -0,0 +1,303 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for StorageAccountCredentialsOperations. + /// + public static partial class StorageAccountCredentialsOperationsExtensions + { + /// + /// Retrieves all the storage account credentials in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByManager(this IStorageAccountCredentialsOperations operations, string resourceGroupName, string managerName) + { + return operations.ListByManagerAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the storage account credentials in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerAsync(this IStorageAccountCredentialsOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified storage account credential name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of storage account credential to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static StorageAccountCredential Get(this IStorageAccountCredentialsOperations operations, string credentialName, string resourceGroupName, string managerName) + { + return operations.GetAsync(credentialName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified storage account credential name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of storage account credential to be fetched. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IStorageAccountCredentialsOperations operations, string credentialName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(credentialName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the storage account credential + /// + /// + /// The operations group for this extension method. + /// + /// + /// The credential name. + /// + /// + /// The storage account credential to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static StorageAccountCredential CreateOrUpdate(this IStorageAccountCredentialsOperations operations, string credentialName, StorageAccountCredential storageAccount, string resourceGroupName, string managerName) + { + return operations.CreateOrUpdateAsync(credentialName, storageAccount, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the storage account credential + /// + /// + /// The operations group for this extension method. + /// + /// + /// The credential name. + /// + /// + /// The storage account credential to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IStorageAccountCredentialsOperations operations, string credentialName, StorageAccountCredential storageAccount, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(credentialName, storageAccount, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the storage account credential + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the storage account credential. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IStorageAccountCredentialsOperations operations, string credentialName, string resourceGroupName, string managerName) + { + operations.DeleteAsync(credentialName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the storage account credential + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the storage account credential. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IStorageAccountCredentialsOperations operations, string credentialName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(credentialName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates the storage account credential + /// + /// + /// The operations group for this extension method. + /// + /// + /// The credential name. + /// + /// + /// The storage account credential to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static StorageAccountCredential BeginCreateOrUpdate(this IStorageAccountCredentialsOperations operations, string credentialName, StorageAccountCredential storageAccount, string resourceGroupName, string managerName) + { + return operations.BeginCreateOrUpdateAsync(credentialName, storageAccount, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the storage account credential + /// + /// + /// The operations group for this extension method. + /// + /// + /// The credential name. + /// + /// + /// The storage account credential to be added or updated. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IStorageAccountCredentialsOperations operations, string credentialName, StorageAccountCredential storageAccount, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(credentialName, storageAccount, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the storage account credential + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the storage account credential. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDelete(this IStorageAccountCredentialsOperations operations, string credentialName, string resourceGroupName, string managerName) + { + operations.BeginDeleteAsync(credentialName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the storage account credential + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the storage account credential. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IStorageAccountCredentialsOperations operations, string credentialName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(credentialName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageDomainsOperations.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageDomainsOperations.cs new file mode 100644 index 000000000000..0306598f1d9b --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageDomainsOperations.cs @@ -0,0 +1,939 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// StorageDomainsOperations operations. + /// + internal partial class StorageDomainsOperations : IServiceOperations, IStorageDomainsOperations + { + /// + /// Initializes a new instance of the StorageDomainsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal StorageDomainsOperations(StorSimpleManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorSimpleManagementClient + /// + public StorSimpleManagementClient Client { get; private set; } + + /// + /// Retrieves all the storage domains in a manager. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByManagerWithHttpMessagesAsync(string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByManager", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageDomains").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the properties of the specified storage domain name. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string storageDomainName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (storageDomainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageDomainName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("storageDomainName", storageDomainName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageDomains/{storageDomainName}").ToString(); + _url = _url.Replace("{storageDomainName}", System.Uri.EscapeDataString(storageDomainName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the storage domain. + /// + /// + /// The storage domain name. + /// + /// + /// The storageDomain. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string storageDomainName, StorageDomain storageDomain, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(storageDomainName, storageDomain, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the storage domain. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string storageDomainName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(storageDomainName, resourceGroupName, managerName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates the storage domain. + /// + /// + /// The storage domain name. + /// + /// + /// The storageDomain. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string storageDomainName, StorageDomain storageDomain, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (storageDomainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageDomainName"); + } + if (storageDomain == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageDomain"); + } + if (storageDomain != null) + { + storageDomain.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("storageDomainName", storageDomainName); + tracingParameters.Add("storageDomain", storageDomain); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageDomains/{storageDomainName}").ToString(); + _url = _url.Replace("{storageDomainName}", System.Uri.EscapeDataString(storageDomainName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(storageDomain != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(storageDomain, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the storage domain. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string storageDomainName, string resourceGroupName, string managerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (storageDomainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "storageDomainName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (managerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "managerName"); + } + if (managerName != null) + { + if (managerName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "managerName", 50); + } + if (managerName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "managerName", 2); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("storageDomainName", storageDomainName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("managerName", managerName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageDomains/{storageDomainName}").ToString(); + _url = _url.Replace("{storageDomainName}", System.Uri.EscapeDataString(storageDomainName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{managerName}", System.Uri.EscapeDataString(managerName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageDomainsOperationsExtensions.cs b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageDomainsOperationsExtensions.cs new file mode 100644 index 000000000000..3335293d5511 --- /dev/null +++ b/sdk/storsimple1200series/Microsoft.Azure.Management.StorSimple1200Series/src/Generated/StorageDomainsOperationsExtensions.cs @@ -0,0 +1,303 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StorSimple1200Series +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for StorageDomainsOperations. + /// + public static partial class StorageDomainsOperationsExtensions + { + /// + /// Retrieves all the storage domains in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static IEnumerable ListByManager(this IStorageDomainsOperations operations, string resourceGroupName, string managerName) + { + return operations.ListByManagerAsync(resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all the storage domains in a manager. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task> ListByManagerAsync(this IStorageDomainsOperations operations, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByManagerWithHttpMessagesAsync(resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the properties of the specified storage domain name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static StorageDomain Get(this IStorageDomainsOperations operations, string storageDomainName, string resourceGroupName, string managerName) + { + return operations.GetAsync(storageDomainName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Returns the properties of the specified storage domain name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IStorageDomainsOperations operations, string storageDomainName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(storageDomainName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the storage domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The storage domain name. + /// + /// + /// The storageDomain. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static StorageDomain CreateOrUpdate(this IStorageDomainsOperations operations, string storageDomainName, StorageDomain storageDomain, string resourceGroupName, string managerName) + { + return operations.CreateOrUpdateAsync(storageDomainName, storageDomain, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the storage domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The storage domain name. + /// + /// + /// The storageDomain. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IStorageDomainsOperations operations, string storageDomainName, StorageDomain storageDomain, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(storageDomainName, storageDomain, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the storage domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void Delete(this IStorageDomainsOperations operations, string storageDomainName, string resourceGroupName, string managerName) + { + operations.DeleteAsync(storageDomainName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the storage domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IStorageDomainsOperations operations, string storageDomainName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(storageDomainName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates the storage domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The storage domain name. + /// + /// + /// The storageDomain. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static StorageDomain BeginCreateOrUpdate(this IStorageDomainsOperations operations, string storageDomainName, StorageDomain storageDomain, string resourceGroupName, string managerName) + { + return operations.BeginCreateOrUpdateAsync(storageDomainName, storageDomain, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the storage domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The storage domain name. + /// + /// + /// The storageDomain. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IStorageDomainsOperations operations, string storageDomainName, StorageDomain storageDomain, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(storageDomainName, storageDomain, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the storage domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + public static void BeginDelete(this IStorageDomainsOperations operations, string storageDomainName, string resourceGroupName, string managerName) + { + operations.BeginDeleteAsync(storageDomainName, resourceGroupName, managerName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the storage domain. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The storage domain name. + /// + /// + /// The resource group name + /// + /// + /// The manager name + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IStorageDomainsOperations operations, string storageDomainName, string resourceGroupName, string managerName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(storageDomainName, resourceGroupName, managerName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +}