diff --git a/eng/mgmt/mgmtmetadata/network_resource-manager.txt b/eng/mgmt/mgmtmetadata/network_resource-manager.txt index bce1f2bf7a98..1ec0f3e1614d 100644 --- a/eng/mgmt/mgmtmetadata/network_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/network_resource-manager.txt @@ -4,11 +4,11 @@ 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=v2 --reflect-api-versions --csharp-sdks-folder=C:\Projects\Generator\azure-sdk-for-net\sdk -2020-08-20 20:08:18 UTC +2020-08-31 23:09:19 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: a7ca142c3f0f290fdda778f26f4f1fab65f71cf9 +Commit: 8b0d31e9650bf8e4ba7fb2c56a7c943f4a34441d AutoRest information Requested version: v2 Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IInboundSecurityRuleOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IInboundSecurityRuleOperations.cs new file mode 100644 index 000000000000..dacb7f8e235e --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IInboundSecurityRuleOperations.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// InboundSecurityRuleOperations operations. + /// + public partial interface IInboundSecurityRuleOperations + { + /// + /// Creates or updates the specified Network Virtual Appliance Inbound + /// Security Rules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Network Virtual Appliance. + /// + /// + /// The name of security rule collection. + /// + /// + /// Parameters supplied to the create or update Network Virtual + /// Appliance Inbound Security Rules 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 networkVirtualApplianceName, string ruleCollectionName, InboundSecurityRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the specified Network Virtual Appliance Inbound + /// Security Rules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Network Virtual Appliance. + /// + /// + /// The name of security rule collection. + /// + /// + /// Parameters supplied to the create or update Network Virtual + /// Appliance Inbound Security Rules 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 networkVirtualApplianceName, string ruleCollectionName, InboundSecurityRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkManagementClient.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkManagementClient.cs index 825e4f8e6baf..1e64ecc367a0 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkManagementClient.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkManagementClient.cs @@ -325,6 +325,11 @@ public partial interface INetworkManagementClient : System.IDisposable /// IVirtualApplianceSkusOperations VirtualApplianceSkus { get; } + /// + /// Gets the IInboundSecurityRuleOperations. + /// + IInboundSecurityRuleOperations InboundSecurityRule { get; } + /// /// Gets the INetworkWatchersOperations. /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualHubBgpConnectionsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualHubBgpConnectionsOperations.cs index e7c91428d754..d4b5f03b8d59 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualHubBgpConnectionsOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualHubBgpConnectionsOperations.cs @@ -49,6 +49,122 @@ public partial interface IVirtualHubBgpConnectionsOperations /// Task>> ListWithHttpMessagesAsync(string resourceGroupName, string virtualHubName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Retrieves a list of routes the virtual hub bgp connection has + /// learned. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// 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> ListLearnedRoutesWithHttpMessagesAsync(string resourceGroupName, string hubName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a list of routes the virtual hub bgp connection is + /// advertising to the specified peer. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// 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> ListAdvertisedRoutesWithHttpMessagesAsync(string resourceGroupName, string hubName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a list of routes the virtual hub bgp connection has + /// learned. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// 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> BeginListLearnedRoutesWithHttpMessagesAsync(string resourceGroupName, string hubName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves a list of routes the virtual hub bgp connection is + /// advertising to the specified peer. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// 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> BeginListAdvertisedRoutesWithHttpMessagesAsync(string resourceGroupName, string hubName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Retrieves the details of all VirtualHubBgpConnections. /// /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/InboundSecurityRuleOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/InboundSecurityRuleOperations.cs new file mode 100644 index 000000000000..37d23c9028b6 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/InboundSecurityRuleOperations.cs @@ -0,0 +1,321 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// InboundSecurityRuleOperations operations. + /// + internal partial class InboundSecurityRuleOperations : IServiceOperations, IInboundSecurityRuleOperations + { + /// + /// Initializes a new instance of the InboundSecurityRuleOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal InboundSecurityRuleOperations(NetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NetworkManagementClient + /// + public NetworkManagementClient Client { get; private set; } + + /// + /// Creates or updates the specified Network Virtual Appliance Inbound Security + /// Rules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Network Virtual Appliance. + /// + /// + /// The name of security rule collection. + /// + /// + /// Parameters supplied to the create or update Network Virtual Appliance + /// Inbound Security Rules operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string networkVirtualApplianceName, string ruleCollectionName, InboundSecurityRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, networkVirtualApplianceName, ruleCollectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates the specified Network Virtual Appliance Inbound Security + /// Rules. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Network Virtual Appliance. + /// + /// + /// The name of security rule collection. + /// + /// + /// Parameters supplied to the create or update Network Virtual Appliance + /// Inbound Security Rules 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 networkVirtualApplianceName, string ruleCollectionName, InboundSecurityRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (networkVirtualApplianceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "networkVirtualApplianceName"); + } + if (ruleCollectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleCollectionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-06-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("networkVirtualApplianceName", networkVirtualApplianceName); + tracingParameters.Add("ruleCollectionName", ruleCollectionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + 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/networkVirtualAppliances/{networkVirtualApplianceName}/inboundSecurityRules/{ruleCollectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{networkVirtualApplianceName}", System.Uri.EscapeDataString(networkVirtualApplianceName)); + _url = _url.Replace("{ruleCollectionName}", System.Uri.EscapeDataString(ruleCollectionName)); + _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("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; + } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/InboundSecurityRuleOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/InboundSecurityRuleOperationsExtensions.cs new file mode 100644 index 000000000000..1cb335d0625b --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/InboundSecurityRuleOperationsExtensions.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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for InboundSecurityRuleOperations. + /// + public static partial class InboundSecurityRuleOperationsExtensions + { + /// + /// Creates or updates the specified Network Virtual Appliance Inbound Security + /// Rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Network Virtual Appliance. + /// + /// + /// The name of security rule collection. + /// + /// + /// Parameters supplied to the create or update Network Virtual Appliance + /// Inbound Security Rules operation. + /// + public static InboundSecurityRule CreateOrUpdate(this IInboundSecurityRuleOperations operations, string resourceGroupName, string networkVirtualApplianceName, string ruleCollectionName, InboundSecurityRule parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, networkVirtualApplianceName, ruleCollectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the specified Network Virtual Appliance Inbound Security + /// Rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Network Virtual Appliance. + /// + /// + /// The name of security rule collection. + /// + /// + /// Parameters supplied to the create or update Network Virtual Appliance + /// Inbound Security Rules operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IInboundSecurityRuleOperations operations, string resourceGroupName, string networkVirtualApplianceName, string ruleCollectionName, InboundSecurityRule parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, networkVirtualApplianceName, ruleCollectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the specified Network Virtual Appliance Inbound Security + /// Rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Network Virtual Appliance. + /// + /// + /// The name of security rule collection. + /// + /// + /// Parameters supplied to the create or update Network Virtual Appliance + /// Inbound Security Rules operation. + /// + public static InboundSecurityRule BeginCreateOrUpdate(this IInboundSecurityRuleOperations operations, string resourceGroupName, string networkVirtualApplianceName, string ruleCollectionName, InboundSecurityRule parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, networkVirtualApplianceName, ruleCollectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the specified Network Virtual Appliance Inbound Security + /// Rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Network Virtual Appliance. + /// + /// + /// The name of security rule collection. + /// + /// + /// Parameters supplied to the create or update Network Virtual Appliance + /// Inbound Security Rules operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IInboundSecurityRuleOperations operations, string resourceGroupName, string networkVirtualApplianceName, string ruleCollectionName, InboundSecurityRule parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, networkVirtualApplianceName, ruleCollectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/HopLink.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/HopLink.cs index 6dad06307919..cb8b113376e1 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/HopLink.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/HopLink.cs @@ -43,10 +43,9 @@ public HopLink() /// Maximum roundtrip time in /// milliseconds. /// List of issues. - /// Provides additional context on the - /// issue. + /// Provides additional context on links. /// Resource ID. - public HopLink(string nextHopId = default(string), string linkType = default(string), int? roundTripTimeMin = default(int?), int? roundTripTimeAvg = default(int?), int? roundTripTimeMax = default(int?), IList issues = default(IList), IList> context = default(IList>), string resourceId = default(string)) + public HopLink(string nextHopId = default(string), string linkType = default(string), int? roundTripTimeMin = default(int?), int? roundTripTimeAvg = default(int?), int? roundTripTimeMax = default(int?), IList issues = default(IList), IDictionary context = default(IDictionary), string resourceId = default(string)) { NextHopId = nextHopId; LinkType = linkType; @@ -101,10 +100,10 @@ public HopLink() public IList Issues { get; private set; } /// - /// Gets provides additional context on the issue. + /// Gets provides additional context on links. /// [JsonProperty(PropertyName = "context")] - public IList> Context { get; private set; } + public IDictionary Context { get; private set; } /// /// Gets resource ID. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRule.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRule.cs new file mode 100644 index 000000000000..fc607a5a8160 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRule.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; + + /// + /// NVA Inbound Security Rule resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class InboundSecurityRule : SubResource + { + /// + /// Initializes a new instance of the InboundSecurityRule class. + /// + public InboundSecurityRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InboundSecurityRule class. + /// + /// Resource ID. + /// List of allowed rules. + /// The provisioning state of the + /// resource. Possible values include: 'Succeeded', 'Updating', + /// 'Deleting', 'Failed' + /// Name of security rule collection. + /// A unique read-only string that changes whenever + /// the resource is updated. + /// NVA inbound security rule type. + public InboundSecurityRule(string id = default(string), IList rules = default(IList), string provisioningState = default(string), string name = default(string), string etag = default(string), string type = default(string)) + : base(id) + { + Rules = rules; + ProvisioningState = provisioningState; + Name = name; + Etag = etag; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of allowed rules. + /// + [JsonProperty(PropertyName = "properties.rules")] + public IList Rules { get; set; } + + /// + /// Gets the provisioning state of the resource. Possible values + /// include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets name of security rule collection. + /// + [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; } + + /// + /// Gets NVA inbound security rule type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRules.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRules.cs new file mode 100644 index 000000000000..be9f44b217ff --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRules.cs @@ -0,0 +1,91 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// Properties of the Inbound Security Rules resource. + /// + public partial class InboundSecurityRules + { + /// + /// Initializes a new instance of the InboundSecurityRules class. + /// + public InboundSecurityRules() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InboundSecurityRules class. + /// + /// Protocol. This should be either TCP or UDP. + /// Possible values include: 'TCP', 'UDP' + /// The CIDR or source IP range. Only + /// /30, /31 and /32 Ip ranges are allowed. + /// NVA port ranges to be opened up. + /// One needs to provide specific ports. + public InboundSecurityRules(string protocol = default(string), string sourceAddressPrefix = default(string), int? destinationPortRange = default(int?)) + { + Protocol = protocol; + SourceAddressPrefix = sourceAddressPrefix; + DestinationPortRange = destinationPortRange; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets protocol. This should be either TCP or UDP. Possible + /// values include: 'TCP', 'UDP' + /// + [JsonProperty(PropertyName = "protocol")] + public string Protocol { get; set; } + + /// + /// Gets or sets the CIDR or source IP range. Only /30, /31 and /32 Ip + /// ranges are allowed. + /// + [JsonProperty(PropertyName = "sourceAddressPrefix")] + public string SourceAddressPrefix { get; set; } + + /// + /// Gets or sets NVA port ranges to be opened up. One needs to provide + /// specific ports. + /// + [JsonProperty(PropertyName = "destinationPortRange")] + public int? DestinationPortRange { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DestinationPortRange > 65535) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "DestinationPortRange", 65535); + } + if (DestinationPortRange < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "DestinationPortRange", 0); + } + } + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRulesProtocol.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRulesProtocol.cs new file mode 100644 index 000000000000..dd4ff80c3873 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRulesProtocol.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 InboundSecurityRulesProtocol. + /// + public static class InboundSecurityRulesProtocol + { + public const string TCP = "TCP"; + public const string UDP = "UDP"; + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkVirtualAppliance.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkVirtualAppliance.cs index 5ecf2f94923a..e56c23395ae6 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkVirtualAppliance.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkVirtualAppliance.cs @@ -56,6 +56,8 @@ public NetworkVirtualAppliance() /// Network Interfaces. /// List of references to /// VirtualApplianceSite. + /// List of references to + /// InboundSecurityRules. /// The provisioning state of the /// resource. Possible values include: 'Succeeded', 'Updating', /// 'Deleting', 'Failed' @@ -63,7 +65,7 @@ public NetworkVirtualAppliance() /// to cloud-init and config blob. /// A unique read-only string that changes whenever /// the resource is updated. - public NetworkVirtualAppliance(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), VirtualApplianceSkuProperties nvaSku = default(VirtualApplianceSkuProperties), string addressPrefix = default(string), IList bootStrapConfigurationBlobs = default(IList), SubResource virtualHub = default(SubResource), IList cloudInitConfigurationBlobs = default(IList), string cloudInitConfiguration = default(string), long? virtualApplianceAsn = default(long?), IList virtualApplianceNics = default(IList), IList virtualApplianceSites = default(IList), string provisioningState = default(string), ManagedServiceIdentity identity = default(ManagedServiceIdentity), string etag = default(string)) + public NetworkVirtualAppliance(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), VirtualApplianceSkuProperties nvaSku = default(VirtualApplianceSkuProperties), string addressPrefix = default(string), IList bootStrapConfigurationBlobs = default(IList), SubResource virtualHub = default(SubResource), IList cloudInitConfigurationBlobs = default(IList), string cloudInitConfiguration = default(string), long? virtualApplianceAsn = default(long?), IList virtualApplianceNics = default(IList), IList virtualApplianceSites = default(IList), IList inboundSecurityRules = default(IList), string provisioningState = default(string), ManagedServiceIdentity identity = default(ManagedServiceIdentity), string etag = default(string)) : base(id, name, type, location, tags) { NvaSku = nvaSku; @@ -75,6 +77,7 @@ public NetworkVirtualAppliance() VirtualApplianceAsn = virtualApplianceAsn; VirtualApplianceNics = virtualApplianceNics; VirtualApplianceSites = virtualApplianceSites; + InboundSecurityRules = inboundSecurityRules; ProvisioningState = provisioningState; Identity = identity; Etag = etag; @@ -141,6 +144,12 @@ public NetworkVirtualAppliance() [JsonProperty(PropertyName = "properties.virtualApplianceSites")] public IList VirtualApplianceSites { get; private set; } + /// + /// Gets list of references to InboundSecurityRules. + /// + [JsonProperty(PropertyName = "properties.inboundSecurityRules")] + public IList InboundSecurityRules { get; private set; } + /// /// Gets the provisioning state of the resource. Possible values /// include: 'Succeeded', 'Updating', 'Deleting', 'Failed' diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PeerRoute.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PeerRoute.cs new file mode 100644 index 000000000000..4652c6c4d956 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PeerRoute.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Peer routing details. + /// + public partial class PeerRoute + { + /// + /// Initializes a new instance of the PeerRoute class. + /// + public PeerRoute() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PeerRoute class. + /// + /// The peer's local address. + /// The route's network prefix. + /// The route's next hop. + /// The peer this route was learned + /// from. + /// The source this route was learned + /// from. + /// The route's AS path sequence. + /// The route's weight. + public PeerRoute(string localAddress = default(string), string network = default(string), string nextHop = default(string), string sourcePeer = default(string), string origin = default(string), string asPath = default(string), int? weight = default(int?)) + { + LocalAddress = localAddress; + Network = network; + NextHop = nextHop; + SourcePeer = sourcePeer; + Origin = origin; + AsPath = asPath; + Weight = weight; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the peer's local address. + /// + [JsonProperty(PropertyName = "localAddress")] + public string LocalAddress { get; private set; } + + /// + /// Gets the route's network prefix. + /// + [JsonProperty(PropertyName = "network")] + public string Network { get; private set; } + + /// + /// Gets the route's next hop. + /// + [JsonProperty(PropertyName = "nextHop")] + public string NextHop { get; private set; } + + /// + /// Gets the peer this route was learned from. + /// + [JsonProperty(PropertyName = "sourcePeer")] + public string SourcePeer { get; private set; } + + /// + /// Gets the source this route was learned from. + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; private set; } + + /// + /// Gets the route's AS path sequence. + /// + [JsonProperty(PropertyName = "asPath")] + public string AsPath { get; private set; } + + /// + /// Gets the route's weight. + /// + [JsonProperty(PropertyName = "weight")] + public int? Weight { get; private set; } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PeerRouteList.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PeerRouteList.cs new file mode 100644 index 000000000000..75053c903f07 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PeerRouteList.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of virtual router peer routes. + /// + public partial class PeerRouteList + { + /// + /// Initializes a new instance of the PeerRouteList class. + /// + public PeerRouteList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PeerRouteList class. + /// + /// List of peer routes. + public PeerRouteList(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of peer routes. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkManagementClient.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkManagementClient.cs index d351a0710417..3d29fe6e2408 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkManagementClient.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkManagementClient.cs @@ -328,6 +328,11 @@ public partial class NetworkManagementClient : ServiceClient public virtual IVirtualApplianceSkusOperations VirtualApplianceSkus { get; private set; } + /// + /// Gets the IInboundSecurityRuleOperations. + /// + public virtual IInboundSecurityRuleOperations InboundSecurityRule { get; private set; } + /// /// Gets the INetworkWatchersOperations. /// @@ -884,6 +889,7 @@ private void Initialize() NetworkVirtualAppliances = new NetworkVirtualAppliancesOperations(this); VirtualApplianceSites = new VirtualApplianceSitesOperations(this); VirtualApplianceSkus = new VirtualApplianceSkusOperations(this); + InboundSecurityRule = new InboundSecurityRuleOperations(this); NetworkWatchers = new NetworkWatchersOperations(this); PacketCaptures = new PacketCapturesOperations(this); ConnectionMonitors = new ConnectionMonitorsOperations(this); diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs index 7dfd35d62f6a..9fb10e114d6b 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs @@ -63,6 +63,7 @@ public static IEnumerable> ApiInfo_NetworkManageme new Tuple("Network", "HubRouteTables", "2020-06-01"), new Tuple("Network", "HubVirtualNetworkConnections", "2020-06-01"), new Tuple("Network", "InboundNatRules", "2020-06-01"), + new Tuple("Network", "InboundSecurityRule", "2020-06-01"), new Tuple("Network", "IpAllocations", "2020-06-01"), new Tuple("Network", "IpGroups", "2020-06-01"), new Tuple("Network", "LoadBalancerBackendAddressPools", "2020-06-01"), @@ -142,7 +143,7 @@ public static IEnumerable> ApiInfo_NetworkManageme 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=v2 --reflect-api-versions --csharp-sdks-folder=C:\\Projects\\Generator\\azure-sdk-for-net\\sdk"; public static readonly String GithubForkName = "Azure"; public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "a7ca142c3f0f290fdda778f26f4f1fab65f71cf9"; + public static readonly String GithubCommidId = "8b0d31e9650bf8e4ba7fb2c56a7c943f4a34441d"; public static readonly String CodeGenerationErrors = ""; public static readonly String GithubRepoName = "azure-rest-api-specs"; // END: Code Generation Metadata Section diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualHubBgpConnectionsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualHubBgpConnectionsOperations.cs index 9388809fe0a5..39e8a22997da 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualHubBgpConnectionsOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualHubBgpConnectionsOperations.cs @@ -244,6 +244,464 @@ internal VirtualHubBgpConnectionsOperations(NetworkManagementClient client) return _result; } + /// + /// Retrieves a list of routes the virtual hub bgp connection has learned. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ListLearnedRoutesWithHttpMessagesAsync(string resourceGroupName, string hubName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginListLearnedRoutesWithHttpMessagesAsync(resourceGroupName, hubName, connectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a list of routes the virtual hub bgp connection is advertising to + /// the specified peer. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> ListAdvertisedRoutesWithHttpMessagesAsync(string resourceGroupName, string hubName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginListAdvertisedRoutesWithHttpMessagesAsync(resourceGroupName, hubName, connectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Retrieves a list of routes the virtual hub bgp connection has learned. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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> BeginListLearnedRoutesWithHttpMessagesAsync(string resourceGroupName, string hubName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hubName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hubName"); + } + if (connectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-06-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("hubName", hubName); + tracingParameters.Add("connectionName", connectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginListLearnedRoutes", 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/virtualHubs/{hubName}/bgpConnections/{connectionName}/learnedRoutes").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hubName}", System.Uri.EscapeDataString(hubName)); + _url = _url.Replace("{connectionName}", System.Uri.EscapeDataString(connectionName)); + _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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves a list of routes the virtual hub bgp connection is advertising to + /// the specified peer. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation 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> BeginListAdvertisedRoutesWithHttpMessagesAsync(string resourceGroupName, string hubName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (hubName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "hubName"); + } + if (connectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-06-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("hubName", hubName); + tracingParameters.Add("connectionName", connectionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginListAdvertisedRoutes", 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/virtualHubs/{hubName}/bgpConnections/{connectionName}/advertisedRoutes").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{hubName}", System.Uri.EscapeDataString(hubName)); + _url = _url.Replace("{connectionName}", System.Uri.EscapeDataString(connectionName)); + _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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Retrieves the details of all VirtualHubBgpConnections. /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualHubBgpConnectionsOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualHubBgpConnectionsOperationsExtensions.cs index 6db098929e3f..f4b57892ab32 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualHubBgpConnectionsOperationsExtensions.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualHubBgpConnectionsOperationsExtensions.cs @@ -61,6 +61,194 @@ public static IPage List(this IVirtualHubBgpConnectionsOperations } } + /// + /// Retrieves a list of routes the virtual hub bgp connection has learned. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + public static PeerRouteList ListLearnedRoutes(this IVirtualHubBgpConnectionsOperations operations, string resourceGroupName, string hubName, string connectionName) + { + return operations.ListLearnedRoutesAsync(resourceGroupName, hubName, connectionName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a list of routes the virtual hub bgp connection has learned. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// The cancellation token. + /// + public static async Task ListLearnedRoutesAsync(this IVirtualHubBgpConnectionsOperations operations, string resourceGroupName, string hubName, string connectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListLearnedRoutesWithHttpMessagesAsync(resourceGroupName, hubName, connectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves a list of routes the virtual hub bgp connection is advertising to + /// the specified peer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + public static PeerRouteList ListAdvertisedRoutes(this IVirtualHubBgpConnectionsOperations operations, string resourceGroupName, string hubName, string connectionName) + { + return operations.ListAdvertisedRoutesAsync(resourceGroupName, hubName, connectionName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a list of routes the virtual hub bgp connection is advertising to + /// the specified peer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// The cancellation token. + /// + public static async Task ListAdvertisedRoutesAsync(this IVirtualHubBgpConnectionsOperations operations, string resourceGroupName, string hubName, string connectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAdvertisedRoutesWithHttpMessagesAsync(resourceGroupName, hubName, connectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves a list of routes the virtual hub bgp connection has learned. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + public static PeerRouteList BeginListLearnedRoutes(this IVirtualHubBgpConnectionsOperations operations, string resourceGroupName, string hubName, string connectionName) + { + return operations.BeginListLearnedRoutesAsync(resourceGroupName, hubName, connectionName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a list of routes the virtual hub bgp connection has learned. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// The cancellation token. + /// + public static async Task BeginListLearnedRoutesAsync(this IVirtualHubBgpConnectionsOperations operations, string resourceGroupName, string hubName, string connectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginListLearnedRoutesWithHttpMessagesAsync(resourceGroupName, hubName, connectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves a list of routes the virtual hub bgp connection is advertising to + /// the specified peer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + public static PeerRouteList BeginListAdvertisedRoutes(this IVirtualHubBgpConnectionsOperations operations, string resourceGroupName, string hubName, string connectionName) + { + return operations.BeginListAdvertisedRoutesAsync(resourceGroupName, hubName, connectionName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves a list of routes the virtual hub bgp connection is advertising to + /// the specified peer. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual hub. + /// + /// + /// The name of the virtual hub bgp connection. + /// + /// + /// The cancellation token. + /// + public static async Task BeginListAdvertisedRoutesAsync(this IVirtualHubBgpConnectionsOperations operations, string resourceGroupName, string hubName, string connectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginListAdvertisedRoutesWithHttpMessagesAsync(resourceGroupName, hubName, connectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Retrieves the details of all VirtualHubBgpConnections. /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Microsoft.Azure.Management.Network.csproj b/sdk/network/Microsoft.Azure.Management.Network/src/Microsoft.Azure.Management.Network.csproj index dc861dea0616..5dee4d49163f 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Microsoft.Azure.Management.Network.csproj +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Microsoft.Azure.Management.Network.csproj @@ -10,7 +10,7 @@ Development of this library has shifted focus to the Azure Unified SDK. The future development will be focused on "Azure.ResourceManager.Network" (https://www.nuget.org/packages/Azure.ResourceManager.Network/). Please see the package changelog for more information. Microsoft.Azure.Management.Network - 20.1.0 + 20.1.1 Microsoft Azure Network management;Network;Network management;