< Summary

Class:Azure.ResourceManager.Network.LoadBalancersRestOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\LoadBalancersRestOperations.cs
Covered lines:170
Uncovered lines:157
Coverable lines:327
Total lines:732
Line coverage:51.9% (170 of 327)
Covered branches:40
Total branches:126
Branch coverage:31.7% (40 of 126)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-70%50%
Delete(...)-70%50%
CreateGetRequest(...)-100%100%
GetAsync()-73.33%50%
Get(...)-73.33%50%
CreateCreateOrUpdateRequest(...)-100%100%
CreateOrUpdateAsync()-66.67%50%
CreateOrUpdate(...)-66.67%50%
CreateUpdateTagsRequest(...)-0%100%
UpdateTagsAsync()-0%0%
UpdateTags(...)-0%0%
CreateListAllRequest()-100%100%
ListAllAsync()-81.82%50%
ListAll(...)-81.82%50%
CreateListRequest(...)-100%100%
ListAsync()-76.92%50%
List(...)-76.92%50%
CreateListAllNextPageRequest(...)-0%100%
ListAllNextPageAsync()-0%0%
ListAllNextPage(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\LoadBalancersRestOperations.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.Network.Models;
 16
 17namespace Azure.ResourceManager.Network
 18{
 19    internal partial class LoadBalancersRestOperations
 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 LoadBalancersRestOperations. </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"> The subscription credentials which uniquely identify the Microsoft Azure subsc
 30        /// <param name="endpoint"> server parameter. </param>
 31        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 21632        public LoadBalancersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti
 33        {
 21634            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 21638            endpoint ??= new Uri("https://management.azure.com");
 39
 21640            this.subscriptionId = subscriptionId;
 21641            this.endpoint = endpoint;
 21642            _clientDiagnostics = clientDiagnostics;
 21643            _pipeline = pipeline;
 21644        }
 45
 46        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string loadBalancerName)
 47        {
 7248            var message = _pipeline.CreateMessage();
 7249            var request = message.Request;
 7250            request.Method = RequestMethod.Delete;
 7251            var uri = new RawRequestUriBuilder();
 7252            uri.Reset(endpoint);
 7253            uri.AppendPath("/subscriptions/", false);
 7254            uri.AppendPath(subscriptionId, true);
 7255            uri.AppendPath("/resourceGroups/", false);
 7256            uri.AppendPath(resourceGroupName, true);
 7257            uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false);
 7258            uri.AppendPath(loadBalancerName, true);
 7259            uri.AppendQuery("api-version", "2020-04-01", true);
 7260            request.Uri = uri;
 7261            return message;
 62        }
 63
 64        /// <summary> Deletes the specified load balancer. </summary>
 65        /// <param name="resourceGroupName"> The name of the resource group. </param>
 66        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 67        /// <param name="cancellationToken"> The cancellation token to use. </param>
 68        public async Task<Response> DeleteAsync(string resourceGroupName, string loadBalancerName, CancellationToken can
 69        {
 1870            if (resourceGroupName == null)
 71            {
 072                throw new ArgumentNullException(nameof(resourceGroupName));
 73            }
 1874            if (loadBalancerName == null)
 75            {
 076                throw new ArgumentNullException(nameof(loadBalancerName));
 77            }
 78
 1879            using var message = CreateDeleteRequest(resourceGroupName, loadBalancerName);
 1880            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 1881            switch (message.Response.Status)
 82            {
 83                case 200:
 84                case 202:
 85                case 204:
 1886                    return message.Response;
 87                default:
 088                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 89            }
 1890        }
 91
 92        /// <summary> Deletes the specified load balancer. </summary>
 93        /// <param name="resourceGroupName"> The name of the resource group. </param>
 94        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 95        /// <param name="cancellationToken"> The cancellation token to use. </param>
 96        public Response Delete(string resourceGroupName, string loadBalancerName, CancellationToken cancellationToken = 
 97        {
 1898            if (resourceGroupName == null)
 99            {
 0100                throw new ArgumentNullException(nameof(resourceGroupName));
 101            }
 18102            if (loadBalancerName == null)
 103            {
 0104                throw new ArgumentNullException(nameof(loadBalancerName));
 105            }
 106
 18107            using var message = CreateDeleteRequest(resourceGroupName, loadBalancerName);
 18108            _pipeline.Send(message, cancellationToken);
 18109            switch (message.Response.Status)
 110            {
 111                case 200:
 112                case 202:
 113                case 204:
 18114                    return message.Response;
 115                default:
 0116                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 117            }
 18118        }
 119
 120        internal HttpMessage CreateGetRequest(string resourceGroupName, string loadBalancerName, string expand)
 121        {
 64122            var message = _pipeline.CreateMessage();
 64123            var request = message.Request;
 64124            request.Method = RequestMethod.Get;
 64125            var uri = new RawRequestUriBuilder();
 64126            uri.Reset(endpoint);
 64127            uri.AppendPath("/subscriptions/", false);
 64128            uri.AppendPath(subscriptionId, true);
 64129            uri.AppendPath("/resourceGroups/", false);
 64130            uri.AppendPath(resourceGroupName, true);
 64131            uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false);
 64132            uri.AppendPath(loadBalancerName, true);
 64133            uri.AppendQuery("api-version", "2020-04-01", true);
 64134            if (expand != null)
 135            {
 12136                uri.AppendQuery("$expand", expand, true);
 137            }
 64138            request.Uri = uri;
 64139            return message;
 140        }
 141
 142        /// <summary> Gets the specified load balancer. </summary>
 143        /// <param name="resourceGroupName"> The name of the resource group. </param>
 144        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 145        /// <param name="expand"> Expands referenced resources. </param>
 146        /// <param name="cancellationToken"> The cancellation token to use. </param>
 147        public async Task<Response<LoadBalancer>> GetAsync(string resourceGroupName, string loadBalancerName, string exp
 148        {
 32149            if (resourceGroupName == null)
 150            {
 0151                throw new ArgumentNullException(nameof(resourceGroupName));
 152            }
 32153            if (loadBalancerName == null)
 154            {
 0155                throw new ArgumentNullException(nameof(loadBalancerName));
 156            }
 157
 32158            using var message = CreateGetRequest(resourceGroupName, loadBalancerName, expand);
 32159            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 32160            switch (message.Response.Status)
 161            {
 162                case 200:
 163                    {
 32164                        LoadBalancer value = default;
 32165                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 32166                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 167                        {
 0168                            value = null;
 169                        }
 170                        else
 171                        {
 32172                            value = LoadBalancer.DeserializeLoadBalancer(document.RootElement);
 173                        }
 32174                        return Response.FromValue(value, message.Response);
 175                    }
 176                default:
 0177                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 178            }
 32179        }
 180
 181        /// <summary> Gets the specified load balancer. </summary>
 182        /// <param name="resourceGroupName"> The name of the resource group. </param>
 183        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 184        /// <param name="expand"> Expands referenced resources. </param>
 185        /// <param name="cancellationToken"> The cancellation token to use. </param>
 186        public Response<LoadBalancer> Get(string resourceGroupName, string loadBalancerName, string expand = null, Cance
 187        {
 32188            if (resourceGroupName == null)
 189            {
 0190                throw new ArgumentNullException(nameof(resourceGroupName));
 191            }
 32192            if (loadBalancerName == null)
 193            {
 0194                throw new ArgumentNullException(nameof(loadBalancerName));
 195            }
 196
 32197            using var message = CreateGetRequest(resourceGroupName, loadBalancerName, expand);
 32198            _pipeline.Send(message, cancellationToken);
 32199            switch (message.Response.Status)
 200            {
 201                case 200:
 202                    {
 32203                        LoadBalancer value = default;
 32204                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 32205                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 206                        {
 0207                            value = null;
 208                        }
 209                        else
 210                        {
 32211                            value = LoadBalancer.DeserializeLoadBalancer(document.RootElement);
 212                        }
 32213                        return Response.FromValue(value, message.Response);
 214                    }
 215                default:
 0216                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 217            }
 32218        }
 219
 220        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string loadBalancerName, LoadBalancer
 221        {
 104222            var message = _pipeline.CreateMessage();
 104223            var request = message.Request;
 104224            request.Method = RequestMethod.Put;
 104225            var uri = new RawRequestUriBuilder();
 104226            uri.Reset(endpoint);
 104227            uri.AppendPath("/subscriptions/", false);
 104228            uri.AppendPath(subscriptionId, true);
 104229            uri.AppendPath("/resourceGroups/", false);
 104230            uri.AppendPath(resourceGroupName, true);
 104231            uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false);
 104232            uri.AppendPath(loadBalancerName, true);
 104233            uri.AppendQuery("api-version", "2020-04-01", true);
 104234            request.Uri = uri;
 104235            request.Headers.Add("Content-Type", "application/json");
 104236            var content = new Utf8JsonRequestContent();
 104237            content.JsonWriter.WriteObjectValue(parameters);
 104238            request.Content = content;
 104239            return message;
 240        }
 241
 242        /// <summary> Creates or updates a load balancer. </summary>
 243        /// <param name="resourceGroupName"> The name of the resource group. </param>
 244        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 245        /// <param name="parameters"> Parameters supplied to the create or update load balancer operation. </param>
 246        /// <param name="cancellationToken"> The cancellation token to use. </param>
 247        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string loadBalancerName, LoadBalancer 
 248        {
 26249            if (resourceGroupName == null)
 250            {
 0251                throw new ArgumentNullException(nameof(resourceGroupName));
 252            }
 26253            if (loadBalancerName == null)
 254            {
 0255                throw new ArgumentNullException(nameof(loadBalancerName));
 256            }
 26257            if (parameters == null)
 258            {
 0259                throw new ArgumentNullException(nameof(parameters));
 260            }
 261
 26262            using var message = CreateCreateOrUpdateRequest(resourceGroupName, loadBalancerName, parameters);
 26263            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 26264            switch (message.Response.Status)
 265            {
 266                case 200:
 267                case 201:
 26268                    return message.Response;
 269                default:
 0270                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 271            }
 26272        }
 273
 274        /// <summary> Creates or updates a load balancer. </summary>
 275        /// <param name="resourceGroupName"> The name of the resource group. </param>
 276        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 277        /// <param name="parameters"> Parameters supplied to the create or update load balancer operation. </param>
 278        /// <param name="cancellationToken"> The cancellation token to use. </param>
 279        public Response CreateOrUpdate(string resourceGroupName, string loadBalancerName, LoadBalancer parameters, Cance
 280        {
 26281            if (resourceGroupName == null)
 282            {
 0283                throw new ArgumentNullException(nameof(resourceGroupName));
 284            }
 26285            if (loadBalancerName == null)
 286            {
 0287                throw new ArgumentNullException(nameof(loadBalancerName));
 288            }
 26289            if (parameters == null)
 290            {
 0291                throw new ArgumentNullException(nameof(parameters));
 292            }
 293
 26294            using var message = CreateCreateOrUpdateRequest(resourceGroupName, loadBalancerName, parameters);
 26295            _pipeline.Send(message, cancellationToken);
 26296            switch (message.Response.Status)
 297            {
 298                case 200:
 299                case 201:
 26300                    return message.Response;
 301                default:
 0302                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 303            }
 26304        }
 305
 306        internal HttpMessage CreateUpdateTagsRequest(string resourceGroupName, string loadBalancerName, TagsObject param
 307        {
 0308            var message = _pipeline.CreateMessage();
 0309            var request = message.Request;
 0310            request.Method = RequestMethod.Patch;
 0311            var uri = new RawRequestUriBuilder();
 0312            uri.Reset(endpoint);
 0313            uri.AppendPath("/subscriptions/", false);
 0314            uri.AppendPath(subscriptionId, true);
 0315            uri.AppendPath("/resourceGroups/", false);
 0316            uri.AppendPath(resourceGroupName, true);
 0317            uri.AppendPath("/providers/Microsoft.Network/loadBalancers/", false);
 0318            uri.AppendPath(loadBalancerName, true);
 0319            uri.AppendQuery("api-version", "2020-04-01", true);
 0320            request.Uri = uri;
 0321            request.Headers.Add("Content-Type", "application/json");
 0322            var content = new Utf8JsonRequestContent();
 0323            content.JsonWriter.WriteObjectValue(parameters);
 0324            request.Content = content;
 0325            return message;
 326        }
 327
 328        /// <summary> Updates a load balancer tags. </summary>
 329        /// <param name="resourceGroupName"> The name of the resource group. </param>
 330        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 331        /// <param name="parameters"> Parameters supplied to update load balancer tags. </param>
 332        /// <param name="cancellationToken"> The cancellation token to use. </param>
 333        public async Task<Response<LoadBalancer>> UpdateTagsAsync(string resourceGroupName, string loadBalancerName, Tag
 334        {
 0335            if (resourceGroupName == null)
 336            {
 0337                throw new ArgumentNullException(nameof(resourceGroupName));
 338            }
 0339            if (loadBalancerName == null)
 340            {
 0341                throw new ArgumentNullException(nameof(loadBalancerName));
 342            }
 0343            if (parameters == null)
 344            {
 0345                throw new ArgumentNullException(nameof(parameters));
 346            }
 347
 0348            using var message = CreateUpdateTagsRequest(resourceGroupName, loadBalancerName, parameters);
 0349            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0350            switch (message.Response.Status)
 351            {
 352                case 200:
 353                    {
 0354                        LoadBalancer value = default;
 0355                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0356                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 357                        {
 0358                            value = null;
 359                        }
 360                        else
 361                        {
 0362                            value = LoadBalancer.DeserializeLoadBalancer(document.RootElement);
 363                        }
 0364                        return Response.FromValue(value, message.Response);
 365                    }
 366                default:
 0367                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 368            }
 0369        }
 370
 371        /// <summary> Updates a load balancer tags. </summary>
 372        /// <param name="resourceGroupName"> The name of the resource group. </param>
 373        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 374        /// <param name="parameters"> Parameters supplied to update load balancer tags. </param>
 375        /// <param name="cancellationToken"> The cancellation token to use. </param>
 376        public Response<LoadBalancer> UpdateTags(string resourceGroupName, string loadBalancerName, TagsObject parameter
 377        {
 0378            if (resourceGroupName == null)
 379            {
 0380                throw new ArgumentNullException(nameof(resourceGroupName));
 381            }
 0382            if (loadBalancerName == null)
 383            {
 0384                throw new ArgumentNullException(nameof(loadBalancerName));
 385            }
 0386            if (parameters == null)
 387            {
 0388                throw new ArgumentNullException(nameof(parameters));
 389            }
 390
 0391            using var message = CreateUpdateTagsRequest(resourceGroupName, loadBalancerName, parameters);
 0392            _pipeline.Send(message, cancellationToken);
 0393            switch (message.Response.Status)
 394            {
 395                case 200:
 396                    {
 0397                        LoadBalancer value = default;
 0398                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0399                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 400                        {
 0401                            value = null;
 402                        }
 403                        else
 404                        {
 0405                            value = LoadBalancer.DeserializeLoadBalancer(document.RootElement);
 406                        }
 0407                        return Response.FromValue(value, message.Response);
 408                    }
 409                default:
 0410                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 411            }
 0412        }
 413
 414        internal HttpMessage CreateListAllRequest()
 415        {
 12416            var message = _pipeline.CreateMessage();
 12417            var request = message.Request;
 12418            request.Method = RequestMethod.Get;
 12419            var uri = new RawRequestUriBuilder();
 12420            uri.Reset(endpoint);
 12421            uri.AppendPath("/subscriptions/", false);
 12422            uri.AppendPath(subscriptionId, true);
 12423            uri.AppendPath("/providers/Microsoft.Network/loadBalancers", false);
 12424            uri.AppendQuery("api-version", "2020-04-01", true);
 12425            request.Uri = uri;
 12426            return message;
 427        }
 428
 429        /// <summary> Gets all the load balancers in a subscription. </summary>
 430        /// <param name="cancellationToken"> The cancellation token to use. </param>
 431        public async Task<Response<LoadBalancerListResult>> ListAllAsync(CancellationToken cancellationToken = default)
 432        {
 6433            using var message = CreateListAllRequest();
 6434            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6435            switch (message.Response.Status)
 436            {
 437                case 200:
 438                    {
 6439                        LoadBalancerListResult value = default;
 6440                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 6441                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 442                        {
 0443                            value = null;
 444                        }
 445                        else
 446                        {
 6447                            value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement);
 448                        }
 6449                        return Response.FromValue(value, message.Response);
 450                    }
 451                default:
 0452                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 453            }
 6454        }
 455
 456        /// <summary> Gets all the load balancers in a subscription. </summary>
 457        /// <param name="cancellationToken"> The cancellation token to use. </param>
 458        public Response<LoadBalancerListResult> ListAll(CancellationToken cancellationToken = default)
 459        {
 6460            using var message = CreateListAllRequest();
 6461            _pipeline.Send(message, cancellationToken);
 6462            switch (message.Response.Status)
 463            {
 464                case 200:
 465                    {
 6466                        LoadBalancerListResult value = default;
 6467                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6468                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 469                        {
 0470                            value = null;
 471                        }
 472                        else
 473                        {
 6474                            value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement);
 475                        }
 6476                        return Response.FromValue(value, message.Response);
 477                    }
 478                default:
 0479                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 480            }
 6481        }
 482
 483        internal HttpMessage CreateListRequest(string resourceGroupName)
 484        {
 52485            var message = _pipeline.CreateMessage();
 52486            var request = message.Request;
 52487            request.Method = RequestMethod.Get;
 52488            var uri = new RawRequestUriBuilder();
 52489            uri.Reset(endpoint);
 52490            uri.AppendPath("/subscriptions/", false);
 52491            uri.AppendPath(subscriptionId, true);
 52492            uri.AppendPath("/resourceGroups/", false);
 52493            uri.AppendPath(resourceGroupName, true);
 52494            uri.AppendPath("/providers/Microsoft.Network/loadBalancers", false);
 52495            uri.AppendQuery("api-version", "2020-04-01", true);
 52496            request.Uri = uri;
 52497            return message;
 498        }
 499
 500        /// <summary> Gets all the load balancers in a resource group. </summary>
 501        /// <param name="resourceGroupName"> The name of the resource group. </param>
 502        /// <param name="cancellationToken"> The cancellation token to use. </param>
 503        public async Task<Response<LoadBalancerListResult>> ListAsync(string resourceGroupName, CancellationToken cancel
 504        {
 26505            if (resourceGroupName == null)
 506            {
 0507                throw new ArgumentNullException(nameof(resourceGroupName));
 508            }
 509
 26510            using var message = CreateListRequest(resourceGroupName);
 26511            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 26512            switch (message.Response.Status)
 513            {
 514                case 200:
 515                    {
 26516                        LoadBalancerListResult value = default;
 26517                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 26518                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 519                        {
 0520                            value = null;
 521                        }
 522                        else
 523                        {
 26524                            value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement);
 525                        }
 26526                        return Response.FromValue(value, message.Response);
 527                    }
 528                default:
 0529                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 530            }
 26531        }
 532
 533        /// <summary> Gets all the load balancers in a resource group. </summary>
 534        /// <param name="resourceGroupName"> The name of the resource group. </param>
 535        /// <param name="cancellationToken"> The cancellation token to use. </param>
 536        public Response<LoadBalancerListResult> List(string resourceGroupName, CancellationToken cancellationToken = def
 537        {
 26538            if (resourceGroupName == null)
 539            {
 0540                throw new ArgumentNullException(nameof(resourceGroupName));
 541            }
 542
 26543            using var message = CreateListRequest(resourceGroupName);
 26544            _pipeline.Send(message, cancellationToken);
 26545            switch (message.Response.Status)
 546            {
 547                case 200:
 548                    {
 26549                        LoadBalancerListResult value = default;
 26550                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 26551                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 552                        {
 0553                            value = null;
 554                        }
 555                        else
 556                        {
 26557                            value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement);
 558                        }
 26559                        return Response.FromValue(value, message.Response);
 560                    }
 561                default:
 0562                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 563            }
 26564        }
 565
 566        internal HttpMessage CreateListAllNextPageRequest(string nextLink)
 567        {
 0568            var message = _pipeline.CreateMessage();
 0569            var request = message.Request;
 0570            request.Method = RequestMethod.Get;
 0571            var uri = new RawRequestUriBuilder();
 0572            uri.Reset(endpoint);
 0573            uri.AppendRawNextLink(nextLink, false);
 0574            request.Uri = uri;
 0575            return message;
 576        }
 577
 578        /// <summary> Gets all the load balancers in a subscription. </summary>
 579        /// <param name="nextLink"> The URL to the next page of results. </param>
 580        /// <param name="cancellationToken"> The cancellation token to use. </param>
 581        public async Task<Response<LoadBalancerListResult>> ListAllNextPageAsync(string nextLink, CancellationToken canc
 582        {
 0583            if (nextLink == null)
 584            {
 0585                throw new ArgumentNullException(nameof(nextLink));
 586            }
 587
 0588            using var message = CreateListAllNextPageRequest(nextLink);
 0589            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0590            switch (message.Response.Status)
 591            {
 592                case 200:
 593                    {
 0594                        LoadBalancerListResult value = default;
 0595                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0596                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 597                        {
 0598                            value = null;
 599                        }
 600                        else
 601                        {
 0602                            value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement);
 603                        }
 0604                        return Response.FromValue(value, message.Response);
 605                    }
 606                default:
 0607                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 608            }
 0609        }
 610
 611        /// <summary> Gets all the load balancers in a subscription. </summary>
 612        /// <param name="nextLink"> The URL to the next page of results. </param>
 613        /// <param name="cancellationToken"> The cancellation token to use. </param>
 614        public Response<LoadBalancerListResult> ListAllNextPage(string nextLink, CancellationToken cancellationToken = d
 615        {
 0616            if (nextLink == null)
 617            {
 0618                throw new ArgumentNullException(nameof(nextLink));
 619            }
 620
 0621            using var message = CreateListAllNextPageRequest(nextLink);
 0622            _pipeline.Send(message, cancellationToken);
 0623            switch (message.Response.Status)
 624            {
 625                case 200:
 626                    {
 0627                        LoadBalancerListResult value = default;
 0628                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0629                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 630                        {
 0631                            value = null;
 632                        }
 633                        else
 634                        {
 0635                            value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement);
 636                        }
 0637                        return Response.FromValue(value, message.Response);
 638                    }
 639                default:
 0640                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 641            }
 0642        }
 643
 644        internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName)
 645        {
 0646            var message = _pipeline.CreateMessage();
 0647            var request = message.Request;
 0648            request.Method = RequestMethod.Get;
 0649            var uri = new RawRequestUriBuilder();
 0650            uri.Reset(endpoint);
 0651            uri.AppendRawNextLink(nextLink, false);
 0652            request.Uri = uri;
 0653            return message;
 654        }
 655
 656        /// <summary> Gets all the load balancers in a resource group. </summary>
 657        /// <param name="nextLink"> The URL to the next page of results. </param>
 658        /// <param name="resourceGroupName"> The name of the resource group. </param>
 659        /// <param name="cancellationToken"> The cancellation token to use. </param>
 660        public async Task<Response<LoadBalancerListResult>> ListNextPageAsync(string nextLink, string resourceGroupName,
 661        {
 0662            if (nextLink == null)
 663            {
 0664                throw new ArgumentNullException(nameof(nextLink));
 665            }
 0666            if (resourceGroupName == null)
 667            {
 0668                throw new ArgumentNullException(nameof(resourceGroupName));
 669            }
 670
 0671            using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
 0672            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0673            switch (message.Response.Status)
 674            {
 675                case 200:
 676                    {
 0677                        LoadBalancerListResult value = default;
 0678                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0679                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 680                        {
 0681                            value = null;
 682                        }
 683                        else
 684                        {
 0685                            value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement);
 686                        }
 0687                        return Response.FromValue(value, message.Response);
 688                    }
 689                default:
 0690                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 691            }
 0692        }
 693
 694        /// <summary> Gets all the load balancers in a resource group. </summary>
 695        /// <param name="nextLink"> The URL to the next page of results. </param>
 696        /// <param name="resourceGroupName"> The name of the resource group. </param>
 697        /// <param name="cancellationToken"> The cancellation token to use. </param>
 698        public Response<LoadBalancerListResult> ListNextPage(string nextLink, string resourceGroupName, CancellationToke
 699        {
 0700            if (nextLink == null)
 701            {
 0702                throw new ArgumentNullException(nameof(nextLink));
 703            }
 0704            if (resourceGroupName == null)
 705            {
 0706                throw new ArgumentNullException(nameof(resourceGroupName));
 707            }
 708
 0709            using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
 0710            _pipeline.Send(message, cancellationToken);
 0711            switch (message.Response.Status)
 712            {
 713                case 200:
 714                    {
 0715                        LoadBalancerListResult value = default;
 0716                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0717                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 718                        {
 0719                            value = null;
 720                        }
 721                        else
 722                        {
 0723                            value = LoadBalancerListResult.DeserializeLoadBalancerListResult(document.RootElement);
 724                        }
 0725                        return Response.FromValue(value, message.Response);
 726                    }
 727                default:
 0728                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 729            }
 0730        }
 731    }
 732}