diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ConnectionMonitorTestsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ConnectionMonitorTestsOperations.cs new file mode 100644 index 000000000000..7182c3cab4a9 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ConnectionMonitorTestsOperations.cs @@ -0,0 +1,1029 @@ +// +// 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.Peering +{ + 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; + + /// + /// ConnectionMonitorTestsOperations operations. + /// + internal partial class ConnectionMonitorTestsOperations : IServiceOperations, IConnectionMonitorTestsOperations + { + /// + /// Initializes a new instance of the ConnectionMonitorTestsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ConnectionMonitorTestsOperations(PeeringManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PeeringManagementClient + /// + public PeeringManagementClient Client { get; private set; } + + /// + /// Gets an existing connection monitor test with the specified name under the + /// given subscription, resource group and peering service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + /// + /// 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 peeringServiceName, string connectionMonitorTestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (peeringServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "peeringServiceName"); + } + if (connectionMonitorTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionMonitorTestName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("peeringServiceName", peeringServiceName); + tracingParameters.Add("connectionMonitorTestName", connectionMonitorTestName); + 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.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{peeringServiceName}", System.Uri.EscapeDataString(peeringServiceName)); + _url = _url.Replace("{connectionMonitorTestName}", System.Uri.EscapeDataString(connectionMonitorTestName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a connection monitor test with the specified name under + /// the given subscription, resource group and peering service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + /// + /// The properties needed to create a connection monitor test + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, ConnectionMonitorTest connectionMonitorTest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (peeringServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "peeringServiceName"); + } + if (connectionMonitorTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionMonitorTestName"); + } + if (connectionMonitorTest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionMonitorTest"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("peeringServiceName", peeringServiceName); + tracingParameters.Add("connectionMonitorTestName", connectionMonitorTestName); + tracingParameters.Add("connectionMonitorTest", connectionMonitorTest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{peeringServiceName}", System.Uri.EscapeDataString(peeringServiceName)); + _url = _url.Replace("{connectionMonitorTestName}", System.Uri.EscapeDataString(connectionMonitorTestName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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(connectionMonitorTest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(connectionMonitorTest, 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an existing connection monitor test with the specified name under + /// the given subscription, resource group and peering service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (peeringServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "peeringServiceName"); + } + if (connectionMonitorTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionMonitorTestName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("peeringServiceName", peeringServiceName); + tracingParameters.Add("connectionMonitorTestName", connectionMonitorTestName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{peeringServiceName}", System.Uri.EscapeDataString(peeringServiceName)); + _url = _url.Replace("{connectionMonitorTestName}", System.Uri.EscapeDataString(connectionMonitorTestName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all connection monitor tests under the given subscription, resource + /// group and peering service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// 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>> ListByPeeringServiceWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (peeringServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "peeringServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("peeringServiceName", peeringServiceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByPeeringService", 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.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{peeringServiceName}", System.Uri.EscapeDataString(peeringServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists all connection monitor tests under the given subscription, resource + /// group and peering service. + /// + /// + /// 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>> ListByPeeringServiceNextWithHttpMessagesAsync(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, "ListByPeeringServiceNext", 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ConnectionMonitorTestsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ConnectionMonitorTestsOperationsExtensions.cs new file mode 100644 index 000000000000..eaf298ccdbc3 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ConnectionMonitorTestsOperationsExtensions.cs @@ -0,0 +1,250 @@ +// +// 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.Peering +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ConnectionMonitorTestsOperations. + /// + public static partial class ConnectionMonitorTestsOperationsExtensions + { + /// + /// Gets an existing connection monitor test with the specified name under the + /// given subscription, resource group and peering service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + public static ConnectionMonitorTest Get(this IConnectionMonitorTestsOperations operations, string resourceGroupName, string peeringServiceName, string connectionMonitorTestName) + { + return operations.GetAsync(resourceGroupName, peeringServiceName, connectionMonitorTestName).GetAwaiter().GetResult(); + } + + /// + /// Gets an existing connection monitor test with the specified name under the + /// given subscription, resource group and peering service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IConnectionMonitorTestsOperations operations, string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, peeringServiceName, connectionMonitorTestName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a connection monitor test with the specified name under + /// the given subscription, resource group and peering service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + /// + /// The properties needed to create a connection monitor test + /// + public static ConnectionMonitorTest CreateOrUpdate(this IConnectionMonitorTestsOperations operations, string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, ConnectionMonitorTest connectionMonitorTest) + { + return operations.CreateOrUpdateAsync(resourceGroupName, peeringServiceName, connectionMonitorTestName, connectionMonitorTest).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a connection monitor test with the specified name under + /// the given subscription, resource group and peering service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + /// + /// The properties needed to create a connection monitor test + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IConnectionMonitorTestsOperations operations, string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, ConnectionMonitorTest connectionMonitorTest, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, peeringServiceName, connectionMonitorTestName, connectionMonitorTest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an existing connection monitor test with the specified name under + /// the given subscription, resource group and peering service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + public static void Delete(this IConnectionMonitorTestsOperations operations, string resourceGroupName, string peeringServiceName, string connectionMonitorTestName) + { + operations.DeleteAsync(resourceGroupName, peeringServiceName, connectionMonitorTestName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an existing connection monitor test with the specified name under + /// the given subscription, resource group and peering service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IConnectionMonitorTestsOperations operations, string resourceGroupName, string peeringServiceName, string connectionMonitorTestName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, peeringServiceName, connectionMonitorTestName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Lists all connection monitor tests under the given subscription, resource + /// group and peering service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + public static IPage ListByPeeringService(this IConnectionMonitorTestsOperations operations, string resourceGroupName, string peeringServiceName) + { + return operations.ListByPeeringServiceAsync(resourceGroupName, peeringServiceName).GetAwaiter().GetResult(); + } + + /// + /// Lists all connection monitor tests under the given subscription, resource + /// group and peering service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByPeeringServiceAsync(this IConnectionMonitorTestsOperations operations, string resourceGroupName, string peeringServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByPeeringServiceWithHttpMessagesAsync(resourceGroupName, peeringServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all connection monitor tests under the given subscription, resource + /// group and peering service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByPeeringServiceNext(this IConnectionMonitorTestsOperations operations, string nextPageLink) + { + return operations.ListByPeeringServiceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all connection monitor tests under the given subscription, resource + /// group and peering service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByPeeringServiceNextAsync(this IConnectionMonitorTestsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByPeeringServiceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IConnectionMonitorTestsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IConnectionMonitorTestsOperations.cs new file mode 100644 index 000000000000..737bff8ed0e4 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IConnectionMonitorTestsOperations.cs @@ -0,0 +1,164 @@ +// +// 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.Peering +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ConnectionMonitorTestsOperations operations. + /// + public partial interface IConnectionMonitorTestsOperations + { + /// + /// Gets an existing connection monitor test with the specified name + /// under the given subscription, resource group and peering service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + /// + /// 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 peeringServiceName, string connectionMonitorTestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a connection monitor test with the specified + /// name under the given subscription, resource group and peering + /// service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + /// + /// The properties needed to create a connection monitor test + /// + /// + /// 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 peeringServiceName, string connectionMonitorTestName, ConnectionMonitorTest connectionMonitorTest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an existing connection monitor test with the specified name + /// under the given subscription, resource group and peering service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// The name of the connection monitor test + /// + /// + /// 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 peeringServiceName, string connectionMonitorTestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all connection monitor tests under the given subscription, + /// resource group and peering service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the peering service. + /// + /// + /// 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>> ListByPeeringServiceWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all connection monitor tests under the given subscription, + /// resource group and peering service. + /// + /// + /// 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>> ListByPeeringServiceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ILookingGlassOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ILookingGlassOperations.cs new file mode 100644 index 000000000000..b545003216f5 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ILookingGlassOperations.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Peering +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// LookingGlassOperations operations. + /// + public partial interface ILookingGlassOperations + { + /// + /// Run looking glass functionality + /// + /// + /// The command to be executed: ping, traceroute, bgpRoute. Possible + /// values include: 'Traceroute', 'Ping', 'BgpRoute' + /// + /// + /// The type of the source: Edge site or Azure Region. Possible values + /// include: 'EdgeSite', 'AzureRegion' + /// + /// + /// The location of the source. + /// + /// + /// The IP address of the destination. + /// + /// + /// 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> InvokeWithHttpMessagesAsync(string command, string sourceType, string sourceLocation, string destinationIP, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs index d1af6abb9917..f1b9bea662d1 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs @@ -33,7 +33,7 @@ public partial interface IPeeringLocationsOperations /// /// /// The type of direct peering. Possible values include: 'Edge', - /// 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' + /// 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs', 'Voice' /// /// /// The headers that will be added to request. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs index 0be46d5566a8..4d580a72f6c0 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs @@ -83,6 +83,11 @@ public partial interface IPeeringManagementClient : System.IDisposable /// ILegacyPeeringsOperations LegacyPeerings { get; } + /// + /// Gets the ILookingGlassOperations. + /// + ILookingGlassOperations LookingGlass { get; } + /// /// Gets the IOperations. /// @@ -118,6 +123,11 @@ public partial interface IPeeringManagementClient : System.IDisposable /// IReceivedRoutesOperations ReceivedRoutes { get; } + /// + /// Gets the IConnectionMonitorTestsOperations. + /// + IConnectionMonitorTestsOperations ConnectionMonitorTests { get; } + /// /// Gets the IPeeringServiceCountriesOperations. /// diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs index 9decb2909c55..e8c7bc1e401d 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs @@ -173,6 +173,22 @@ public partial interface IPeeringServicesOperations /// Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Initialize Peering Service for Connection Monitor functionality + /// + /// + /// 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 InitializeConnectionMonitorWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Lists all of the peering services under the given subscription and /// resource group. /// diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs index 7ace3a92d703..dc539a670328 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs @@ -126,7 +126,7 @@ internal LegacyPeeringsOperations(PeeringManagementClient client) } if (kind != null) { - _queryParameters.Add(string.Format("kind={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(kind, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("kind={0}", System.Uri.EscapeDataString(kind))); } if (asn != null) { diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LookingGlassOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LookingGlassOperations.cs new file mode 100644 index 000000000000..233598f1ee12 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LookingGlassOperations.cs @@ -0,0 +1,277 @@ +// +// 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.Peering +{ + 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; + + /// + /// LookingGlassOperations operations. + /// + internal partial class LookingGlassOperations : IServiceOperations, ILookingGlassOperations + { + /// + /// Initializes a new instance of the LookingGlassOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal LookingGlassOperations(PeeringManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PeeringManagementClient + /// + public PeeringManagementClient Client { get; private set; } + + /// + /// Run looking glass functionality + /// + /// + /// The command to be executed: ping, traceroute, bgpRoute. Possible values + /// include: 'Traceroute', 'Ping', 'BgpRoute' + /// + /// + /// The type of the source: Edge site or Azure Region. Possible values include: + /// 'EdgeSite', 'AzureRegion' + /// + /// + /// The location of the source. + /// + /// + /// The IP address of the destination. + /// + /// + /// 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> InvokeWithHttpMessagesAsync(string command, string sourceType, string sourceLocation, string destinationIP, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (command == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "command"); + } + if (sourceType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sourceType"); + } + if (sourceLocation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sourceLocation"); + } + if (destinationIP == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "destinationIP"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("command", command); + tracingParameters.Add("sourceType", sourceType); + tracingParameters.Add("sourceLocation", sourceLocation); + tracingParameters.Add("destinationIP", destinationIP); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Invoke", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Peering/lookingGlass").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (command != null) + { + _queryParameters.Add(string.Format("command={0}", System.Uri.EscapeDataString(command))); + } + if (sourceType != null) + { + _queryParameters.Add(string.Format("sourceType={0}", System.Uri.EscapeDataString(sourceType))); + } + if (sourceLocation != null) + { + _queryParameters.Add(string.Format("sourceLocation={0}", System.Uri.EscapeDataString(sourceLocation))); + } + if (destinationIP != null) + { + _queryParameters.Add(string.Format("destinationIP={0}", System.Uri.EscapeDataString(destinationIP))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LookingGlassOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LookingGlassOperationsExtensions.cs new file mode 100644 index 000000000000..c69fe8f36267 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LookingGlassOperationsExtensions.cs @@ -0,0 +1,81 @@ +// +// 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.Peering +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for LookingGlassOperations. + /// + public static partial class LookingGlassOperationsExtensions + { + /// + /// Run looking glass functionality + /// + /// + /// The operations group for this extension method. + /// + /// + /// The command to be executed: ping, traceroute, bgpRoute. Possible values + /// include: 'Traceroute', 'Ping', 'BgpRoute' + /// + /// + /// The type of the source: Edge site or Azure Region. Possible values include: + /// 'EdgeSite', 'AzureRegion' + /// + /// + /// The location of the source. + /// + /// + /// The IP address of the destination. + /// + public static LookingGlassOutput Invoke(this ILookingGlassOperations operations, string command, string sourceType, string sourceLocation, string destinationIP) + { + return operations.InvokeAsync(command, sourceType, sourceLocation, destinationIP).GetAwaiter().GetResult(); + } + + /// + /// Run looking glass functionality + /// + /// + /// The operations group for this extension method. + /// + /// + /// The command to be executed: ping, traceroute, bgpRoute. Possible values + /// include: 'Traceroute', 'Ping', 'BgpRoute' + /// + /// + /// The type of the source: Edge site or Azure Region. Possible values include: + /// 'EdgeSite', 'AzureRegion' + /// + /// + /// The location of the source. + /// + /// + /// The IP address of the destination. + /// + /// + /// The cancellation token. + /// + public static async Task InvokeAsync(this ILookingGlassOperations operations, string command, string sourceType, string sourceLocation, string destinationIP, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.InvokeWithHttpMessagesAsync(command, sourceType, sourceLocation, destinationIP, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Command.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Command.cs new file mode 100644 index 000000000000..5b84c0e7bef0 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Command.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.Peering.Models +{ + + /// + /// Defines values for Command. + /// + public static class Command + { + public const string Traceroute = "Traceroute"; + public const string Ping = "Ping"; + public const string BgpRoute = "BgpRoute"; + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ConnectionMonitorTest.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ConnectionMonitorTest.cs new file mode 100644 index 000000000000..2e784eaf4f1e --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ConnectionMonitorTest.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Peering.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Connection Monitor Test class. + /// + [Rest.Serialization.JsonTransformation] + public partial class ConnectionMonitorTest : Resource + { + /// + /// Initializes a new instance of the ConnectionMonitorTest class. + /// + public ConnectionMonitorTest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectionMonitorTest class. + /// + /// The name of the resource. + /// The ID of the resource. + /// The type of the resource. + /// The Connection Monitor test source + /// agent + /// The Connection Monitor test + /// destination + /// The Connection Monitor test + /// destination port + /// The Connection Monitor test + /// frequency in seconds + /// The flag that indicates if the + /// Connection Monitor test is successful or not. + /// The path representing the Connection Monitor + /// test. + /// The provisioning state of the + /// resource. Possible values include: 'Succeeded', 'Updating', + /// 'Deleting', 'Failed' + public ConnectionMonitorTest(string name = default(string), string id = default(string), string type = default(string), string sourceAgent = default(string), string destination = default(string), int? destinationPort = default(int?), int? testFrequencyInSec = default(int?), bool? isTestSuccessful = default(bool?), IList path = default(IList), string provisioningState = default(string)) + : base(name, id, type) + { + SourceAgent = sourceAgent; + Destination = destination; + DestinationPort = destinationPort; + TestFrequencyInSec = testFrequencyInSec; + IsTestSuccessful = isTestSuccessful; + Path = path; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Connection Monitor test source agent + /// + [JsonProperty(PropertyName = "properties.sourceAgent")] + public string SourceAgent { get; set; } + + /// + /// Gets or sets the Connection Monitor test destination + /// + [JsonProperty(PropertyName = "properties.destination")] + public string Destination { get; set; } + + /// + /// Gets or sets the Connection Monitor test destination port + /// + [JsonProperty(PropertyName = "properties.destinationPort")] + public int? DestinationPort { get; set; } + + /// + /// Gets or sets the Connection Monitor test frequency in seconds + /// + [JsonProperty(PropertyName = "properties.testFrequencyInSec")] + public int? TestFrequencyInSec { get; set; } + + /// + /// Gets the flag that indicates if the Connection Monitor test is + /// successful or not. + /// + [JsonProperty(PropertyName = "properties.isTestSuccessful")] + public bool? IsTestSuccessful { get; private set; } + + /// + /// Gets the path representing the Connection Monitor test. + /// + [JsonProperty(PropertyName = "properties.path")] + public IList Path { get; private 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; } + + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs index f374f44e0224..a61283986b89 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs @@ -33,7 +33,7 @@ public DirectPeeringFacility() /// facility. /// The type of the direct peering. /// Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', - /// 'Ix', 'IxRs' + /// 'Ix', 'IxRs', 'Voice' /// The PeeringDB.com ID of the /// facility. /// The PeeringDB.com URL of the @@ -60,7 +60,8 @@ public DirectPeeringFacility() /// /// Gets or sets the type of the direct peering. Possible values - /// include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' + /// include: 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs', + /// 'Voice' /// [JsonProperty(PropertyName = "directPeeringType")] public string DirectPeeringType { get; set; } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs index c211fd8dcf81..a26f4516bb1d 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs @@ -22,5 +22,6 @@ public static class DirectPeeringType public const string Internal = "Internal"; public const string Ix = "Ix"; public const string IxRs = "IxRs"; + public const string Voice = "Voice"; } } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LegacyPeeringsKind.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LegacyPeeringsKind.cs new file mode 100644 index 000000000000..79933d9863e0 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LegacyPeeringsKind.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.Peering.Models +{ + + /// + /// Defines values for LegacyPeeringsKind. + /// + public static class LegacyPeeringsKind + { + public const string Direct = "Direct"; + public const string Exchange = "Exchange"; + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LogAnalyticsWorkspaceProperties.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LogAnalyticsWorkspaceProperties.cs new file mode 100644 index 000000000000..50c1d001a80a --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LogAnalyticsWorkspaceProperties.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Peering.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The properties that define a Log Analytics Workspace. + /// + public partial class LogAnalyticsWorkspaceProperties + { + /// + /// Initializes a new instance of the LogAnalyticsWorkspaceProperties + /// class. + /// + public LogAnalyticsWorkspaceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogAnalyticsWorkspaceProperties + /// class. + /// + /// The Workspace ID. + /// The Workspace Key. + /// The list of connected agents. + public LogAnalyticsWorkspaceProperties(string workspaceID = default(string), string key = default(string), IList connectedAgents = default(IList)) + { + WorkspaceID = workspaceID; + Key = key; + ConnectedAgents = connectedAgents; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Workspace ID. + /// + [JsonProperty(PropertyName = "workspaceID")] + public string WorkspaceID { get; private set; } + + /// + /// Gets the Workspace Key. + /// + [JsonProperty(PropertyName = "key")] + public string Key { get; private set; } + + /// + /// Gets the list of connected agents. + /// + [JsonProperty(PropertyName = "connectedAgents")] + public IList ConnectedAgents { get; private set; } + + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LookingGlassCommand.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LookingGlassCommand.cs new file mode 100644 index 000000000000..954786cab537 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LookingGlassCommand.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.Peering.Models +{ + + /// + /// Defines values for LookingGlassCommand. + /// + public static class LookingGlassCommand + { + public const string Traceroute = "Traceroute"; + public const string Ping = "Ping"; + public const string BgpRoute = "BgpRoute"; + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LookingGlassOutput.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LookingGlassOutput.cs new file mode 100644 index 000000000000..ef91e68b2909 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LookingGlassOutput.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Peering.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Looking glass output model + /// + public partial class LookingGlassOutput + { + /// + /// Initializes a new instance of the LookingGlassOutput class. + /// + public LookingGlassOutput() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LookingGlassOutput class. + /// + /// Invoked command. Possible values include: + /// 'Traceroute', 'Ping', 'BgpRoute' + /// Output of the command + public LookingGlassOutput(string command = default(string), string output = default(string)) + { + Command = command; + Output = output; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets invoked command. Possible values include: + /// 'Traceroute', 'Ping', 'BgpRoute' + /// + [JsonProperty(PropertyName = "command")] + public string Command { get; set; } + + /// + /// Gets or sets output of the command + /// + [JsonProperty(PropertyName = "output")] + public string Output { get; set; } + + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LookingGlassSourceType.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LookingGlassSourceType.cs new file mode 100644 index 000000000000..d2e895cedd27 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LookingGlassSourceType.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.Peering.Models +{ + + /// + /// Defines values for LookingGlassSourceType. + /// + public static class LookingGlassSourceType + { + public const string EdgeSite = "EdgeSite"; + public const string AzureRegion = "AzureRegion"; + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/MetricDimension.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/MetricDimension.cs new file mode 100644 index 000000000000..066d742f7213 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/MetricDimension.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Peering.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Dimensions of the metric. + /// + public partial class MetricDimension + { + /// + /// Initializes a new instance of the MetricDimension class. + /// + public MetricDimension() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricDimension class. + /// + /// Name of the dimension. + /// Localized friendly display name of the + /// dimension. + public MetricDimension(string name = default(string), string displayName = default(string)) + { + Name = name; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets name of the dimension. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets localized friendly display name of the dimension. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; private set; } + + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/MetricSpecification.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/MetricSpecification.cs new file mode 100644 index 000000000000..b41bb3db3266 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/MetricSpecification.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Peering.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Specifications of the Metrics for Azure Monitoring. + /// + public partial class MetricSpecification + { + /// + /// Initializes a new instance of the MetricSpecification class. + /// + public MetricSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetricSpecification class. + /// + /// Name of the metric. + /// Localized friendly display name of the + /// metric. + /// Localized friendly description of + /// the metric. + /// Unit that makes sense for the metric. + /// Aggregation type will be set to one + /// of the values: Average, Minimum, Maximum, Total, Count. + /// Supported time grain types + /// for the metric. + /// Dimensions of the metric. + public MetricSpecification(string name = default(string), string displayName = default(string), string displayDescription = default(string), string unit = default(string), string aggregationType = default(string), IList supportedTimeGrainTypes = default(IList), IList dimensions = default(IList)) + { + Name = name; + DisplayName = displayName; + DisplayDescription = displayDescription; + Unit = unit; + AggregationType = aggregationType; + SupportedTimeGrainTypes = supportedTimeGrainTypes; + Dimensions = dimensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets name of the metric. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets localized friendly display name of the metric. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets localized friendly description of the metric. + /// + [JsonProperty(PropertyName = "displayDescription")] + public string DisplayDescription { get; private set; } + + /// + /// Gets unit that makes sense for the metric. + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; private set; } + + /// + /// Gets aggregation type will be set to one of the values: Average, + /// Minimum, Maximum, Total, Count. + /// + [JsonProperty(PropertyName = "aggregationType")] + public string AggregationType { get; private set; } + + /// + /// Gets supported time grain types for the metric. + /// + [JsonProperty(PropertyName = "supportedTimeGrainTypes")] + public IList SupportedTimeGrainTypes { get; private set; } + + /// + /// Gets dimensions of the metric. + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; private set; } + + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs index 0c1e561b991e..cf16f073fb98 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs @@ -10,12 +10,15 @@ namespace Microsoft.Azure.Management.Peering.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Linq; /// /// The peering API operation. /// + [Rest.Serialization.JsonTransformation] public partial class Operation { /// @@ -34,11 +37,14 @@ public Operation() /// operation. /// The flag that indicates whether the /// operation applies to data plane. - public Operation(string name = default(string), OperationDisplayInfo display = default(OperationDisplayInfo), bool? isDataAction = default(bool?)) + /// Service specification + /// payload. + public Operation(string name = default(string), OperationDisplayInfo display = default(OperationDisplayInfo), bool? isDataAction = default(bool?), ServiceSpecification serviceSpecification = default(ServiceSpecification)) { Name = name; Display = display; IsDataAction = isDataAction; + ServiceSpecification = serviceSpecification; CustomInit(); } @@ -66,5 +72,11 @@ public Operation() [JsonProperty(PropertyName = "isDataAction")] public bool? IsDataAction { get; private set; } + /// + /// Gets service specification payload. + /// + [JsonProperty(PropertyName = "properties.serviceSpecification")] + public ServiceSpecification ServiceSpecification { get; private set; } + } } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs index 66c3547932c3..93dd252d4635 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs @@ -82,12 +82,11 @@ public PeerAsn() public string PeerName { get; set; } /// - /// Gets or sets the validation state of the ASN associated with the - /// peer. Possible values include: 'None', 'Pending', 'Approved', - /// 'Failed' + /// Gets the validation state of the ASN associated with the peer. + /// Possible values include: 'None', 'Pending', 'Approved', 'Failed' /// [JsonProperty(PropertyName = "properties.validationState")] - public string ValidationState { get; set; } + public string ValidationState { get; private set; } /// /// Gets the error message for the validation state diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationsDirectPeeringType.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationsDirectPeeringType.cs new file mode 100644 index 000000000000..5506c06d6798 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationsDirectPeeringType.cs @@ -0,0 +1,27 @@ +// +// 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.Peering.Models +{ + + /// + /// Defines values for PeeringLocationsDirectPeeringType. + /// + public static class PeeringLocationsDirectPeeringType + { + public const string Edge = "Edge"; + public const string Transit = "Transit"; + public const string Cdn = "Cdn"; + public const string Internal = "Internal"; + public const string Ix = "Ix"; + public const string IxRs = "IxRs"; + public const string Voice = "Voice"; + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationsKind.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationsKind.cs new file mode 100644 index 000000000000..15a0dede8a90 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationsKind.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.Peering.Models +{ + + /// + /// Defines values for PeeringLocationsKind. + /// + public static class PeeringLocationsKind + { + public const string Direct = "Direct"; + public const string Exchange = "Exchange"; + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs index 2bce9bddae0c..98e914419d37 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs @@ -38,7 +38,7 @@ public PeeringPropertiesDirect() /// The reference of the peer ASN. /// The type of direct peering. /// Possible values include: 'Edge', 'Transit', 'Cdn', 'Internal', - /// 'Ix', 'IxRs' + /// 'Ix', 'IxRs', 'Voice' public PeeringPropertiesDirect(IList connections = default(IList), bool? useForPeeringService = default(bool?), SubResource peerAsn = default(SubResource), string directPeeringType = default(string)) { Connections = connections; @@ -75,7 +75,7 @@ public PeeringPropertiesDirect() /// /// Gets or sets the type of direct peering. Possible values include: - /// 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs' + /// 'Edge', 'Transit', 'Cdn', 'Internal', 'Ix', 'IxRs', 'Voice' /// [JsonProperty(PropertyName = "directPeeringType")] public string DirectPeeringType { get; set; } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs index d5ced2386f6c..c430dd4586bd 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs @@ -40,21 +40,32 @@ public PeeringService() /// The type of the resource. /// The SKU that defines the type of the peering /// service. - /// The PeeringServiceLocation of - /// the Customer. - /// The MAPS Provider - /// Name. + /// The location (state/province) + /// of the customer. + /// The name of the service + /// provider. /// The provisioning state of the /// resource. Possible values include: 'Succeeded', 'Updating', /// 'Deleting', 'Failed' + /// The primary peering + /// (Microsoft/service provider) location to be used for customer + /// traffic. + /// The backup peering + /// (Microsoft/service provider) location to be used for customer + /// traffic. + /// The Log Analytics + /// Workspace Properties /// The resource tags. - public PeeringService(string location, string name = default(string), string id = default(string), string type = default(string), PeeringServiceSku sku = default(PeeringServiceSku), string peeringServiceLocation = default(string), string peeringServiceProvider = default(string), string provisioningState = default(string), IDictionary tags = default(IDictionary)) + public PeeringService(string location, string name = default(string), string id = default(string), string type = default(string), PeeringServiceSku sku = default(PeeringServiceSku), string peeringServiceLocation = default(string), string peeringServiceProvider = default(string), string provisioningState = default(string), string providerPrimaryPeeringLocation = default(string), string providerBackupPeeringLocation = default(string), LogAnalyticsWorkspaceProperties logAnalyticsWorkspaceProperties = default(LogAnalyticsWorkspaceProperties), IDictionary tags = default(IDictionary)) : base(name, id, type) { Sku = sku; PeeringServiceLocation = peeringServiceLocation; PeeringServiceProvider = peeringServiceProvider; ProvisioningState = provisioningState; + ProviderPrimaryPeeringLocation = providerPrimaryPeeringLocation; + ProviderBackupPeeringLocation = providerBackupPeeringLocation; + LogAnalyticsWorkspaceProperties = logAnalyticsWorkspaceProperties; Location = location; Tags = tags; CustomInit(); @@ -72,13 +83,13 @@ public PeeringService() public PeeringServiceSku Sku { get; set; } /// - /// Gets or sets the PeeringServiceLocation of the Customer. + /// Gets or sets the location (state/province) of the customer. /// [JsonProperty(PropertyName = "properties.peeringServiceLocation")] public string PeeringServiceLocation { get; set; } /// - /// Gets or sets the MAPS Provider Name. + /// Gets or sets the name of the service provider. /// [JsonProperty(PropertyName = "properties.peeringServiceProvider")] public string PeeringServiceProvider { get; set; } @@ -90,6 +101,26 @@ public PeeringService() [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; private set; } + /// + /// Gets or sets the primary peering (Microsoft/service provider) + /// location to be used for customer traffic. + /// + [JsonProperty(PropertyName = "properties.providerPrimaryPeeringLocation")] + public string ProviderPrimaryPeeringLocation { get; set; } + + /// + /// Gets or sets the backup peering (Microsoft/service provider) + /// location to be used for customer traffic. + /// + [JsonProperty(PropertyName = "properties.providerBackupPeeringLocation")] + public string ProviderBackupPeeringLocation { get; set; } + + /// + /// Gets or sets the Log Analytics Workspace Properties + /// + [JsonProperty(PropertyName = "properties.logAnalyticsWorkspaceProperties")] + public LogAnalyticsWorkspaceProperties LogAnalyticsWorkspaceProperties { get; set; } + /// /// Gets or sets the location of the resource. /// diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs index 1cbca93ee403..4e169230e32c 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs @@ -13,6 +13,8 @@ namespace Microsoft.Azure.Management.Peering.Models using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -37,10 +39,13 @@ public PeeringServiceProvider() /// The type of the resource. /// The name of the service /// provider. - public PeeringServiceProvider(string name = default(string), string id = default(string), string type = default(string), string serviceProviderName = default(string)) + /// The list of locations at which the + /// service provider peers with Microsoft. + public PeeringServiceProvider(string name = default(string), string id = default(string), string type = default(string), string serviceProviderName = default(string), IList peeringLocations = default(IList)) : base(name, id, type) { ServiceProviderName = serviceProviderName; + PeeringLocations = peeringLocations; CustomInit(); } @@ -55,5 +60,12 @@ public PeeringServiceProvider() [JsonProperty(PropertyName = "properties.serviceProviderName")] public string ServiceProviderName { get; set; } + /// + /// Gets or sets the list of locations at which the service provider + /// peers with Microsoft. + /// + [JsonProperty(PropertyName = "properties.peeringLocations")] + public IList PeeringLocations { get; set; } + } } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs index d2cb07fed4f1..fab52b749af6 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs @@ -57,25 +57,25 @@ public PeeringSku() public string Name { get; set; } /// - /// Gets or sets the tier of the peering SKU. Possible values include: - /// 'Basic', 'Premium' + /// Gets the tier of the peering SKU. Possible values include: 'Basic', + /// 'Premium' /// [JsonProperty(PropertyName = "tier")] - public string Tier { get; set; } + public string Tier { get; private set; } /// - /// Gets or sets the family of the peering SKU. Possible values - /// include: 'Direct', 'Exchange' + /// Gets the family of the peering SKU. Possible values include: + /// 'Direct', 'Exchange' /// [JsonProperty(PropertyName = "family")] - public string Family { get; set; } + public string Family { get; private set; } /// - /// Gets or sets the size of the peering SKU. Possible values include: - /// 'Free', 'Metered', 'Unlimited' + /// Gets the size of the peering SKU. Possible values include: 'Free', + /// 'Metered', 'Unlimited' /// [JsonProperty(PropertyName = "size")] - public string Size { get; set; } + public string Size { get; private set; } } } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ServiceSpecification.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ServiceSpecification.cs new file mode 100644 index 000000000000..21dfdc4c3ec7 --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ServiceSpecification.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Peering.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Service specification payload. + /// + public partial class ServiceSpecification + { + /// + /// Initializes a new instance of the ServiceSpecification class. + /// + public ServiceSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceSpecification class. + /// + /// Specifications of the Metrics + /// for Azure Monitoring. + public ServiceSpecification(IList metricSpecifications = default(IList)) + { + MetricSpecifications = metricSpecifications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets specifications of the Metrics for Azure Monitoring. + /// + [JsonProperty(PropertyName = "metricSpecifications")] + public IList MetricSpecifications { get; private set; } + + } +} diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs index e3da8c9c1266..ebf080cfbed5 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs @@ -59,7 +59,7 @@ internal PeeringLocationsOperations(PeeringManagementClient client) /// /// /// The type of direct peering. Possible values include: 'Edge', 'Transit', - /// 'Cdn', 'Internal', 'Ix', 'IxRs' + /// 'Cdn', 'Internal', 'Ix', 'IxRs', 'Voice' /// /// /// Headers that will be added to request. @@ -115,11 +115,11 @@ internal PeeringLocationsOperations(PeeringManagementClient client) List _queryParameters = new List(); if (kind != null) { - _queryParameters.Add(string.Format("kind={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(kind, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("kind={0}", System.Uri.EscapeDataString(kind))); } if (directPeeringType != null) { - _queryParameters.Add(string.Format("directPeeringType={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(directPeeringType, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("directPeeringType={0}", System.Uri.EscapeDataString(directPeeringType))); } if (Client.ApiVersion != null) { diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs index 8788fb6e9b6b..53db23cfabcf 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs @@ -33,7 +33,7 @@ public static partial class PeeringLocationsOperationsExtensions /// /// /// The type of direct peering. Possible values include: 'Edge', 'Transit', - /// 'Cdn', 'Internal', 'Ix', 'IxRs' + /// 'Cdn', 'Internal', 'Ix', 'IxRs', 'Voice' /// public static IPage List(this IPeeringLocationsOperations operations, string kind, string directPeeringType = default(string)) { @@ -52,7 +52,7 @@ public static partial class PeeringLocationsOperationsExtensions /// /// /// The type of direct peering. Possible values include: 'Edge', 'Transit', - /// 'Cdn', 'Internal', 'Ix', 'IxRs' + /// 'Cdn', 'Internal', 'Ix', 'IxRs', 'Voice' /// /// /// The cancellation token. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs index a2754a94f659..928e77fc8103 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs @@ -86,6 +86,11 @@ public partial class PeeringManagementClient : ServiceClient public virtual ILegacyPeeringsOperations LegacyPeerings { get; private set; } + /// + /// Gets the ILookingGlassOperations. + /// + public virtual ILookingGlassOperations LookingGlass { get; private set; } + /// /// Gets the IOperations. /// @@ -121,6 +126,11 @@ public partial class PeeringManagementClient : ServiceClient public virtual IReceivedRoutesOperations ReceivedRoutes { get; private set; } + /// + /// Gets the IConnectionMonitorTestsOperations. + /// + public virtual IConnectionMonitorTestsOperations ConnectionMonitorTests { get; private set; } + /// /// Gets the IPeeringServiceCountriesOperations. /// @@ -389,6 +399,7 @@ private void Initialize() { CdnPeeringPrefixes = new CdnPeeringPrefixesOperations(this); LegacyPeerings = new LegacyPeeringsOperations(this); + LookingGlass = new LookingGlassOperations(this); Operations = new Operations(this); PeerAsns = new PeerAsnsOperations(this); PeeringLocations = new PeeringLocationsOperations(this); @@ -396,13 +407,14 @@ private void Initialize() RegisteredPrefixes = new RegisteredPrefixesOperations(this); Peerings = new PeeringsOperations(this); ReceivedRoutes = new ReceivedRoutesOperations(this); + ConnectionMonitorTests = new ConnectionMonitorTestsOperations(this); PeeringServiceCountries = new PeeringServiceCountriesOperations(this); PeeringServiceLocations = new PeeringServiceLocationsOperations(this); Prefixes = new PrefixesOperations(this); PeeringServiceProviders = new PeeringServiceProvidersOperations(this); PeeringServices = new PeeringServicesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-10-01"; + ApiVersion = "2021-06-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -496,7 +508,7 @@ private void Initialize() } // Construct URL var _baseUrl = BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Peering/CheckServiceProviderAvailability").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Peering/checkServiceProviderAvailability").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); List _queryParameters = new List(); if (ApiVersion != null) diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs index 969074805a68..0101a87f97a7 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs @@ -1204,6 +1204,158 @@ internal PeeringServicesOperations(PeeringManagementClient client) return _result; } + /// + /// Initialize Peering Service for Connection Monitor functionality + /// + /// + /// 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 InitializeConnectionMonitorWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "InitializeConnectionMonitor", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Peering/initializeConnectionMonitor").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Lists all of the peering services under the given subscription and resource /// group. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs index 1c2cdfc0be82..9ab01f1e259e 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs @@ -264,6 +264,31 @@ public static IPage ListBySubscription(this IPeeringServicesOper } } + /// + /// Initialize Peering Service for Connection Monitor functionality + /// + /// + /// The operations group for this extension method. + /// + public static void InitializeConnectionMonitor(this IPeeringServicesOperations operations) + { + operations.InitializeConnectionMonitorAsync().GetAwaiter().GetResult(); + } + + /// + /// Initialize Peering Service for Connection Monitor functionality + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task InitializeConnectionMonitorAsync(this IPeeringServicesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.InitializeConnectionMonitorWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Lists all of the peering services under the given subscription and resource /// group. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs index c6b718d92fc6..56b3a6ed8b60 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs @@ -19,21 +19,23 @@ public static IEnumerable> ApiInfo_PeeringManageme { return new Tuple[] { - new Tuple("Peering", "CdnPeeringPrefixes", "2020-10-01"), - new Tuple("Peering", "CheckServiceProviderAvailability", "2020-10-01"), - new Tuple("Peering", "LegacyPeerings", "2020-10-01"), - new Tuple("Peering", "Operations", "2020-10-01"), - new Tuple("Peering", "PeerAsns", "2020-10-01"), - new Tuple("Peering", "PeeringLocations", "2020-10-01"), - new Tuple("Peering", "PeeringServiceCountries", "2020-10-01"), - new Tuple("Peering", "PeeringServiceLocations", "2020-10-01"), - new Tuple("Peering", "PeeringServiceProviders", "2020-10-01"), - new Tuple("Peering", "PeeringServices", "2020-10-01"), - new Tuple("Peering", "Peerings", "2020-10-01"), - new Tuple("Peering", "Prefixes", "2020-10-01"), - new Tuple("Peering", "ReceivedRoutes", "2020-10-01"), - new Tuple("Peering", "RegisteredAsns", "2020-10-01"), - new Tuple("Peering", "RegisteredPrefixes", "2020-10-01"), + new Tuple("Peering", "CdnPeeringPrefixes", "2021-06-01"), + new Tuple("Peering", "CheckServiceProviderAvailability", "2021-06-01"), + new Tuple("Peering", "ConnectionMonitorTests", "2021-06-01"), + new Tuple("Peering", "LegacyPeerings", "2021-06-01"), + new Tuple("Peering", "LookingGlass", "2021-06-01"), + new Tuple("Peering", "Operations", "2021-06-01"), + new Tuple("Peering", "PeerAsns", "2021-06-01"), + new Tuple("Peering", "PeeringLocations", "2021-06-01"), + new Tuple("Peering", "PeeringServiceCountries", "2021-06-01"), + new Tuple("Peering", "PeeringServiceLocations", "2021-06-01"), + new Tuple("Peering", "PeeringServiceProviders", "2021-06-01"), + new Tuple("Peering", "PeeringServices", "2021-06-01"), + new Tuple("Peering", "Peerings", "2021-06-01"), + new Tuple("Peering", "Prefixes", "2021-06-01"), + new Tuple("Peering", "ReceivedRoutes", "2021-06-01"), + new Tuple("Peering", "RegisteredAsns", "2021-06-01"), + new Tuple("Peering", "RegisteredPrefixes", "2021-06-01"), }.AsEnumerable(); } }