< Summary

Class:Azure.ResourceManager.EventHubs.ClustersRestOperations
Assembly:Azure.ResourceManager.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\ClustersRestOperations.cs
Covered lines:0
Uncovered lines:318
Coverable lines:318
Total lines:711
Line coverage:0% (0 of 318)
Covered branches:0
Total branches:120
Branch coverage:0% (0 of 120)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateListAvailableClustersRequest()-0%100%
ListAvailableClustersAsync()-0%0%
ListAvailableClusters(...)-0%0%
CreateListByResourceGroupRequest(...)-0%100%
ListByResourceGroupAsync()-0%0%
ListByResourceGroup(...)-0%0%
CreateGetRequest(...)-0%100%
GetAsync()-0%0%
Get(...)-0%0%
CreatePutRequest(...)-0%100%
PutAsync()-0%0%
Put(...)-0%0%
CreatePatchRequest(...)-0%100%
PatchAsync()-0%0%
Patch(...)-0%0%
CreateDeleteRequest(...)-0%100%
DeleteAsync()-0%0%
Delete(...)-0%0%
CreateListNamespacesRequest(...)-0%100%
ListNamespacesAsync()-0%0%
ListNamespaces(...)-0%0%
CreateListByResourceGroupNextPageRequest(...)-0%100%
ListByResourceGroupNextPageAsync()-0%0%
ListByResourceGroupNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\ClustersRestOperations.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 ClustersRestOperations
 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 ClustersRestOperations. </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
 032        public ClustersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId,
 33        {
 034            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 038            endpoint ??= new Uri("https://management.azure.com");
 39
 040            this.subscriptionId = subscriptionId;
 041            this.endpoint = endpoint;
 042            _clientDiagnostics = clientDiagnostics;
 043            _pipeline = pipeline;
 044        }
 45
 46        internal HttpMessage CreateListAvailableClustersRequest()
 47        {
 048            var message = _pipeline.CreateMessage();
 049            var request = message.Request;
 050            request.Method = RequestMethod.Get;
 051            var uri = new RawRequestUriBuilder();
 052            uri.Reset(endpoint);
 053            uri.AppendPath("/subscriptions/", false);
 054            uri.AppendPath(subscriptionId, true);
 055            uri.AppendPath("/providers/Microsoft.EventHub/availableClusterRegions", false);
 056            uri.AppendQuery("api-version", "2018-01-01-preview", true);
 057            request.Uri = uri;
 058            return message;
 59        }
 60
 61        /// <summary> List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region. </sum
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public async Task<Response<AvailableClustersList>> ListAvailableClustersAsync(CancellationToken cancellationToke
 64        {
 065            using var message = CreateListAvailableClustersRequest();
 066            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 067            switch (message.Response.Status)
 68            {
 69                case 200:
 70                    {
 071                        AvailableClustersList value = default;
 072                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 073                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 74                        {
 075                            value = null;
 76                        }
 77                        else
 78                        {
 079                            value = AvailableClustersList.DeserializeAvailableClustersList(document.RootElement);
 80                        }
 081                        return Response.FromValue(value, message.Response);
 82                    }
 83                default:
 084                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 85            }
 086        }
 87
 88        /// <summary> List the quantity of available pre-provisioned Event Hubs Clusters, indexed by Azure region. </sum
 89        /// <param name="cancellationToken"> The cancellation token to use. </param>
 90        public Response<AvailableClustersList> ListAvailableClusters(CancellationToken cancellationToken = default)
 91        {
 092            using var message = CreateListAvailableClustersRequest();
 093            _pipeline.Send(message, cancellationToken);
 094            switch (message.Response.Status)
 95            {
 96                case 200:
 97                    {
 098                        AvailableClustersList value = default;
 099                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0100                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 101                        {
 0102                            value = null;
 103                        }
 104                        else
 105                        {
 0106                            value = AvailableClustersList.DeserializeAvailableClustersList(document.RootElement);
 107                        }
 0108                        return Response.FromValue(value, message.Response);
 109                    }
 110                default:
 0111                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 112            }
 0113        }
 114
 115        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 116        {
 0117            var message = _pipeline.CreateMessage();
 0118            var request = message.Request;
 0119            request.Method = RequestMethod.Get;
 0120            var uri = new RawRequestUriBuilder();
 0121            uri.Reset(endpoint);
 0122            uri.AppendPath("/subscriptions/", false);
 0123            uri.AppendPath(subscriptionId, true);
 0124            uri.AppendPath("/resourceGroups/", false);
 0125            uri.AppendPath(resourceGroupName, true);
 0126            uri.AppendPath("/providers/Microsoft.EventHub/clusters", false);
 0127            uri.AppendQuery("api-version", "2018-01-01-preview", true);
 0128            request.Uri = uri;
 0129            return message;
 130        }
 131
 132        /// <summary> Lists the available Event Hubs Clusters within an ARM resource group. </summary>
 133        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 134        /// <param name="cancellationToken"> The cancellation token to use. </param>
 135        public async Task<Response<ClusterListResult>> ListByResourceGroupAsync(string resourceGroupName, CancellationTo
 136        {
 0137            if (resourceGroupName == null)
 138            {
 0139                throw new ArgumentNullException(nameof(resourceGroupName));
 140            }
 141
 0142            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0143            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0144            switch (message.Response.Status)
 145            {
 146                case 200:
 147                    {
 0148                        ClusterListResult value = default;
 0149                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0150                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 151                        {
 0152                            value = null;
 153                        }
 154                        else
 155                        {
 0156                            value = ClusterListResult.DeserializeClusterListResult(document.RootElement);
 157                        }
 0158                        return Response.FromValue(value, message.Response);
 159                    }
 160                default:
 0161                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 162            }
 0163        }
 164
 165        /// <summary> Lists the available Event Hubs Clusters within an ARM resource group. </summary>
 166        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 167        /// <param name="cancellationToken"> The cancellation token to use. </param>
 168        public Response<ClusterListResult> ListByResourceGroup(string resourceGroupName, CancellationToken cancellationT
 169        {
 0170            if (resourceGroupName == null)
 171            {
 0172                throw new ArgumentNullException(nameof(resourceGroupName));
 173            }
 174
 0175            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0176            _pipeline.Send(message, cancellationToken);
 0177            switch (message.Response.Status)
 178            {
 179                case 200:
 180                    {
 0181                        ClusterListResult value = default;
 0182                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0183                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 184                        {
 0185                            value = null;
 186                        }
 187                        else
 188                        {
 0189                            value = ClusterListResult.DeserializeClusterListResult(document.RootElement);
 190                        }
 0191                        return Response.FromValue(value, message.Response);
 192                    }
 193                default:
 0194                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 195            }
 0196        }
 197
 198        internal HttpMessage CreateGetRequest(string resourceGroupName, string clusterName)
 199        {
 0200            var message = _pipeline.CreateMessage();
 0201            var request = message.Request;
 0202            request.Method = RequestMethod.Get;
 0203            var uri = new RawRequestUriBuilder();
 0204            uri.Reset(endpoint);
 0205            uri.AppendPath("/subscriptions/", false);
 0206            uri.AppendPath(subscriptionId, true);
 0207            uri.AppendPath("/resourceGroups/", false);
 0208            uri.AppendPath(resourceGroupName, true);
 0209            uri.AppendPath("/providers/Microsoft.EventHub/clusters/", false);
 0210            uri.AppendPath(clusterName, true);
 0211            uri.AppendQuery("api-version", "2018-01-01-preview", true);
 0212            request.Uri = uri;
 0213            return message;
 214        }
 215
 216        /// <summary> Gets the resource description of the specified Event Hubs Cluster. </summary>
 217        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 218        /// <param name="clusterName"> The name of the Event Hubs Cluster. </param>
 219        /// <param name="cancellationToken"> The cancellation token to use. </param>
 220        public async Task<Response<Cluster>> GetAsync(string resourceGroupName, string clusterName, CancellationToken ca
 221        {
 0222            if (resourceGroupName == null)
 223            {
 0224                throw new ArgumentNullException(nameof(resourceGroupName));
 225            }
 0226            if (clusterName == null)
 227            {
 0228                throw new ArgumentNullException(nameof(clusterName));
 229            }
 230
 0231            using var message = CreateGetRequest(resourceGroupName, clusterName);
 0232            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0233            switch (message.Response.Status)
 234            {
 235                case 200:
 236                    {
 0237                        Cluster value = default;
 0238                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0239                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 240                        {
 0241                            value = null;
 242                        }
 243                        else
 244                        {
 0245                            value = Cluster.DeserializeCluster(document.RootElement);
 246                        }
 0247                        return Response.FromValue(value, message.Response);
 248                    }
 249                default:
 0250                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 251            }
 0252        }
 253
 254        /// <summary> Gets the resource description of the specified Event Hubs Cluster. </summary>
 255        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 256        /// <param name="clusterName"> The name of the Event Hubs Cluster. </param>
 257        /// <param name="cancellationToken"> The cancellation token to use. </param>
 258        public Response<Cluster> Get(string resourceGroupName, string clusterName, CancellationToken cancellationToken =
 259        {
 0260            if (resourceGroupName == null)
 261            {
 0262                throw new ArgumentNullException(nameof(resourceGroupName));
 263            }
 0264            if (clusterName == null)
 265            {
 0266                throw new ArgumentNullException(nameof(clusterName));
 267            }
 268
 0269            using var message = CreateGetRequest(resourceGroupName, clusterName);
 0270            _pipeline.Send(message, cancellationToken);
 0271            switch (message.Response.Status)
 272            {
 273                case 200:
 274                    {
 0275                        Cluster value = default;
 0276                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0277                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 278                        {
 0279                            value = null;
 280                        }
 281                        else
 282                        {
 0283                            value = Cluster.DeserializeCluster(document.RootElement);
 284                        }
 0285                        return Response.FromValue(value, message.Response);
 286                    }
 287                default:
 0288                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 289            }
 0290        }
 291
 292        internal HttpMessage CreatePutRequest(string resourceGroupName, string clusterName)
 293        {
 0294            var message = _pipeline.CreateMessage();
 0295            var request = message.Request;
 0296            request.Method = RequestMethod.Put;
 0297            var uri = new RawRequestUriBuilder();
 0298            uri.Reset(endpoint);
 0299            uri.AppendPath("/subscriptions/", false);
 0300            uri.AppendPath(subscriptionId, true);
 0301            uri.AppendPath("/resourceGroups/", false);
 0302            uri.AppendPath(resourceGroupName, true);
 0303            uri.AppendPath("/providers/Microsoft.EventHub/clusters/", false);
 0304            uri.AppendPath(clusterName, true);
 0305            uri.AppendQuery("api-version", "2018-01-01-preview", true);
 0306            request.Uri = uri;
 0307            return message;
 308        }
 309
 310        /// <summary> Creates or updates an instance of an Event Hubs Cluster. </summary>
 311        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 312        /// <param name="clusterName"> The name of the Event Hubs Cluster. </param>
 313        /// <param name="cancellationToken"> The cancellation token to use. </param>
 314        public async Task<Response> PutAsync(string resourceGroupName, string clusterName, CancellationToken cancellatio
 315        {
 0316            if (resourceGroupName == null)
 317            {
 0318                throw new ArgumentNullException(nameof(resourceGroupName));
 319            }
 0320            if (clusterName == null)
 321            {
 0322                throw new ArgumentNullException(nameof(clusterName));
 323            }
 324
 0325            using var message = CreatePutRequest(resourceGroupName, clusterName);
 0326            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0327            switch (message.Response.Status)
 328            {
 329                case 200:
 330                case 201:
 331                case 202:
 0332                    return message.Response;
 333                default:
 0334                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 335            }
 0336        }
 337
 338        /// <summary> Creates or updates an instance of an Event Hubs Cluster. </summary>
 339        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 340        /// <param name="clusterName"> The name of the Event Hubs Cluster. </param>
 341        /// <param name="cancellationToken"> The cancellation token to use. </param>
 342        public Response Put(string resourceGroupName, string clusterName, CancellationToken cancellationToken = default)
 343        {
 0344            if (resourceGroupName == null)
 345            {
 0346                throw new ArgumentNullException(nameof(resourceGroupName));
 347            }
 0348            if (clusterName == null)
 349            {
 0350                throw new ArgumentNullException(nameof(clusterName));
 351            }
 352
 0353            using var message = CreatePutRequest(resourceGroupName, clusterName);
 0354            _pipeline.Send(message, cancellationToken);
 0355            switch (message.Response.Status)
 356            {
 357                case 200:
 358                case 201:
 359                case 202:
 0360                    return message.Response;
 361                default:
 0362                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 363            }
 0364        }
 365
 366        internal HttpMessage CreatePatchRequest(string resourceGroupName, string clusterName, Cluster parameters)
 367        {
 0368            var message = _pipeline.CreateMessage();
 0369            var request = message.Request;
 0370            request.Method = RequestMethod.Patch;
 0371            var uri = new RawRequestUriBuilder();
 0372            uri.Reset(endpoint);
 0373            uri.AppendPath("/subscriptions/", false);
 0374            uri.AppendPath(subscriptionId, true);
 0375            uri.AppendPath("/resourceGroups/", false);
 0376            uri.AppendPath(resourceGroupName, true);
 0377            uri.AppendPath("/providers/Microsoft.EventHub/clusters/", false);
 0378            uri.AppendPath(clusterName, true);
 0379            uri.AppendQuery("api-version", "2018-01-01-preview", true);
 0380            request.Uri = uri;
 0381            request.Headers.Add("Content-Type", "application/json");
 0382            var content = new Utf8JsonRequestContent();
 0383            content.JsonWriter.WriteObjectValue(parameters);
 0384            request.Content = content;
 0385            return message;
 386        }
 387
 388        /// <summary> Modifies mutable properties on the Event Hubs Cluster. This operation is idempotent. </summary>
 389        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 390        /// <param name="clusterName"> The name of the Event Hubs Cluster. </param>
 391        /// <param name="parameters"> The properties of the Event Hubs Cluster which should be updated. </param>
 392        /// <param name="cancellationToken"> The cancellation token to use. </param>
 393        public async Task<Response> PatchAsync(string resourceGroupName, string clusterName, Cluster parameters, Cancell
 394        {
 0395            if (resourceGroupName == null)
 396            {
 0397                throw new ArgumentNullException(nameof(resourceGroupName));
 398            }
 0399            if (clusterName == null)
 400            {
 0401                throw new ArgumentNullException(nameof(clusterName));
 402            }
 0403            if (parameters == null)
 404            {
 0405                throw new ArgumentNullException(nameof(parameters));
 406            }
 407
 0408            using var message = CreatePatchRequest(resourceGroupName, clusterName, parameters);
 0409            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0410            switch (message.Response.Status)
 411            {
 412                case 200:
 413                case 201:
 414                case 202:
 0415                    return message.Response;
 416                default:
 0417                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 418            }
 0419        }
 420
 421        /// <summary> Modifies mutable properties on the Event Hubs Cluster. This operation is idempotent. </summary>
 422        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 423        /// <param name="clusterName"> The name of the Event Hubs Cluster. </param>
 424        /// <param name="parameters"> The properties of the Event Hubs Cluster which should be updated. </param>
 425        /// <param name="cancellationToken"> The cancellation token to use. </param>
 426        public Response Patch(string resourceGroupName, string clusterName, Cluster parameters, CancellationToken cancel
 427        {
 0428            if (resourceGroupName == null)
 429            {
 0430                throw new ArgumentNullException(nameof(resourceGroupName));
 431            }
 0432            if (clusterName == null)
 433            {
 0434                throw new ArgumentNullException(nameof(clusterName));
 435            }
 0436            if (parameters == null)
 437            {
 0438                throw new ArgumentNullException(nameof(parameters));
 439            }
 440
 0441            using var message = CreatePatchRequest(resourceGroupName, clusterName, parameters);
 0442            _pipeline.Send(message, cancellationToken);
 0443            switch (message.Response.Status)
 444            {
 445                case 200:
 446                case 201:
 447                case 202:
 0448                    return message.Response;
 449                default:
 0450                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 451            }
 0452        }
 453
 454        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string clusterName)
 455        {
 0456            var message = _pipeline.CreateMessage();
 0457            var request = message.Request;
 0458            request.Method = RequestMethod.Delete;
 0459            var uri = new RawRequestUriBuilder();
 0460            uri.Reset(endpoint);
 0461            uri.AppendPath("/subscriptions/", false);
 0462            uri.AppendPath(subscriptionId, true);
 0463            uri.AppendPath("/resourceGroups/", false);
 0464            uri.AppendPath(resourceGroupName, true);
 0465            uri.AppendPath("/providers/Microsoft.EventHub/clusters/", false);
 0466            uri.AppendPath(clusterName, true);
 0467            uri.AppendQuery("api-version", "2018-01-01-preview", true);
 0468            request.Uri = uri;
 0469            return message;
 470        }
 471
 472        /// <summary> Deletes an existing Event Hubs Cluster. This operation is idempotent. </summary>
 473        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 474        /// <param name="clusterName"> The name of the Event Hubs Cluster. </param>
 475        /// <param name="cancellationToken"> The cancellation token to use. </param>
 476        public async Task<Response> DeleteAsync(string resourceGroupName, string clusterName, CancellationToken cancella
 477        {
 0478            if (resourceGroupName == null)
 479            {
 0480                throw new ArgumentNullException(nameof(resourceGroupName));
 481            }
 0482            if (clusterName == null)
 483            {
 0484                throw new ArgumentNullException(nameof(clusterName));
 485            }
 486
 0487            using var message = CreateDeleteRequest(resourceGroupName, clusterName);
 0488            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0489            switch (message.Response.Status)
 490            {
 491                case 200:
 492                case 202:
 493                case 204:
 0494                    return message.Response;
 495                default:
 0496                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 497            }
 0498        }
 499
 500        /// <summary> Deletes an existing Event Hubs Cluster. This operation is idempotent. </summary>
 501        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 502        /// <param name="clusterName"> The name of the Event Hubs Cluster. </param>
 503        /// <param name="cancellationToken"> The cancellation token to use. </param>
 504        public Response Delete(string resourceGroupName, string clusterName, CancellationToken cancellationToken = defau
 505        {
 0506            if (resourceGroupName == null)
 507            {
 0508                throw new ArgumentNullException(nameof(resourceGroupName));
 509            }
 0510            if (clusterName == null)
 511            {
 0512                throw new ArgumentNullException(nameof(clusterName));
 513            }
 514
 0515            using var message = CreateDeleteRequest(resourceGroupName, clusterName);
 0516            _pipeline.Send(message, cancellationToken);
 0517            switch (message.Response.Status)
 518            {
 519                case 200:
 520                case 202:
 521                case 204:
 0522                    return message.Response;
 523                default:
 0524                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 525            }
 0526        }
 527
 528        internal HttpMessage CreateListNamespacesRequest(string resourceGroupName, string clusterName)
 529        {
 0530            var message = _pipeline.CreateMessage();
 0531            var request = message.Request;
 0532            request.Method = RequestMethod.Get;
 0533            var uri = new RawRequestUriBuilder();
 0534            uri.Reset(endpoint);
 0535            uri.AppendPath("/subscriptions/", false);
 0536            uri.AppendPath(subscriptionId, true);
 0537            uri.AppendPath("/resourceGroups/", false);
 0538            uri.AppendPath(resourceGroupName, true);
 0539            uri.AppendPath("/providers/Microsoft.EventHub/clusters/", false);
 0540            uri.AppendPath(clusterName, true);
 0541            uri.AppendPath("/namespaces", false);
 0542            uri.AppendQuery("api-version", "2018-01-01-preview", true);
 0543            request.Uri = uri;
 0544            return message;
 545        }
 546
 547        /// <summary> List all Event Hubs Namespace IDs in an Event Hubs Dedicated Cluster. </summary>
 548        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 549        /// <param name="clusterName"> The name of the Event Hubs Cluster. </param>
 550        /// <param name="cancellationToken"> The cancellation token to use. </param>
 551        public async Task<Response<EHNamespaceIdListResult>> ListNamespacesAsync(string resourceGroupName, string cluste
 552        {
 0553            if (resourceGroupName == null)
 554            {
 0555                throw new ArgumentNullException(nameof(resourceGroupName));
 556            }
 0557            if (clusterName == null)
 558            {
 0559                throw new ArgumentNullException(nameof(clusterName));
 560            }
 561
 0562            using var message = CreateListNamespacesRequest(resourceGroupName, clusterName);
 0563            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0564            switch (message.Response.Status)
 565            {
 566                case 200:
 567                    {
 0568                        EHNamespaceIdListResult value = default;
 0569                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0570                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 571                        {
 0572                            value = null;
 573                        }
 574                        else
 575                        {
 0576                            value = EHNamespaceIdListResult.DeserializeEHNamespaceIdListResult(document.RootElement);
 577                        }
 0578                        return Response.FromValue(value, message.Response);
 579                    }
 580                default:
 0581                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 582            }
 0583        }
 584
 585        /// <summary> List all Event Hubs Namespace IDs in an Event Hubs Dedicated Cluster. </summary>
 586        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 587        /// <param name="clusterName"> The name of the Event Hubs Cluster. </param>
 588        /// <param name="cancellationToken"> The cancellation token to use. </param>
 589        public Response<EHNamespaceIdListResult> ListNamespaces(string resourceGroupName, string clusterName, Cancellati
 590        {
 0591            if (resourceGroupName == null)
 592            {
 0593                throw new ArgumentNullException(nameof(resourceGroupName));
 594            }
 0595            if (clusterName == null)
 596            {
 0597                throw new ArgumentNullException(nameof(clusterName));
 598            }
 599
 0600            using var message = CreateListNamespacesRequest(resourceGroupName, clusterName);
 0601            _pipeline.Send(message, cancellationToken);
 0602            switch (message.Response.Status)
 603            {
 604                case 200:
 605                    {
 0606                        EHNamespaceIdListResult value = default;
 0607                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0608                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 609                        {
 0610                            value = null;
 611                        }
 612                        else
 613                        {
 0614                            value = EHNamespaceIdListResult.DeserializeEHNamespaceIdListResult(document.RootElement);
 615                        }
 0616                        return Response.FromValue(value, message.Response);
 617                    }
 618                default:
 0619                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 620            }
 0621        }
 622
 623        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 624        {
 0625            var message = _pipeline.CreateMessage();
 0626            var request = message.Request;
 0627            request.Method = RequestMethod.Get;
 0628            var uri = new RawRequestUriBuilder();
 0629            uri.Reset(endpoint);
 0630            uri.AppendRawNextLink(nextLink, false);
 0631            request.Uri = uri;
 0632            return message;
 633        }
 634
 635        /// <summary> Lists the available Event Hubs Clusters within an ARM resource group. </summary>
 636        /// <param name="nextLink"> The URL to the next page of results. </param>
 637        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 638        /// <param name="cancellationToken"> The cancellation token to use. </param>
 639        public async Task<Response<ClusterListResult>> ListByResourceGroupNextPageAsync(string nextLink, string resource
 640        {
 0641            if (nextLink == null)
 642            {
 0643                throw new ArgumentNullException(nameof(nextLink));
 644            }
 0645            if (resourceGroupName == null)
 646            {
 0647                throw new ArgumentNullException(nameof(resourceGroupName));
 648            }
 649
 0650            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0651            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0652            switch (message.Response.Status)
 653            {
 654                case 200:
 655                    {
 0656                        ClusterListResult value = default;
 0657                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0658                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 659                        {
 0660                            value = null;
 661                        }
 662                        else
 663                        {
 0664                            value = ClusterListResult.DeserializeClusterListResult(document.RootElement);
 665                        }
 0666                        return Response.FromValue(value, message.Response);
 667                    }
 668                default:
 0669                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 670            }
 0671        }
 672
 673        /// <summary> Lists the available Event Hubs Clusters within an ARM resource group. </summary>
 674        /// <param name="nextLink"> The URL to the next page of results. </param>
 675        /// <param name="resourceGroupName"> Name of the resource group within the azure subscription. </param>
 676        /// <param name="cancellationToken"> The cancellation token to use. </param>
 677        public Response<ClusterListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, Cancel
 678        {
 0679            if (nextLink == null)
 680            {
 0681                throw new ArgumentNullException(nameof(nextLink));
 682            }
 0683            if (resourceGroupName == null)
 684            {
 0685                throw new ArgumentNullException(nameof(resourceGroupName));
 686            }
 687
 0688            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0689            _pipeline.Send(message, cancellationToken);
 0690            switch (message.Response.Status)
 691            {
 692                case 200:
 693                    {
 0694                        ClusterListResult value = default;
 0695                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0696                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 697                        {
 0698                            value = null;
 699                        }
 700                        else
 701                        {
 0702                            value = ClusterListResult.DeserializeClusterListResult(document.RootElement);
 703                        }
 0704                        return Response.FromValue(value, message.Response);
 705                    }
 706                default:
 0707                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 708            }
 0709        }
 710    }
 711}