diff --git a/src/SDKs/Network/Management.Network/Generated/ExpressRouteGatewaysOperations.cs b/src/SDKs/Network/Management.Network/Generated/ExpressRouteGatewaysOperations.cs index b81ab08647faf..6c2abdbb014ee 100644 --- a/src/SDKs/Network/Management.Network/Generated/ExpressRouteGatewaysOperations.cs +++ b/src/SDKs/Network/Management.Network/Generated/ExpressRouteGatewaysOperations.cs @@ -563,7 +563,7 @@ internal ExpressRouteGatewaysOperations(NetworkManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 404) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try diff --git a/src/SDKs/Network/Management.Network/Generated/ExpressRouteLinksOperations.cs b/src/SDKs/Network/Management.Network/Generated/ExpressRouteLinksOperations.cs new file mode 100644 index 0000000000000..2ab5d325ba7ec --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/ExpressRouteLinksOperations.cs @@ -0,0 +1,626 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + 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; + + /// + /// ExpressRouteLinksOperations operations. + /// + internal partial class ExpressRouteLinksOperations : IServiceOperations, IExpressRouteLinksOperations + { + /// + /// Initializes a new instance of the ExpressRouteLinksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ExpressRouteLinksOperations(NetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NetworkManagementClient + /// + public NetworkManagementClient Client { get; private set; } + + /// + /// Retrieves the specified ExpressRouteLink resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// The name of the ExpressRouteLink resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string expressRoutePortName, string linkName, 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 (expressRoutePortName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "expressRoutePortName"); + } + if (linkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "linkName"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("expressRoutePortName", expressRoutePortName); + tracingParameters.Add("linkName", linkName); + 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.Network/ExpressRoutePorts/{expressRoutePortName}/links/{linkName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{expressRoutePortName}", System.Uri.EscapeDataString(expressRoutePortName)); + _url = _url.Replace("{linkName}", System.Uri.EscapeDataString(linkName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieve the ExpressRouteLink sub-resources of the specified + /// ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string expressRoutePortName, 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 (expressRoutePortName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "expressRoutePortName"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("expressRoutePortName", expressRoutePortName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{expressRoutePortName}", System.Uri.EscapeDataString(expressRoutePortName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieve the ExpressRouteLink sub-resources of the specified + /// ExpressRoutePort resource. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/ExpressRouteLinksOperationsExtensions.cs b/src/SDKs/Network/Management.Network/Generated/ExpressRouteLinksOperationsExtensions.cs new file mode 100644 index 0000000000000..74b1d0f03c206 --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/ExpressRouteLinksOperationsExtensions.cs @@ -0,0 +1,149 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ExpressRouteLinksOperations. + /// + public static partial class ExpressRouteLinksOperationsExtensions + { + /// + /// Retrieves the specified ExpressRouteLink resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// The name of the ExpressRouteLink resource. + /// + public static ExpressRouteLink Get(this IExpressRouteLinksOperations operations, string resourceGroupName, string expressRoutePortName, string linkName) + { + return operations.GetAsync(resourceGroupName, expressRoutePortName, linkName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves the specified ExpressRouteLink resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// The name of the ExpressRouteLink resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IExpressRouteLinksOperations operations, string resourceGroupName, string expressRoutePortName, string linkName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, linkName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve the ExpressRouteLink sub-resources of the specified + /// ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + public static IPage List(this IExpressRouteLinksOperations operations, string resourceGroupName, string expressRoutePortName) + { + return operations.ListAsync(resourceGroupName, expressRoutePortName).GetAwaiter().GetResult(); + } + + /// + /// Retrieve the ExpressRouteLink sub-resources of the specified + /// ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IExpressRouteLinksOperations operations, string resourceGroupName, string expressRoutePortName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieve the ExpressRouteLink sub-resources of the specified + /// ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IExpressRouteLinksOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieve the ExpressRouteLink sub-resources of the specified + /// ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IExpressRouteLinksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsLocationsOperations.cs b/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsLocationsOperations.cs new file mode 100644 index 0000000000000..75619d5a8b20e --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsLocationsOperations.cs @@ -0,0 +1,593 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + 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; + + /// + /// ExpressRoutePortsLocationsOperations operations. + /// + internal partial class ExpressRoutePortsLocationsOperations : IServiceOperations, IExpressRoutePortsLocationsOperations + { + /// + /// Initializes a new instance of the ExpressRoutePortsLocationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ExpressRoutePortsLocationsOperations(NetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NetworkManagementClient + /// + public NetworkManagementClient Client { get; private set; } + + /// + /// Retrieves all ExpressRoutePort peering locations. Does not return available + /// bandwidths for each location. Available bandwidths can only be obtained + /// when retriving a specific peering location. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves a single ExpressRoutePort peering location, including the list of + /// available bandwidths available at said peering location. + /// + /// + /// Name of the requested ExpressRoutePort peering location. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (locationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("locationName", locationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations/{locationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves all ExpressRoutePort peering locations. Does not return available + /// bandwidths for each location. Available bandwidths can only be obtained + /// when retriving a specific peering location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsLocationsOperationsExtensions.cs b/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsLocationsOperationsExtensions.cs new file mode 100644 index 0000000000000..aed15b558f338 --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsLocationsOperationsExtensions.cs @@ -0,0 +1,131 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ExpressRoutePortsLocationsOperations. + /// + public static partial class ExpressRoutePortsLocationsOperationsExtensions + { + /// + /// Retrieves all ExpressRoutePort peering locations. Does not return available + /// bandwidths for each location. Available bandwidths can only be obtained + /// when retriving a specific peering location. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IExpressRoutePortsLocationsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Retrieves all ExpressRoutePort peering locations. Does not return available + /// bandwidths for each location. Available bandwidths can only be obtained + /// when retriving a specific peering location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IExpressRoutePortsLocationsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves a single ExpressRoutePort peering location, including the list of + /// available bandwidths available at said peering location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the requested ExpressRoutePort peering location. + /// + public static ExpressRoutePortsLocation Get(this IExpressRoutePortsLocationsOperations operations, string locationName) + { + return operations.GetAsync(locationName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a single ExpressRoutePort peering location, including the list of + /// available bandwidths available at said peering location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the requested ExpressRoutePort peering location. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IExpressRoutePortsLocationsOperations operations, string locationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(locationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves all ExpressRoutePort peering locations. Does not return available + /// bandwidths for each location. Available bandwidths can only be obtained + /// when retriving a specific peering location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IExpressRoutePortsLocationsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all ExpressRoutePort peering locations. Does not return available + /// bandwidths for each location. Available bandwidths can only be obtained + /// when retriving a specific peering location. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IExpressRoutePortsLocationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsOperations.cs b/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsOperations.cs new file mode 100644 index 0000000000000..8c3ab2c046a0a --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsOperations.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.Network +{ + 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; + + /// + /// ExpressRoutePortsOperations operations. + /// + internal partial class ExpressRoutePortsOperations : IServiceOperations, IExpressRoutePortsOperations + { + /// + /// Initializes a new instance of the ExpressRoutePortsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ExpressRoutePortsOperations(NetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NetworkManagementClient + /// + public NetworkManagementClient Client { get; private set; } + + /// + /// Deletes the specified ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string expressRoutePortName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves the requested ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of ExpressRoutePort. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 expressRoutePortName, 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 (expressRoutePortName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "expressRoutePortName"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("expressRoutePortName", expressRoutePortName); + 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.Network/ExpressRoutePorts/{expressRoutePortName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{expressRoutePortName}", System.Uri.EscapeDataString(expressRoutePortName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the specified ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to the create ExpressRoutePort operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string expressRoutePortName, ExpressRoutePort parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update ExpressRoutePort tags + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to update ExpressRoutePort resource tags. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string expressRoutePortName, TagsObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateTagsWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List all the ExpressRoutePort resources in the specified resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("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.Network/ExpressRoutePorts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List all the ExpressRoutePort resources in the specified subscription + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePorts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the specified ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// 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 expressRoutePortName, 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 (expressRoutePortName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "expressRoutePortName"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("expressRoutePortName", expressRoutePortName); + 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.Network/ExpressRoutePorts/{expressRoutePortName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{expressRoutePortName}", System.Uri.EscapeDataString(expressRoutePortName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the specified ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to the create ExpressRoutePort 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 expressRoutePortName, ExpressRoutePort parameters, 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 (expressRoutePortName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "expressRoutePortName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("expressRoutePortName", expressRoutePortName); + tracingParameters.Add("parameters", parameters); + 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.Network/ExpressRoutePorts/{expressRoutePortName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{expressRoutePortName}", System.Uri.EscapeDataString(expressRoutePortName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update ExpressRoutePort tags + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to update ExpressRoutePort 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> BeginUpdateTagsWithHttpMessagesAsync(string resourceGroupName, string expressRoutePortName, TagsObject parameters, 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 (expressRoutePortName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "expressRoutePortName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("expressRoutePortName", expressRoutePortName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateTags", 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.Network/ExpressRoutePorts/{expressRoutePortName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{expressRoutePortName}", System.Uri.EscapeDataString(expressRoutePortName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List all the ExpressRoutePort resources in the specified 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List all the ExpressRoutePort resources in the specified 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsOperationsExtensions.cs b/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsOperationsExtensions.cs new file mode 100644 index 0000000000000..d0c816a545cc1 --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/ExpressRoutePortsOperationsExtensions.cs @@ -0,0 +1,453 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ExpressRoutePortsOperations. + /// + public static partial class ExpressRoutePortsOperationsExtensions + { + /// + /// Deletes the specified ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + public static void Delete(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName) + { + operations.DeleteAsync(resourceGroupName, expressRoutePortName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Retrieves the requested ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of ExpressRoutePort. + /// + public static ExpressRoutePort Get(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName) + { + return operations.GetAsync(resourceGroupName, expressRoutePortName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves the requested ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of ExpressRoutePort. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the specified ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to the create ExpressRoutePort operation. + /// + public static ExpressRoutePort CreateOrUpdate(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName, ExpressRoutePort parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, expressRoutePortName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the specified ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to the create ExpressRoutePort operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName, ExpressRoutePort parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update ExpressRoutePort tags + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to update ExpressRoutePort resource tags. + /// + public static ExpressRoutePort UpdateTags(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName, TagsObject parameters) + { + return operations.UpdateTagsAsync(resourceGroupName, expressRoutePortName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update ExpressRoutePort tags + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to update ExpressRoutePort resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateTagsAsync(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName, TagsObject parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all the ExpressRoutePort resources in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage ListByResourceGroup(this IExpressRoutePortsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List all the ExpressRoutePort resources in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IExpressRoutePortsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all the ExpressRoutePort resources in the specified subscription + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IExpressRoutePortsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List all the ExpressRoutePort resources in the specified subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IExpressRoutePortsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + public static void BeginDelete(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName) + { + operations.BeginDeleteAsync(resourceGroupName, expressRoutePortName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates the specified ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to the create ExpressRoutePort operation. + /// + public static ExpressRoutePort BeginCreateOrUpdate(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName, ExpressRoutePort parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, expressRoutePortName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the specified ExpressRoutePort resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to the create ExpressRoutePort operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName, ExpressRoutePort parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update ExpressRoutePort tags + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to update ExpressRoutePort resource tags. + /// + public static ExpressRoutePort BeginUpdateTags(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName, TagsObject parameters) + { + return operations.BeginUpdateTagsAsync(resourceGroupName, expressRoutePortName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update ExpressRoutePort tags + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to update ExpressRoutePort resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateTagsAsync(this IExpressRoutePortsOperations operations, string resourceGroupName, string expressRoutePortName, TagsObject parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateTagsWithHttpMessagesAsync(resourceGroupName, expressRoutePortName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all the ExpressRoutePort resources in the specified resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IExpressRoutePortsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all the ExpressRoutePort resources in the specified 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 IExpressRoutePortsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all the ExpressRoutePort resources in the specified subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IExpressRoutePortsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all the ExpressRoutePort resources in the specified 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> ListNextAsync(this IExpressRoutePortsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/IExpressRouteLinksOperations.cs b/src/SDKs/Network/Management.Network/Generated/IExpressRouteLinksOperations.cs new file mode 100644 index 0000000000000..090173d7d0f0c --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/IExpressRouteLinksOperations.cs @@ -0,0 +1,104 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ExpressRouteLinksOperations operations. + /// + public partial interface IExpressRouteLinksOperations + { + /// + /// Retrieves the specified ExpressRouteLink resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// The name of the ExpressRouteLink resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string expressRoutePortName, string linkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve the ExpressRouteLink sub-resources of the specified + /// ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string expressRoutePortName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve the ExpressRouteLink sub-resources of the specified + /// ExpressRoutePort resource. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/IExpressRoutePortsLocationsOperations.cs b/src/SDKs/Network/Management.Network/Generated/IExpressRoutePortsLocationsOperations.cs new file mode 100644 index 0000000000000..3f670a114d458 --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/IExpressRoutePortsLocationsOperations.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ExpressRoutePortsLocationsOperations operations. + /// + public partial interface IExpressRoutePortsLocationsOperations + { + /// + /// Retrieves all ExpressRoutePort peering locations. Does not return + /// available bandwidths for each location. Available bandwidths can + /// only be obtained when retriving a specific peering location. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a single ExpressRoutePort peering location, including the + /// list of available bandwidths available at said peering location. + /// + /// + /// Name of the requested ExpressRoutePort peering location. + /// + /// + /// 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 locationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves all ExpressRoutePort peering locations. Does not return + /// available bandwidths for each location. Available bandwidths can + /// only be obtained when retriving a specific peering location. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/IExpressRoutePortsOperations.cs b/src/SDKs/Network/Management.Network/Generated/IExpressRoutePortsOperations.cs new file mode 100644 index 0000000000000..f5a3a5c15643a --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/IExpressRoutePortsOperations.cs @@ -0,0 +1,297 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ExpressRoutePortsOperations operations. + /// + public partial interface IExpressRoutePortsOperations + { + /// + /// Deletes the specified ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// 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 expressRoutePortName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves the requested ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of ExpressRoutePort. + /// + /// + /// 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 expressRoutePortName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the specified ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to the create ExpressRoutePort 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 expressRoutePortName, ExpressRoutePort parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update ExpressRoutePort tags + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to update ExpressRoutePort 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string expressRoutePortName, TagsObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the ExpressRoutePort resources in the specified resource + /// group. + /// + /// + /// The name of the resource group. + /// + /// + /// 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)); + /// + /// List all the ExpressRoutePort resources in the specified + /// subscription + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// 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 expressRoutePortName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the specified ExpressRoutePort resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to the create ExpressRoutePort 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 expressRoutePortName, ExpressRoutePort parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update ExpressRoutePort tags + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the ExpressRoutePort resource. + /// + /// + /// Parameters supplied to update ExpressRoutePort 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> BeginUpdateTagsWithHttpMessagesAsync(string resourceGroupName, string expressRoutePortName, TagsObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the ExpressRoutePort resources in the specified 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)); + /// + /// List all the ExpressRoutePort resources in the specified + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/ILoadBalancerOutboundRulesOperations.cs b/src/SDKs/Network/Management.Network/Generated/ILoadBalancerOutboundRulesOperations.cs new file mode 100644 index 0000000000000..a9cdd20240308 --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/ILoadBalancerOutboundRulesOperations.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.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LoadBalancerOutboundRulesOperations operations. + /// + public partial interface ILoadBalancerOutboundRulesOperations + { + /// + /// Gets all the outbound rules in a load balancer. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the load balancer. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string loadBalancerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified load balancer outbound rule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the load balancer. + /// + /// + /// The name of the outbound rule. + /// + /// + /// 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 loadBalancerName, string outboundRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the outbound rules in a load balancer. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/INetworkManagementClient.cs b/src/SDKs/Network/Management.Network/Generated/INetworkManagementClient.cs index cac46e5d2e0c3..5c56066295145 100644 --- a/src/SDKs/Network/Management.Network/Generated/INetworkManagementClient.cs +++ b/src/SDKs/Network/Management.Network/Generated/INetworkManagementClient.cs @@ -155,6 +155,21 @@ public partial interface INetworkManagementClient : System.IDisposable /// IExpressRouteConnectionsOperations ExpressRouteConnections { get; } + /// + /// Gets the IExpressRoutePortsLocationsOperations. + /// + IExpressRoutePortsLocationsOperations ExpressRoutePortsLocations { get; } + + /// + /// Gets the IExpressRoutePortsOperations. + /// + IExpressRoutePortsOperations ExpressRoutePorts { get; } + + /// + /// Gets the IExpressRouteLinksOperations. + /// + IExpressRouteLinksOperations ExpressRouteLinks { get; } + /// /// Gets the IInterfaceEndpointsOperations. /// @@ -185,6 +200,11 @@ public partial interface INetworkManagementClient : System.IDisposable /// ILoadBalancerLoadBalancingRulesOperations LoadBalancerLoadBalancingRules { get; } + /// + /// Gets the ILoadBalancerOutboundRulesOperations. + /// + ILoadBalancerOutboundRulesOperations LoadBalancerOutboundRules { get; } + /// /// Gets the ILoadBalancerNetworkInterfacesOperations. /// diff --git a/src/SDKs/Network/Management.Network/Generated/IVirtualNetworksOperations.cs b/src/SDKs/Network/Management.Network/Generated/IVirtualNetworksOperations.cs index 925fac1640e5c..3ab5473bd14f0 100644 --- a/src/SDKs/Network/Management.Network/Generated/IVirtualNetworksOperations.cs +++ b/src/SDKs/Network/Management.Network/Generated/IVirtualNetworksOperations.cs @@ -175,15 +175,15 @@ public partial interface IVirtualNetworksOperations /// /// Checks whether a private IP address is available for use. /// + /// + /// The private IP address to be verified. + /// /// /// The name of the resource group. /// /// /// The name of the virtual network. /// - /// - /// The private IP address to be verified. - /// /// /// The headers that will be added to request. /// @@ -199,7 +199,7 @@ public partial interface IVirtualNetworksOperations /// /// Thrown when a required parameter is null /// - Task> CheckIPAddressAvailabilityWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkName, string ipAddress = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CheckIPAddressAvailabilityWithHttpMessagesAsync(string ipAddress, string resourceGroupName, string virtualNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists usage stats. /// diff --git a/src/SDKs/Network/Management.Network/Generated/LoadBalancerOutboundRulesOperations.cs b/src/SDKs/Network/Management.Network/Generated/LoadBalancerOutboundRulesOperations.cs new file mode 100644 index 0000000000000..0d7e299dbd6a2 --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/LoadBalancerOutboundRulesOperations.cs @@ -0,0 +1,624 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + 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; + + /// + /// LoadBalancerOutboundRulesOperations operations. + /// + internal partial class LoadBalancerOutboundRulesOperations : IServiceOperations, ILoadBalancerOutboundRulesOperations + { + /// + /// Initializes a new instance of the LoadBalancerOutboundRulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LoadBalancerOutboundRulesOperations(NetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NetworkManagementClient + /// + public NetworkManagementClient Client { get; private set; } + + /// + /// Gets all the outbound rules in a load balancer. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the load balancer. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string loadBalancerName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (loadBalancerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "loadBalancerName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("loadBalancerName", loadBalancerName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{loadBalancerName}", System.Uri.EscapeDataString(loadBalancerName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the specified load balancer outbound rule. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the load balancer. + /// + /// + /// The name of the outbound rule. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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 loadBalancerName, string outboundRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (loadBalancerName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "loadBalancerName"); + } + if (outboundRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "outboundRuleName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2018-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("loadBalancerName", loadBalancerName); + tracingParameters.Add("outboundRuleName", outboundRuleName); + tracingParameters.Add("apiVersion", apiVersion); + 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.Network/loadBalancers/{loadBalancerName}/outboundRules/{outboundRuleName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{loadBalancerName}", System.Uri.EscapeDataString(loadBalancerName)); + _url = _url.Replace("{outboundRuleName}", System.Uri.EscapeDataString(outboundRuleName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the outbound rules in a load balancer. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/LoadBalancerOutboundRulesOperationsExtensions.cs b/src/SDKs/Network/Management.Network/Generated/LoadBalancerOutboundRulesOperationsExtensions.cs new file mode 100644 index 0000000000000..eee33bc919d5d --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/LoadBalancerOutboundRulesOperationsExtensions.cs @@ -0,0 +1,145 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for LoadBalancerOutboundRulesOperations. + /// + public static partial class LoadBalancerOutboundRulesOperationsExtensions + { + /// + /// Gets all the outbound rules in a load balancer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the load balancer. + /// + public static IPage List(this ILoadBalancerOutboundRulesOperations operations, string resourceGroupName, string loadBalancerName) + { + return operations.ListAsync(resourceGroupName, loadBalancerName).GetAwaiter().GetResult(); + } + + /// + /// Gets all the outbound rules in a load balancer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the load balancer. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ILoadBalancerOutboundRulesOperations operations, string resourceGroupName, string loadBalancerName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, loadBalancerName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the specified load balancer outbound rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the load balancer. + /// + /// + /// The name of the outbound rule. + /// + public static OutboundRule Get(this ILoadBalancerOutboundRulesOperations operations, string resourceGroupName, string loadBalancerName, string outboundRuleName) + { + return operations.GetAsync(resourceGroupName, loadBalancerName, outboundRuleName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified load balancer outbound rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the load balancer. + /// + /// + /// The name of the outbound rule. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ILoadBalancerOutboundRulesOperations operations, string resourceGroupName, string loadBalancerName, string outboundRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, loadBalancerName, outboundRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the outbound rules in a load balancer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ILoadBalancerOutboundRulesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the outbound rules in a load balancer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ILoadBalancerOutboundRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGateway.cs b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGateway.cs index eef25b919e7f2..63054edce6a1f 100644 --- a/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGateway.cs +++ b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGateway.cs @@ -84,11 +84,13 @@ public ApplicationGateway() /// Provisioning state of the /// application gateway resource. Possible values are: 'Updating', /// 'Deleting', and 'Failed'. + /// Custom error configurations + /// of the application gateway resource. /// A unique read-only string that changes whenever /// the resource is updated. /// A list of availability zones denoting where the /// resource needs to come from. - public ApplicationGateway(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ApplicationGatewaySku sku = default(ApplicationGatewaySku), ApplicationGatewaySslPolicy sslPolicy = default(ApplicationGatewaySslPolicy), string operationalState = default(string), IList gatewayIPConfigurations = default(IList), IList authenticationCertificates = default(IList), IList trustedRootCertificates = default(IList), IList sslCertificates = default(IList), IList frontendIPConfigurations = default(IList), IList frontendPorts = default(IList), IList probes = default(IList), IList backendAddressPools = default(IList), IList backendHttpSettingsCollection = default(IList), IList httpListeners = default(IList), IList urlPathMaps = default(IList), IList requestRoutingRules = default(IList), IList redirectConfigurations = default(IList), ApplicationGatewayWebApplicationFirewallConfiguration webApplicationFirewallConfiguration = default(ApplicationGatewayWebApplicationFirewallConfiguration), bool? enableHttp2 = default(bool?), bool? enableFips = default(bool?), ApplicationGatewayAutoscaleConfiguration autoscaleConfiguration = default(ApplicationGatewayAutoscaleConfiguration), string resourceGuid = default(string), string provisioningState = default(string), string etag = default(string), IList zones = default(IList)) + public ApplicationGateway(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ApplicationGatewaySku sku = default(ApplicationGatewaySku), ApplicationGatewaySslPolicy sslPolicy = default(ApplicationGatewaySslPolicy), string operationalState = default(string), IList gatewayIPConfigurations = default(IList), IList authenticationCertificates = default(IList), IList trustedRootCertificates = default(IList), IList sslCertificates = default(IList), IList frontendIPConfigurations = default(IList), IList frontendPorts = default(IList), IList probes = default(IList), IList backendAddressPools = default(IList), IList backendHttpSettingsCollection = default(IList), IList httpListeners = default(IList), IList urlPathMaps = default(IList), IList requestRoutingRules = default(IList), IList redirectConfigurations = default(IList), ApplicationGatewayWebApplicationFirewallConfiguration webApplicationFirewallConfiguration = default(ApplicationGatewayWebApplicationFirewallConfiguration), bool? enableHttp2 = default(bool?), bool? enableFips = default(bool?), ApplicationGatewayAutoscaleConfiguration autoscaleConfiguration = default(ApplicationGatewayAutoscaleConfiguration), string resourceGuid = default(string), string provisioningState = default(string), IList customErrorConfigurations = default(IList), string etag = default(string), IList zones = default(IList)) : base(id, name, type, location, tags) { Sku = sku; @@ -113,6 +115,7 @@ public ApplicationGateway() AutoscaleConfiguration = autoscaleConfiguration; ResourceGuid = resourceGuid; ProvisioningState = provisioningState; + CustomErrorConfigurations = customErrorConfigurations; Etag = etag; Zones = zones; CustomInit(); @@ -269,6 +272,13 @@ public ApplicationGateway() [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; set; } + /// + /// Gets or sets custom error configurations of the application gateway + /// resource. + /// + [JsonProperty(PropertyName = "properties.customErrorConfigurations")] + public IList CustomErrorConfigurations { get; set; } + /// /// Gets or sets a unique read-only string that changes whenever the /// resource is updated. diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayCustomError.cs b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayCustomError.cs new file mode 100644 index 0000000000000..5f5456e695efe --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayCustomError.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.Network.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Customer error of an application gateway. + /// + public partial class ApplicationGatewayCustomError + { + /// + /// Initializes a new instance of the ApplicationGatewayCustomError + /// class. + /// + public ApplicationGatewayCustomError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationGatewayCustomError + /// class. + /// + /// Status code of the application gateway + /// customer error. Possible values include: 'HttpStatus403', + /// 'HttpStatus502' + /// Error page URL of the application + /// gateway customer error. + public ApplicationGatewayCustomError(string statusCode = default(string), string customErrorPageUrl = default(string)) + { + StatusCode = statusCode; + CustomErrorPageUrl = customErrorPageUrl; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets status code of the application gateway customer error. + /// Possible values include: 'HttpStatus403', 'HttpStatus502' + /// + [JsonProperty(PropertyName = "statusCode")] + public string StatusCode { get; set; } + + /// + /// Gets or sets error page URL of the application gateway customer + /// error. + /// + [JsonProperty(PropertyName = "customErrorPageUrl")] + public string CustomErrorPageUrl { get; set; } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayCustomErrorStatusCode.cs b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayCustomErrorStatusCode.cs new file mode 100644 index 0000000000000..223574408eefb --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayCustomErrorStatusCode.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + + /// + /// Defines values for ApplicationGatewayCustomErrorStatusCode. + /// + public static class ApplicationGatewayCustomErrorStatusCode + { + public const string HttpStatus403 = "HttpStatus403"; + public const string HttpStatus502 = "HttpStatus502"; + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayFirewallExclusion.cs b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayFirewallExclusion.cs new file mode 100644 index 0000000000000..f01d1cdd383bf --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayFirewallExclusion.cs @@ -0,0 +1,98 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Allow to exclude some variable satisfy the condition for the WAF check + /// + public partial class ApplicationGatewayFirewallExclusion + { + /// + /// Initializes a new instance of the + /// ApplicationGatewayFirewallExclusion class. + /// + public ApplicationGatewayFirewallExclusion() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationGatewayFirewallExclusion class. + /// + /// The variable to be excluded. + /// When matchVariable is a + /// collection, operate on the selector to specify which elements in + /// the collection this exclusion applies to. + /// When matchVariable is a collection, operator + /// used to specify which elements in the collection this exclusion + /// applies to. + public ApplicationGatewayFirewallExclusion(string matchVariable, string selectorMatchOperator, string selector) + { + MatchVariable = matchVariable; + SelectorMatchOperator = selectorMatchOperator; + Selector = selector; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the variable to be excluded. + /// + [JsonProperty(PropertyName = "matchVariable")] + public string MatchVariable { get; set; } + + /// + /// Gets or sets when matchVariable is a collection, operate on the + /// selector to specify which elements in the collection this exclusion + /// applies to. + /// + [JsonProperty(PropertyName = "selectorMatchOperator")] + public string SelectorMatchOperator { get; set; } + + /// + /// Gets or sets when matchVariable is a collection, operator used to + /// specify which elements in the collection this exclusion applies to. + /// + [JsonProperty(PropertyName = "selector")] + public string Selector { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MatchVariable == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MatchVariable"); + } + if (SelectorMatchOperator == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SelectorMatchOperator"); + } + if (Selector == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Selector"); + } + } + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayHttpListener.cs b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayHttpListener.cs index bbe22e85bb49b..0262b4bfc5120 100644 --- a/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayHttpListener.cs +++ b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayHttpListener.cs @@ -13,6 +13,8 @@ namespace Microsoft.Azure.Management.Network.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -50,12 +52,14 @@ public ApplicationGatewayHttpListener() /// Provisioning state of the HTTP /// listener resource. Possible values are: 'Updating', 'Deleting', and /// 'Failed'. + /// Custom error configurations + /// of the HTTP listener. /// Name of the HTTP listener that is unique within /// an Application Gateway. /// A unique read-only string that changes whenever /// the resource is updated. /// Type of the resource. - public ApplicationGatewayHttpListener(string id = default(string), SubResource frontendIPConfiguration = default(SubResource), SubResource frontendPort = default(SubResource), string protocol = default(string), string hostName = default(string), SubResource sslCertificate = default(SubResource), bool? requireServerNameIndication = default(bool?), string provisioningState = default(string), string name = default(string), string etag = default(string), string type = default(string)) + public ApplicationGatewayHttpListener(string id = default(string), SubResource frontendIPConfiguration = default(SubResource), SubResource frontendPort = default(SubResource), string protocol = default(string), string hostName = default(string), SubResource sslCertificate = default(SubResource), bool? requireServerNameIndication = default(bool?), string provisioningState = default(string), IList customErrorConfigurations = default(IList), string name = default(string), string etag = default(string), string type = default(string)) : base(id) { FrontendIPConfiguration = frontendIPConfiguration; @@ -65,6 +69,7 @@ public ApplicationGatewayHttpListener() SslCertificate = sslCertificate; RequireServerNameIndication = requireServerNameIndication; ProvisioningState = provisioningState; + CustomErrorConfigurations = customErrorConfigurations; Name = name; Etag = etag; Type = type; @@ -122,6 +127,12 @@ public ApplicationGatewayHttpListener() [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; set; } + /// + /// Gets or sets custom error configurations of the HTTP listener. + /// + [JsonProperty(PropertyName = "properties.customErrorConfigurations")] + public IList CustomErrorConfigurations { get; set; } + /// /// Gets or sets name of the HTTP listener that is unique within an /// Application Gateway. diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayWebApplicationFirewallConfiguration.cs b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayWebApplicationFirewallConfiguration.cs index 4b2f647afdb58..08c9064de88b0 100644 --- a/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayWebApplicationFirewallConfiguration.cs +++ b/src/SDKs/Network/Management.Network/Generated/Models/ApplicationGatewayWebApplicationFirewallConfiguration.cs @@ -47,7 +47,12 @@ public ApplicationGatewayWebApplicationFirewallConfiguration() /// Body. /// Maxium request body size for /// WAF. - public ApplicationGatewayWebApplicationFirewallConfiguration(bool enabled, string firewallMode, string ruleSetType, string ruleSetVersion, IList disabledRuleGroups = default(IList), bool? requestBodyCheck = default(bool?), int? maxRequestBodySize = default(int?)) + /// Maxium request body size in Kb + /// for WAF. + /// Maxium file upload size in Mb for + /// WAF. + /// The exclusion list. + public ApplicationGatewayWebApplicationFirewallConfiguration(bool enabled, string firewallMode, string ruleSetType, string ruleSetVersion, IList disabledRuleGroups = default(IList), bool? requestBodyCheck = default(bool?), int? maxRequestBodySize = default(int?), int? maxRequestBodySizeInKb = default(int?), int? fileUploadLimitInMb = default(int?), IList exclusions = default(IList)) { Enabled = enabled; FirewallMode = firewallMode; @@ -56,6 +61,9 @@ public ApplicationGatewayWebApplicationFirewallConfiguration() DisabledRuleGroups = disabledRuleGroups; RequestBodyCheck = requestBodyCheck; MaxRequestBodySize = maxRequestBodySize; + MaxRequestBodySizeInKb = maxRequestBodySizeInKb; + FileUploadLimitInMb = fileUploadLimitInMb; + Exclusions = exclusions; CustomInit(); } @@ -109,6 +117,24 @@ public ApplicationGatewayWebApplicationFirewallConfiguration() [JsonProperty(PropertyName = "maxRequestBodySize")] public int? MaxRequestBodySize { get; set; } + /// + /// Gets or sets maxium request body size in Kb for WAF. + /// + [JsonProperty(PropertyName = "maxRequestBodySizeInKb")] + public int? MaxRequestBodySizeInKb { get; set; } + + /// + /// Gets or sets maxium file upload size in Mb for WAF. + /// + [JsonProperty(PropertyName = "fileUploadLimitInMb")] + public int? FileUploadLimitInMb { get; set; } + + /// + /// Gets or sets the exclusion list. + /// + [JsonProperty(PropertyName = "exclusions")] + public IList Exclusions { get; set; } + /// /// Validate the object. /// @@ -147,6 +173,32 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxRequestBodySize", 8); } + if (MaxRequestBodySizeInKb > 128) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxRequestBodySizeInKb", 128); + } + if (MaxRequestBodySizeInKb < 8) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxRequestBodySizeInKb", 8); + } + if (FileUploadLimitInMb > 500) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "FileUploadLimitInMb", 500); + } + if (FileUploadLimitInMb < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "FileUploadLimitInMb", 0); + } + if (Exclusions != null) + { + foreach (var element1 in Exclusions) + { + if (element1 != null) + { + element1.Validate(); + } + } + } } } } diff --git a/src/SDKs/Network/Management.Network/Generated/Models/AzureFirewallNetworkRuleProtocol.cs b/src/SDKs/Network/Management.Network/Generated/Models/AzureFirewallNetworkRuleProtocol.cs index ee0283523e91a..b1acae7f47e0e 100644 --- a/src/SDKs/Network/Management.Network/Generated/Models/AzureFirewallNetworkRuleProtocol.cs +++ b/src/SDKs/Network/Management.Network/Generated/Models/AzureFirewallNetworkRuleProtocol.cs @@ -19,5 +19,6 @@ public static class AzureFirewallNetworkRuleProtocol public const string TCP = "TCP"; public const string UDP = "UDP"; public const string Any = "Any"; + public const string ICMP = "ICMP"; } } diff --git a/src/SDKs/Network/Management.Network/Generated/Models/EvaluatedNetworkSecurityGroup.cs b/src/SDKs/Network/Management.Network/Generated/Models/EvaluatedNetworkSecurityGroup.cs index ddd4d9590a2aa..b24f468098473 100644 --- a/src/SDKs/Network/Management.Network/Generated/Models/EvaluatedNetworkSecurityGroup.cs +++ b/src/SDKs/Network/Management.Network/Generated/Models/EvaluatedNetworkSecurityGroup.cs @@ -35,11 +35,14 @@ public EvaluatedNetworkSecurityGroup() /// /// Network security group /// ID. + /// Resource ID of nic or subnet to which + /// network security group is applied. /// List of network security rules /// evaluation results. - public EvaluatedNetworkSecurityGroup(string networkSecurityGroupId = default(string), MatchedRule matchedRule = default(MatchedRule), IList rulesEvaluationResult = default(IList)) + public EvaluatedNetworkSecurityGroup(string networkSecurityGroupId = default(string), string appliedTo = default(string), MatchedRule matchedRule = default(MatchedRule), IList rulesEvaluationResult = default(IList)) { NetworkSecurityGroupId = networkSecurityGroupId; + AppliedTo = appliedTo; MatchedRule = matchedRule; RulesEvaluationResult = rulesEvaluationResult; CustomInit(); @@ -56,6 +59,13 @@ public EvaluatedNetworkSecurityGroup() [JsonProperty(PropertyName = "networkSecurityGroupId")] public string NetworkSecurityGroupId { get; set; } + /// + /// Gets or sets resource ID of nic or subnet to which network security + /// group is applied. + /// + [JsonProperty(PropertyName = "appliedTo")] + public string AppliedTo { get; set; } + /// /// [JsonProperty(PropertyName = "matchedRule")] diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuit.cs b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuit.cs index 83f210fb9886e..37b9653bb2418 100644 --- a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuit.cs +++ b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuit.cs @@ -56,6 +56,13 @@ public ExpressRouteCircuit() /// ServiceProviderNotes. /// The /// ServiceProviderProperties. + /// The reference to the + /// ExpressRoutePort resource when the circuit is provisioned on an + /// ExpressRoutePort resource. + /// The bandwidth of the circuit when the + /// circuit is provisioned on an ExpressRoutePort resource. + /// The identifier of the circuit traffic. Outer tag + /// for QinQ encapsulation. /// Gets the provisioning state of the /// public IP resource. Possible values are: 'Updating', 'Deleting', /// and 'Failed'. @@ -64,7 +71,7 @@ public ExpressRouteCircuit() /// circuit. /// Gets a unique read-only string that changes /// whenever the resource is updated. - public ExpressRouteCircuit(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ExpressRouteCircuitSku sku = default(ExpressRouteCircuitSku), bool? allowClassicOperations = default(bool?), string circuitProvisioningState = default(string), string serviceProviderProvisioningState = default(string), IList authorizations = default(IList), IList peerings = default(IList), string serviceKey = default(string), string serviceProviderNotes = default(string), ExpressRouteCircuitServiceProviderProperties serviceProviderProperties = default(ExpressRouteCircuitServiceProviderProperties), string provisioningState = default(string), string gatewayManagerEtag = default(string), bool? allowGlobalReach = default(bool?), string etag = default(string)) + public ExpressRouteCircuit(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), ExpressRouteCircuitSku sku = default(ExpressRouteCircuitSku), bool? allowClassicOperations = default(bool?), string circuitProvisioningState = default(string), string serviceProviderProvisioningState = default(string), IList authorizations = default(IList), IList peerings = default(IList), string serviceKey = default(string), string serviceProviderNotes = default(string), ExpressRouteCircuitServiceProviderProperties serviceProviderProperties = default(ExpressRouteCircuitServiceProviderProperties), SubResource expressRoutePort = default(SubResource), double? bandwidthInGbps = default(double?), int? stag = default(int?), string provisioningState = default(string), string gatewayManagerEtag = default(string), bool? allowGlobalReach = default(bool?), string etag = default(string)) : base(id, name, type, location, tags) { Sku = sku; @@ -76,6 +83,9 @@ public ExpressRouteCircuit() ServiceKey = serviceKey; ServiceProviderNotes = serviceProviderNotes; ServiceProviderProperties = serviceProviderProperties; + ExpressRoutePort = expressRoutePort; + BandwidthInGbps = bandwidthInGbps; + Stag = stag; ProvisioningState = provisioningState; GatewayManagerEtag = gatewayManagerEtag; AllowGlobalReach = allowGlobalReach; @@ -145,6 +155,27 @@ public ExpressRouteCircuit() [JsonProperty(PropertyName = "properties.serviceProviderProperties")] public ExpressRouteCircuitServiceProviderProperties ServiceProviderProperties { get; set; } + /// + /// Gets or sets the reference to the ExpressRoutePort resource when + /// the circuit is provisioned on an ExpressRoutePort resource. + /// + [JsonProperty(PropertyName = "properties.expressRoutePort")] + public SubResource ExpressRoutePort { get; set; } + + /// + /// Gets or sets the bandwidth of the circuit when the circuit is + /// provisioned on an ExpressRoutePort resource. + /// + [JsonProperty(PropertyName = "properties.bandwidthInGbps")] + public double? BandwidthInGbps { get; set; } + + /// + /// Gets the identifier of the circuit traffic. Outer tag for QinQ + /// encapsulation. + /// + [JsonProperty(PropertyName = "properties.stag")] + public int? Stag { get; private set; } + /// /// Gets the provisioning state of the public IP resource. Possible /// values are: 'Updating', 'Deleting', and 'Failed'. diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuitSku.cs b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuitSku.cs index ffe8938b74072..95a332e529665 100644 --- a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuitSku.cs +++ b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuitSku.cs @@ -31,8 +31,8 @@ public ExpressRouteCircuitSku() /// /// The name of the SKU. /// The tier of the SKU. Possible values are - /// 'Standard' and 'Premium'. Possible values include: 'Standard', - /// 'Premium' + /// 'Standard', 'Premium' or 'Basic'. Possible values include: + /// 'Standard', 'Premium', 'Basic' /// The family of the SKU. Possible values are: /// 'UnlimitedData' and 'MeteredData'. Possible values include: /// 'UnlimitedData', 'MeteredData' @@ -56,8 +56,9 @@ public ExpressRouteCircuitSku() public string Name { get; set; } /// - /// Gets or sets the tier of the SKU. Possible values are 'Standard' - /// and 'Premium'. Possible values include: 'Standard', 'Premium' + /// Gets or sets the tier of the SKU. Possible values are 'Standard', + /// 'Premium' or 'Basic'. Possible values include: 'Standard', + /// 'Premium', 'Basic' /// [JsonProperty(PropertyName = "tier")] public string Tier { get; set; } diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuitSkuTier.cs b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuitSkuTier.cs index e488c300d8096..ac513c915452f 100644 --- a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuitSkuTier.cs +++ b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteCircuitSkuTier.cs @@ -18,5 +18,6 @@ public static class ExpressRouteCircuitSkuTier { public const string Standard = "Standard"; public const string Premium = "Premium"; + public const string Basic = "Basic"; } } diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteLink.cs b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteLink.cs new file mode 100644 index 0000000000000..75b9f268e5ccc --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteLink.cs @@ -0,0 +1,137 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// ExpressRouteLink + /// + /// + /// ExpressRouteLink child resource definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class ExpressRouteLink : SubResource + { + /// + /// Initializes a new instance of the ExpressRouteLink class. + /// + public ExpressRouteLink() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpressRouteLink class. + /// + /// Resource ID. + /// Name of Azure router associated with + /// physical port. + /// Name of Azure router interface. + /// Mapping between physical port to patch + /// panel port. + /// Mapping of physical patch panel to + /// rack. + /// Physical fiber port type. Possible + /// values include: 'LC', 'SC' + /// Administrative state of the physical port. + /// Possible values include: 'Enabled', 'Disabled' + /// The provisioning state of the + /// ExpressRouteLink resource. Possible values are: 'Succeeded', + /// 'Updating', 'Deleting', and 'Failed'. + /// Name of child port resource that is unique among + /// child port resources of the parent. + /// A unique read-only string that changes whenever + /// the resource is updated. + public ExpressRouteLink(string id = default(string), string routerName = default(string), string interfaceName = default(string), string patchPanelId = default(string), string rackId = default(string), string connectorType = default(string), string adminState = default(string), string provisioningState = default(string), string name = default(string), string etag = default(string)) + : base(id) + { + RouterName = routerName; + InterfaceName = interfaceName; + PatchPanelId = patchPanelId; + RackId = rackId; + ConnectorType = connectorType; + AdminState = adminState; + ProvisioningState = provisioningState; + Name = name; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets name of Azure router associated with physical port. + /// + [JsonProperty(PropertyName = "properties.routerName")] + public string RouterName { get; private set; } + + /// + /// Gets name of Azure router interface. + /// + [JsonProperty(PropertyName = "properties.interfaceName")] + public string InterfaceName { get; private set; } + + /// + /// Gets mapping between physical port to patch panel port. + /// + [JsonProperty(PropertyName = "properties.patchPanelId")] + public string PatchPanelId { get; private set; } + + /// + /// Gets mapping of physical patch panel to rack. + /// + [JsonProperty(PropertyName = "properties.rackId")] + public string RackId { get; private set; } + + /// + /// Gets physical fiber port type. Possible values include: 'LC', 'SC' + /// + [JsonProperty(PropertyName = "properties.connectorType")] + public string ConnectorType { get; private set; } + + /// + /// Gets or sets administrative state of the physical port. Possible + /// values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.adminState")] + public string AdminState { get; set; } + + /// + /// Gets the provisioning state of the ExpressRouteLink resource. + /// Possible values are: 'Succeeded', 'Updating', 'Deleting', and + /// 'Failed'. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets name of child port resource that is unique among child + /// port resources of the parent. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteLinkAdminState.cs b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteLinkAdminState.cs new file mode 100644 index 0000000000000..be25145aa0d18 --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteLinkAdminState.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + + /// + /// Defines values for ExpressRouteLinkAdminState. + /// + public static class ExpressRouteLinkAdminState + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteLinkConnectorType.cs b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteLinkConnectorType.cs new file mode 100644 index 0000000000000..cbf955ed70b88 --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRouteLinkConnectorType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + + /// + /// Defines values for ExpressRouteLinkConnectorType. + /// + public static class ExpressRouteLinkConnectorType + { + public const string LC = "LC"; + public const string SC = "SC"; + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePort.cs b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePort.cs new file mode 100644 index 0000000000000..52d1e78c2c03e --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePort.cs @@ -0,0 +1,175 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// ExpressRoute Port + /// + /// + /// ExpressRoutePort resource definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class ExpressRoutePort : Resource + { + /// + /// Initializes a new instance of the ExpressRoutePort class. + /// + public ExpressRoutePort() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpressRoutePort class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// The name of the peering location that + /// the ExpressRoutePort is mapped to physically. + /// Bandwidth of procured ports in + /// Gbps + /// Aggregate Gbps of + /// associated circuit bandwidths. + /// Maximum transmission unit of the physical port + /// pair(s) + /// Encapsulation method on physical ports. + /// Possible values include: 'Dot1Q', 'QinQ' + /// Ethertype of the physical port. + /// Date of the physical port allocation + /// to be used in Letter of Authorization. + /// ExpressRouteLink Sub-Resources + /// Reference the ExpressRoute circuit(s) that + /// are provisioned on this ExpressRoutePort resource. + /// The provisioning state of the + /// ExpressRoutePort resource. Possible values are: 'Succeeded', + /// 'Updating', 'Deleting', and 'Failed'. + /// The resource GUID property of the + /// ExpressRoutePort resource. + /// A unique read-only string that changes whenever + /// the resource is updated. + public ExpressRoutePort(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string peeringLocation = default(string), int? bandwidthInGbps = default(int?), double? provisionedBandwidthInGbps = default(double?), string mtu = default(string), string encapsulation = default(string), string etherType = default(string), string allocationDate = default(string), IList links = default(IList), IList circuits = default(IList), string provisioningState = default(string), string resourceGuid = default(string), string etag = default(string)) + : base(id, name, type, location, tags) + { + PeeringLocation = peeringLocation; + BandwidthInGbps = bandwidthInGbps; + ProvisionedBandwidthInGbps = provisionedBandwidthInGbps; + Mtu = mtu; + Encapsulation = encapsulation; + EtherType = etherType; + AllocationDate = allocationDate; + Links = links; + Circuits = circuits; + ProvisioningState = provisioningState; + ResourceGuid = resourceGuid; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the peering location that the + /// ExpressRoutePort is mapped to physically. + /// + [JsonProperty(PropertyName = "properties.peeringLocation")] + public string PeeringLocation { get; set; } + + /// + /// Gets or sets bandwidth of procured ports in Gbps + /// + [JsonProperty(PropertyName = "properties.bandwidthInGbps")] + public int? BandwidthInGbps { get; set; } + + /// + /// Gets aggregate Gbps of associated circuit bandwidths. + /// + [JsonProperty(PropertyName = "properties.provisionedBandwidthInGbps")] + public double? ProvisionedBandwidthInGbps { get; private set; } + + /// + /// Gets maximum transmission unit of the physical port pair(s) + /// + [JsonProperty(PropertyName = "properties.mtu")] + public string Mtu { get; private set; } + + /// + /// Gets or sets encapsulation method on physical ports. Possible + /// values include: 'Dot1Q', 'QinQ' + /// + [JsonProperty(PropertyName = "properties.encapsulation")] + public string Encapsulation { get; set; } + + /// + /// Gets ethertype of the physical port. + /// + [JsonProperty(PropertyName = "properties.etherType")] + public string EtherType { get; private set; } + + /// + /// Gets date of the physical port allocation to be used in Letter of + /// Authorization. + /// + [JsonProperty(PropertyName = "properties.allocationDate")] + public string AllocationDate { get; private set; } + + /// + /// Gets or sets expressRouteLink Sub-Resources + /// + /// + /// The set of physical links of the ExpressRoutePort resource + /// + [JsonProperty(PropertyName = "properties.links")] + public IList Links { get; set; } + + /// + /// Gets reference the ExpressRoute circuit(s) that are provisioned on + /// this ExpressRoutePort resource. + /// + [JsonProperty(PropertyName = "properties.circuits")] + public IList Circuits { get; private set; } + + /// + /// Gets the provisioning state of the ExpressRoutePort resource. + /// Possible values are: 'Succeeded', 'Updating', 'Deleting', and + /// 'Failed'. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the resource GUID property of the ExpressRoutePort + /// resource. + /// + [JsonProperty(PropertyName = "properties.resourceGuid")] + public string ResourceGuid { get; set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePortsEncapsulation.cs b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePortsEncapsulation.cs new file mode 100644 index 0000000000000..370129c940458 --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePortsEncapsulation.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + + /// + /// Defines values for ExpressRoutePortsEncapsulation. + /// + public static class ExpressRoutePortsEncapsulation + { + public const string Dot1Q = "Dot1Q"; + public const string QinQ = "QinQ"; + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePortsLocation.cs b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePortsLocation.cs new file mode 100644 index 0000000000000..75e2c4af960b9 --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePortsLocation.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// ExpressRoutePorts Peering Location + /// + /// + /// Definition of the ExpressRoutePorts peering location resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class ExpressRoutePortsLocation : Resource + { + /// + /// Initializes a new instance of the ExpressRoutePortsLocation class. + /// + public ExpressRoutePortsLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpressRoutePortsLocation class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// Address of peering location. + /// Contact details of peering locations. + /// The inventory of available + /// ExpressRoutePort bandwidths. + /// The provisioning state of the + /// ExpressRoutePortLocation resource. Possible values are: + /// 'Succeeded', 'Updating', 'Deleting', and 'Failed'. + public ExpressRoutePortsLocation(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string address = default(string), string contact = default(string), IList availableBandwidths = default(IList), string provisioningState = default(string)) + : base(id, name, type, location, tags) + { + Address = address; + Contact = contact; + AvailableBandwidths = availableBandwidths; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets address of peering location. + /// + [JsonProperty(PropertyName = "properties.address")] + public string Address { get; private set; } + + /// + /// Gets contact details of peering locations. + /// + [JsonProperty(PropertyName = "properties.contact")] + public string Contact { get; private set; } + + /// + /// Gets or sets the inventory of available ExpressRoutePort + /// bandwidths. + /// + [JsonProperty(PropertyName = "properties.availableBandwidths")] + public IList AvailableBandwidths { get; set; } + + /// + /// Gets the provisioning state of the ExpressRoutePortLocation + /// resource. Possible values are: 'Succeeded', 'Updating', 'Deleting', + /// and 'Failed'. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePortsLocationBandwidths.cs b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePortsLocationBandwidths.cs new file mode 100644 index 0000000000000..f6d636c1d088b --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/Models/ExpressRoutePortsLocationBandwidths.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ExpressRoutePorts Location Bandwidths + /// + /// + /// Real-time inventory of available ExpressRoute port bandwidths. + /// + public partial class ExpressRoutePortsLocationBandwidths + { + /// + /// Initializes a new instance of the + /// ExpressRoutePortsLocationBandwidths class. + /// + public ExpressRoutePortsLocationBandwidths() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ExpressRoutePortsLocationBandwidths class. + /// + /// Bandwidth descriptive name + /// Bandwidth value in Gbps + public ExpressRoutePortsLocationBandwidths(string offerName = default(string), int? valueInGbps = default(int?)) + { + OfferName = offerName; + ValueInGbps = valueInGbps; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets bandwidth descriptive name + /// + [JsonProperty(PropertyName = "offerName")] + public string OfferName { get; private set; } + + /// + /// Gets bandwidth value in Gbps + /// + [JsonProperty(PropertyName = "valueInGbps")] + public int? ValueInGbps { get; private set; } + + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/Models/NetworkConfigurationDiagnosticParameters.cs b/src/SDKs/Network/Management.Network/Generated/Models/NetworkConfigurationDiagnosticParameters.cs index fda845130ebb0..6f9042e5c7ce1 100644 --- a/src/SDKs/Network/Management.Network/Generated/Models/NetworkConfigurationDiagnosticParameters.cs +++ b/src/SDKs/Network/Management.Network/Generated/Models/NetworkConfigurationDiagnosticParameters.cs @@ -38,11 +38,16 @@ public NetworkConfigurationDiagnosticParameters() /// perform network configuration diagnostic. Valid options are VM, /// NetworkInterface, VMSS/NetworkInterface and Application /// Gateway. - /// List of traffic queries. - public NetworkConfigurationDiagnosticParameters(string targetResourceId, IList queries) + /// List of network configuration diagnostic + /// profiles. + /// Verbosity level. Accepted values are + /// 'Normal', 'Minimum', 'Full'. Possible values include: 'Normal', + /// 'Minimum', 'Full' + public NetworkConfigurationDiagnosticParameters(string targetResourceId, IList profiles, string verbosityLevel = default(string)) { TargetResourceId = targetResourceId; - Queries = queries; + VerbosityLevel = verbosityLevel; + Profiles = profiles; CustomInit(); } @@ -60,10 +65,18 @@ public NetworkConfigurationDiagnosticParameters(string targetResourceId, IList - /// Gets or sets list of traffic queries. + /// Gets or sets verbosity level. Accepted values are 'Normal', + /// 'Minimum', 'Full'. Possible values include: 'Normal', 'Minimum', + /// 'Full' /// - [JsonProperty(PropertyName = "queries")] - public IList Queries { get; set; } + [JsonProperty(PropertyName = "verbosityLevel")] + public string VerbosityLevel { get; set; } + + /// + /// Gets or sets list of network configuration diagnostic profiles. + /// + [JsonProperty(PropertyName = "profiles")] + public IList Profiles { get; set; } /// /// Validate the object. @@ -77,13 +90,13 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "TargetResourceId"); } - if (Queries == null) + if (Profiles == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Queries"); + throw new ValidationException(ValidationRules.CannotBeNull, "Profiles"); } - if (Queries != null) + if (Profiles != null) { - foreach (var element in Queries) + foreach (var element in Profiles) { if (element != null) { diff --git a/src/SDKs/Network/Management.Network/Generated/Models/TrafficQuery.cs b/src/SDKs/Network/Management.Network/Generated/Models/NetworkConfigurationDiagnosticProfile.cs similarity index 90% rename from src/SDKs/Network/Management.Network/Generated/Models/TrafficQuery.cs rename to src/SDKs/Network/Management.Network/Generated/Models/NetworkConfigurationDiagnosticProfile.cs index 5275bef3aec4e..c39d5f1905f41 100644 --- a/src/SDKs/Network/Management.Network/Generated/Models/TrafficQuery.cs +++ b/src/SDKs/Network/Management.Network/Generated/Models/NetworkConfigurationDiagnosticProfile.cs @@ -17,18 +17,20 @@ namespace Microsoft.Azure.Management.Network.Models /// /// Parameters to compare with network configuration. /// - public partial class TrafficQuery + public partial class NetworkConfigurationDiagnosticProfile { /// - /// Initializes a new instance of the TrafficQuery class. + /// Initializes a new instance of the + /// NetworkConfigurationDiagnosticProfile class. /// - public TrafficQuery() + public NetworkConfigurationDiagnosticProfile() { CustomInit(); } /// - /// Initializes a new instance of the TrafficQuery class. + /// Initializes a new instance of the + /// NetworkConfigurationDiagnosticProfile class. /// /// The direction of the traffic. Accepted /// values are 'Inbound' and 'Outbound'. Possible values include: @@ -42,7 +44,7 @@ public TrafficQuery() /// Traffice destination port. Accepted /// values are '*', port (for example, 3389) and port range (for /// example, 80-100). - public TrafficQuery(string direction, string protocol, string source, string destination, string destinationPort) + public NetworkConfigurationDiagnosticProfile(string direction, string protocol, string source, string destination, string destinationPort) { Direction = direction; Protocol = protocol; diff --git a/src/SDKs/Network/Management.Network/Generated/Models/NetworkConfigurationDiagnosticResult.cs b/src/SDKs/Network/Management.Network/Generated/Models/NetworkConfigurationDiagnosticResult.cs index 4b176d35f87a0..b6da685288b0f 100644 --- a/src/SDKs/Network/Management.Network/Generated/Models/NetworkConfigurationDiagnosticResult.cs +++ b/src/SDKs/Network/Management.Network/Generated/Models/NetworkConfigurationDiagnosticResult.cs @@ -32,9 +32,9 @@ public NetworkConfigurationDiagnosticResult() /// Initializes a new instance of the /// NetworkConfigurationDiagnosticResult class. /// - public NetworkConfigurationDiagnosticResult(TrafficQuery trafficQuery = default(TrafficQuery), NetworkSecurityGroupResult networkSecurityGroupResult = default(NetworkSecurityGroupResult)) + public NetworkConfigurationDiagnosticResult(NetworkConfigurationDiagnosticProfile profile = default(NetworkConfigurationDiagnosticProfile), NetworkSecurityGroupResult networkSecurityGroupResult = default(NetworkSecurityGroupResult)) { - TrafficQuery = trafficQuery; + Profile = profile; NetworkSecurityGroupResult = networkSecurityGroupResult; CustomInit(); } @@ -46,8 +46,8 @@ public NetworkConfigurationDiagnosticResult() /// /// - [JsonProperty(PropertyName = "trafficQuery")] - public TrafficQuery TrafficQuery { get; set; } + [JsonProperty(PropertyName = "profile")] + public NetworkConfigurationDiagnosticProfile Profile { get; set; } /// /// @@ -62,9 +62,9 @@ public NetworkConfigurationDiagnosticResult() /// public virtual void Validate() { - if (TrafficQuery != null) + if (Profile != null) { - TrafficQuery.Validate(); + Profile.Validate(); } } } diff --git a/src/SDKs/Network/Management.Network/Generated/Models/VerbosityLevel.cs b/src/SDKs/Network/Management.Network/Generated/Models/VerbosityLevel.cs new file mode 100644 index 0000000000000..a22faf6b7880d --- /dev/null +++ b/src/SDKs/Network/Management.Network/Generated/Models/VerbosityLevel.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.Network.Models +{ + + /// + /// Defines values for VerbosityLevel. + /// + public static class VerbosityLevel + { + public const string Normal = "Normal"; + public const string Minimum = "Minimum"; + public const string Full = "Full"; + } +} diff --git a/src/SDKs/Network/Management.Network/Generated/NetworkManagementClient.cs b/src/SDKs/Network/Management.Network/Generated/NetworkManagementClient.cs index a9b7b3cc9b30d..33cc059e5f34f 100644 --- a/src/SDKs/Network/Management.Network/Generated/NetworkManagementClient.cs +++ b/src/SDKs/Network/Management.Network/Generated/NetworkManagementClient.cs @@ -158,6 +158,21 @@ public partial class NetworkManagementClient : ServiceClient public virtual IExpressRouteConnectionsOperations ExpressRouteConnections { get; private set; } + /// + /// Gets the IExpressRoutePortsLocationsOperations. + /// + public virtual IExpressRoutePortsLocationsOperations ExpressRoutePortsLocations { get; private set; } + + /// + /// Gets the IExpressRoutePortsOperations. + /// + public virtual IExpressRoutePortsOperations ExpressRoutePorts { get; private set; } + + /// + /// Gets the IExpressRouteLinksOperations. + /// + public virtual IExpressRouteLinksOperations ExpressRouteLinks { get; private set; } + /// /// Gets the IInterfaceEndpointsOperations. /// @@ -188,6 +203,11 @@ public partial class NetworkManagementClient : ServiceClient public virtual ILoadBalancerLoadBalancingRulesOperations LoadBalancerLoadBalancingRules { get; private set; } + /// + /// Gets the ILoadBalancerOutboundRulesOperations. + /// + public virtual ILoadBalancerOutboundRulesOperations LoadBalancerOutboundRules { get; private set; } + /// /// Gets the ILoadBalancerNetworkInterfacesOperations. /// @@ -646,12 +666,16 @@ private void Initialize() ExpressRouteCrossConnectionPeerings = new ExpressRouteCrossConnectionPeeringsOperations(this); ExpressRouteGateways = new ExpressRouteGatewaysOperations(this); ExpressRouteConnections = new ExpressRouteConnectionsOperations(this); + ExpressRoutePortsLocations = new ExpressRoutePortsLocationsOperations(this); + ExpressRoutePorts = new ExpressRoutePortsOperations(this); + ExpressRouteLinks = new ExpressRouteLinksOperations(this); InterfaceEndpoints = new InterfaceEndpointsOperations(this); LoadBalancers = new LoadBalancersOperations(this); LoadBalancerBackendAddressPools = new LoadBalancerBackendAddressPoolsOperations(this); LoadBalancerFrontendIPConfigurations = new LoadBalancerFrontendIPConfigurationsOperations(this); InboundNatRules = new InboundNatRulesOperations(this); LoadBalancerLoadBalancingRules = new LoadBalancerLoadBalancingRulesOperations(this); + LoadBalancerOutboundRules = new LoadBalancerOutboundRulesOperations(this); LoadBalancerNetworkInterfaces = new LoadBalancerNetworkInterfacesOperations(this); LoadBalancerProbes = new LoadBalancerProbesOperations(this); NetworkInterfaces = new NetworkInterfacesOperations(this); diff --git a/src/SDKs/Network/Management.Network/Generated/SdkInfo_NetworkManagementClient.cs b/src/SDKs/Network/Management.Network/Generated/SdkInfo_NetworkManagementClient.cs index 79261e607ec51..2d9e5b8ea64a6 100644 --- a/src/SDKs/Network/Management.Network/Generated/SdkInfo_NetworkManagementClient.cs +++ b/src/SDKs/Network/Management.Network/Generated/SdkInfo_NetworkManagementClient.cs @@ -41,6 +41,9 @@ public static IEnumerable> ApiInfo_NetworkManageme new Tuple("Network", "ExpressRouteCrossConnectionPeerings", "2018-08-01"), new Tuple("Network", "ExpressRouteCrossConnections", "2018-08-01"), new Tuple("Network", "ExpressRouteGateways", "2018-08-01"), + new Tuple("Network", "ExpressRouteLinks", "2018-08-01"), + new Tuple("Network", "ExpressRoutePorts", "2018-08-01"), + new Tuple("Network", "ExpressRoutePortsLocations", "2018-08-01"), new Tuple("Network", "ExpressRouteServiceProviders", "2018-08-01"), new Tuple("Network", "HubVirtualNetworkConnections", "2018-08-01"), new Tuple("Network", "InboundNatRules", "2018-08-01"), @@ -49,6 +52,7 @@ public static IEnumerable> ApiInfo_NetworkManageme new Tuple("Network", "LoadBalancerFrontendIPConfigurations", "2018-08-01"), new Tuple("Network", "LoadBalancerLoadBalancingRules", "2018-08-01"), new Tuple("Network", "LoadBalancerNetworkInterfaces", "2018-08-01"), + new Tuple("Network", "LoadBalancerOutboundRules", "2018-08-01"), new Tuple("Network", "LoadBalancerProbes", "2018-08-01"), new Tuple("Network", "LoadBalancers", "2018-08-01"), new Tuple("Network", "LocalNetworkGateways", "2018-08-01"), @@ -93,10 +97,10 @@ public static IEnumerable> ApiInfo_NetworkManageme // BEGIN: Code Generation Metadata Section public static readonly String AutoRestVersion = "latest"; public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/network/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\Repos\\azure-sdk-for-net\\src\\SDKs"; + public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/network/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\Projects\\azure-sdk-for-net\\src\\SDKs"; public static readonly String GithubForkName = "Azure"; public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "4d1b5ac80425123cd271697fe46df2a0233ac3e6"; + public static readonly String GithubCommidId = "73d0c3c4a4bcd3cb6e58ab0cc5f61599e47806bb"; public static readonly String CodeGenerationErrors = ""; public static readonly String GithubRepoName = "azure-rest-api-specs"; // END: Code Generation Metadata Section diff --git a/src/SDKs/Network/Management.Network/Generated/VirtualNetworksOperations.cs b/src/SDKs/Network/Management.Network/Generated/VirtualNetworksOperations.cs index 2165229d160d5..24d0618b33aa5 100644 --- a/src/SDKs/Network/Management.Network/Generated/VirtualNetworksOperations.cs +++ b/src/SDKs/Network/Management.Network/Generated/VirtualNetworksOperations.cs @@ -688,15 +688,15 @@ internal VirtualNetworksOperations(NetworkManagementClient client) /// /// Checks whether a private IP address is available for use. /// + /// + /// The private IP address to be verified. + /// /// /// The name of the resource group. /// /// /// The name of the virtual network. /// - /// - /// The private IP address to be verified. - /// /// /// Headers that will be added to request. /// @@ -718,8 +718,12 @@ internal VirtualNetworksOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CheckIPAddressAvailabilityWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkName, string ipAddress = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CheckIPAddressAvailabilityWithHttpMessagesAsync(string ipAddress, string resourceGroupName, string virtualNetworkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (ipAddress == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ipAddress"); + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); diff --git a/src/SDKs/Network/Management.Network/Generated/VirtualNetworksOperationsExtensions.cs b/src/SDKs/Network/Management.Network/Generated/VirtualNetworksOperationsExtensions.cs index 7df73c2093329..120be562a8da2 100644 --- a/src/SDKs/Network/Management.Network/Generated/VirtualNetworksOperationsExtensions.cs +++ b/src/SDKs/Network/Management.Network/Generated/VirtualNetworksOperationsExtensions.cs @@ -264,18 +264,18 @@ public static IPage List(this IVirtualNetworksOperations operati /// /// The operations group for this extension method. /// + /// + /// The private IP address to be verified. + /// /// /// The name of the resource group. /// /// /// The name of the virtual network. /// - /// - /// The private IP address to be verified. - /// - public static IPAddressAvailabilityResult CheckIPAddressAvailability(this IVirtualNetworksOperations operations, string resourceGroupName, string virtualNetworkName, string ipAddress = default(string)) + public static IPAddressAvailabilityResult CheckIPAddressAvailability(this IVirtualNetworksOperations operations, string ipAddress, string resourceGroupName, string virtualNetworkName) { - return operations.CheckIPAddressAvailabilityAsync(resourceGroupName, virtualNetworkName, ipAddress).GetAwaiter().GetResult(); + return operations.CheckIPAddressAvailabilityAsync(ipAddress, resourceGroupName, virtualNetworkName).GetAwaiter().GetResult(); } /// @@ -284,21 +284,21 @@ public static IPage List(this IVirtualNetworksOperations operati /// /// The operations group for this extension method. /// + /// + /// The private IP address to be verified. + /// /// /// The name of the resource group. /// /// /// The name of the virtual network. /// - /// - /// The private IP address to be verified. - /// /// /// The cancellation token. /// - public static async Task CheckIPAddressAvailabilityAsync(this IVirtualNetworksOperations operations, string resourceGroupName, string virtualNetworkName, string ipAddress = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CheckIPAddressAvailabilityAsync(this IVirtualNetworksOperations operations, string ipAddress, string resourceGroupName, string virtualNetworkName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CheckIPAddressAvailabilityWithHttpMessagesAsync(resourceGroupName, virtualNetworkName, ipAddress, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CheckIPAddressAvailabilityWithHttpMessagesAsync(ipAddress, resourceGroupName, virtualNetworkName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/src/SDKs/Network/Management.Network/Microsoft.Azure.Management.Network.csproj b/src/SDKs/Network/Management.Network/Microsoft.Azure.Management.Network.csproj index c1e591bf2ecfa..02c73b7ec8763 100644 --- a/src/SDKs/Network/Management.Network/Microsoft.Azure.Management.Network.csproj +++ b/src/SDKs/Network/Management.Network/Microsoft.Azure.Management.Network.csproj @@ -7,9 +7,20 @@ Microsoft.Azure.Management.Network Provides management capabilities for Network services. Microsoft.Azure.Management.Network - 19.5.1-preview + 19.6.0-preview Microsoft Azure Network management;Network;Network management; - Taking dependency on 10.0.3 version of Newtonsoft nuget package. + + net452;netstandard1.4 @@ -18,4 +29,4 @@ - \ No newline at end of file + diff --git a/src/SDKs/Network/Management.Network/Properties/AssemblyInfo.cs b/src/SDKs/Network/Management.Network/Properties/AssemblyInfo.cs index 68c6cd3c75288..9b465492af5af 100644 --- a/src/SDKs/Network/Management.Network/Properties/AssemblyInfo.cs +++ b/src/SDKs/Network/Management.Network/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ [assembly: AssemblyDescription("Provides Microsoft Azure Network management functions for managing the Microsoft Azure Network service.")] [assembly: AssemblyVersion("19.5.0.0")] -[assembly: AssemblyFileVersion("19.5.1.0")] +[assembly: AssemblyFileVersion("19.6.0.0")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")] diff --git a/src/SDKs/_metadata/network_resource-manager.txt b/src/SDKs/_metadata/network_resource-manager.txt index 334d119757321..227c0b5b78671 100644 --- a/src/SDKs/_metadata/network_resource-manager.txt +++ b/src/SDKs/_metadata/network_resource-manager.txt @@ -3,12 +3,12 @@ AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/network/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\Repos\azure-sdk-for-net\src\SDKs -2018-09-14 05:25:47 UTC +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/network/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\Projects\azure-sdk-for-net\src\SDKs +2018-10-31 06:10:07 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 4d1b5ac80425123cd271697fe46df2a0233ac3e6 +Commit: 73d0c3c4a4bcd3cb6e58ab0cc5f61599e47806bb AutoRest information Requested version: latest Bootstrapper version: autorest@2.0.4283