diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/HybridConnectionsOperations.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/HybridConnectionsOperations.cs
new file mode 100644
index 000000000000..d9217c50f000
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/HybridConnectionsOperations.cs
@@ -0,0 +1,2821 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay
+{
+ using Azure;
+ using Management;
+ using Rest;
+ using 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;
+
+ ///
+ /// HybridConnectionsOperations operations.
+ ///
+ internal partial class HybridConnectionsOperations : IServiceOperations, IHybridConnectionsOperations
+ {
+ ///
+ /// Initializes a new instance of the HybridConnectionsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal HybridConnectionsOperations(RelayManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the RelayManagementClient
+ ///
+ public RelayManagementClient Client { get; private set; }
+
+ ///
+ /// Lists the HybridConnection within the namespace.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListByNamespaceWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (namespaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName");
+ }
+ if (namespaceName != null)
+ {
+ if (namespaceName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50);
+ }
+ if (namespaceName.Length < 6)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6);
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("namespaceName", namespaceName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByNamespace", 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.Relay/namespaces/{namespaceName}/HybridConnections").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName));
+ _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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.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 service HybridConnection. This operation is
+ /// idempotent.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// Parameters supplied to create a HybridConnection.
+ ///
+ ///
+ /// 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 namespaceName, string hybridConnectionName, HybridConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (namespaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName");
+ }
+ if (namespaceName != null)
+ {
+ if (namespaceName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50);
+ }
+ if (namespaceName.Length < 6)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6);
+ }
+ }
+ if (hybridConnectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "hybridConnectionName");
+ }
+ if (hybridConnectionName != null)
+ {
+ if (hybridConnectionName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "hybridConnectionName", 50);
+ }
+ if (hybridConnectionName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "hybridConnectionName", 1);
+ }
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("namespaceName", namespaceName);
+ tracingParameters.Add("hybridConnectionName", hybridConnectionName);
+ tracingParameters.Add("parameters", parameters);
+ 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.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName));
+ _url = _url.Replace("{hybridConnectionName}", System.Uri.EscapeDataString(hybridConnectionName));
+ _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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new 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;
+ }
+
+ ///
+ /// Deletes a HybridConnection .
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (namespaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName");
+ }
+ if (namespaceName != null)
+ {
+ if (namespaceName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50);
+ }
+ if (namespaceName.Length < 6)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6);
+ }
+ }
+ if (hybridConnectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "hybridConnectionName");
+ }
+ if (hybridConnectionName != null)
+ {
+ if (hybridConnectionName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "hybridConnectionName", 50);
+ }
+ if (hybridConnectionName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "hybridConnectionName", 1);
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("namespaceName", namespaceName);
+ tracingParameters.Add("hybridConnectionName", hybridConnectionName);
+ 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.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName));
+ _url = _url.Replace("{hybridConnectionName}", System.Uri.EscapeDataString(hybridConnectionName));
+ _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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.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;
+ }
+
+ ///
+ /// Returns the description for the specified HybridConnection.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (namespaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName");
+ }
+ if (namespaceName != null)
+ {
+ if (namespaceName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50);
+ }
+ if (namespaceName.Length < 6)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6);
+ }
+ }
+ if (hybridConnectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "hybridConnectionName");
+ }
+ if (hybridConnectionName != null)
+ {
+ if (hybridConnectionName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "hybridConnectionName", 50);
+ }
+ if (hybridConnectionName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "hybridConnectionName", 1);
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("namespaceName", namespaceName);
+ tracingParameters.Add("hybridConnectionName", hybridConnectionName);
+ 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.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName));
+ _url = _url.Replace("{hybridConnectionName}", System.Uri.EscapeDataString(hybridConnectionName));
+ _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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.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;
+ }
+
+ ///
+ /// Authorization rules for a HybridConnection.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (namespaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName");
+ }
+ if (namespaceName != null)
+ {
+ if (namespaceName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50);
+ }
+ if (namespaceName.Length < 6)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6);
+ }
+ }
+ if (hybridConnectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "hybridConnectionName");
+ }
+ if (hybridConnectionName != null)
+ {
+ if (hybridConnectionName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "hybridConnectionName", 50);
+ }
+ if (hybridConnectionName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "hybridConnectionName", 1);
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("namespaceName", namespaceName);
+ tracingParameters.Add("hybridConnectionName", hybridConnectionName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListAuthorizationRules", 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.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName));
+ _url = _url.Replace("{hybridConnectionName}", System.Uri.EscapeDataString(hybridConnectionName));
+ _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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Creates or Updates an authorization rule for a HybridConnection
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The authorization rule parameters
+ ///
+ ///
+ /// 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> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, AuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (namespaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName");
+ }
+ if (namespaceName != null)
+ {
+ if (namespaceName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50);
+ }
+ if (namespaceName.Length < 6)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6);
+ }
+ }
+ if (hybridConnectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "hybridConnectionName");
+ }
+ if (hybridConnectionName != null)
+ {
+ if (hybridConnectionName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "hybridConnectionName", 50);
+ }
+ if (hybridConnectionName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "hybridConnectionName", 1);
+ }
+ }
+ if (authorizationRuleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName");
+ }
+ if (authorizationRuleName != null)
+ {
+ if (authorizationRuleName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50);
+ }
+ if (authorizationRuleName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1);
+ }
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("namespaceName", namespaceName);
+ tracingParameters.Add("hybridConnectionName", hybridConnectionName);
+ tracingParameters.Add("authorizationRuleName", authorizationRuleName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAuthorizationRule", 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.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName));
+ _url = _url.Replace("{hybridConnectionName}", System.Uri.EscapeDataString(hybridConnectionName));
+ _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName));
+ _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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new 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;
+ }
+
+ ///
+ /// Deletes a HybridConnection authorization rule
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (namespaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName");
+ }
+ if (namespaceName != null)
+ {
+ if (namespaceName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50);
+ }
+ if (namespaceName.Length < 6)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6);
+ }
+ }
+ if (hybridConnectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "hybridConnectionName");
+ }
+ if (hybridConnectionName != null)
+ {
+ if (hybridConnectionName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "hybridConnectionName", 50);
+ }
+ if (hybridConnectionName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "hybridConnectionName", 1);
+ }
+ }
+ if (authorizationRuleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName");
+ }
+ if (authorizationRuleName != null)
+ {
+ if (authorizationRuleName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50);
+ }
+ if (authorizationRuleName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1);
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("namespaceName", namespaceName);
+ tracingParameters.Add("hybridConnectionName", hybridConnectionName);
+ tracingParameters.Add("authorizationRuleName", authorizationRuleName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "DeleteAuthorizationRule", 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.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName));
+ _url = _url.Replace("{hybridConnectionName}", System.Uri.EscapeDataString(hybridConnectionName));
+ _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName));
+ _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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.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;
+ }
+
+ ///
+ /// HybridConnection authorizationRule for a HybridConnection by name.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (namespaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName");
+ }
+ if (namespaceName != null)
+ {
+ if (namespaceName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50);
+ }
+ if (namespaceName.Length < 6)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6);
+ }
+ }
+ if (hybridConnectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "hybridConnectionName");
+ }
+ if (hybridConnectionName != null)
+ {
+ if (hybridConnectionName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "hybridConnectionName", 50);
+ }
+ if (hybridConnectionName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "hybridConnectionName", 1);
+ }
+ }
+ if (authorizationRuleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName");
+ }
+ if (authorizationRuleName != null)
+ {
+ if (authorizationRuleName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50);
+ }
+ if (authorizationRuleName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1);
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("namespaceName", namespaceName);
+ tracingParameters.Add("hybridConnectionName", hybridConnectionName);
+ tracingParameters.Add("authorizationRuleName", authorizationRuleName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetAuthorizationRule", 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.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName));
+ _url = _url.Replace("{hybridConnectionName}", System.Uri.EscapeDataString(hybridConnectionName));
+ _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName));
+ _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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.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;
+ }
+
+ ///
+ /// Primary and Secondary ConnectionStrings to the HybridConnection.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (namespaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName");
+ }
+ if (namespaceName != null)
+ {
+ if (namespaceName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50);
+ }
+ if (namespaceName.Length < 6)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6);
+ }
+ }
+ if (hybridConnectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "hybridConnectionName");
+ }
+ if (hybridConnectionName != null)
+ {
+ if (hybridConnectionName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "hybridConnectionName", 50);
+ }
+ if (hybridConnectionName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "hybridConnectionName", 1);
+ }
+ }
+ if (authorizationRuleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName");
+ }
+ if (authorizationRuleName != null)
+ {
+ if (authorizationRuleName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50);
+ }
+ if (authorizationRuleName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1);
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("namespaceName", namespaceName);
+ tracingParameters.Add("hybridConnectionName", hybridConnectionName);
+ tracingParameters.Add("authorizationRuleName", authorizationRuleName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListKeys", 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.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/ListKeys").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName));
+ _url = _url.Replace("{hybridConnectionName}", System.Uri.EscapeDataString(hybridConnectionName));
+ _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName));
+ _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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.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;
+ }
+
+ ///
+ /// Regenerates the Primary or Secondary ConnectionStrings to the
+ /// HybridConnection
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// Parameters supplied to regenerate Auth Rule.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, RegenerateKeysParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (namespaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName");
+ }
+ if (namespaceName != null)
+ {
+ if (namespaceName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50);
+ }
+ if (namespaceName.Length < 6)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6);
+ }
+ }
+ if (hybridConnectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "hybridConnectionName");
+ }
+ if (hybridConnectionName != null)
+ {
+ if (hybridConnectionName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "hybridConnectionName", 50);
+ }
+ if (hybridConnectionName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "hybridConnectionName", 1);
+ }
+ }
+ if (authorizationRuleName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "authorizationRuleName");
+ }
+ if (authorizationRuleName != null)
+ {
+ if (authorizationRuleName.Length > 50)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "authorizationRuleName", 50);
+ }
+ if (authorizationRuleName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "authorizationRuleName", 1);
+ }
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("namespaceName", namespaceName);
+ tracingParameters.Add("hybridConnectionName", hybridConnectionName);
+ tracingParameters.Add("authorizationRuleName", authorizationRuleName);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "RegenerateKeys", 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.Relay/namespaces/{namespaceName}/HybridConnections/{hybridConnectionName}/authorizationRules/{authorizationRuleName}/regenerateKeys").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName));
+ _url = _url.Replace("{hybridConnectionName}", System.Uri.EscapeDataString(hybridConnectionName));
+ _url = _url.Replace("{authorizationRuleName}", System.Uri.EscapeDataString(authorizationRuleName));
+ _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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new 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 the HybridConnection within the namespace.
+ ///
+ ///
+ /// 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>> ListByNamespaceNextWithHttpMessagesAsync(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, "ListByNamespaceNext", 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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.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;
+ }
+
+ ///
+ /// Authorization rules for a HybridConnection.
+ ///
+ ///
+ /// 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>> ListAuthorizationRulesNextWithHttpMessagesAsync(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, "ListAuthorizationRulesNext", 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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/HybridConnectionsOperationsExtensions.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/HybridConnectionsOperationsExtensions.cs
new file mode 100644
index 000000000000..9e2f65992eb8
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/HybridConnectionsOperationsExtensions.cs
@@ -0,0 +1,594 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay
+{
+ using Azure;
+ using Management;
+ using Rest;
+ using Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for HybridConnectionsOperations.
+ ///
+ public static partial class HybridConnectionsOperationsExtensions
+ {
+ ///
+ /// Lists the HybridConnection within the namespace.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ public static IPage ListByNamespace(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName)
+ {
+ return operations.ListByNamespaceAsync(resourceGroupName, namespaceName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists the HybridConnection within the namespace.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListByNamespaceAsync(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByNamespaceWithHttpMessagesAsync(resourceGroupName, namespaceName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Creates or Updates a service HybridConnection. This operation is
+ /// idempotent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// Parameters supplied to create a HybridConnection.
+ ///
+ public static HybridConnection CreateOrUpdate(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, HybridConnection parameters)
+ {
+ return operations.CreateOrUpdateAsync(resourceGroupName, namespaceName, hybridConnectionName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates or Updates a service HybridConnection. This operation is
+ /// idempotent.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// Parameters supplied to create a HybridConnection.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAsync(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, HybridConnection parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, hybridConnectionName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Deletes a HybridConnection .
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ public static void Delete(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName)
+ {
+ operations.DeleteAsync(resourceGroupName, namespaceName, hybridConnectionName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Deletes a HybridConnection .
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ await operations.DeleteWithHttpMessagesAsync(resourceGroupName, namespaceName, hybridConnectionName, null, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Returns the description for the specified HybridConnection.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ public static HybridConnection Get(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName)
+ {
+ return operations.GetAsync(resourceGroupName, namespaceName, hybridConnectionName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Returns the description for the specified HybridConnection.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, namespaceName, hybridConnectionName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Authorization rules for a HybridConnection.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ public static IPage ListAuthorizationRules(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName)
+ {
+ return operations.ListAuthorizationRulesAsync(resourceGroupName, namespaceName, hybridConnectionName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Authorization rules for a HybridConnection.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAuthorizationRulesAsync(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListAuthorizationRulesWithHttpMessagesAsync(resourceGroupName, namespaceName, hybridConnectionName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Creates or Updates an authorization rule for a HybridConnection
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The authorization rule parameters
+ ///
+ public static AuthorizationRule CreateOrUpdateAuthorizationRule(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, AuthorizationRule parameters)
+ {
+ return operations.CreateOrUpdateAuthorizationRuleAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates or Updates an authorization rule for a HybridConnection
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The authorization rule parameters
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAuthorizationRuleAsync(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, AuthorizationRule parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Deletes a HybridConnection authorization rule
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ public static void DeleteAuthorizationRule(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName)
+ {
+ operations.DeleteAuthorizationRuleAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Deletes a HybridConnection authorization rule
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAuthorizationRuleAsync(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ await operations.DeleteAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// HybridConnection authorizationRule for a HybridConnection by name.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ public static AuthorizationRule GetAuthorizationRule(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName)
+ {
+ return operations.GetAuthorizationRuleAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// HybridConnection authorizationRule for a HybridConnection by name.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAuthorizationRuleAsync(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetAuthorizationRuleWithHttpMessagesAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Primary and Secondary ConnectionStrings to the HybridConnection.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ public static AuthorizationRuleKeys ListKeys(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName)
+ {
+ return operations.ListKeysAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Primary and Secondary ConnectionStrings to the HybridConnection.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListKeysAsync(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Regenerates the Primary or Secondary ConnectionStrings to the
+ /// HybridConnection
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// Parameters supplied to regenerate Auth Rule.
+ ///
+ public static AuthorizationRuleKeys RegenerateKeys(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, RegenerateKeysParameters parameters)
+ {
+ return operations.RegenerateKeysAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Regenerates the Primary or Secondary ConnectionStrings to the
+ /// HybridConnection
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// Parameters supplied to regenerate Auth Rule.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task RegenerateKeysAsync(this IHybridConnectionsOperations operations, string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, RegenerateKeysParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.RegenerateKeysWithHttpMessagesAsync(resourceGroupName, namespaceName, hybridConnectionName, authorizationRuleName, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Lists the HybridConnection within the namespace.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListByNamespaceNext(this IHybridConnectionsOperations operations, string nextPageLink)
+ {
+ return operations.ListByNamespaceNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists the HybridConnection within the namespace.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListByNamespaceNextAsync(this IHybridConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListByNamespaceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Authorization rules for a HybridConnection.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListAuthorizationRulesNext(this IHybridConnectionsOperations operations, string nextPageLink)
+ {
+ return operations.ListAuthorizationRulesNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Authorization rules for a HybridConnection.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAuthorizationRulesNextAsync(this IHybridConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListAuthorizationRulesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IHybridConnectionsOperations.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IHybridConnectionsOperations.cs
new file mode 100644
index 000000000000..a767eeb419c1
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IHybridConnectionsOperations.cs
@@ -0,0 +1,369 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay
+{
+ using Azure;
+ using Management;
+ using Rest;
+ using Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// HybridConnectionsOperations operations.
+ ///
+ public partial interface IHybridConnectionsOperations
+ {
+ ///
+ /// Lists the HybridConnection within the namespace.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByNamespaceWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or Updates a service HybridConnection. This operation is
+ /// idempotent.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// Parameters supplied to create a HybridConnection.
+ ///
+ ///
+ /// 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 namespaceName, string hybridConnectionName, HybridConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes a HybridConnection .
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Returns the description for the specified HybridConnection.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Authorization rules for a HybridConnection.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or Updates an authorization rule for a HybridConnection
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The authorization rule parameters
+ ///
+ ///
+ /// 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> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, AuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes a HybridConnection authorization rule
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// HybridConnection authorizationRule for a HybridConnection by name.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Primary and Secondary ConnectionStrings to the HybridConnection.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Regenerates the Primary or Secondary ConnectionStrings to the
+ /// HybridConnection
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The hybrid connection name.
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// Parameters supplied to regenerate Auth Rule.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string hybridConnectionName, string authorizationRuleName, RegenerateKeysParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the HybridConnection within the namespace.
+ ///
+ ///
+ /// 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>> ListByNamespaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Authorization rules for a HybridConnection.
+ ///
+ ///
+ /// 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>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/INamespacesOperations.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/INamespacesOperations.cs
new file mode 100644
index 000000000000..395961fbafc1
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/INamespacesOperations.cs
@@ -0,0 +1,484 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay
+{
+ using Azure;
+ using Management;
+ using Rest;
+ using Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// NamespacesOperations operations.
+ ///
+ public partial interface INamespacesOperations
+ {
+ ///
+ /// Check the give namespace name availability.
+ ///
+ ///
+ /// Parameters to check availability of the given namespace name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CheckNameAvailabilityMethodWithHttpMessagesAsync(CheckNameAvailability parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists all the available namespaces within the subscription
+ /// irrespective of the resourceGroups.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists all the available namespaces within the ResourceGroup.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Create Azure Relay namespace.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// Parameters supplied to create a Namespace Resource.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, RelayNamespace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes an existing namespace. This operation also removes all
+ /// associated resources under the namespace.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Returns the description for the specified namespace.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or updates a namespace. Once created, this namespace's
+ /// resource manifest is immutable. This operation is idempotent.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// Parameters for updating a namespace resource.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, RelayNamespaceUpdateParameter parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Authorization rules for a namespace.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or Updates an authorization rule for a namespace
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The authorization rule parameters
+ ///
+ ///
+ /// 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> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, AuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes a namespace authorization rule
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Authorization rule for a namespace by name.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Primary and Secondary ConnectionStrings to the namespace
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Regenerates the Primary or Secondary ConnectionStrings to the
+ /// namespace
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// Parameters supplied to regenerate Auth Rule.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string authorizationRuleName, RegenerateKeysParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Create Azure Relay namespace.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// Parameters supplied to create a Namespace Resource.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, RelayNamespace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes an existing namespace. This operation also removes all
+ /// associated resources under the namespace.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists all the available namespaces within the subscription
+ /// irrespective of the resourceGroups.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists all the available namespaces within the ResourceGroup.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Authorization rules for a namespace.
+ ///
+ ///
+ /// 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>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IOperations.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IOperations.cs
new file mode 100644
index 000000000000..869511362f68
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IOperations.cs
@@ -0,0 +1,69 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay
+{
+ using Azure;
+ using Management;
+ using Rest;
+ using Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Operations operations.
+ ///
+ public partial interface IOperations
+ {
+ ///
+ /// Lists all of the available Relay REST API operations.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists all of the available Relay REST API operations.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IRelayManagementClient.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IRelayManagementClient.cs
new file mode 100644
index 000000000000..aa9f642dd609
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IRelayManagementClient.cs
@@ -0,0 +1,96 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay
+{
+ using Azure;
+ using Management;
+ using Rest;
+ using Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+
+ ///
+ /// Use these API to manage Azure Relay resources through Azure Resources
+ /// Manager.
+ ///
+ public partial interface IRelayManagementClient : System.IDisposable
+ {
+ ///
+ /// The base URI of the service.
+ ///
+ System.Uri BaseUri { get; set; }
+
+ ///
+ /// Gets or sets json serialization settings.
+ ///
+ JsonSerializerSettings SerializationSettings { get; }
+
+ ///
+ /// Gets or sets json deserialization settings.
+ ///
+ JsonSerializerSettings DeserializationSettings { get; }
+
+ ///
+ /// Credentials needed for the client to connect to Azure.
+ ///
+ ServiceClientCredentials Credentials { get; }
+
+ ///
+ /// Subscription credentials which uniquely identify Microsoft Azure
+ /// subscription. The subscription ID forms part of the URI for every
+ /// service call.
+ ///
+ string SubscriptionId { get; set; }
+
+ ///
+ /// Client Api Version.
+ ///
+ string ApiVersion { get; }
+
+ ///
+ /// Gets or sets the preferred language for the response.
+ ///
+ string AcceptLanguage { get; set; }
+
+ ///
+ /// Gets or sets the retry timeout in seconds for Long Running
+ /// Operations. Default value is 30.
+ ///
+ int? LongRunningOperationRetryTimeout { get; set; }
+
+ ///
+ /// When set to true a unique x-ms-client-request-id value is generated
+ /// and included in each request. Default is true.
+ ///
+ bool? GenerateClientRequestId { get; set; }
+
+
+ ///
+ /// Gets the IOperations.
+ ///
+ IOperations Operations { get; }
+
+ ///
+ /// Gets the INamespacesOperations.
+ ///
+ INamespacesOperations Namespaces { get; }
+
+ ///
+ /// Gets the IHybridConnectionsOperations.
+ ///
+ IHybridConnectionsOperations HybridConnections { get; }
+
+ ///
+ /// Gets the IWCFRelaysOperations.
+ ///
+ IWCFRelaysOperations WCFRelays { get; }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IWCFRelaysOperations.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IWCFRelaysOperations.cs
new file mode 100644
index 000000000000..c1ebbea09567
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/IWCFRelaysOperations.cs
@@ -0,0 +1,368 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay
+{
+ using Azure;
+ using Management;
+ using Rest;
+ using Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// WCFRelaysOperations operations.
+ ///
+ public partial interface IWCFRelaysOperations
+ {
+ ///
+ /// Lists the WCFRelays within the namespace.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByNamespaceWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or Updates a WCFRelay. This operation is idempotent.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The relay name
+ ///
+ ///
+ /// Parameters supplied to create a WCFRelays.
+ ///
+ ///
+ /// 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 namespaceName, string relayName, WcfRelay parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes a WCFRelays .
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The relay name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string relayName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Returns the description for the specified WCFRelays.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The relay name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string relayName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Authorization rules for a WCFRelays.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The relay name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListAuthorizationRulesWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string relayName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates or Updates an authorization rule for a WCFRelays
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The relay name
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The authorization rule parameters.
+ ///
+ ///
+ /// 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> CreateOrUpdateAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string relayName, string authorizationRuleName, AuthorizationRule parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Deletes a WCFRelays authorization rule
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The relay name
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string relayName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Get authorizationRule for a WCFRelays by name.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The relay name
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetAuthorizationRuleWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string relayName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Primary and Secondary ConnectionStrings to the WCFRelays.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The relay name
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string relayName, string authorizationRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Regenerates the Primary or Secondary ConnectionStrings to the
+ /// WCFRelays
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The relay name
+ ///
+ ///
+ /// The authorizationRule name.
+ ///
+ ///
+ /// Parameters supplied to regenerate Auth Rule.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string namespaceName, string relayName, string authorizationRuleName, RegenerateKeysParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Lists the WCFRelays within the namespace.
+ ///
+ ///
+ /// 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>> ListByNamespaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Authorization rules for a WCFRelays.
+ ///
+ ///
+ /// 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>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/AccessRights.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/AccessRights.cs
new file mode 100644
index 000000000000..6e8a415fbbde
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/AccessRights.cs
@@ -0,0 +1,25 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+
+ ///
+ /// Defines values for AccessRights.
+ ///
+ public static class AccessRights
+ {
+ public const string Manage = "Manage";
+ public const string Send = "Send";
+ public const string Listen = "Listen";
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/AuthorizationRule.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/AuthorizationRule.cs
new file mode 100644
index 000000000000..328527998235
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/AuthorizationRule.cs
@@ -0,0 +1,73 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Rest;
+ using Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Description of a Namespace AuthorizationRules.
+ ///
+ [JsonTransformation]
+ public partial class AuthorizationRule : Resource
+ {
+ ///
+ /// Initializes a new instance of the AuthorizationRule class.
+ ///
+ public AuthorizationRule() { }
+
+ ///
+ /// Initializes a new instance of the AuthorizationRule class.
+ ///
+ /// The rights associated with the rule.
+ /// Resource Id
+ /// Resource name
+ /// Resource type
+ public AuthorizationRule(IList rights, string id = default(string), string name = default(string), string type = default(string))
+ : base(id, name, type)
+ {
+ Rights = rights;
+ }
+
+ ///
+ /// Gets or sets the rights associated with the rule.
+ ///
+ [JsonProperty(PropertyName = "properties.rights")]
+ public IList Rights { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Rights == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Rights");
+ }
+ if (Rights != null)
+ {
+ if (Rights.Count != Rights.Distinct().Count())
+ {
+ throw new ValidationException(ValidationRules.UniqueItems, "Rights");
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/AuthorizationRuleKeys.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/AuthorizationRuleKeys.cs
new file mode 100644
index 000000000000..5f32967b21c8
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/AuthorizationRuleKeys.cs
@@ -0,0 +1,85 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Namespace/Relay Connection String
+ ///
+ public partial class AuthorizationRuleKeys
+ {
+ ///
+ /// Initializes a new instance of the AuthorizationRuleKeys class.
+ ///
+ public AuthorizationRuleKeys() { }
+
+ ///
+ /// Initializes a new instance of the AuthorizationRuleKeys class.
+ ///
+ /// PrimaryConnectionString of
+ /// the created Namespace AuthorizationRule.
+ /// SecondaryConnectionString
+ /// of the created Namespace AuthorizationRule
+ /// A base64-encoded 256-bit primary key for
+ /// signing and validating the SAS token
+ /// A base64-encoded 256-bit secondary key
+ /// for signing and validating the SAS token
+ /// A string that describes the authorization
+ /// rule
+ public AuthorizationRuleKeys(string primaryConnectionString = default(string), string secondaryConnectionString = default(string), string primaryKey = default(string), string secondaryKey = default(string), string keyName = default(string))
+ {
+ PrimaryConnectionString = primaryConnectionString;
+ SecondaryConnectionString = secondaryConnectionString;
+ PrimaryKey = primaryKey;
+ SecondaryKey = secondaryKey;
+ KeyName = keyName;
+ }
+
+ ///
+ /// Gets or sets primaryConnectionString of the created Namespace
+ /// AuthorizationRule.
+ ///
+ [JsonProperty(PropertyName = "primaryConnectionString")]
+ public string PrimaryConnectionString { get; set; }
+
+ ///
+ /// Gets or sets secondaryConnectionString of the created Namespace
+ /// AuthorizationRule
+ ///
+ [JsonProperty(PropertyName = "secondaryConnectionString")]
+ public string SecondaryConnectionString { get; set; }
+
+ ///
+ /// Gets or sets a base64-encoded 256-bit primary key for signing and
+ /// validating the SAS token
+ ///
+ [JsonProperty(PropertyName = "primaryKey")]
+ public string PrimaryKey { get; set; }
+
+ ///
+ /// Gets or sets a base64-encoded 256-bit secondary key for signing and
+ /// validating the SAS token
+ ///
+ [JsonProperty(PropertyName = "secondaryKey")]
+ public string SecondaryKey { get; set; }
+
+ ///
+ /// Gets or sets a string that describes the authorization rule
+ ///
+ [JsonProperty(PropertyName = "keyName")]
+ public string KeyName { get; set; }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/CheckNameAvailability.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/CheckNameAvailability.cs
new file mode 100644
index 000000000000..3df0f7dc1272
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/CheckNameAvailability.cs
@@ -0,0 +1,64 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Description of a Check Name availability request properties.
+ ///
+ public partial class CheckNameAvailability
+ {
+ ///
+ /// Initializes a new instance of the CheckNameAvailability class.
+ ///
+ public CheckNameAvailability() { }
+
+ ///
+ /// Initializes a new instance of the CheckNameAvailability class.
+ ///
+ /// The Name to check the namespce name availability
+ /// and The namespace name can contain only letters, numbers, and
+ /// hyphens. The namespace must start with a letter, and it must end
+ /// with a letter or number.
+ public CheckNameAvailability(string name)
+ {
+ Name = name;
+ }
+
+ ///
+ /// Gets or sets the Name to check the namespce name availability and
+ /// The namespace name can contain only letters, numbers, and hyphens.
+ /// The namespace must start with a letter, and it must end with a
+ /// letter or number.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Name == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Name");
+ }
+ }
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/CheckNameAvailabilityResult.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/CheckNameAvailabilityResult.cs
new file mode 100644
index 000000000000..8ec64b3da192
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/CheckNameAvailabilityResult.cs
@@ -0,0 +1,73 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Description of a Check Name availability request properties.
+ ///
+ public partial class CheckNameAvailabilityResult
+ {
+ ///
+ /// Initializes a new instance of the CheckNameAvailabilityResult
+ /// class.
+ ///
+ public CheckNameAvailabilityResult() { }
+
+ ///
+ /// Initializes a new instance of the CheckNameAvailabilityResult
+ /// class.
+ ///
+ /// Value indicating namespace is
+ /// availability, true if the namespace is available; otherwise,
+ /// false.
+ /// The reason for unavailability of a namespace.
+ /// Possible values include: 'None', 'InvalidName',
+ /// 'SubscriptionIsDisabled', 'NameInUse', 'NameInLockdown',
+ /// 'TooManyNamespaceInCurrentSubscription'
+ /// The detailed info regarding the reason
+ /// associated with the namespace.
+ public CheckNameAvailabilityResult(bool? nameAvailable = default(bool?), UnavailableReason? reason = default(UnavailableReason?), string message = default(string))
+ {
+ NameAvailable = nameAvailable;
+ Reason = reason;
+ Message = message;
+ }
+
+ ///
+ /// Gets or sets value indicating namespace is availability, true if
+ /// the namespace is available; otherwise, false.
+ ///
+ [JsonProperty(PropertyName = "nameAvailable")]
+ public bool? NameAvailable { get; set; }
+
+ ///
+ /// Gets or sets the reason for unavailability of a namespace. Possible
+ /// values include: 'None', 'InvalidName', 'SubscriptionIsDisabled',
+ /// 'NameInUse', 'NameInLockdown',
+ /// 'TooManyNamespaceInCurrentSubscription'
+ ///
+ [JsonProperty(PropertyName = "reason")]
+ public UnavailableReason? Reason { get; set; }
+
+ ///
+ /// Gets the detailed info regarding the reason associated with the
+ /// namespace.
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; protected set; }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/ErrorResponse.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/ErrorResponse.cs
new file mode 100644
index 000000000000..9678754d4844
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/ErrorResponse.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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Error reponse indicates Relay service is not able to process the
+ /// incoming request. The reason is provided in the error message.
+ ///
+ public partial class ErrorResponse
+ {
+ ///
+ /// Initializes a new instance of the ErrorResponse class.
+ ///
+ public ErrorResponse() { }
+
+ ///
+ /// Initializes a new instance of the ErrorResponse class.
+ ///
+ /// Error code.
+ /// Error message indicating why the operation
+ /// failed.
+ public ErrorResponse(string code = default(string), string message = default(string))
+ {
+ Code = code;
+ Message = message;
+ }
+
+ ///
+ /// Gets or sets error code.
+ ///
+ [JsonProperty(PropertyName = "code")]
+ public string Code { get; set; }
+
+ ///
+ /// Gets or sets error message indicating why the operation failed.
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; set; }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/ErrorResponseException.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/ErrorResponseException.cs
new file mode 100644
index 000000000000..de537298069d
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/ErrorResponseException.cs
@@ -0,0 +1,104 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Rest;
+ using System.Runtime;
+ using System.Runtime.Serialization;
+ using System.Security;
+
+ ///
+ /// Exception thrown for an invalid response with ErrorResponse
+ /// information.
+ ///
+#if !PORTABLE
+ [System.Serializable]
+#endif
+ public class ErrorResponseException : RestException
+ {
+ ///
+ /// Gets information about the associated HTTP request.
+ ///
+ public HttpRequestMessageWrapper Request { get; set; }
+
+ ///
+ /// Gets information about the associated HTTP response.
+ ///
+ public HttpResponseMessageWrapper Response { get; set; }
+
+ ///
+ /// Gets or sets the body object.
+ ///
+ public ErrorResponse Body { get; set; }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseException class.
+ ///
+ public ErrorResponseException()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseException class.
+ ///
+ /// The exception message.
+ public ErrorResponseException(string message)
+ : this(message, null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseException class.
+ ///
+ /// The exception message.
+ /// Inner exception.
+ public ErrorResponseException(string message, System.Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+#if !PORTABLE
+ ///
+ /// Initializes a new instance of the ErrorResponseException class.
+ ///
+ /// Serialization info.
+ /// Streaming context.
+ protected ErrorResponseException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+
+ ///
+ /// Serializes content of the exception.
+ ///
+ /// Serialization info.
+ /// Streaming context.
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand, SerializationFormatter = true)]
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData(info, context);
+ if (info == null)
+ {
+ throw new System.ArgumentNullException("info");
+ }
+
+ info.AddValue("Request", Request);
+ info.AddValue("Response", Response);
+ info.AddValue("Body", Body);
+ }
+#endif
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/HybridConnection.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/HybridConnection.cs
new file mode 100644
index 000000000000..c4bbc5851555
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/HybridConnection.cs
@@ -0,0 +1,113 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Rest;
+ using Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Description of HybridConnection Resource.
+ ///
+ [JsonTransformation]
+ public partial class HybridConnection : Resource
+ {
+ ///
+ /// Initializes a new instance of the HybridConnection class.
+ ///
+ public HybridConnection() { }
+
+ ///
+ /// Initializes a new instance of the HybridConnection class.
+ ///
+ /// Resource Id
+ /// Resource name
+ /// Resource type
+ /// The time the HybridConnection was
+ /// created.
+ /// The time the namespace was updated.
+ /// The number of listeners for this
+ /// HybridConnection. min : 1 and max:25 supported
+ /// true if client
+ /// authorization is needed for this HybridConnection; otherwise,
+ /// false.
+ /// usermetadata is a placeholder to store
+ /// user-defined string data for the HybridConnection endpoint.e.g. it
+ /// can be used to store descriptive data, such as list of teams and
+ /// their contact information also user-defined configuration settings
+ /// can be stored.
+ public HybridConnection(string id = default(string), string name = default(string), string type = default(string), System.DateTime? createdAt = default(System.DateTime?), System.DateTime? updatedAt = default(System.DateTime?), int? listenerCount = default(int?), bool? requiresClientAuthorization = default(bool?), string userMetadata = default(string))
+ : base(id, name, type)
+ {
+ CreatedAt = createdAt;
+ UpdatedAt = updatedAt;
+ ListenerCount = listenerCount;
+ RequiresClientAuthorization = requiresClientAuthorization;
+ UserMetadata = userMetadata;
+ }
+
+ ///
+ /// Gets the time the HybridConnection was created.
+ ///
+ [JsonProperty(PropertyName = "properties.createdAt")]
+ public System.DateTime? CreatedAt { get; protected set; }
+
+ ///
+ /// Gets the time the namespace was updated.
+ ///
+ [JsonProperty(PropertyName = "properties.updatedAt")]
+ public System.DateTime? UpdatedAt { get; protected set; }
+
+ ///
+ /// Gets the number of listeners for this HybridConnection. min : 1 and
+ /// max:25 supported
+ ///
+ [JsonProperty(PropertyName = "properties.listenerCount")]
+ public int? ListenerCount { get; protected set; }
+
+ ///
+ /// Gets or sets true if client authorization is needed for this
+ /// HybridConnection; otherwise, false.
+ ///
+ [JsonProperty(PropertyName = "properties.requiresClientAuthorization")]
+ public bool? RequiresClientAuthorization { get; set; }
+
+ ///
+ /// Gets or sets usermetadata is a placeholder to store user-defined
+ /// string data for the HybridConnection endpoint.e.g. it can be used
+ /// to store descriptive data, such as list of teams and their contact
+ /// information also user-defined configuration settings can be stored.
+ ///
+ [JsonProperty(PropertyName = "properties.userMetadata")]
+ public string UserMetadata { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (ListenerCount > 25)
+ {
+ throw new ValidationException(ValidationRules.InclusiveMaximum, "ListenerCount", 25);
+ }
+ if (ListenerCount < 1)
+ {
+ throw new ValidationException(ValidationRules.InclusiveMinimum, "ListenerCount", 1);
+ }
+ }
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Operation.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Operation.cs
new file mode 100644
index 000000000000..3bf423501500
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Operation.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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// A EventHub REST API operation
+ ///
+ public partial class Operation
+ {
+ ///
+ /// Initializes a new instance of the Operation class.
+ ///
+ public Operation() { }
+
+ ///
+ /// Initializes a new instance of the Operation class.
+ ///
+ /// Operation name:
+ /// {provider}/{resource}/{operation}
+ /// The object that represents the
+ /// operation.
+ public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay))
+ {
+ Name = name;
+ Display = display;
+ }
+
+ ///
+ /// Gets operation name: {provider}/{resource}/{operation}
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; protected set; }
+
+ ///
+ /// Gets or sets the object that represents the operation.
+ ///
+ [JsonProperty(PropertyName = "display")]
+ public OperationDisplay Display { get; set; }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/OperationDisplay.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/OperationDisplay.cs
new file mode 100644
index 000000000000..7ad5fda37c47
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/OperationDisplay.cs
@@ -0,0 +1,62 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The object that represents the operation.
+ ///
+ public partial class OperationDisplay
+ {
+ ///
+ /// Initializes a new instance of the OperationDisplay class.
+ ///
+ public OperationDisplay() { }
+
+ ///
+ /// Initializes a new instance of the OperationDisplay class.
+ ///
+ /// Service provider: Microsoft.EventHub
+ /// Resource on which the operation is
+ /// performed: Invoice, etc.
+ /// Operation type: Read, write, delete,
+ /// etc.
+ public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string))
+ {
+ Provider = provider;
+ Resource = resource;
+ Operation = operation;
+ }
+
+ ///
+ /// Gets service provider: Microsoft.EventHub
+ ///
+ [JsonProperty(PropertyName = "provider")]
+ public string Provider { get; protected set; }
+
+ ///
+ /// Gets resource on which the operation is performed: Invoice, etc.
+ ///
+ [JsonProperty(PropertyName = "resource")]
+ public string Resource { get; protected set; }
+
+ ///
+ /// Gets operation type: Read, write, delete, etc.
+ ///
+ [JsonProperty(PropertyName = "operation")]
+ public string Operation { get; protected set; }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Page.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Page.cs
new file mode 100644
index 000000000000..a93374cd37e9
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Page.cs
@@ -0,0 +1,55 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Rest;
+ using Rest.Azure;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+
+ ///
+ /// Defines a page in Azure responses.
+ ///
+ /// Type of the page content items
+ [JsonObject]
+ public class Page : IPage
+ {
+ ///
+ /// Gets the link to the next page.
+ ///
+ [JsonProperty("nextLink")]
+ public string NextPageLink { get; private set; }
+
+ [JsonProperty("value")]
+ private IList Items{ get; set; }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ public IEnumerator GetEnumerator()
+ {
+ return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator();
+ }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/PolicyKey.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/PolicyKey.cs
new file mode 100644
index 000000000000..3a08c4e9d983
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/PolicyKey.cs
@@ -0,0 +1,24 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+
+ ///
+ /// Defines values for PolicyKey.
+ ///
+ public static class PolicyKey
+ {
+ public const string PrimaryKey = "PrimaryKey";
+ public const string SecondaryKey = "SecondaryKey";
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/RegenerateKeysParameters.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/RegenerateKeysParameters.cs
new file mode 100644
index 000000000000..e593d7290847
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/RegenerateKeysParameters.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Parameters supplied to the Regenerate Authorization Rule operation.
+ ///
+ public partial class RegenerateKeysParameters
+ {
+ ///
+ /// Initializes a new instance of the RegenerateKeysParameters class.
+ ///
+ public RegenerateKeysParameters() { }
+
+ ///
+ /// Initializes a new instance of the RegenerateKeysParameters class.
+ ///
+ /// Key that needs to be regenerated. Possible
+ /// values include: 'PrimaryKey', 'SecondaryKey'
+ public RegenerateKeysParameters(string policyKey = default(string))
+ {
+ PolicyKey = policyKey;
+ }
+
+ ///
+ /// Gets or sets key that needs to be regenerated. Possible values
+ /// include: 'PrimaryKey', 'SecondaryKey'
+ ///
+ [JsonProperty(PropertyName = "policyKey")]
+ public string PolicyKey { get; set; }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/RelayNamespace.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/RelayNamespace.cs
new file mode 100644
index 000000000000..8cfe0d0ad82b
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/RelayNamespace.cs
@@ -0,0 +1,115 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Rest;
+ using Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Description of a Namespace resource.
+ ///
+ [JsonTransformation]
+ public partial class RelayNamespace : TrackedResource
+ {
+ ///
+ /// Initializes a new instance of the RelayNamespace class.
+ ///
+ public RelayNamespace()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the RelayNamespace class.
+ ///
+ /// Resource location
+ /// Resource Id
+ /// Resource name
+ /// Resource type
+ /// Resource tags
+ /// Provisioning state of the
+ /// namespace.
+ /// The time the namespace was created.
+ /// The time the namespace was updated.
+ /// Endpoint you can use to perform
+ /// Service Bus operations.
+ /// Identifier for Azure Insights
+ /// metrics
+ public RelayNamespace(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), System.DateTime? createdAt = default(System.DateTime?), System.DateTime? updatedAt = default(System.DateTime?), string serviceBusEndpoint = default(string), string metricId = default(string))
+ : base(location, id, name, type, tags)
+ {
+ ProvisioningState = provisioningState;
+ CreatedAt = createdAt;
+ UpdatedAt = updatedAt;
+ ServiceBusEndpoint = serviceBusEndpoint;
+ MetricId = metricId;
+ }
+ ///
+ /// Static constructor for RelayNamespace class.
+ ///
+ static RelayNamespace()
+ {
+ Sku = new Sku();
+ }
+
+ ///
+ /// Gets provisioning state of the namespace.
+ ///
+ [JsonProperty(PropertyName = "properties.provisioningState")]
+ public string ProvisioningState { get; protected set; }
+
+ ///
+ /// Gets the time the namespace was created.
+ ///
+ [JsonProperty(PropertyName = "properties.createdAt")]
+ public System.DateTime? CreatedAt { get; protected set; }
+
+ ///
+ /// Gets the time the namespace was updated.
+ ///
+ [JsonProperty(PropertyName = "properties.updatedAt")]
+ public System.DateTime? UpdatedAt { get; protected set; }
+
+ ///
+ /// Gets endpoint you can use to perform Service Bus operations.
+ ///
+ [JsonProperty(PropertyName = "properties.serviceBusEndpoint")]
+ public string ServiceBusEndpoint { get; protected set; }
+
+ ///
+ /// Gets identifier for Azure Insights metrics
+ ///
+ [JsonProperty(PropertyName = "properties.metricId")]
+ public string MetricId { get; protected set; }
+
+ ///
+ /// Sku of the Namespace.
+ ///
+ [JsonProperty(PropertyName = "sku")]
+ public static Sku Sku { get; private set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public override void Validate()
+ {
+ base.Validate();
+ }
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/RelayNamespaceUpdateParameter.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/RelayNamespaceUpdateParameter.cs
new file mode 100644
index 000000000000..9ce614fc29c3
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/RelayNamespaceUpdateParameter.cs
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Parameters supplied to the Patch Namespace operation.
+ ///
+ public partial class RelayNamespaceUpdateParameter
+ {
+ ///
+ /// Initializes a new instance of the RelayNamespaceUpdateParameter
+ /// class.
+ ///
+ public RelayNamespaceUpdateParameter()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the RelayNamespaceUpdateParameter
+ /// class.
+ ///
+ /// Resource tags
+ public RelayNamespaceUpdateParameter(IDictionary tags = default(IDictionary))
+ {
+ Tags = tags;
+ }
+ ///
+ /// Static constructor for RelayNamespaceUpdateParameter class.
+ ///
+ static RelayNamespaceUpdateParameter()
+ {
+ Sku = new Sku();
+ }
+
+ ///
+ /// Gets or sets resource tags
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// The sku of the created namespace
+ ///
+ [JsonProperty(PropertyName = "sku")]
+ public static Sku Sku { get; private set; }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Relaytype.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Relaytype.cs
new file mode 100644
index 000000000000..eb29e4a654eb
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Relaytype.cs
@@ -0,0 +1,24 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+
+ ///
+ /// Defines values for Relaytype.
+ ///
+ public static class Relaytype
+ {
+ public const string NetTcp = "NetTcp";
+ public const string Http = "Http";
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Resource.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Resource.cs
new file mode 100644
index 000000000000..460cefd3e0cf
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Resource.cs
@@ -0,0 +1,62 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Rest;
+ using Rest.Azure;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The Resource definition
+ ///
+ public partial class Resource : IResource
+ {
+ ///
+ /// Initializes a new instance of the Resource class.
+ ///
+ public Resource() { }
+
+ ///
+ /// Initializes a new instance of the Resource class.
+ ///
+ /// Resource Id
+ /// Resource name
+ /// Resource type
+ public Resource(string id = default(string), string name = default(string), string type = default(string))
+ {
+ Id = id;
+ Name = name;
+ Type = type;
+ }
+
+ ///
+ /// Gets resource Id
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; protected set; }
+
+ ///
+ /// Gets resource name
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; protected set; }
+
+ ///
+ /// Gets resource type
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; protected set; }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Sku.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Sku.cs
new file mode 100644
index 000000000000..817412b6771a
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/Sku.cs
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Sku of the Namespace.
+ ///
+ public partial class Sku
+ {
+ ///
+ /// Initializes a new instance of the Sku class.
+ ///
+ public Sku() { }
+
+ ///
+ /// Static constructor for Sku class.
+ ///
+ static Sku()
+ {
+ Name = "Standard";
+ Tier = "Standard";
+ }
+
+ ///
+ /// Name of this Sku
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public static string Name { get; private set; }
+
+ ///
+ /// The tier of this particular SKU
+ ///
+ [JsonProperty(PropertyName = "tier")]
+ public static string Tier { get; private set; }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/TrackedResource.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/TrackedResource.cs
new file mode 100644
index 000000000000..33554ff781b2
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/TrackedResource.cs
@@ -0,0 +1,72 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Rest;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Definition of Resource
+ ///
+ public partial class TrackedResource : Resource
+ {
+ ///
+ /// Initializes a new instance of the TrackedResource class.
+ ///
+ public TrackedResource() { }
+
+ ///
+ /// Initializes a new instance of the TrackedResource class.
+ ///
+ /// Resource location
+ /// Resource Id
+ /// Resource name
+ /// Resource type
+ /// Resource tags
+ public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary))
+ : base(id, name, type)
+ {
+ Location = location;
+ Tags = tags;
+ }
+
+ ///
+ /// Gets or sets resource location
+ ///
+ [JsonProperty(PropertyName = "location")]
+ public string Location { get; set; }
+
+ ///
+ /// Gets or sets resource tags
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Location == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Location");
+ }
+ }
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/UnavailableReason.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/UnavailableReason.cs
new file mode 100644
index 000000000000..7c20a557eecf
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/UnavailableReason.cs
@@ -0,0 +1,39 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Converters;
+ using System.Runtime;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Defines values for UnavailableReason.
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum UnavailableReason
+ {
+ [EnumMember(Value = "None")]
+ None,
+ [EnumMember(Value = "InvalidName")]
+ InvalidName,
+ [EnumMember(Value = "SubscriptionIsDisabled")]
+ SubscriptionIsDisabled,
+ [EnumMember(Value = "NameInUse")]
+ NameInUse,
+ [EnumMember(Value = "NameInLockdown")]
+ NameInLockdown,
+ [EnumMember(Value = "TooManyNamespaceInCurrentSubscription")]
+ TooManyNamespaceInCurrentSubscription
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/WcfRelay.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/WcfRelay.cs
new file mode 100644
index 000000000000..8488f6b15441
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/Models/WcfRelay.cs
@@ -0,0 +1,123 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay.Models
+{
+ using Azure;
+ using Management;
+ using Relay;
+ using Rest;
+ using Rest.Serialization;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Description of WcfRelays Resource.
+ ///
+ [JsonTransformation]
+ public partial class WcfRelay : Resource
+ {
+ ///
+ /// Initializes a new instance of the WcfRelay class.
+ ///
+ public WcfRelay() { }
+
+ ///
+ /// Initializes a new instance of the WcfRelay class.
+ ///
+ /// Resource Id
+ /// Resource name
+ /// Resource type
+ /// WCFRelay Type. Possible values include:
+ /// 'NetTcp', 'Http'
+ /// The time the WCFRelay was created.
+ /// The time the namespace was updated.
+ /// The number of listeners for this relay.
+ /// min : 1 and max:25 supported
+ /// true if client
+ /// authorization is needed for this relay; otherwise, false.
+ /// true if transport security
+ /// is needed for this relay; otherwise, false.
+ /// true if the relay is dynamic; otherwise,
+ /// false.
+ /// usermetadata is a placeholder to store
+ /// user-defined string data for the HybridConnection endpoint.e.g. it
+ /// can be used to store descriptive data, such as list of teams and
+ /// their contact information also user-defined configuration settings
+ /// can be stored.
+ public WcfRelay(string id = default(string), string name = default(string), string type = default(string), string relayType = default(string), System.DateTime? createdAt = default(System.DateTime?), System.DateTime? updatedAt = default(System.DateTime?), int? listenerCount = default(int?), bool? requiresClientAuthorization = default(bool?), bool? requiresTransportSecurity = default(bool?), bool? isDynamic = default(bool?), string userMetadata = default(string))
+ : base(id, name, type)
+ {
+ RelayType = relayType;
+ CreatedAt = createdAt;
+ UpdatedAt = updatedAt;
+ ListenerCount = listenerCount;
+ RequiresClientAuthorization = requiresClientAuthorization;
+ RequiresTransportSecurity = requiresTransportSecurity;
+ IsDynamic = isDynamic;
+ UserMetadata = userMetadata;
+ }
+
+ ///
+ /// Gets or sets wCFRelay Type. Possible values include: 'NetTcp',
+ /// 'Http'
+ ///
+ [JsonProperty(PropertyName = "properties.relayType")]
+ public string RelayType { get; set; }
+
+ ///
+ /// Gets the time the WCFRelay was created.
+ ///
+ [JsonProperty(PropertyName = "properties.createdAt")]
+ public System.DateTime? CreatedAt { get; protected set; }
+
+ ///
+ /// Gets the time the namespace was updated.
+ ///
+ [JsonProperty(PropertyName = "properties.updatedAt")]
+ public System.DateTime? UpdatedAt { get; protected set; }
+
+ ///
+ /// Gets the number of listeners for this relay. min : 1 and max:25
+ /// supported
+ ///
+ [JsonProperty(PropertyName = "properties.listenerCount")]
+ public int? ListenerCount { get; protected set; }
+
+ ///
+ /// Gets or sets true if client authorization is needed for this relay;
+ /// otherwise, false.
+ ///
+ [JsonProperty(PropertyName = "properties.requiresClientAuthorization")]
+ public bool? RequiresClientAuthorization { get; set; }
+
+ ///
+ /// Gets or sets true if transport security is needed for this relay;
+ /// otherwise, false.
+ ///
+ [JsonProperty(PropertyName = "properties.requiresTransportSecurity")]
+ public bool? RequiresTransportSecurity { get; set; }
+
+ ///
+ /// Gets true if the relay is dynamic; otherwise, false.
+ ///
+ [JsonProperty(PropertyName = "properties.isDynamic")]
+ public bool? IsDynamic { get; protected set; }
+
+ ///
+ /// Gets or sets usermetadata is a placeholder to store user-defined
+ /// string data for the HybridConnection endpoint.e.g. it can be used
+ /// to store descriptive data, such as list of teams and their contact
+ /// information also user-defined configuration settings can be stored.
+ ///
+ [JsonProperty(PropertyName = "properties.userMetadata")]
+ public string UserMetadata { get; set; }
+
+ }
+}
+
diff --git a/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/NamespacesOperations.cs b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/NamespacesOperations.cs
new file mode 100644
index 000000000000..1a5cadd270e9
--- /dev/null
+++ b/src/ResourceManagement/Relay/Microsoft.Azure.Management.Relay/Generated/NamespacesOperations.cs
@@ -0,0 +1,3438 @@
+// 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 1.0.0.0
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+
+namespace Microsoft.Azure.Management.Relay
+{
+ using Azure;
+ using Management;
+ using Rest;
+ using 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;
+
+ ///
+ /// NamespacesOperations operations.
+ ///
+ internal partial class NamespacesOperations : IServiceOperations, INamespacesOperations
+ {
+ ///
+ /// Initializes a new instance of the NamespacesOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal NamespacesOperations(RelayManagementClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the RelayManagementClient
+ ///
+ public RelayManagementClient Client { get; private set; }
+
+ ///
+ /// Check the give namespace name availability.
+ ///
+ ///
+ /// Parameters to check availability of the given namespace name
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CheckNameAvailabilityMethodWithHttpMessagesAsync(CheckNameAvailability parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailabilityMethod", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Relay/CheckNameAvailability").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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Lists all the available namespaces within the subscription irrespective of
+ /// the resourceGroups.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Relay/Namespaces").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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.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 the available namespaces within the ResourceGroup.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/Namespaces").ToString();
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _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 System.Net.Http.HttpRequestMessage();
+ System.Net.Http.HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new System.Net.Http.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;
+ }
+
+ ///
+ /// Create Azure Relay namespace.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// Parameters supplied to create a Namespace Resource.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string namespaceName, RelayNamespace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send Request
+ AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, namespaceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Deletes an existing namespace. This operation also removes all associated
+ /// resources under the namespace.
+ ///
+ ///
+ /// Name of the Resource group within the Azure subscription.
+ ///
+ ///
+ /// The Namespace Name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary