From 039ab347fc2e5e3da87708806ec6f9704451cfea Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 19 Feb 2021 09:25:32 +0000 Subject: [PATCH] CodeGen from PR 12954 in Azure/azure-rest-api-specs Merge 8fd86abec50849e9689e5324688dc6140f532c6b into a8c959366fec1621befcbbd333c05581c21a5cda --- .../src/Generated/DiskPoolsOperations.cs | 1634 +++++++++++++++++ .../DiskPoolsOperationsExtensions.cs | 471 +++++ .../src/Generated/IDiskPoolsOperations.cs | 301 +++ .../src/Generated/IIscsiTargetsOperations.cs | 288 +++ .../src/Generated/IOperations.cs | 46 + .../Generated/IStoragePoolManagementClient.cs | 87 + .../src/Generated/IscsiTargetsOperations.cs | 1356 ++++++++++++++ .../IscsiTargetsOperationsExtensions.cs | 457 +++++ .../src/Generated/Models/Acl.cs | 87 + .../src/Generated/Models/Attributes.cs | 63 + .../src/Generated/Models/Disk.cs | 52 + .../src/Generated/Models/DiskPool.cs | 139 ++ .../src/Generated/Models/DiskPoolCreate.cs | 143 ++ .../src/Generated/Models/DiskPoolTier.cs | 23 + .../src/Generated/Models/DiskPoolUpdate.cs | 66 + .../src/Generated/Models/Error.cs | 51 + .../Generated/Models/ErrorAdditionalInfo.cs | 59 + .../src/Generated/Models/ErrorException.cs | 61 + .../src/Generated/Models/ErrorResponse.cs | 85 + .../src/Generated/Models/IscsiLun.cs | 61 + .../src/Generated/Models/IscsiTarget.cs | 101 + .../src/Generated/Models/IscsiTargetCreate.cs | 75 + .../src/Generated/Models/IscsiTargetUpdate.cs | 58 + .../src/Generated/Models/OperationalStatus.cs | 28 + .../src/Generated/Models/Page.cs | 53 + .../src/Generated/Models/Page1.cs | 53 + .../Generated/Models/ProvisioningStates.cs | 28 + .../src/Generated/Models/ProxyResource.cs | 50 + .../src/Generated/Models/Resource.cs | 75 + .../Models/StoragePoolOperationDisplay.cs | 84 + .../Models/StoragePoolRPOperation.cs | 90 + .../src/Generated/Models/SystemMetadata.cs | 101 + .../src/Generated/Models/TargetPortalGroup.cs | 102 + .../Models/TargetPortalGroupCreate.cs | 75 + .../Models/TargetPortalGroupUpdate.cs | 65 + .../src/Generated/Models/TrackedResource.cs | 69 + .../src/Generated/Operations.cs | 222 +++ .../src/Generated/OperationsExtensions.cs | 55 + .../SdkInfo_StoragePoolManagement.cs | 29 + .../Generated/StoragePoolManagementClient.cs | 369 ++++ 40 files changed, 7312 insertions(+) create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/DiskPoolsOperations.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/DiskPoolsOperationsExtensions.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IDiskPoolsOperations.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IIscsiTargetsOperations.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IOperations.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IStoragePoolManagementClient.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IscsiTargetsOperations.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IscsiTargetsOperationsExtensions.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Acl.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Attributes.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Disk.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPool.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolCreate.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolTier.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolUpdate.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Error.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ErrorAdditionalInfo.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ErrorException.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiLun.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTarget.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTargetCreate.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTargetUpdate.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/OperationalStatus.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Page.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Page1.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ProvisioningStates.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ProxyResource.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Resource.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/StoragePoolOperationDisplay.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/StoragePoolRPOperation.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/SystemMetadata.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroup.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroupCreate.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroupUpdate.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TrackedResource.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Operations.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/OperationsExtensions.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/SdkInfo_StoragePoolManagement.cs create mode 100644 sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/StoragePoolManagementClient.cs diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/DiskPoolsOperations.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/DiskPoolsOperations.cs new file mode 100644 index 000000000000..5cf596c9be92 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/DiskPoolsOperations.cs @@ -0,0 +1,1634 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool +{ + 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; + + /// + /// DiskPoolsOperations operations. + /// + internal partial class DiskPoolsOperations : IServiceOperations, IDiskPoolsOperations + { + /// + /// Initializes a new instance of the DiskPoolsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DiskPoolsOperations(StoragePoolManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StoragePoolManagementClient + /// + public StoragePoolManagementClient Client { get; private set; } + + /// + /// Gets a list of Disk Pools 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>> ListBySubscriptionWithHttpMessagesAsync(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, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/diskPools").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; + } + + /// + /// Gets a list of DiskPools in a resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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.StoragePool/diskPools").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; + } + + /// + /// Create or Update Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// Request payload for Disk pool create operation + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, DiskPoolCreate diskPoolCreatePayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// List of Azure Managed Disks to attach to a Disk pool. Can attach 8 disks at + /// most. + /// + /// + /// Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, IList disks = default(IList), IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, disks, tags, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskPoolName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, 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 (diskPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskPoolName"); + } + 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("diskPoolName", diskPoolName); + 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.StoragePool/diskPools/{diskPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskPoolName}", System.Uri.EscapeDataString(diskPoolName)); + 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; + } + + /// + /// Create or Update Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// Request payload for Disk pool create 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, DiskPoolCreate diskPoolCreatePayload, 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 (diskPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskPoolName"); + } + if (diskPoolCreatePayload == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskPoolCreatePayload"); + } + 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("diskPoolName", diskPoolName); + tracingParameters.Add("diskPoolCreatePayload", diskPoolCreatePayload); + 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.StoragePool/diskPools/{diskPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskPoolName}", System.Uri.EscapeDataString(diskPoolName)); + 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(diskPoolCreatePayload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskPoolCreatePayload, 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; + } + + /// + /// Update a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// List of Azure Managed Disks to attach to a Disk pool. Can attach 8 disks at + /// most. + /// + /// + /// Resource tags. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, IList disks = default(IList), IDictionary tags = default(IDictionary), 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 (diskPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskPoolName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + DiskPoolUpdate diskPoolUpdatePayload = new DiskPoolUpdate(); + if (disks != null || tags != null) + { + diskPoolUpdatePayload.Disks = disks; + diskPoolUpdatePayload.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskPoolName", diskPoolName); + tracingParameters.Add("diskPoolUpdatePayload", diskPoolUpdatePayload); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskPoolName}", System.Uri.EscapeDataString(diskPoolName)); + 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(diskPoolUpdatePayload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(diskPoolUpdatePayload, 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); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, 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 (diskPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskPoolName"); + } + 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("diskPoolName", diskPoolName); + 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.StoragePool/diskPools/{diskPoolName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskPoolName}", System.Uri.EscapeDataString(diskPoolName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new 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; + } + + /// + /// Gets a list of Disk Pools in a subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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 a list of DiskPools in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/DiskPoolsOperationsExtensions.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/DiskPoolsOperationsExtensions.cs new file mode 100644 index 000000000000..1e1a74c19b69 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/DiskPoolsOperationsExtensions.cs @@ -0,0 +1,471 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool +{ + 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 DiskPoolsOperations. + /// + public static partial class DiskPoolsOperationsExtensions + { + /// + /// Gets a list of Disk Pools in a subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IDiskPoolsOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Disk Pools in a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IDiskPoolsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of DiskPools in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IDiskPoolsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of DiskPools in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IDiskPoolsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or Update Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// Request payload for Disk pool create operation + /// + public static DiskPool CreateOrUpdate(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName, DiskPoolCreate diskPoolCreatePayload) + { + return operations.CreateOrUpdateAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload).GetAwaiter().GetResult(); + } + + /// + /// Create or Update Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// Request payload for Disk pool create operation + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName, DiskPoolCreate diskPoolCreatePayload, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// List of Azure Managed Disks to attach to a Disk pool. Can attach 8 disks at + /// most. + /// + /// + /// Resource tags. + /// + public static DiskPool Update(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName, IList disks = default(IList), IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, diskPoolName, disks, tags).GetAwaiter().GetResult(); + } + + /// + /// Update a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// List of Azure Managed Disks to attach to a Disk pool. Can attach 8 disks at + /// most. + /// + /// + /// Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName, IList disks = default(IList), IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, disks, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + public static void Delete(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName) + { + operations.DeleteAsync(resourceGroupName, diskPoolName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, diskPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + public static DiskPool Get(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName) + { + return operations.GetAsync(resourceGroupName, diskPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, diskPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or Update Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// Request payload for Disk pool create operation + /// + public static DiskPool BeginCreateOrUpdate(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName, DiskPoolCreate diskPoolCreatePayload) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload).GetAwaiter().GetResult(); + } + + /// + /// Create or Update Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// Request payload for Disk pool create operation + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName, DiskPoolCreate diskPoolCreatePayload, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// List of Azure Managed Disks to attach to a Disk pool. Can attach 8 disks at + /// most. + /// + /// + /// Resource tags. + /// + public static DiskPool BeginUpdate(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName, IList disks = default(IList), IDictionary tags = default(IDictionary)) + { + return operations.BeginUpdateAsync(resourceGroupName, diskPoolName, disks, tags).GetAwaiter().GetResult(); + } + + /// + /// Update a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// List of Azure Managed Disks to attach to a Disk pool. Can attach 8 disks at + /// most. + /// + /// + /// Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName, IList disks = default(IList), IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, disks, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + public static void BeginDelete(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName) + { + operations.BeginDeleteAsync(resourceGroupName, diskPoolName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IDiskPoolsOperations operations, string resourceGroupName, string diskPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of Disk Pools in a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IDiskPoolsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Disk Pools in a subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionNextAsync(this IDiskPoolsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of DiskPools in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IDiskPoolsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of DiskPools in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IDiskPoolsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IDiskPoolsOperations.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IDiskPoolsOperations.cs new file mode 100644 index 000000000000..acf4331f410a --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IDiskPoolsOperations.cs @@ -0,0 +1,301 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DiskPoolsOperations operations. + /// + public partial interface IDiskPoolsOperations + { + /// + /// Gets a list of Disk Pools 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of DiskPools in a resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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)); + /// + /// Create or Update Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// Request payload for Disk pool create 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, DiskPoolCreate diskPoolCreatePayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// List of Azure Managed Disks to attach to a Disk pool. Can attach 8 + /// disks at most. + /// + /// + /// Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, IList disks = default(IList), IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// 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 diskPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or Update Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// Request payload for Disk pool create 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, DiskPoolCreate diskPoolCreatePayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// List of Azure Managed Disks to attach to a Disk pool. Can attach 8 + /// disks at most. + /// + /// + /// Resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, IList disks = default(IList), IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of Disk Pools in a subscription + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of DiskPools in a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IIscsiTargetsOperations.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IIscsiTargetsOperations.cs new file mode 100644 index 000000000000..8d70a70e1702 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IIscsiTargetsOperations.cs @@ -0,0 +1,288 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IscsiTargetsOperations operations. + /// + public partial interface IIscsiTargetsOperations + { + /// + /// Get iSCSI Targets in a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByDiskPoolWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or Update an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at + /// most. + /// + /// + /// iSCSI target IQN (iSCSI Qualified Name); example: + /// "iqn.2005-03.org.iscsi:server". + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, string targetIqn = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at + /// most. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// 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 diskPoolName, string iscsiTargetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// 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 diskPoolName, string iscsiTargetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or Update an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at + /// most. + /// + /// + /// iSCSI target IQN (iSCSI Qualified Name); example: + /// "iqn.2005-03.org.iscsi:server". + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, string targetIqn = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at + /// most. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, string iscsiTargetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get iSCSI Targets in a Disk pool. + /// + /// + /// 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>> ListByDiskPoolNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IOperations.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IOperations.cs new file mode 100644 index 000000000000..c7d40cf4ebe3 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IOperations.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Gets a list of StoragePool operations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IStoragePoolManagementClient.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IStoragePoolManagementClient.cs new file mode 100644 index 000000000000..42a16c05f541 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IStoragePoolManagementClient.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.StoragePool +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// + public partial interface IStoragePoolManagementClient : 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 ID of the target subscription. + /// + string SubscriptionId { get; set; } + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IDiskPoolsOperations. + /// + IDiskPoolsOperations DiskPools { get; } + + /// + /// Gets the IIscsiTargetsOperations. + /// + IIscsiTargetsOperations IscsiTargets { get; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IscsiTargetsOperations.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IscsiTargetsOperations.cs new file mode 100644 index 000000000000..59e43adc9a0c --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IscsiTargetsOperations.cs @@ -0,0 +1,1356 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool +{ + 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; + + /// + /// IscsiTargetsOperations operations. + /// + internal partial class IscsiTargetsOperations : IServiceOperations, IIscsiTargetsOperations + { + /// + /// Initializes a new instance of the IscsiTargetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IscsiTargetsOperations(StoragePoolManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StoragePoolManagementClient + /// + public StoragePoolManagementClient Client { get; private set; } + + /// + /// Get iSCSI Targets in a Disk pool. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByDiskPoolWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, 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 (diskPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskPoolName"); + } + 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("diskPoolName", diskPoolName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByDiskPool", 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.StoragePool/diskPools/{diskPoolName}/iscsiTargets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskPoolName}", System.Uri.EscapeDataString(diskPoolName)); + 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; + } + + /// + /// Create or Update an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + /// + /// iSCSI target IQN (iSCSI Qualified Name); example: + /// "iqn.2005-03.org.iscsi:server". + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, string targetIqn = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, iscsiTargetName, tpgs, targetIqn, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, iscsiTargetName, tpgs, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, string iscsiTargetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskPoolName, iscsiTargetName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 diskPoolName, string iscsiTargetName, 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 (diskPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskPoolName"); + } + if (iscsiTargetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiTargetName"); + } + 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("diskPoolName", diskPoolName); + tracingParameters.Add("iscsiTargetName", iscsiTargetName); + 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.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskPoolName}", System.Uri.EscapeDataString(diskPoolName)); + _url = _url.Replace("{iscsiTargetName}", System.Uri.EscapeDataString(iscsiTargetName)); + 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; + } + + /// + /// Create or Update an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + /// + /// iSCSI target IQN (iSCSI Qualified Name); example: + /// "iqn.2005-03.org.iscsi:server". + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, string targetIqn = 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 (diskPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskPoolName"); + } + if (iscsiTargetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiTargetName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (tpgs == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tpgs"); + } + IscsiTargetCreate iscsiTargetCreatePayload = new IscsiTargetCreate(); + if (tpgs != null || targetIqn != null) + { + iscsiTargetCreatePayload.Tpgs = tpgs; + iscsiTargetCreatePayload.TargetIqn = targetIqn; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskPoolName", diskPoolName); + tracingParameters.Add("iscsiTargetName", iscsiTargetName); + tracingParameters.Add("iscsiTargetCreatePayload", iscsiTargetCreatePayload); + 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.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskPoolName}", System.Uri.EscapeDataString(diskPoolName)); + _url = _url.Replace("{iscsiTargetName}", System.Uri.EscapeDataString(iscsiTargetName)); + 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(iscsiTargetCreatePayload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iscsiTargetCreatePayload, 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; + } + + /// + /// Update an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, 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 (diskPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskPoolName"); + } + if (iscsiTargetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiTargetName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (tpgs == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tpgs"); + } + IscsiTargetUpdate iscsiTargetUpdatePayload = new IscsiTargetUpdate(); + if (tpgs != null) + { + iscsiTargetUpdatePayload.Tpgs = tpgs; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("diskPoolName", diskPoolName); + tracingParameters.Add("iscsiTargetName", iscsiTargetName); + tracingParameters.Add("iscsiTargetUpdatePayload", iscsiTargetUpdatePayload); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskPoolName}", System.Uri.EscapeDataString(diskPoolName)); + _url = _url.Replace("{iscsiTargetName}", System.Uri.EscapeDataString(iscsiTargetName)); + 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(iscsiTargetUpdatePayload != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iscsiTargetUpdatePayload, 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); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete an iSCSI target. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string diskPoolName, string iscsiTargetName, 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 (diskPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "diskPoolName"); + } + if (iscsiTargetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iscsiTargetName"); + } + 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("diskPoolName", diskPoolName); + tracingParameters.Add("iscsiTargetName", iscsiTargetName); + 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.StoragePool/diskPools/{diskPoolName}/iscsiTargets/{iscsiTargetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{diskPoolName}", System.Uri.EscapeDataString(diskPoolName)); + _url = _url.Replace("{iscsiTargetName}", System.Uri.EscapeDataString(iscsiTargetName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new 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; + } + + /// + /// Get iSCSI Targets in a Disk pool. + /// + /// + /// 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>> ListByDiskPoolNextWithHttpMessagesAsync(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, "ListByDiskPoolNext", 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/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IscsiTargetsOperationsExtensions.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IscsiTargetsOperationsExtensions.cs new file mode 100644 index 000000000000..928b5dff457a --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/IscsiTargetsOperationsExtensions.cs @@ -0,0 +1,457 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool +{ + 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 IscsiTargetsOperations. + /// + public static partial class IscsiTargetsOperationsExtensions + { + /// + /// Get iSCSI Targets in a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + public static IPage ListByDiskPool(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName) + { + return operations.ListByDiskPoolAsync(resourceGroupName, diskPoolName).GetAwaiter().GetResult(); + } + + /// + /// Get iSCSI Targets in a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDiskPoolAsync(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDiskPoolWithHttpMessagesAsync(resourceGroupName, diskPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or Update an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + /// + /// iSCSI target IQN (iSCSI Qualified Name); example: + /// "iqn.2005-03.org.iscsi:server". + /// + public static IscsiTarget CreateOrUpdate(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, string targetIqn = default(string)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, diskPoolName, iscsiTargetName, tpgs, targetIqn).GetAwaiter().GetResult(); + } + + /// + /// Create or Update an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + /// + /// iSCSI target IQN (iSCSI Qualified Name); example: + /// "iqn.2005-03.org.iscsi:server". + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, string targetIqn = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, iscsiTargetName, tpgs, targetIqn, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + public static IscsiTarget Update(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs) + { + return operations.UpdateAsync(resourceGroupName, diskPoolName, iscsiTargetName, tpgs).GetAwaiter().GetResult(); + } + + /// + /// Update an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, iscsiTargetName, tpgs, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + public static void Delete(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName) + { + operations.DeleteAsync(resourceGroupName, diskPoolName, iscsiTargetName).GetAwaiter().GetResult(); + } + + /// + /// Delete an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, diskPoolName, iscsiTargetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + public static IscsiTarget Get(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName) + { + return operations.GetAsync(resourceGroupName, diskPoolName, iscsiTargetName).GetAwaiter().GetResult(); + } + + /// + /// Get an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, diskPoolName, iscsiTargetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or Update an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + /// + /// iSCSI target IQN (iSCSI Qualified Name); example: + /// "iqn.2005-03.org.iscsi:server". + /// + public static IscsiTarget BeginCreateOrUpdate(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, string targetIqn = default(string)) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, diskPoolName, iscsiTargetName, tpgs, targetIqn).GetAwaiter().GetResult(); + } + + /// + /// Create or Update an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + /// + /// iSCSI target IQN (iSCSI Qualified Name); example: + /// "iqn.2005-03.org.iscsi:server". + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, string targetIqn = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, iscsiTargetName, tpgs, targetIqn, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + public static IscsiTarget BeginUpdate(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs) + { + return operations.BeginUpdateAsync(resourceGroupName, diskPoolName, iscsiTargetName, tpgs).GetAwaiter().GetResult(); + } + + /// + /// Update an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// List of iSCSI target portal groups. Can have 1 portal group at most. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName, IList tpgs, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, diskPoolName, iscsiTargetName, tpgs, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + public static void BeginDelete(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName) + { + operations.BeginDeleteAsync(resourceGroupName, diskPoolName, iscsiTargetName).GetAwaiter().GetResult(); + } + + /// + /// Delete an iSCSI target. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Disk pool. + /// + /// + /// The name of the iSCSI target. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IIscsiTargetsOperations operations, string resourceGroupName, string diskPoolName, string iscsiTargetName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, diskPoolName, iscsiTargetName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get iSCSI Targets in a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByDiskPoolNext(this IIscsiTargetsOperations operations, string nextPageLink) + { + return operations.ListByDiskPoolNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get iSCSI Targets in a Disk pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByDiskPoolNextAsync(this IIscsiTargetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByDiskPoolNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Acl.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Acl.cs new file mode 100644 index 000000000000..9d00bc5969ce --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Acl.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.StoragePool.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Access Control List (ACL) for an iSCSI target portal group + /// + [Rest.Serialization.JsonTransformation] + public partial class Acl + { + /// + /// Initializes a new instance of the Acl class. + /// + public Acl() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Acl class. + /// + /// iSCSI initiator IQN (iSCSI Qualified + /// Name); example: "iqn.2005-03.org.iscsi:client". + /// List of LUN names mapped to the + /// ACL. + /// Username for Challenge Handshake + /// Authentication Protocol (CHAP) authentication. + /// Password for Challenge Handshake + /// Authentication Protocol (CHAP) authentication. + public Acl(string initiatorIqn, IList mappedLuns, string username, string password) + { + InitiatorIqn = initiatorIqn; + MappedLuns = mappedLuns; + Username = username; + Password = password; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets iSCSI initiator IQN (iSCSI Qualified Name); example: + /// "iqn.2005-03.org.iscsi:client". + /// + [JsonProperty(PropertyName = "initiatorIqn")] + public string InitiatorIqn { get; set; } + + /// + /// Gets or sets list of LUN names mapped to the ACL. + /// + [JsonProperty(PropertyName = "mappedLuns")] + public IList MappedLuns { get; set; } + + /// + /// Gets or sets username for Challenge Handshake Authentication + /// Protocol (CHAP) authentication. + /// + [JsonProperty(PropertyName = "credentials.username")] + public string Username { get; set; } + + /// + /// Gets or sets password for Challenge Handshake Authentication + /// Protocol (CHAP) authentication. + /// + [JsonProperty(PropertyName = "credentials.password")] + public string Password { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Attributes.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Attributes.cs new file mode 100644 index 000000000000..c53eeed0d492 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Attributes.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Attributes of a iSCSI target portal group. + /// + public partial class Attributes + { + /// + /// Initializes a new instance of the Attributes class. + /// + public Attributes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Attributes class. + /// + /// Indicates whether or not + /// authentication is enabled on the ACL. + /// Indicates whether or not write + /// protect is enabled on the LUNs. + public Attributes(bool authentication, bool prodModeWriteProtect) + { + Authentication = authentication; + ProdModeWriteProtect = prodModeWriteProtect; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether or not authentication is enabled on + /// the ACL. + /// + [JsonProperty(PropertyName = "authentication")] + public bool Authentication { get; set; } + + /// + /// Gets or sets indicates whether or not write protect is enabled on + /// the LUNs. + /// + [JsonProperty(PropertyName = "prodModeWriteProtect")] + public bool ProdModeWriteProtect { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Disk.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Disk.cs new file mode 100644 index 000000000000..66d1bd2a3a49 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Disk.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.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Managed Disk to attach to the Disk pool. + /// + public partial class Disk + { + /// + /// Initializes a new instance of the Disk class. + /// + public Disk() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Disk class. + /// + /// Unique Azure Resource ID of the Managed + /// Disk. + public Disk(string id) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique Azure Resource ID of the Managed Disk. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPool.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPool.cs new file mode 100644 index 000000000000..17f289b98cbe --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPool.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.StoragePool.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Response for Disk pool request. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskPool : TrackedResource + { + /// + /// Initializes a new instance of the DiskPool class. + /// + public DiskPool() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskPool class. + /// + /// The geo-location where the resource + /// lives. + /// State of the operation on the + /// resource. Possible values include: 'Invalid', 'Succeeded', + /// 'Failed', 'Canceled', 'Pending', 'Creating', 'Updating', + /// 'Deleting' + /// Logical zone for Disk pool + /// resource; example: ["1"]. + /// Operational status of the Disk pool. Possible + /// values include: 'Invalid', 'Unknown', 'Healthy', 'Unhealthy', + /// 'Updating', 'Running', 'Stopped', 'Stopped (deallocated)' + /// Azure Resource ID of a Subnet for the Disk + /// pool. + /// Determines the SKU of VM deployed for Disk pool. + /// Possible values include: 'Basic', 'Standard', 'Premium' + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + /// List of Azure Managed Disks to attach to a Disk + /// pool. Can attach 8 disks at most. + /// List of additional + /// capabilities for Disk pool. + /// Resource metadata required by ARM + /// RPC + public DiskPool(string location, string provisioningState, IList availabilityZones, string status, string subnetId, string tier, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList disks = default(IList), IList additionalCapabilities = default(IList), SystemMetadata systemData = default(SystemMetadata)) + : base(location, id, name, type, tags) + { + ProvisioningState = provisioningState; + AvailabilityZones = availabilityZones; + Status = status; + Disks = disks; + SubnetId = subnetId; + AdditionalCapabilities = additionalCapabilities; + Tier = tier; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets state of the operation on the resource. Possible + /// values include: 'Invalid', 'Succeeded', 'Failed', 'Canceled', + /// 'Pending', 'Creating', 'Updating', 'Deleting' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets logical zone for Disk pool resource; example: ["1"]. + /// + [JsonProperty(PropertyName = "properties.availabilityZones")] + public IList AvailabilityZones { get; set; } + + /// + /// Gets or sets operational status of the Disk pool. Possible values + /// include: 'Invalid', 'Unknown', 'Healthy', 'Unhealthy', 'Updating', + /// 'Running', 'Stopped', 'Stopped (deallocated)' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets list of Azure Managed Disks to attach to a Disk pool. + /// Can attach 8 disks at most. + /// + [JsonProperty(PropertyName = "properties.disks")] + public IList Disks { get; set; } + + /// + /// Gets or sets azure Resource ID of a Subnet for the Disk pool. + /// + [JsonProperty(PropertyName = "properties.subnetId")] + public string SubnetId { get; set; } + + /// + /// Gets or sets list of additional capabilities for Disk pool. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public IList AdditionalCapabilities { get; set; } + + /// + /// Gets or sets determines the SKU of VM deployed for Disk pool. + /// Possible values include: 'Basic', 'Standard', 'Premium' + /// + [JsonProperty(PropertyName = "properties.tier")] + public string Tier { get; set; } + + /// + /// Gets resource metadata required by ARM RPC + /// + [JsonProperty(PropertyName = "systemData")] + public SystemMetadata SystemData { get; private set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolCreate.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolCreate.cs new file mode 100644 index 000000000000..0daf9697a86b --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolCreate.cs @@ -0,0 +1,143 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Request payload for create or update Disk pool request. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskPoolCreate : IResource + { + /// + /// Initializes a new instance of the DiskPoolCreate class. + /// + public DiskPoolCreate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskPoolCreate class. + /// + /// Logical zone for Disk pool + /// resource; example: ["1"]. + /// Azure Resource ID of a Subnet for the Disk + /// pool. + /// Determines the SKU of VM deployed for Disk pool. + /// Possible values include: 'Basic', 'Standard', 'Premium' + /// The geo-location where the resource + /// lives. + /// List of Azure Managed Disks to attach to a Disk + /// pool. Can attach 8 disks at most. + /// List of additional + /// capabilities for a Disk pool. + /// Resource tags. + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public DiskPoolCreate(IList availabilityZones, string subnetId, string tier, string location, IList disks = default(IList), IList additionalCapabilities = default(IList), IDictionary tags = default(IDictionary), string id = default(string), string name = default(string), string type = default(string)) + { + AvailabilityZones = availabilityZones; + Disks = disks; + SubnetId = subnetId; + AdditionalCapabilities = additionalCapabilities; + Tier = tier; + Tags = tags; + Location = location; + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets logical zone for Disk pool resource; example: ["1"]. + /// + [JsonProperty(PropertyName = "properties.availabilityZones")] + public IList AvailabilityZones { get; set; } + + /// + /// Gets or sets list of Azure Managed Disks to attach to a Disk pool. + /// Can attach 8 disks at most. + /// + [JsonProperty(PropertyName = "properties.disks")] + public IList Disks { get; set; } + + /// + /// Gets or sets azure Resource ID of a Subnet for the Disk pool. + /// + [JsonProperty(PropertyName = "properties.subnetId")] + public string SubnetId { get; set; } + + /// + /// Gets or sets list of additional capabilities for a Disk pool. + /// + [JsonProperty(PropertyName = "properties.additionalCapabilities")] + public IList AdditionalCapabilities { get; set; } + + /// + /// Gets or sets determines the SKU of VM deployed for Disk pool. + /// Possible values include: 'Basic', 'Standard', 'Premium' + /// + [JsonProperty(PropertyName = "properties.tier")] + public string Tier { get; set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolTier.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolTier.cs new file mode 100644 index 000000000000..cf0a34f14200 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolTier.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + + /// + /// Defines values for DiskPoolTier. + /// + public static class DiskPoolTier + { + public const string Basic = "Basic"; + public const string Standard = "Standard"; + public const string Premium = "Premium"; + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolUpdate.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolUpdate.cs new file mode 100644 index 000000000000..1591bdc998cb --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/DiskPoolUpdate.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.StoragePool.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Request payload for Update Disk pool request. + /// + [Rest.Serialization.JsonTransformation] + public partial class DiskPoolUpdate + { + /// + /// Initializes a new instance of the DiskPoolUpdate class. + /// + public DiskPoolUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiskPoolUpdate class. + /// + /// List of Azure Managed Disks to attach to a Disk + /// pool. Can attach 8 disks at most. + /// Resource tags. + public DiskPoolUpdate(IList disks = default(IList), IDictionary tags = default(IDictionary)) + { + Disks = disks; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of Azure Managed Disks to attach to a Disk pool. + /// Can attach 8 disks at most. + /// + [JsonProperty(PropertyName = "properties.disks")] + public IList Disks { get; set; } + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Error.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Error.cs new file mode 100644 index 000000000000..d8b3fc02b7f8 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Error.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.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error response. + /// + public partial class Error + { + /// + /// Initializes a new instance of the Error class. + /// + public Error() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Error class. + /// + /// RP error response. + public Error(ErrorResponse errorProperty = default(ErrorResponse)) + { + ErrorProperty = errorProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets RP error response. + /// + [JsonProperty(PropertyName = "error")] + public ErrorResponse ErrorProperty { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..5b1d71d98969 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ErrorException.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ErrorException.cs new file mode 100644 index 000000000000..57a3b2a0ddfc --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/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.StoragePool.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/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ErrorResponse.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..135054e7a5ad --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ErrorResponse.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.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource management error response. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorResponse(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiLun.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiLun.cs new file mode 100644 index 000000000000..6b9084109e51 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiLun.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.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// LUN to expose the Azure Managed Disk. + /// + public partial class IscsiLun + { + /// + /// Initializes a new instance of the IscsiLun class. + /// + public IscsiLun() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IscsiLun class. + /// + /// User defined name for iSCSI LUN; example: + /// "lun0" + /// Azure Resource ID of the + /// Managed Disk. + public IscsiLun(string name, string managedDiskAzureResourceId) + { + Name = name; + ManagedDiskAzureResourceId = managedDiskAzureResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets user defined name for iSCSI LUN; example: "lun0" + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets azure Resource ID of the Managed Disk. + /// + [JsonProperty(PropertyName = "managedDiskAzureResourceId")] + public string ManagedDiskAzureResourceId { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTarget.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTarget.cs new file mode 100644 index 000000000000..444dc3e949af --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTarget.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Response for iSCSI target requests. + /// + [Rest.Serialization.JsonTransformation] + public partial class IscsiTarget : ProxyResource + { + /// + /// Initializes a new instance of the IscsiTarget class. + /// + public IscsiTarget() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IscsiTarget class. + /// + /// State of the operation on the + /// resource. Possible values include: 'Invalid', 'Succeeded', + /// 'Failed', 'Canceled', 'Pending', 'Creating', 'Updating', + /// 'Deleting' + /// Operational status of the iSCSI target. + /// Possible values include: 'Invalid', 'Unknown', 'Healthy', + /// 'Unhealthy', 'Updating', 'Running', 'Stopped', 'Stopped + /// (deallocated)' + /// List of iSCSI target portal groups. Can have 1 + /// portal group at most. + /// iSCSI target IQN (iSCSI Qualified Name); + /// example: "iqn.2005-03.org.iscsi:server". + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public IscsiTarget(string provisioningState, string status, IList tpgs, string targetIqn, string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + ProvisioningState = provisioningState; + Status = status; + Tpgs = tpgs; + TargetIqn = targetIqn; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets state of the operation on the resource. Possible + /// values include: 'Invalid', 'Succeeded', 'Failed', 'Canceled', + /// 'Pending', 'Creating', 'Updating', 'Deleting' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets operational status of the iSCSI target. Possible + /// values include: 'Invalid', 'Unknown', 'Healthy', 'Unhealthy', + /// 'Updating', 'Running', 'Stopped', 'Stopped (deallocated)' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets list of iSCSI target portal groups. Can have 1 portal + /// group at most. + /// + [JsonProperty(PropertyName = "properties.tpgs")] + public IList Tpgs { get; set; } + + /// + /// Gets or sets iSCSI target IQN (iSCSI Qualified Name); example: + /// "iqn.2005-03.org.iscsi:server". + /// + [JsonProperty(PropertyName = "properties.targetIqn")] + public string TargetIqn { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTargetCreate.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTargetCreate.cs new file mode 100644 index 000000000000..b967dd864609 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTargetCreate.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.StoragePool.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Payload for iSCSI target create or update requests. + /// + [Rest.Serialization.JsonTransformation] + public partial class IscsiTargetCreate : ProxyResource + { + /// + /// Initializes a new instance of the IscsiTargetCreate class. + /// + public IscsiTargetCreate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IscsiTargetCreate class. + /// + /// List of iSCSI target portal groups. Can have 1 + /// portal group at most. + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// iSCSI target IQN (iSCSI Qualified Name); + /// example: "iqn.2005-03.org.iscsi:server". + public IscsiTargetCreate(IList tpgs, string id = default(string), string name = default(string), string type = default(string), string targetIqn = default(string)) + : base(id, name, type) + { + Tpgs = tpgs; + TargetIqn = targetIqn; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of iSCSI target portal groups. Can have 1 portal + /// group at most. + /// + [JsonProperty(PropertyName = "properties.tpgs")] + public IList Tpgs { get; set; } + + /// + /// Gets or sets iSCSI target IQN (iSCSI Qualified Name); example: + /// "iqn.2005-03.org.iscsi:server". + /// + [JsonProperty(PropertyName = "properties.targetIqn")] + public string TargetIqn { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTargetUpdate.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTargetUpdate.cs new file mode 100644 index 000000000000..f09212952676 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/IscsiTargetUpdate.cs @@ -0,0 +1,58 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Payload for iSCSI target update request. + /// + [Rest.Serialization.JsonTransformation] + public partial class IscsiTargetUpdate + { + /// + /// Initializes a new instance of the IscsiTargetUpdate class. + /// + public IscsiTargetUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IscsiTargetUpdate class. + /// + /// List of iSCSI target portal groups. Can have 1 + /// portal group at most. + public IscsiTargetUpdate(IList tpgs) + { + Tpgs = tpgs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of iSCSI target portal groups. Can have 1 portal + /// group at most. + /// + [JsonProperty(PropertyName = "properties.tpgs")] + public IList Tpgs { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/OperationalStatus.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/OperationalStatus.cs new file mode 100644 index 000000000000..518b53da41b0 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/OperationalStatus.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + + /// + /// Defines values for OperationalStatus. + /// + public static class OperationalStatus + { + public const string Invalid = "Invalid"; + public const string Unknown = "Unknown"; + public const string Healthy = "Healthy"; + public const string Unhealthy = "Unhealthy"; + public const string Updating = "Updating"; + public const string Running = "Running"; + public const string Stopped = "Stopped"; + public const string Stoppeddeallocated = "Stopped (deallocated)"; + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Page.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..6e712a5874f7 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/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.StoragePool.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/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Page1.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Page1.cs new file mode 100644 index 000000000000..24f9224d8ef7 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/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.StoragePool.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/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ProvisioningStates.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ProvisioningStates.cs new file mode 100644 index 000000000000..71ed1757596d --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ProvisioningStates.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + + /// + /// Defines values for ProvisioningStates. + /// + public static class ProvisioningStates + { + public const string Invalid = "Invalid"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + public const string Pending = "Pending"; + public const string Creating = "Creating"; + public const string Updating = "Updating"; + public const string Deleting = "Deleting"; + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ProxyResource.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..ab578aeda7f2 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,50 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + using System.Linq; + + /// + /// The resource model definition for a ARM proxy resource. It will have + /// everything other than required location and tags + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Resource.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Resource.cs new file mode 100644 index 000000000000..d4187eea458d --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/Resource.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.StoragePool.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// ARM resource model definition. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + public Resource(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 fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/StoragePoolOperationDisplay.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/StoragePoolOperationDisplay.cs new file mode 100644 index 000000000000..f83fd1251468 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/StoragePoolOperationDisplay.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.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata about an operation. + /// + public partial class StoragePoolOperationDisplay + { + /// + /// Initializes a new instance of the StoragePoolOperationDisplay + /// class. + /// + public StoragePoolOperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StoragePoolOperationDisplay + /// class. + /// + /// Localized friendly form of the resource + /// provider name. + /// Localized friendly form of the resource type + /// related to this action/operation. + /// Localized friendly name for the operation, + /// as it should be shown to the user. + /// Localized friendly description for the + /// operation, as it should be shown to the user. + public StoragePoolOperationDisplay(string provider, string resource, string operation, string description) + { + 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 localized friendly form of the resource provider name. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets localized friendly form of the resource type related + /// to this action/operation. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets localized friendly name for the operation, as it + /// should be shown to the user. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets localized friendly description for the operation, as + /// it should be shown to the user. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/StoragePoolRPOperation.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/StoragePoolRPOperation.cs new file mode 100644 index 000000000000..18d1972d9f06 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/StoragePoolRPOperation.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.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Description of a StoragePool RP Operation + /// + public partial class StoragePoolRPOperation + { + /// + /// Initializes a new instance of the StoragePoolRPOperation class. + /// + public StoragePoolRPOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the StoragePoolRPOperation class. + /// + /// The name of the operation being performed on + /// this particular object + /// Indicates whether the operation applies + /// to data-plane. + /// Additional metadata about RP + /// operation. + /// Indicates the action type. + /// The intended executor of the operation; + /// governs the display of the operation in the RBAC UX and the audit + /// logs UX. + public StoragePoolRPOperation(string name, bool isDataAction, StoragePoolOperationDisplay display, string actionType = default(string), string origin = default(string)) + { + Name = name; + IsDataAction = isDataAction; + ActionType = actionType; + Display = display; + Origin = origin; + 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 + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets indicates whether the operation applies to data-plane. + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool IsDataAction { get; set; } + + /// + /// Gets or sets indicates the action type. + /// + [JsonProperty(PropertyName = "actionType")] + public string ActionType { get; set; } + + /// + /// Gets or sets additional metadata about RP operation. + /// + [JsonProperty(PropertyName = "display")] + public StoragePoolOperationDisplay Display { get; set; } + + /// + /// Gets or sets the intended executor of the operation; governs the + /// display of the operation in the RBAC UX and the audit logs UX. + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/SystemMetadata.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/SystemMetadata.cs new file mode 100644 index 000000000000..ba1dbf89335c --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/SystemMetadata.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Resource metadata required by ARM RPC. + /// + public partial class SystemMetadata + { + /// + /// Initializes a new instance of the SystemMetadata class. + /// + public SystemMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemMetadata class. + /// + /// A string identifier for the identity that + /// created the resource. + /// The type of identity that created the + /// resource: user, application, managedIdentity. + /// The timestamp of resource creation + /// (UTC). + /// A string identifier for the identity + /// that last modified the resource. + /// The type of identity that last + /// modified the resource: user, application, managedIdentity. + /// The timestamp of resource last + /// modification (UTC). + public SystemMetadata(string createdBy = default(string), string createdByType = default(string), string createdAt = default(string), string lastModifiedBy = default(string), string lastModifiedByType = default(string), string lastModifiedAt = default(string)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a string identifier for the identity that created the + /// resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource: user, + /// application, managedIdentity. + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public string CreatedAt { get; set; } + + /// + /// Gets or sets a string identifier for the identity that last + /// modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource: + /// user, application, managedIdentity. + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC). + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public string LastModifiedAt { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroup.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroup.cs new file mode 100644 index 000000000000..a5ba9fff9c80 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroup.cs @@ -0,0 +1,102 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Response properties for iSCSI target portal group. + /// + public partial class TargetPortalGroup + { + /// + /// Initializes a new instance of the TargetPortalGroup class. + /// + public TargetPortalGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TargetPortalGroup class. + /// + /// List of LUNs to be exposed through iSCSI target + /// portal group. + /// Access Control List (ACL) for an iSCSI target + /// portal group. + /// Attributes of an iSCSI target portal + /// group. + /// List of private IPv4 addresses to connect + /// to the iSCSI target. + /// The tag associated with the iSCSI target portal + /// group. + /// The port used by iSCSI target portal + /// group. + public TargetPortalGroup(IList luns, IList acls, Attributes attributes, IList endpoints, int tag, int port) + { + Luns = luns; + Acls = acls; + Attributes = attributes; + Endpoints = endpoints; + Tag = tag; + Port = port; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of LUNs to be exposed through iSCSI target portal + /// group. + /// + [JsonProperty(PropertyName = "luns")] + public IList Luns { get; set; } + + /// + /// Gets or sets access Control List (ACL) for an iSCSI target portal + /// group. + /// + [JsonProperty(PropertyName = "acls")] + public IList Acls { get; set; } + + /// + /// Gets or sets attributes of an iSCSI target portal group. + /// + [JsonProperty(PropertyName = "attributes")] + public Attributes Attributes { get; set; } + + /// + /// Gets or sets list of private IPv4 addresses to connect to the iSCSI + /// target. + /// + [JsonProperty(PropertyName = "endpoints")] + public IList Endpoints { get; set; } + + /// + /// Gets or sets the tag associated with the iSCSI target portal group. + /// + [JsonProperty(PropertyName = "tag")] + public int Tag { get; set; } + + /// + /// Gets or sets the port used by iSCSI target portal group. + /// + [JsonProperty(PropertyName = "port")] + public int Port { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroupCreate.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroupCreate.cs new file mode 100644 index 000000000000..7e4bbfc61e3e --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroupCreate.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.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Target portal group properties for create or update iSCSI target + /// request. + /// + public partial class TargetPortalGroupCreate + { + /// + /// Initializes a new instance of the TargetPortalGroupCreate class. + /// + public TargetPortalGroupCreate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TargetPortalGroupCreate class. + /// + /// List of LUNs to be exposed through the iSCSI + /// target portal group. + /// Access Control List (ACL) for an iSCSI target + /// portal group. + /// Attributes of an iSCSI target portal + /// group. + public TargetPortalGroupCreate(IList luns, IList acls, Attributes attributes) + { + Luns = luns; + Acls = acls; + Attributes = attributes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of LUNs to be exposed through the iSCSI target + /// portal group. + /// + [JsonProperty(PropertyName = "luns")] + public IList Luns { get; set; } + + /// + /// Gets or sets access Control List (ACL) for an iSCSI target portal + /// group. + /// + [JsonProperty(PropertyName = "acls")] + public IList Acls { get; set; } + + /// + /// Gets or sets attributes of an iSCSI target portal group. + /// + [JsonProperty(PropertyName = "attributes")] + public Attributes Attributes { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroupUpdate.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroupUpdate.cs new file mode 100644 index 000000000000..e495995eda3f --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TargetPortalGroupUpdate.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Target portal group properties for update iSCSI target request. + /// + public partial class TargetPortalGroupUpdate + { + /// + /// Initializes a new instance of the TargetPortalGroupUpdate class. + /// + public TargetPortalGroupUpdate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TargetPortalGroupUpdate class. + /// + /// List of LUNs to be exposed through the iSCSI + /// target portal group. + /// Access Control List (ACL) for an iSCSI target + /// portal group. + public TargetPortalGroupUpdate(IList luns = default(IList), IList acls = default(IList)) + { + Luns = luns; + Acls = acls; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of LUNs to be exposed through the iSCSI target + /// portal group. + /// + [JsonProperty(PropertyName = "luns")] + public IList Luns { get; set; } + + /// + /// Gets or sets access Control List (ACL) for an iSCSI target portal + /// group. + /// + [JsonProperty(PropertyName = "acls")] + public IList Acls { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TrackedResource.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..bd130757571e --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Models/TrackedResource.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.StoragePool.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The resource model definition for a ARM tracked top level resource. + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives. + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Operations.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Operations.cs new file mode 100644 index 000000000000..890fe63d0a65 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/Operations.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.StoragePool +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(StoragePoolManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StoragePoolManagementClient + /// + public StoragePoolManagementClient Client { get; private set; } + + /// + /// Gets a list of StoragePool operations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.StoragePool/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; + } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/OperationsExtensions.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..625069ef5965 --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/OperationsExtensions.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool +{ + 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 Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Gets a list of StoragePool operations. + /// + /// + /// The operations group for this extension method. + /// + public static IEnumerable List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of StoragePool operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/SdkInfo_StoragePoolManagement.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/SdkInfo_StoragePoolManagement.cs new file mode 100644 index 000000000000..d859900e6d6a --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/SdkInfo_StoragePoolManagement.cs @@ -0,0 +1,29 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_StoragePoolManagement + { + get + { + return new Tuple[] + { + new Tuple("StoragePool", "DiskPools", "2020-03-15-preview"), + new Tuple("StoragePool", "IscsiTargets", "2020-03-15-preview"), + new Tuple("StoragePool", "Operations", "2020-03-15-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/StoragePoolManagementClient.cs b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/StoragePoolManagementClient.cs new file mode 100644 index 000000000000..03412b21581f --- /dev/null +++ b/sdk/storagepool/Microsoft.Azure.Management.StoragePool/src/Generated/StoragePoolManagementClient.cs @@ -0,0 +1,369 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.StoragePool +{ + 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 StoragePoolManagementClient : ServiceClient, IStoragePoolManagementClient, 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 ID of the target subscription. + /// + public string SubscriptionId { get; set; } + + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IDiskPoolsOperations. + /// + public virtual IDiskPoolsOperations DiskPools { get; private set; } + + /// + /// Gets the IIscsiTargetsOperations. + /// + public virtual IIscsiTargetsOperations IscsiTargets { get; private set; } + + /// + /// Initializes a new instance of the StoragePoolManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling StoragePoolManagementClient.Dispose(). False: will not dispose provided httpClient + protected StoragePoolManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the StoragePoolManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected StoragePoolManagementClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the StoragePoolManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected StoragePoolManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the StoragePoolManagementClient 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 StoragePoolManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the StoragePoolManagementClient 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 StoragePoolManagementClient(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 StoragePoolManagementClient 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 StoragePoolManagementClient(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 StoragePoolManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling StoragePoolManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public StoragePoolManagementClient(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 StoragePoolManagementClient 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 StoragePoolManagementClient(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 StoragePoolManagementClient 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 StoragePoolManagementClient(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 StoragePoolManagementClient 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 StoragePoolManagementClient(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() + { + Operations = new Operations(this); + DiskPools = new DiskPoolsOperations(this); + IscsiTargets = new IscsiTargetsOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2020-03-15-preview"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +}