< Summary

Class:Azure.ResourceManager.EventHubs.EventHubsRestOperations
Assembly:Azure.ResourceManager.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\EventHubsRestOperations.cs
Covered lines:434
Uncovered lines:199
Coverable lines:633
Total lines:1378
Line coverage:68.5% (434 of 633)
Covered branches:120
Total branches:280
Branch coverage:42.8% (120 of 280)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateListAuthorizationRulesRequest(...)-100%100%
ListAuthorizationRulesAsync()-70.59%50%
ListAuthorizationRules(...)-70.59%50%
CreateCreateOrUpdateAuthorizationRuleRequest(...)-100%100%
CreateOrUpdateAuthorizationRuleAsync()-66.67%50%
CreateOrUpdateAuthorizationRule(...)-66.67%50%
CreateGetAuthorizationRuleRequest(...)-100%100%
GetAuthorizationRuleAsync()-68.42%50%
GetAuthorizationRule(...)-68.42%50%
CreateDeleteAuthorizationRuleRequest(...)-100%100%
DeleteAuthorizationRuleAsync()-64.29%50%
DeleteAuthorizationRule(...)-64.29%50%
CreateListKeysRequest(...)-100%100%
ListKeysAsync()-68.42%50%
ListKeys(...)-68.42%50%
CreateRegenerateKeysRequest(...)-100%100%
RegenerateKeysAsync()-66.67%50%
RegenerateKeys(...)-66.67%50%
CreateListByNamespaceRequest(...)-100%100%
ListByNamespaceAsync()-73.33%50%
ListByNamespace(...)-73.33%50%
CreateCreateOrUpdateRequest(...)-100%100%
CreateOrUpdateAsync()-68.42%50%
CreateOrUpdate(...)-68.42%50%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-66.67%50%
Delete(...)-66.67%50%
CreateGetRequest(...)-100%100%
GetAsync()-70.59%50%
Get(...)-70.59%50%
CreateListAuthorizationRulesNextPageRequest(...)-0%100%
ListAuthorizationRulesNextPageAsync()-0%0%
ListAuthorizationRulesNextPage(...)-0%0%
CreateListByNamespaceNextPageRequest(...)-0%100%
ListByNamespaceNextPageAsync()-0%0%
ListByNamespaceNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\EventHubsRestOperations.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Text.Json;
 10using System.Threading;
 11using System.Threading.Tasks;
 12using Azure;
 13using Azure.Core;
 14using Azure.Core.Pipeline;
 15using Azure.ResourceManager.EventHubs.Models;
 16
 17namespace Azure.ResourceManager.EventHubs
 18{
 19    internal partial class EventHubsRestOperations
 20    {
 21        private string subscriptionId;
 22        private Uri endpoint;
 23        private ClientDiagnostics _clientDiagnostics;
 24        private HttpPipeline _pipeline;
 25
 26        /// <summary> Initializes a new instance of EventHubsRestOperations. </summary>
 27        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 28        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 29        /// <param name="subscriptionId"> Subscription credentials that uniquely identify a Microsoft Azure subscription
 30        /// <param name="endpoint"> server parameter. </param>
 31        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 4832        public EventHubsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId
 33        {
 4834            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 4838            endpoint ??= new Uri("https://management.azure.com");
 39
 4840            this.subscriptionId = subscriptionId;
 4841            this.endpoint = endpoint;
 4842            _clientDiagnostics = clientDiagnostics;
 4843            _pipeline = pipeline;
 4844        }
 45
 46        internal HttpMessage CreateListAuthorizationRulesRequest(string resourceGroupName, string namespaceName, string 
 47        {
 848            var message = _pipeline.CreateMessage();
 849            var request = message.Request;
 850            request.Method = RequestMethod.Get;
 851            var uri = new RawRequestUriBuilder();
 852            uri.Reset(endpoint);
 853            uri.AppendPath("/subscriptions/", false);
 854            uri.AppendPath(subscriptionId, true);
 855            uri.AppendPath("/resourceGroups/", false);
 856            uri.AppendPath(resourceGroupName, true);
 857            uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false);
 858            uri.AppendPath(namespaceName, true);
 859            uri.AppendPath("/eventhubs/", false);
 860            uri.AppendPath(eventHubName, true);
 861            uri.AppendPath("/authorizationRules", false);
 862            uri.AppendQuery("api-version", "2017-04-01", true);
 863            request.Uri = uri;
 864            return message;
 65        }
 66
 67        /// <summary> Gets the authorization rules for an Event Hub. </summary>
 68        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 69        /// <param name="namespaceName"> The Namespace name. </param>
 70        /// <param name="eventHubName"> The Event Hub name. </param>
 71        /// <param name="cancellationToken"> The cancellation token to use. </param>
 72        public async Task<Response<AuthorizationRuleListResult>> ListAuthorizationRulesAsync(string resourceGroupName, s
 73        {
 474            if (resourceGroupName == null)
 75            {
 076                throw new ArgumentNullException(nameof(resourceGroupName));
 77            }
 478            if (namespaceName == null)
 79            {
 080                throw new ArgumentNullException(nameof(namespaceName));
 81            }
 482            if (eventHubName == null)
 83            {
 084                throw new ArgumentNullException(nameof(eventHubName));
 85            }
 86
 487            using var message = CreateListAuthorizationRulesRequest(resourceGroupName, namespaceName, eventHubName);
 488            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 489            switch (message.Response.Status)
 90            {
 91                case 200:
 92                    {
 493                        AuthorizationRuleListResult value = default;
 494                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 495                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 96                        {
 097                            value = null;
 98                        }
 99                        else
 100                        {
 4101                            value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem
 102                        }
 4103                        return Response.FromValue(value, message.Response);
 104                    }
 105                default:
 0106                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 107            }
 4108        }
 109
 110        /// <summary> Gets the authorization rules for an Event Hub. </summary>
 111        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 112        /// <param name="namespaceName"> The Namespace name. </param>
 113        /// <param name="eventHubName"> The Event Hub name. </param>
 114        /// <param name="cancellationToken"> The cancellation token to use. </param>
 115        public Response<AuthorizationRuleListResult> ListAuthorizationRules(string resourceGroupName, string namespaceNa
 116        {
 4117            if (resourceGroupName == null)
 118            {
 0119                throw new ArgumentNullException(nameof(resourceGroupName));
 120            }
 4121            if (namespaceName == null)
 122            {
 0123                throw new ArgumentNullException(nameof(namespaceName));
 124            }
 4125            if (eventHubName == null)
 126            {
 0127                throw new ArgumentNullException(nameof(eventHubName));
 128            }
 129
 4130            using var message = CreateListAuthorizationRulesRequest(resourceGroupName, namespaceName, eventHubName);
 4131            _pipeline.Send(message, cancellationToken);
 4132            switch (message.Response.Status)
 133            {
 134                case 200:
 135                    {
 4136                        AuthorizationRuleListResult value = default;
 4137                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4138                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 139                        {
 0140                            value = null;
 141                        }
 142                        else
 143                        {
 4144                            value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem
 145                        }
 4146                        return Response.FromValue(value, message.Response);
 147                    }
 148                default:
 0149                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 150            }
 4151        }
 152
 153        internal HttpMessage CreateCreateOrUpdateAuthorizationRuleRequest(string resourceGroupName, string namespaceName
 154        {
 16155            var message = _pipeline.CreateMessage();
 16156            var request = message.Request;
 16157            request.Method = RequestMethod.Put;
 16158            var uri = new RawRequestUriBuilder();
 16159            uri.Reset(endpoint);
 16160            uri.AppendPath("/subscriptions/", false);
 16161            uri.AppendPath(subscriptionId, true);
 16162            uri.AppendPath("/resourceGroups/", false);
 16163            uri.AppendPath(resourceGroupName, true);
 16164            uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false);
 16165            uri.AppendPath(namespaceName, true);
 16166            uri.AppendPath("/eventhubs/", false);
 16167            uri.AppendPath(eventHubName, true);
 16168            uri.AppendPath("/authorizationRules/", false);
 16169            uri.AppendPath(authorizationRuleName, true);
 16170            uri.AppendQuery("api-version", "2017-04-01", true);
 16171            request.Uri = uri;
 16172            request.Headers.Add("Content-Type", "application/json");
 16173            var content = new Utf8JsonRequestContent();
 16174            content.JsonWriter.WriteObjectValue(parameters);
 16175            request.Content = content;
 16176            return message;
 177        }
 178
 179        /// <summary> Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the Author
 180        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 181        /// <param name="namespaceName"> The Namespace name. </param>
 182        /// <param name="eventHubName"> The Event Hub name. </param>
 183        /// <param name="authorizationRuleName"> The authorization rule name. </param>
 184        /// <param name="parameters"> The shared access AuthorizationRule. </param>
 185        /// <param name="cancellationToken"> The cancellation token to use. </param>
 186        public async Task<Response<AuthorizationRule>> CreateOrUpdateAuthorizationRuleAsync(string resourceGroupName, st
 187        {
 8188            if (resourceGroupName == null)
 189            {
 0190                throw new ArgumentNullException(nameof(resourceGroupName));
 191            }
 8192            if (namespaceName == null)
 193            {
 0194                throw new ArgumentNullException(nameof(namespaceName));
 195            }
 8196            if (eventHubName == null)
 197            {
 0198                throw new ArgumentNullException(nameof(eventHubName));
 199            }
 8200            if (authorizationRuleName == null)
 201            {
 0202                throw new ArgumentNullException(nameof(authorizationRuleName));
 203            }
 8204            if (parameters == null)
 205            {
 0206                throw new ArgumentNullException(nameof(parameters));
 207            }
 208
 8209            using var message = CreateCreateOrUpdateAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubN
 8210            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 8211            switch (message.Response.Status)
 212            {
 213                case 200:
 214                    {
 8215                        AuthorizationRule value = default;
 8216                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 8217                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 218                        {
 0219                            value = null;
 220                        }
 221                        else
 222                        {
 8223                            value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement);
 224                        }
 8225                        return Response.FromValue(value, message.Response);
 226                    }
 227                default:
 0228                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 229            }
 8230        }
 231
 232        /// <summary> Creates or updates an AuthorizationRule for the specified Event Hub. Creation/update of the Author
 233        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 234        /// <param name="namespaceName"> The Namespace name. </param>
 235        /// <param name="eventHubName"> The Event Hub name. </param>
 236        /// <param name="authorizationRuleName"> The authorization rule name. </param>
 237        /// <param name="parameters"> The shared access AuthorizationRule. </param>
 238        /// <param name="cancellationToken"> The cancellation token to use. </param>
 239        public Response<AuthorizationRule> CreateOrUpdateAuthorizationRule(string resourceGroupName, string namespaceNam
 240        {
 8241            if (resourceGroupName == null)
 242            {
 0243                throw new ArgumentNullException(nameof(resourceGroupName));
 244            }
 8245            if (namespaceName == null)
 246            {
 0247                throw new ArgumentNullException(nameof(namespaceName));
 248            }
 8249            if (eventHubName == null)
 250            {
 0251                throw new ArgumentNullException(nameof(eventHubName));
 252            }
 8253            if (authorizationRuleName == null)
 254            {
 0255                throw new ArgumentNullException(nameof(authorizationRuleName));
 256            }
 8257            if (parameters == null)
 258            {
 0259                throw new ArgumentNullException(nameof(parameters));
 260            }
 261
 8262            using var message = CreateCreateOrUpdateAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubN
 8263            _pipeline.Send(message, cancellationToken);
 8264            switch (message.Response.Status)
 265            {
 266                case 200:
 267                    {
 8268                        AuthorizationRule value = default;
 8269                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 8270                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 271                        {
 0272                            value = null;
 273                        }
 274                        else
 275                        {
 8276                            value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement);
 277                        }
 8278                        return Response.FromValue(value, message.Response);
 279                    }
 280                default:
 0281                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 282            }
 8283        }
 284
 285        internal HttpMessage CreateGetAuthorizationRuleRequest(string resourceGroupName, string namespaceName, string ev
 286        {
 16287            var message = _pipeline.CreateMessage();
 16288            var request = message.Request;
 16289            request.Method = RequestMethod.Get;
 16290            var uri = new RawRequestUriBuilder();
 16291            uri.Reset(endpoint);
 16292            uri.AppendPath("/subscriptions/", false);
 16293            uri.AppendPath(subscriptionId, true);
 16294            uri.AppendPath("/resourceGroups/", false);
 16295            uri.AppendPath(resourceGroupName, true);
 16296            uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false);
 16297            uri.AppendPath(namespaceName, true);
 16298            uri.AppendPath("/eventhubs/", false);
 16299            uri.AppendPath(eventHubName, true);
 16300            uri.AppendPath("/authorizationRules/", false);
 16301            uri.AppendPath(authorizationRuleName, true);
 16302            uri.AppendQuery("api-version", "2017-04-01", true);
 16303            request.Uri = uri;
 16304            return message;
 305        }
 306
 307        /// <summary> Gets an AuthorizationRule for an Event Hub by rule name. </summary>
 308        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 309        /// <param name="namespaceName"> The Namespace name. </param>
 310        /// <param name="eventHubName"> The Event Hub name. </param>
 311        /// <param name="authorizationRuleName"> The authorization rule name. </param>
 312        /// <param name="cancellationToken"> The cancellation token to use. </param>
 313        public async Task<Response<AuthorizationRule>> GetAuthorizationRuleAsync(string resourceGroupName, string namesp
 314        {
 8315            if (resourceGroupName == null)
 316            {
 0317                throw new ArgumentNullException(nameof(resourceGroupName));
 318            }
 8319            if (namespaceName == null)
 320            {
 0321                throw new ArgumentNullException(nameof(namespaceName));
 322            }
 8323            if (eventHubName == null)
 324            {
 0325                throw new ArgumentNullException(nameof(eventHubName));
 326            }
 8327            if (authorizationRuleName == null)
 328            {
 0329                throw new ArgumentNullException(nameof(authorizationRuleName));
 330            }
 331
 8332            using var message = CreateGetAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubName, author
 8333            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 8334            switch (message.Response.Status)
 335            {
 336                case 200:
 337                    {
 8338                        AuthorizationRule value = default;
 8339                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 8340                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 341                        {
 0342                            value = null;
 343                        }
 344                        else
 345                        {
 8346                            value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement);
 347                        }
 8348                        return Response.FromValue(value, message.Response);
 349                    }
 350                default:
 0351                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 352            }
 8353        }
 354
 355        /// <summary> Gets an AuthorizationRule for an Event Hub by rule name. </summary>
 356        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 357        /// <param name="namespaceName"> The Namespace name. </param>
 358        /// <param name="eventHubName"> The Event Hub name. </param>
 359        /// <param name="authorizationRuleName"> The authorization rule name. </param>
 360        /// <param name="cancellationToken"> The cancellation token to use. </param>
 361        public Response<AuthorizationRule> GetAuthorizationRule(string resourceGroupName, string namespaceName, string e
 362        {
 8363            if (resourceGroupName == null)
 364            {
 0365                throw new ArgumentNullException(nameof(resourceGroupName));
 366            }
 8367            if (namespaceName == null)
 368            {
 0369                throw new ArgumentNullException(nameof(namespaceName));
 370            }
 8371            if (eventHubName == null)
 372            {
 0373                throw new ArgumentNullException(nameof(eventHubName));
 374            }
 8375            if (authorizationRuleName == null)
 376            {
 0377                throw new ArgumentNullException(nameof(authorizationRuleName));
 378            }
 379
 8380            using var message = CreateGetAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubName, author
 8381            _pipeline.Send(message, cancellationToken);
 8382            switch (message.Response.Status)
 383            {
 384                case 200:
 385                    {
 8386                        AuthorizationRule value = default;
 8387                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 8388                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 389                        {
 0390                            value = null;
 391                        }
 392                        else
 393                        {
 8394                            value = AuthorizationRule.DeserializeAuthorizationRule(document.RootElement);
 395                        }
 8396                        return Response.FromValue(value, message.Response);
 397                    }
 398                default:
 0399                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 400            }
 8401        }
 402
 403        internal HttpMessage CreateDeleteAuthorizationRuleRequest(string resourceGroupName, string namespaceName, string
 404        {
 8405            var message = _pipeline.CreateMessage();
 8406            var request = message.Request;
 8407            request.Method = RequestMethod.Delete;
 8408            var uri = new RawRequestUriBuilder();
 8409            uri.Reset(endpoint);
 8410            uri.AppendPath("/subscriptions/", false);
 8411            uri.AppendPath(subscriptionId, true);
 8412            uri.AppendPath("/resourceGroups/", false);
 8413            uri.AppendPath(resourceGroupName, true);
 8414            uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false);
 8415            uri.AppendPath(namespaceName, true);
 8416            uri.AppendPath("/eventhubs/", false);
 8417            uri.AppendPath(eventHubName, true);
 8418            uri.AppendPath("/authorizationRules/", false);
 8419            uri.AppendPath(authorizationRuleName, true);
 8420            uri.AppendQuery("api-version", "2017-04-01", true);
 8421            request.Uri = uri;
 8422            return message;
 423        }
 424
 425        /// <summary> Deletes an Event Hub AuthorizationRule. </summary>
 426        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 427        /// <param name="namespaceName"> The Namespace name. </param>
 428        /// <param name="eventHubName"> The Event Hub name. </param>
 429        /// <param name="authorizationRuleName"> The authorization rule name. </param>
 430        /// <param name="cancellationToken"> The cancellation token to use. </param>
 431        public async Task<Response> DeleteAuthorizationRuleAsync(string resourceGroupName, string namespaceName, string 
 432        {
 4433            if (resourceGroupName == null)
 434            {
 0435                throw new ArgumentNullException(nameof(resourceGroupName));
 436            }
 4437            if (namespaceName == null)
 438            {
 0439                throw new ArgumentNullException(nameof(namespaceName));
 440            }
 4441            if (eventHubName == null)
 442            {
 0443                throw new ArgumentNullException(nameof(eventHubName));
 444            }
 4445            if (authorizationRuleName == null)
 446            {
 0447                throw new ArgumentNullException(nameof(authorizationRuleName));
 448            }
 449
 4450            using var message = CreateDeleteAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubName, aut
 4451            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4452            switch (message.Response.Status)
 453            {
 454                case 200:
 455                case 204:
 4456                    return message.Response;
 457                default:
 0458                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 459            }
 4460        }
 461
 462        /// <summary> Deletes an Event Hub AuthorizationRule. </summary>
 463        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 464        /// <param name="namespaceName"> The Namespace name. </param>
 465        /// <param name="eventHubName"> The Event Hub name. </param>
 466        /// <param name="authorizationRuleName"> The authorization rule name. </param>
 467        /// <param name="cancellationToken"> The cancellation token to use. </param>
 468        public Response DeleteAuthorizationRule(string resourceGroupName, string namespaceName, string eventHubName, str
 469        {
 4470            if (resourceGroupName == null)
 471            {
 0472                throw new ArgumentNullException(nameof(resourceGroupName));
 473            }
 4474            if (namespaceName == null)
 475            {
 0476                throw new ArgumentNullException(nameof(namespaceName));
 477            }
 4478            if (eventHubName == null)
 479            {
 0480                throw new ArgumentNullException(nameof(eventHubName));
 481            }
 4482            if (authorizationRuleName == null)
 483            {
 0484                throw new ArgumentNullException(nameof(authorizationRuleName));
 485            }
 486
 4487            using var message = CreateDeleteAuthorizationRuleRequest(resourceGroupName, namespaceName, eventHubName, aut
 4488            _pipeline.Send(message, cancellationToken);
 4489            switch (message.Response.Status)
 490            {
 491                case 200:
 492                case 204:
 4493                    return message.Response;
 494                default:
 0495                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 496            }
 4497        }
 498
 499        internal HttpMessage CreateListKeysRequest(string resourceGroupName, string namespaceName, string eventHubName, 
 500        {
 8501            var message = _pipeline.CreateMessage();
 8502            var request = message.Request;
 8503            request.Method = RequestMethod.Post;
 8504            var uri = new RawRequestUriBuilder();
 8505            uri.Reset(endpoint);
 8506            uri.AppendPath("/subscriptions/", false);
 8507            uri.AppendPath(subscriptionId, true);
 8508            uri.AppendPath("/resourceGroups/", false);
 8509            uri.AppendPath(resourceGroupName, true);
 8510            uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false);
 8511            uri.AppendPath(namespaceName, true);
 8512            uri.AppendPath("/eventhubs/", false);
 8513            uri.AppendPath(eventHubName, true);
 8514            uri.AppendPath("/authorizationRules/", false);
 8515            uri.AppendPath(authorizationRuleName, true);
 8516            uri.AppendPath("/listKeys", false);
 8517            uri.AppendQuery("api-version", "2017-04-01", true);
 8518            request.Uri = uri;
 8519            return message;
 520        }
 521
 522        /// <summary> Gets the ACS and SAS connection strings for the Event Hub. </summary>
 523        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 524        /// <param name="namespaceName"> The Namespace name. </param>
 525        /// <param name="eventHubName"> The Event Hub name. </param>
 526        /// <param name="authorizationRuleName"> The authorization rule name. </param>
 527        /// <param name="cancellationToken"> The cancellation token to use. </param>
 528        public async Task<Response<AccessKeys>> ListKeysAsync(string resourceGroupName, string namespaceName, string eve
 529        {
 4530            if (resourceGroupName == null)
 531            {
 0532                throw new ArgumentNullException(nameof(resourceGroupName));
 533            }
 4534            if (namespaceName == null)
 535            {
 0536                throw new ArgumentNullException(nameof(namespaceName));
 537            }
 4538            if (eventHubName == null)
 539            {
 0540                throw new ArgumentNullException(nameof(eventHubName));
 541            }
 4542            if (authorizationRuleName == null)
 543            {
 0544                throw new ArgumentNullException(nameof(authorizationRuleName));
 545            }
 546
 4547            using var message = CreateListKeysRequest(resourceGroupName, namespaceName, eventHubName, authorizationRuleN
 4548            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4549            switch (message.Response.Status)
 550            {
 551                case 200:
 552                    {
 4553                        AccessKeys value = default;
 4554                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4555                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 556                        {
 0557                            value = null;
 558                        }
 559                        else
 560                        {
 4561                            value = AccessKeys.DeserializeAccessKeys(document.RootElement);
 562                        }
 4563                        return Response.FromValue(value, message.Response);
 564                    }
 565                default:
 0566                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 567            }
 4568        }
 569
 570        /// <summary> Gets the ACS and SAS connection strings for the Event Hub. </summary>
 571        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 572        /// <param name="namespaceName"> The Namespace name. </param>
 573        /// <param name="eventHubName"> The Event Hub name. </param>
 574        /// <param name="authorizationRuleName"> The authorization rule name. </param>
 575        /// <param name="cancellationToken"> The cancellation token to use. </param>
 576        public Response<AccessKeys> ListKeys(string resourceGroupName, string namespaceName, string eventHubName, string
 577        {
 4578            if (resourceGroupName == null)
 579            {
 0580                throw new ArgumentNullException(nameof(resourceGroupName));
 581            }
 4582            if (namespaceName == null)
 583            {
 0584                throw new ArgumentNullException(nameof(namespaceName));
 585            }
 4586            if (eventHubName == null)
 587            {
 0588                throw new ArgumentNullException(nameof(eventHubName));
 589            }
 4590            if (authorizationRuleName == null)
 591            {
 0592                throw new ArgumentNullException(nameof(authorizationRuleName));
 593            }
 594
 4595            using var message = CreateListKeysRequest(resourceGroupName, namespaceName, eventHubName, authorizationRuleN
 4596            _pipeline.Send(message, cancellationToken);
 4597            switch (message.Response.Status)
 598            {
 599                case 200:
 600                    {
 4601                        AccessKeys value = default;
 4602                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4603                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 604                        {
 0605                            value = null;
 606                        }
 607                        else
 608                        {
 4609                            value = AccessKeys.DeserializeAccessKeys(document.RootElement);
 610                        }
 4611                        return Response.FromValue(value, message.Response);
 612                    }
 613                default:
 0614                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 615            }
 4616        }
 617
 618        internal HttpMessage CreateRegenerateKeysRequest(string resourceGroupName, string namespaceName, string eventHub
 619        {
 16620            var message = _pipeline.CreateMessage();
 16621            var request = message.Request;
 16622            request.Method = RequestMethod.Post;
 16623            var uri = new RawRequestUriBuilder();
 16624            uri.Reset(endpoint);
 16625            uri.AppendPath("/subscriptions/", false);
 16626            uri.AppendPath(subscriptionId, true);
 16627            uri.AppendPath("/resourceGroups/", false);
 16628            uri.AppendPath(resourceGroupName, true);
 16629            uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false);
 16630            uri.AppendPath(namespaceName, true);
 16631            uri.AppendPath("/eventhubs/", false);
 16632            uri.AppendPath(eventHubName, true);
 16633            uri.AppendPath("/authorizationRules/", false);
 16634            uri.AppendPath(authorizationRuleName, true);
 16635            uri.AppendPath("/regenerateKeys", false);
 16636            uri.AppendQuery("api-version", "2017-04-01", true);
 16637            request.Uri = uri;
 16638            request.Headers.Add("Content-Type", "application/json");
 16639            var content = new Utf8JsonRequestContent();
 16640            content.JsonWriter.WriteObjectValue(parameters);
 16641            request.Content = content;
 16642            return message;
 643        }
 644
 645        /// <summary> Regenerates the ACS and SAS connection strings for the Event Hub. </summary>
 646        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 647        /// <param name="namespaceName"> The Namespace name. </param>
 648        /// <param name="eventHubName"> The Event Hub name. </param>
 649        /// <param name="authorizationRuleName"> The authorization rule name. </param>
 650        /// <param name="parameters"> Parameters supplied to regenerate the AuthorizationRule Keys (PrimaryKey/Secondary
 651        /// <param name="cancellationToken"> The cancellation token to use. </param>
 652        public async Task<Response<AccessKeys>> RegenerateKeysAsync(string resourceGroupName, string namespaceName, stri
 653        {
 8654            if (resourceGroupName == null)
 655            {
 0656                throw new ArgumentNullException(nameof(resourceGroupName));
 657            }
 8658            if (namespaceName == null)
 659            {
 0660                throw new ArgumentNullException(nameof(namespaceName));
 661            }
 8662            if (eventHubName == null)
 663            {
 0664                throw new ArgumentNullException(nameof(eventHubName));
 665            }
 8666            if (authorizationRuleName == null)
 667            {
 0668                throw new ArgumentNullException(nameof(authorizationRuleName));
 669            }
 8670            if (parameters == null)
 671            {
 0672                throw new ArgumentNullException(nameof(parameters));
 673            }
 674
 8675            using var message = CreateRegenerateKeysRequest(resourceGroupName, namespaceName, eventHubName, authorizatio
 8676            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 8677            switch (message.Response.Status)
 678            {
 679                case 200:
 680                    {
 8681                        AccessKeys value = default;
 8682                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 8683                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 684                        {
 0685                            value = null;
 686                        }
 687                        else
 688                        {
 8689                            value = AccessKeys.DeserializeAccessKeys(document.RootElement);
 690                        }
 8691                        return Response.FromValue(value, message.Response);
 692                    }
 693                default:
 0694                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 695            }
 8696        }
 697
 698        /// <summary> Regenerates the ACS and SAS connection strings for the Event Hub. </summary>
 699        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 700        /// <param name="namespaceName"> The Namespace name. </param>
 701        /// <param name="eventHubName"> The Event Hub name. </param>
 702        /// <param name="authorizationRuleName"> The authorization rule name. </param>
 703        /// <param name="parameters"> Parameters supplied to regenerate the AuthorizationRule Keys (PrimaryKey/Secondary
 704        /// <param name="cancellationToken"> The cancellation token to use. </param>
 705        public Response<AccessKeys> RegenerateKeys(string resourceGroupName, string namespaceName, string eventHubName, 
 706        {
 8707            if (resourceGroupName == null)
 708            {
 0709                throw new ArgumentNullException(nameof(resourceGroupName));
 710            }
 8711            if (namespaceName == null)
 712            {
 0713                throw new ArgumentNullException(nameof(namespaceName));
 714            }
 8715            if (eventHubName == null)
 716            {
 0717                throw new ArgumentNullException(nameof(eventHubName));
 718            }
 8719            if (authorizationRuleName == null)
 720            {
 0721                throw new ArgumentNullException(nameof(authorizationRuleName));
 722            }
 8723            if (parameters == null)
 724            {
 0725                throw new ArgumentNullException(nameof(parameters));
 726            }
 727
 8728            using var message = CreateRegenerateKeysRequest(resourceGroupName, namespaceName, eventHubName, authorizatio
 8729            _pipeline.Send(message, cancellationToken);
 8730            switch (message.Response.Status)
 731            {
 732                case 200:
 733                    {
 8734                        AccessKeys value = default;
 8735                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 8736                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 737                        {
 0738                            value = null;
 739                        }
 740                        else
 741                        {
 8742                            value = AccessKeys.DeserializeAccessKeys(document.RootElement);
 743                        }
 8744                        return Response.FromValue(value, message.Response);
 745                    }
 746                default:
 0747                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 748            }
 8749        }
 750
 751        internal HttpMessage CreateListByNamespaceRequest(string resourceGroupName, string namespaceName, int? skip, int
 752        {
 12753            var message = _pipeline.CreateMessage();
 12754            var request = message.Request;
 12755            request.Method = RequestMethod.Get;
 12756            var uri = new RawRequestUriBuilder();
 12757            uri.Reset(endpoint);
 12758            uri.AppendPath("/subscriptions/", false);
 12759            uri.AppendPath(subscriptionId, true);
 12760            uri.AppendPath("/resourceGroups/", false);
 12761            uri.AppendPath(resourceGroupName, true);
 12762            uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false);
 12763            uri.AppendPath(namespaceName, true);
 12764            uri.AppendPath("/eventhubs", false);
 12765            uri.AppendQuery("api-version", "2017-04-01", true);
 12766            if (skip != null)
 767            {
 4768                uri.AppendQuery("$skip", skip.Value, true);
 769            }
 12770            if (top != null)
 771            {
 4772                uri.AppendQuery("$top", top.Value, true);
 773            }
 12774            request.Uri = uri;
 12775            return message;
 776        }
 777
 778        /// <summary> Gets all the Event Hubs in a Namespace. </summary>
 779        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 780        /// <param name="namespaceName"> The Namespace name. </param>
 781        /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo
 782        /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param>
 783        /// <param name="cancellationToken"> The cancellation token to use. </param>
 784        public async Task<Response<EventHubListResult>> ListByNamespaceAsync(string resourceGroupName, string namespaceN
 785        {
 6786            if (resourceGroupName == null)
 787            {
 0788                throw new ArgumentNullException(nameof(resourceGroupName));
 789            }
 6790            if (namespaceName == null)
 791            {
 0792                throw new ArgumentNullException(nameof(namespaceName));
 793            }
 794
 6795            using var message = CreateListByNamespaceRequest(resourceGroupName, namespaceName, skip, top);
 6796            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6797            switch (message.Response.Status)
 798            {
 799                case 200:
 800                    {
 6801                        EventHubListResult value = default;
 6802                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 6803                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 804                        {
 0805                            value = null;
 806                        }
 807                        else
 808                        {
 6809                            value = EventHubListResult.DeserializeEventHubListResult(document.RootElement);
 810                        }
 6811                        return Response.FromValue(value, message.Response);
 812                    }
 813                default:
 0814                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 815            }
 6816        }
 817
 818        /// <summary> Gets all the Event Hubs in a Namespace. </summary>
 819        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 820        /// <param name="namespaceName"> The Namespace name. </param>
 821        /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo
 822        /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param>
 823        /// <param name="cancellationToken"> The cancellation token to use. </param>
 824        public Response<EventHubListResult> ListByNamespace(string resourceGroupName, string namespaceName, int? skip = 
 825        {
 6826            if (resourceGroupName == null)
 827            {
 0828                throw new ArgumentNullException(nameof(resourceGroupName));
 829            }
 6830            if (namespaceName == null)
 831            {
 0832                throw new ArgumentNullException(nameof(namespaceName));
 833            }
 834
 6835            using var message = CreateListByNamespaceRequest(resourceGroupName, namespaceName, skip, top);
 6836            _pipeline.Send(message, cancellationToken);
 6837            switch (message.Response.Status)
 838            {
 839                case 200:
 840                    {
 6841                        EventHubListResult value = default;
 6842                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6843                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 844                        {
 0845                            value = null;
 846                        }
 847                        else
 848                        {
 6849                            value = EventHubListResult.DeserializeEventHubListResult(document.RootElement);
 850                        }
 6851                        return Response.FromValue(value, message.Response);
 852                    }
 853                default:
 0854                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 855            }
 6856        }
 857
 858        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string namespaceName, string eventHub
 859        {
 64860            var message = _pipeline.CreateMessage();
 64861            var request = message.Request;
 64862            request.Method = RequestMethod.Put;
 64863            var uri = new RawRequestUriBuilder();
 64864            uri.Reset(endpoint);
 64865            uri.AppendPath("/subscriptions/", false);
 64866            uri.AppendPath(subscriptionId, true);
 64867            uri.AppendPath("/resourceGroups/", false);
 64868            uri.AppendPath(resourceGroupName, true);
 64869            uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false);
 64870            uri.AppendPath(namespaceName, true);
 64871            uri.AppendPath("/eventhubs/", false);
 64872            uri.AppendPath(eventHubName, true);
 64873            uri.AppendQuery("api-version", "2017-04-01", true);
 64874            request.Uri = uri;
 64875            request.Headers.Add("Content-Type", "application/json");
 64876            var content = new Utf8JsonRequestContent();
 64877            content.JsonWriter.WriteObjectValue(parameters);
 64878            request.Content = content;
 64879            return message;
 880        }
 881
 882        /// <summary> Creates or updates a new Event Hub as a nested resource within a Namespace. </summary>
 883        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 884        /// <param name="namespaceName"> The Namespace name. </param>
 885        /// <param name="eventHubName"> The Event Hub name. </param>
 886        /// <param name="parameters"> Parameters supplied to create an Event Hub resource. </param>
 887        /// <param name="cancellationToken"> The cancellation token to use. </param>
 888        public async Task<Response<Eventhub>> CreateOrUpdateAsync(string resourceGroupName, string namespaceName, string
 889        {
 32890            if (resourceGroupName == null)
 891            {
 0892                throw new ArgumentNullException(nameof(resourceGroupName));
 893            }
 32894            if (namespaceName == null)
 895            {
 0896                throw new ArgumentNullException(nameof(namespaceName));
 897            }
 32898            if (eventHubName == null)
 899            {
 0900                throw new ArgumentNullException(nameof(eventHubName));
 901            }
 32902            if (parameters == null)
 903            {
 0904                throw new ArgumentNullException(nameof(parameters));
 905            }
 906
 32907            using var message = CreateCreateOrUpdateRequest(resourceGroupName, namespaceName, eventHubName, parameters);
 32908            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 32909            switch (message.Response.Status)
 910            {
 911                case 200:
 912                    {
 32913                        Eventhub value = default;
 32914                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 32915                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 916                        {
 0917                            value = null;
 918                        }
 919                        else
 920                        {
 32921                            value = Eventhub.DeserializeEventhub(document.RootElement);
 922                        }
 32923                        return Response.FromValue(value, message.Response);
 924                    }
 925                default:
 0926                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 927            }
 32928        }
 929
 930        /// <summary> Creates or updates a new Event Hub as a nested resource within a Namespace. </summary>
 931        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 932        /// <param name="namespaceName"> The Namespace name. </param>
 933        /// <param name="eventHubName"> The Event Hub name. </param>
 934        /// <param name="parameters"> Parameters supplied to create an Event Hub resource. </param>
 935        /// <param name="cancellationToken"> The cancellation token to use. </param>
 936        public Response<Eventhub> CreateOrUpdate(string resourceGroupName, string namespaceName, string eventHubName, Ev
 937        {
 32938            if (resourceGroupName == null)
 939            {
 0940                throw new ArgumentNullException(nameof(resourceGroupName));
 941            }
 32942            if (namespaceName == null)
 943            {
 0944                throw new ArgumentNullException(nameof(namespaceName));
 945            }
 32946            if (eventHubName == null)
 947            {
 0948                throw new ArgumentNullException(nameof(eventHubName));
 949            }
 32950            if (parameters == null)
 951            {
 0952                throw new ArgumentNullException(nameof(parameters));
 953            }
 954
 32955            using var message = CreateCreateOrUpdateRequest(resourceGroupName, namespaceName, eventHubName, parameters);
 32956            _pipeline.Send(message, cancellationToken);
 32957            switch (message.Response.Status)
 958            {
 959                case 200:
 960                    {
 32961                        Eventhub value = default;
 32962                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 32963                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 964                        {
 0965                            value = null;
 966                        }
 967                        else
 968                        {
 32969                            value = Eventhub.DeserializeEventhub(document.RootElement);
 970                        }
 32971                        return Response.FromValue(value, message.Response);
 972                    }
 973                default:
 0974                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 975            }
 32976        }
 977
 978        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string namespaceName, string eventHubName)
 979        {
 20980            var message = _pipeline.CreateMessage();
 20981            var request = message.Request;
 20982            request.Method = RequestMethod.Delete;
 20983            var uri = new RawRequestUriBuilder();
 20984            uri.Reset(endpoint);
 20985            uri.AppendPath("/subscriptions/", false);
 20986            uri.AppendPath(subscriptionId, true);
 20987            uri.AppendPath("/resourceGroups/", false);
 20988            uri.AppendPath(resourceGroupName, true);
 20989            uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false);
 20990            uri.AppendPath(namespaceName, true);
 20991            uri.AppendPath("/eventhubs/", false);
 20992            uri.AppendPath(eventHubName, true);
 20993            uri.AppendQuery("api-version", "2017-04-01", true);
 20994            request.Uri = uri;
 20995            return message;
 996        }
 997
 998        /// <summary> Deletes an Event Hub from the specified Namespace and resource group. </summary>
 999        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 1000        /// <param name="namespaceName"> The Namespace name. </param>
 1001        /// <param name="eventHubName"> The Event Hub name. </param>
 1002        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1003        public async Task<Response> DeleteAsync(string resourceGroupName, string namespaceName, string eventHubName, Can
 1004        {
 101005            if (resourceGroupName == null)
 1006            {
 01007                throw new ArgumentNullException(nameof(resourceGroupName));
 1008            }
 101009            if (namespaceName == null)
 1010            {
 01011                throw new ArgumentNullException(nameof(namespaceName));
 1012            }
 101013            if (eventHubName == null)
 1014            {
 01015                throw new ArgumentNullException(nameof(eventHubName));
 1016            }
 1017
 101018            using var message = CreateDeleteRequest(resourceGroupName, namespaceName, eventHubName);
 101019            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 101020            switch (message.Response.Status)
 1021            {
 1022                case 200:
 1023                case 204:
 101024                    return message.Response;
 1025                default:
 01026                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1027            }
 101028        }
 1029
 1030        /// <summary> Deletes an Event Hub from the specified Namespace and resource group. </summary>
 1031        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 1032        /// <param name="namespaceName"> The Namespace name. </param>
 1033        /// <param name="eventHubName"> The Event Hub name. </param>
 1034        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1035        public Response Delete(string resourceGroupName, string namespaceName, string eventHubName, CancellationToken ca
 1036        {
 101037            if (resourceGroupName == null)
 1038            {
 01039                throw new ArgumentNullException(nameof(resourceGroupName));
 1040            }
 101041            if (namespaceName == null)
 1042            {
 01043                throw new ArgumentNullException(nameof(namespaceName));
 1044            }
 101045            if (eventHubName == null)
 1046            {
 01047                throw new ArgumentNullException(nameof(eventHubName));
 1048            }
 1049
 101050            using var message = CreateDeleteRequest(resourceGroupName, namespaceName, eventHubName);
 101051            _pipeline.Send(message, cancellationToken);
 101052            switch (message.Response.Status)
 1053            {
 1054                case 200:
 1055                case 204:
 101056                    return message.Response;
 1057                default:
 01058                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1059            }
 101060        }
 1061
 1062        internal HttpMessage CreateGetRequest(string resourceGroupName, string namespaceName, string eventHubName)
 1063        {
 241064            var message = _pipeline.CreateMessage();
 241065            var request = message.Request;
 241066            request.Method = RequestMethod.Get;
 241067            var uri = new RawRequestUriBuilder();
 241068            uri.Reset(endpoint);
 241069            uri.AppendPath("/subscriptions/", false);
 241070            uri.AppendPath(subscriptionId, true);
 241071            uri.AppendPath("/resourceGroups/", false);
 241072            uri.AppendPath(resourceGroupName, true);
 241073            uri.AppendPath("/providers/Microsoft.EventHub/namespaces/", false);
 241074            uri.AppendPath(namespaceName, true);
 241075            uri.AppendPath("/eventhubs/", false);
 241076            uri.AppendPath(eventHubName, true);
 241077            uri.AppendQuery("api-version", "2017-04-01", true);
 241078            request.Uri = uri;
 241079            return message;
 1080        }
 1081
 1082        /// <summary> Gets an Event Hubs description for the specified Event Hub. </summary>
 1083        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 1084        /// <param name="namespaceName"> The Namespace name. </param>
 1085        /// <param name="eventHubName"> The Event Hub name. </param>
 1086        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1087        public async Task<Response<Eventhub>> GetAsync(string resourceGroupName, string namespaceName, string eventHubNa
 1088        {
 121089            if (resourceGroupName == null)
 1090            {
 01091                throw new ArgumentNullException(nameof(resourceGroupName));
 1092            }
 121093            if (namespaceName == null)
 1094            {
 01095                throw new ArgumentNullException(nameof(namespaceName));
 1096            }
 121097            if (eventHubName == null)
 1098            {
 01099                throw new ArgumentNullException(nameof(eventHubName));
 1100            }
 1101
 121102            using var message = CreateGetRequest(resourceGroupName, namespaceName, eventHubName);
 121103            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 121104            switch (message.Response.Status)
 1105            {
 1106                case 200:
 1107                    {
 121108                        Eventhub value = default;
 121109                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 121110                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1111                        {
 01112                            value = null;
 1113                        }
 1114                        else
 1115                        {
 121116                            value = Eventhub.DeserializeEventhub(document.RootElement);
 1117                        }
 121118                        return Response.FromValue(value, message.Response);
 1119                    }
 1120                default:
 01121                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1122            }
 121123        }
 1124
 1125        /// <summary> Gets an Event Hubs description for the specified Event Hub. </summary>
 1126        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 1127        /// <param name="namespaceName"> The Namespace name. </param>
 1128        /// <param name="eventHubName"> The Event Hub name. </param>
 1129        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1130        public Response<Eventhub> Get(string resourceGroupName, string namespaceName, string eventHubName, CancellationT
 1131        {
 121132            if (resourceGroupName == null)
 1133            {
 01134                throw new ArgumentNullException(nameof(resourceGroupName));
 1135            }
 121136            if (namespaceName == null)
 1137            {
 01138                throw new ArgumentNullException(nameof(namespaceName));
 1139            }
 121140            if (eventHubName == null)
 1141            {
 01142                throw new ArgumentNullException(nameof(eventHubName));
 1143            }
 1144
 121145            using var message = CreateGetRequest(resourceGroupName, namespaceName, eventHubName);
 121146            _pipeline.Send(message, cancellationToken);
 121147            switch (message.Response.Status)
 1148            {
 1149                case 200:
 1150                    {
 121151                        Eventhub value = default;
 121152                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 121153                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1154                        {
 01155                            value = null;
 1156                        }
 1157                        else
 1158                        {
 121159                            value = Eventhub.DeserializeEventhub(document.RootElement);
 1160                        }
 121161                        return Response.FromValue(value, message.Response);
 1162                    }
 1163                default:
 01164                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1165            }
 121166        }
 1167
 1168        internal HttpMessage CreateListAuthorizationRulesNextPageRequest(string nextLink, string resourceGroupName, stri
 1169        {
 01170            var message = _pipeline.CreateMessage();
 01171            var request = message.Request;
 01172            request.Method = RequestMethod.Get;
 01173            var uri = new RawRequestUriBuilder();
 01174            uri.Reset(endpoint);
 01175            uri.AppendRawNextLink(nextLink, false);
 01176            request.Uri = uri;
 01177            return message;
 1178        }
 1179
 1180        /// <summary> Gets the authorization rules for an Event Hub. </summary>
 1181        /// <param name="nextLink"> The URL to the next page of results. </param>
 1182        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 1183        /// <param name="namespaceName"> The Namespace name. </param>
 1184        /// <param name="eventHubName"> The Event Hub name. </param>
 1185        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1186        public async Task<Response<AuthorizationRuleListResult>> ListAuthorizationRulesNextPageAsync(string nextLink, st
 1187        {
 01188            if (nextLink == null)
 1189            {
 01190                throw new ArgumentNullException(nameof(nextLink));
 1191            }
 01192            if (resourceGroupName == null)
 1193            {
 01194                throw new ArgumentNullException(nameof(resourceGroupName));
 1195            }
 01196            if (namespaceName == null)
 1197            {
 01198                throw new ArgumentNullException(nameof(namespaceName));
 1199            }
 01200            if (eventHubName == null)
 1201            {
 01202                throw new ArgumentNullException(nameof(eventHubName));
 1203            }
 1204
 01205            using var message = CreateListAuthorizationRulesNextPageRequest(nextLink, resourceGroupName, namespaceName, 
 01206            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01207            switch (message.Response.Status)
 1208            {
 1209                case 200:
 1210                    {
 01211                        AuthorizationRuleListResult value = default;
 01212                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01213                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1214                        {
 01215                            value = null;
 1216                        }
 1217                        else
 1218                        {
 01219                            value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem
 1220                        }
 01221                        return Response.FromValue(value, message.Response);
 1222                    }
 1223                default:
 01224                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1225            }
 01226        }
 1227
 1228        /// <summary> Gets the authorization rules for an Event Hub. </summary>
 1229        /// <param name="nextLink"> The URL to the next page of results. </param>
 1230        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 1231        /// <param name="namespaceName"> The Namespace name. </param>
 1232        /// <param name="eventHubName"> The Event Hub name. </param>
 1233        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1234        public Response<AuthorizationRuleListResult> ListAuthorizationRulesNextPage(string nextLink, string resourceGrou
 1235        {
 01236            if (nextLink == null)
 1237            {
 01238                throw new ArgumentNullException(nameof(nextLink));
 1239            }
 01240            if (resourceGroupName == null)
 1241            {
 01242                throw new ArgumentNullException(nameof(resourceGroupName));
 1243            }
 01244            if (namespaceName == null)
 1245            {
 01246                throw new ArgumentNullException(nameof(namespaceName));
 1247            }
 01248            if (eventHubName == null)
 1249            {
 01250                throw new ArgumentNullException(nameof(eventHubName));
 1251            }
 1252
 01253            using var message = CreateListAuthorizationRulesNextPageRequest(nextLink, resourceGroupName, namespaceName, 
 01254            _pipeline.Send(message, cancellationToken);
 01255            switch (message.Response.Status)
 1256            {
 1257                case 200:
 1258                    {
 01259                        AuthorizationRuleListResult value = default;
 01260                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01261                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1262                        {
 01263                            value = null;
 1264                        }
 1265                        else
 1266                        {
 01267                            value = AuthorizationRuleListResult.DeserializeAuthorizationRuleListResult(document.RootElem
 1268                        }
 01269                        return Response.FromValue(value, message.Response);
 1270                    }
 1271                default:
 01272                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1273            }
 01274        }
 1275
 1276        internal HttpMessage CreateListByNamespaceNextPageRequest(string nextLink, string resourceGroupName, string name
 1277        {
 01278            var message = _pipeline.CreateMessage();
 01279            var request = message.Request;
 01280            request.Method = RequestMethod.Get;
 01281            var uri = new RawRequestUriBuilder();
 01282            uri.Reset(endpoint);
 01283            uri.AppendRawNextLink(nextLink, false);
 01284            request.Uri = uri;
 01285            return message;
 1286        }
 1287
 1288        /// <summary> Gets all the Event Hubs in a Namespace. </summary>
 1289        /// <param name="nextLink"> The URL to the next page of results. </param>
 1290        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 1291        /// <param name="namespaceName"> The Namespace name. </param>
 1292        /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo
 1293        /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param>
 1294        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1295        public async Task<Response<EventHubListResult>> ListByNamespaceNextPageAsync(string nextLink, string resourceGro
 1296        {
 01297            if (nextLink == null)
 1298            {
 01299                throw new ArgumentNullException(nameof(nextLink));
 1300            }
 01301            if (resourceGroupName == null)
 1302            {
 01303                throw new ArgumentNullException(nameof(resourceGroupName));
 1304            }
 01305            if (namespaceName == null)
 1306            {
 01307                throw new ArgumentNullException(nameof(namespaceName));
 1308            }
 1309
 01310            using var message = CreateListByNamespaceNextPageRequest(nextLink, resourceGroupName, namespaceName, skip, t
 01311            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01312            switch (message.Response.Status)
 1313            {
 1314                case 200:
 1315                    {
 01316                        EventHubListResult value = default;
 01317                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01318                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1319                        {
 01320                            value = null;
 1321                        }
 1322                        else
 1323                        {
 01324                            value = EventHubListResult.DeserializeEventHubListResult(document.RootElement);
 1325                        }
 01326                        return Response.FromValue(value, message.Response);
 1327                    }
 1328                default:
 01329                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1330            }
 01331        }
 1332
 1333        /// <summary> Gets all the Event Hubs in a Namespace. </summary>
 1334        /// <param name="nextLink"> The URL to the next page of results. </param>
 1335        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 1336        /// <param name="namespaceName"> The Namespace name. </param>
 1337        /// <param name="skip"> Skip is only used if a previous operation returned a partial result. If a previous respo
 1338        /// <param name="top"> May be used to limit the number of results to the most recent N usageDetails. </param>
 1339        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1340        public Response<EventHubListResult> ListByNamespaceNextPage(string nextLink, string resourceGroupName, string na
 1341        {
 01342            if (nextLink == null)
 1343            {
 01344                throw new ArgumentNullException(nameof(nextLink));
 1345            }
 01346            if (resourceGroupName == null)
 1347            {
 01348                throw new ArgumentNullException(nameof(resourceGroupName));
 1349            }
 01350            if (namespaceName == null)
 1351            {
 01352                throw new ArgumentNullException(nameof(namespaceName));
 1353            }
 1354
 01355            using var message = CreateListByNamespaceNextPageRequest(nextLink, resourceGroupName, namespaceName, skip, t
 01356            _pipeline.Send(message, cancellationToken);
 01357            switch (message.Response.Status)
 1358            {
 1359                case 200:
 1360                    {
 01361                        EventHubListResult value = default;
 01362                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01363                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1364                        {
 01365                            value = null;
 1366                        }
 1367                        else
 1368                        {
 01369                            value = EventHubListResult.DeserializeEventHubListResult(document.RootElement);
 1370                        }
 01371                        return Response.FromValue(value, message.Response);
 1372                    }
 1373                default:
 01374                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1375            }
 01376        }
 1377    }
 1378}