< Summary

Class:Azure.ResourceManager.Network.VirtualRoutersRestOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\VirtualRoutersRestOperations.cs
Covered lines:0
Uncovered lines:275
Coverable lines:275
Total lines:624
Line coverage:0% (0 of 275)
Covered branches:0
Total branches:106
Branch coverage:0% (0 of 106)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateDeleteRequest(...)-0%100%
DeleteAsync()-0%0%
Delete(...)-0%0%
CreateGetRequest(...)-0%0%
GetAsync()-0%0%
Get(...)-0%0%
CreateCreateOrUpdateRequest(...)-0%100%
CreateOrUpdateAsync()-0%0%
CreateOrUpdate(...)-0%0%
CreateListByResourceGroupRequest(...)-0%100%
ListByResourceGroupAsync()-0%0%
ListByResourceGroup(...)-0%0%
CreateListRequest()-0%100%
ListAsync()-0%0%
List(...)-0%0%
CreateListByResourceGroupNextPageRequest(...)-0%100%
ListByResourceGroupNextPageAsync()-0%0%
ListByResourceGroupNextPage(...)-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\VirtualRoutersRestOperations.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 VirtualRoutersRestOperations
 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 VirtualRoutersRestOperations. </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
 032        public VirtualRoutersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscript
 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 CreateDeleteRequest(string resourceGroupName, string virtualRouterName)
 47        {
 048            var message = _pipeline.CreateMessage();
 049            var request = message.Request;
 050            request.Method = RequestMethod.Delete;
 051            var uri = new RawRequestUriBuilder();
 052            uri.Reset(endpoint);
 053            uri.AppendPath("/subscriptions/", false);
 054            uri.AppendPath(subscriptionId, true);
 055            uri.AppendPath("/resourceGroups/", false);
 056            uri.AppendPath(resourceGroupName, true);
 057            uri.AppendPath("/providers/Microsoft.Network/virtualRouters/", false);
 058            uri.AppendPath(virtualRouterName, true);
 059            uri.AppendQuery("api-version", "2020-04-01", true);
 060            request.Uri = uri;
 061            return message;
 62        }
 63
 64        /// <summary> Deletes the specified Virtual Router. </summary>
 65        /// <param name="resourceGroupName"> The name of the resource group. </param>
 66        /// <param name="virtualRouterName"> The name of the Virtual Router. </param>
 67        /// <param name="cancellationToken"> The cancellation token to use. </param>
 68        public async Task<Response> DeleteAsync(string resourceGroupName, string virtualRouterName, CancellationToken ca
 69        {
 070            if (resourceGroupName == null)
 71            {
 072                throw new ArgumentNullException(nameof(resourceGroupName));
 73            }
 074            if (virtualRouterName == null)
 75            {
 076                throw new ArgumentNullException(nameof(virtualRouterName));
 77            }
 78
 079            using var message = CreateDeleteRequest(resourceGroupName, virtualRouterName);
 080            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 081            switch (message.Response.Status)
 82            {
 83                case 200:
 84                case 202:
 85                case 204:
 086                    return message.Response;
 87                default:
 088                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 89            }
 090        }
 91
 92        /// <summary> Deletes the specified Virtual Router. </summary>
 93        /// <param name="resourceGroupName"> The name of the resource group. </param>
 94        /// <param name="virtualRouterName"> The name of the Virtual Router. </param>
 95        /// <param name="cancellationToken"> The cancellation token to use. </param>
 96        public Response Delete(string resourceGroupName, string virtualRouterName, CancellationToken cancellationToken =
 97        {
 098            if (resourceGroupName == null)
 99            {
 0100                throw new ArgumentNullException(nameof(resourceGroupName));
 101            }
 0102            if (virtualRouterName == null)
 103            {
 0104                throw new ArgumentNullException(nameof(virtualRouterName));
 105            }
 106
 0107            using var message = CreateDeleteRequest(resourceGroupName, virtualRouterName);
 0108            _pipeline.Send(message, cancellationToken);
 0109            switch (message.Response.Status)
 110            {
 111                case 200:
 112                case 202:
 113                case 204:
 0114                    return message.Response;
 115                default:
 0116                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 117            }
 0118        }
 119
 120        internal HttpMessage CreateGetRequest(string resourceGroupName, string virtualRouterName, string expand)
 121        {
 0122            var message = _pipeline.CreateMessage();
 0123            var request = message.Request;
 0124            request.Method = RequestMethod.Get;
 0125            var uri = new RawRequestUriBuilder();
 0126            uri.Reset(endpoint);
 0127            uri.AppendPath("/subscriptions/", false);
 0128            uri.AppendPath(subscriptionId, true);
 0129            uri.AppendPath("/resourceGroups/", false);
 0130            uri.AppendPath(resourceGroupName, true);
 0131            uri.AppendPath("/providers/Microsoft.Network/virtualRouters/", false);
 0132            uri.AppendPath(virtualRouterName, true);
 0133            uri.AppendQuery("api-version", "2020-04-01", true);
 0134            if (expand != null)
 135            {
 0136                uri.AppendQuery("$expand", expand, true);
 137            }
 0138            request.Uri = uri;
 0139            return message;
 140        }
 141
 142        /// <summary> Gets the specified Virtual Router. </summary>
 143        /// <param name="resourceGroupName"> The name of the resource group. </param>
 144        /// <param name="virtualRouterName"> The name of the Virtual Router. </param>
 145        /// <param name="expand"> Expands referenced resources. </param>
 146        /// <param name="cancellationToken"> The cancellation token to use. </param>
 147        public async Task<Response<VirtualRouter>> GetAsync(string resourceGroupName, string virtualRouterName, string e
 148        {
 0149            if (resourceGroupName == null)
 150            {
 0151                throw new ArgumentNullException(nameof(resourceGroupName));
 152            }
 0153            if (virtualRouterName == null)
 154            {
 0155                throw new ArgumentNullException(nameof(virtualRouterName));
 156            }
 157
 0158            using var message = CreateGetRequest(resourceGroupName, virtualRouterName, expand);
 0159            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0160            switch (message.Response.Status)
 161            {
 162                case 200:
 163                    {
 0164                        VirtualRouter value = default;
 0165                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0166                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 167                        {
 0168                            value = null;
 169                        }
 170                        else
 171                        {
 0172                            value = VirtualRouter.DeserializeVirtualRouter(document.RootElement);
 173                        }
 0174                        return Response.FromValue(value, message.Response);
 175                    }
 176                default:
 0177                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 178            }
 0179        }
 180
 181        /// <summary> Gets the specified Virtual Router. </summary>
 182        /// <param name="resourceGroupName"> The name of the resource group. </param>
 183        /// <param name="virtualRouterName"> The name of the Virtual Router. </param>
 184        /// <param name="expand"> Expands referenced resources. </param>
 185        /// <param name="cancellationToken"> The cancellation token to use. </param>
 186        public Response<VirtualRouter> Get(string resourceGroupName, string virtualRouterName, string expand = null, Can
 187        {
 0188            if (resourceGroupName == null)
 189            {
 0190                throw new ArgumentNullException(nameof(resourceGroupName));
 191            }
 0192            if (virtualRouterName == null)
 193            {
 0194                throw new ArgumentNullException(nameof(virtualRouterName));
 195            }
 196
 0197            using var message = CreateGetRequest(resourceGroupName, virtualRouterName, expand);
 0198            _pipeline.Send(message, cancellationToken);
 0199            switch (message.Response.Status)
 200            {
 201                case 200:
 202                    {
 0203                        VirtualRouter value = default;
 0204                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0205                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 206                        {
 0207                            value = null;
 208                        }
 209                        else
 210                        {
 0211                            value = VirtualRouter.DeserializeVirtualRouter(document.RootElement);
 212                        }
 0213                        return Response.FromValue(value, message.Response);
 214                    }
 215                default:
 0216                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 217            }
 0218        }
 219
 220        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string virtualRouterName, VirtualRout
 221        {
 0222            var message = _pipeline.CreateMessage();
 0223            var request = message.Request;
 0224            request.Method = RequestMethod.Put;
 0225            var uri = new RawRequestUriBuilder();
 0226            uri.Reset(endpoint);
 0227            uri.AppendPath("/subscriptions/", false);
 0228            uri.AppendPath(subscriptionId, true);
 0229            uri.AppendPath("/resourceGroups/", false);
 0230            uri.AppendPath(resourceGroupName, true);
 0231            uri.AppendPath("/providers/Microsoft.Network/virtualRouters/", false);
 0232            uri.AppendPath(virtualRouterName, true);
 0233            uri.AppendQuery("api-version", "2020-04-01", true);
 0234            request.Uri = uri;
 0235            request.Headers.Add("Content-Type", "application/json");
 0236            var content = new Utf8JsonRequestContent();
 0237            content.JsonWriter.WriteObjectValue(parameters);
 0238            request.Content = content;
 0239            return message;
 240        }
 241
 242        /// <summary> Creates or updates the specified Virtual Router. </summary>
 243        /// <param name="resourceGroupName"> The name of the resource group. </param>
 244        /// <param name="virtualRouterName"> The name of the Virtual Router. </param>
 245        /// <param name="parameters"> Parameters supplied to the create or update Virtual Router. </param>
 246        /// <param name="cancellationToken"> The cancellation token to use. </param>
 247        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string virtualRouterName, VirtualRoute
 248        {
 0249            if (resourceGroupName == null)
 250            {
 0251                throw new ArgumentNullException(nameof(resourceGroupName));
 252            }
 0253            if (virtualRouterName == null)
 254            {
 0255                throw new ArgumentNullException(nameof(virtualRouterName));
 256            }
 0257            if (parameters == null)
 258            {
 0259                throw new ArgumentNullException(nameof(parameters));
 260            }
 261
 0262            using var message = CreateCreateOrUpdateRequest(resourceGroupName, virtualRouterName, parameters);
 0263            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0264            switch (message.Response.Status)
 265            {
 266                case 200:
 267                case 201:
 0268                    return message.Response;
 269                default:
 0270                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 271            }
 0272        }
 273
 274        /// <summary> Creates or updates the specified Virtual Router. </summary>
 275        /// <param name="resourceGroupName"> The name of the resource group. </param>
 276        /// <param name="virtualRouterName"> The name of the Virtual Router. </param>
 277        /// <param name="parameters"> Parameters supplied to the create or update Virtual Router. </param>
 278        /// <param name="cancellationToken"> The cancellation token to use. </param>
 279        public Response CreateOrUpdate(string resourceGroupName, string virtualRouterName, VirtualRouter parameters, Can
 280        {
 0281            if (resourceGroupName == null)
 282            {
 0283                throw new ArgumentNullException(nameof(resourceGroupName));
 284            }
 0285            if (virtualRouterName == null)
 286            {
 0287                throw new ArgumentNullException(nameof(virtualRouterName));
 288            }
 0289            if (parameters == null)
 290            {
 0291                throw new ArgumentNullException(nameof(parameters));
 292            }
 293
 0294            using var message = CreateCreateOrUpdateRequest(resourceGroupName, virtualRouterName, parameters);
 0295            _pipeline.Send(message, cancellationToken);
 0296            switch (message.Response.Status)
 297            {
 298                case 200:
 299                case 201:
 0300                    return message.Response;
 301                default:
 0302                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 303            }
 0304        }
 305
 306        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 307        {
 0308            var message = _pipeline.CreateMessage();
 0309            var request = message.Request;
 0310            request.Method = RequestMethod.Get;
 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/virtualRouters", false);
 0318            uri.AppendQuery("api-version", "2020-04-01", true);
 0319            request.Uri = uri;
 0320            return message;
 321        }
 322
 323        /// <summary> Lists all Virtual Routers in a resource group. </summary>
 324        /// <param name="resourceGroupName"> The name of the resource group. </param>
 325        /// <param name="cancellationToken"> The cancellation token to use. </param>
 326        public async Task<Response<VirtualRouterListResult>> ListByResourceGroupAsync(string resourceGroupName, Cancella
 327        {
 0328            if (resourceGroupName == null)
 329            {
 0330                throw new ArgumentNullException(nameof(resourceGroupName));
 331            }
 332
 0333            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0334            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0335            switch (message.Response.Status)
 336            {
 337                case 200:
 338                    {
 0339                        VirtualRouterListResult value = default;
 0340                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0341                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 342                        {
 0343                            value = null;
 344                        }
 345                        else
 346                        {
 0347                            value = VirtualRouterListResult.DeserializeVirtualRouterListResult(document.RootElement);
 348                        }
 0349                        return Response.FromValue(value, message.Response);
 350                    }
 351                default:
 0352                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 353            }
 0354        }
 355
 356        /// <summary> Lists all Virtual Routers in a resource group. </summary>
 357        /// <param name="resourceGroupName"> The name of the resource group. </param>
 358        /// <param name="cancellationToken"> The cancellation token to use. </param>
 359        public Response<VirtualRouterListResult> ListByResourceGroup(string resourceGroupName, CancellationToken cancell
 360        {
 0361            if (resourceGroupName == null)
 362            {
 0363                throw new ArgumentNullException(nameof(resourceGroupName));
 364            }
 365
 0366            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0367            _pipeline.Send(message, cancellationToken);
 0368            switch (message.Response.Status)
 369            {
 370                case 200:
 371                    {
 0372                        VirtualRouterListResult value = default;
 0373                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0374                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 375                        {
 0376                            value = null;
 377                        }
 378                        else
 379                        {
 0380                            value = VirtualRouterListResult.DeserializeVirtualRouterListResult(document.RootElement);
 381                        }
 0382                        return Response.FromValue(value, message.Response);
 383                    }
 384                default:
 0385                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 386            }
 0387        }
 388
 389        internal HttpMessage CreateListRequest()
 390        {
 0391            var message = _pipeline.CreateMessage();
 0392            var request = message.Request;
 0393            request.Method = RequestMethod.Get;
 0394            var uri = new RawRequestUriBuilder();
 0395            uri.Reset(endpoint);
 0396            uri.AppendPath("/subscriptions/", false);
 0397            uri.AppendPath(subscriptionId, true);
 0398            uri.AppendPath("/providers/Microsoft.Network/virtualRouters", false);
 0399            uri.AppendQuery("api-version", "2020-04-01", true);
 0400            request.Uri = uri;
 0401            return message;
 402        }
 403
 404        /// <summary> Gets all the Virtual Routers in a subscription. </summary>
 405        /// <param name="cancellationToken"> The cancellation token to use. </param>
 406        public async Task<Response<VirtualRouterListResult>> ListAsync(CancellationToken cancellationToken = default)
 407        {
 0408            using var message = CreateListRequest();
 0409            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0410            switch (message.Response.Status)
 411            {
 412                case 200:
 413                    {
 0414                        VirtualRouterListResult value = default;
 0415                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0416                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 417                        {
 0418                            value = null;
 419                        }
 420                        else
 421                        {
 0422                            value = VirtualRouterListResult.DeserializeVirtualRouterListResult(document.RootElement);
 423                        }
 0424                        return Response.FromValue(value, message.Response);
 425                    }
 426                default:
 0427                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 428            }
 0429        }
 430
 431        /// <summary> Gets all the Virtual Routers in a subscription. </summary>
 432        /// <param name="cancellationToken"> The cancellation token to use. </param>
 433        public Response<VirtualRouterListResult> List(CancellationToken cancellationToken = default)
 434        {
 0435            using var message = CreateListRequest();
 0436            _pipeline.Send(message, cancellationToken);
 0437            switch (message.Response.Status)
 438            {
 439                case 200:
 440                    {
 0441                        VirtualRouterListResult value = default;
 0442                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0443                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 444                        {
 0445                            value = null;
 446                        }
 447                        else
 448                        {
 0449                            value = VirtualRouterListResult.DeserializeVirtualRouterListResult(document.RootElement);
 450                        }
 0451                        return Response.FromValue(value, message.Response);
 452                    }
 453                default:
 0454                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 455            }
 0456        }
 457
 458        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 459        {
 0460            var message = _pipeline.CreateMessage();
 0461            var request = message.Request;
 0462            request.Method = RequestMethod.Get;
 0463            var uri = new RawRequestUriBuilder();
 0464            uri.Reset(endpoint);
 0465            uri.AppendRawNextLink(nextLink, false);
 0466            request.Uri = uri;
 0467            return message;
 468        }
 469
 470        /// <summary> Lists all Virtual Routers in a resource group. </summary>
 471        /// <param name="nextLink"> The URL to the next page of results. </param>
 472        /// <param name="resourceGroupName"> The name of the resource group. </param>
 473        /// <param name="cancellationToken"> The cancellation token to use. </param>
 474        public async Task<Response<VirtualRouterListResult>> ListByResourceGroupNextPageAsync(string nextLink, string re
 475        {
 0476            if (nextLink == null)
 477            {
 0478                throw new ArgumentNullException(nameof(nextLink));
 479            }
 0480            if (resourceGroupName == null)
 481            {
 0482                throw new ArgumentNullException(nameof(resourceGroupName));
 483            }
 484
 0485            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0486            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0487            switch (message.Response.Status)
 488            {
 489                case 200:
 490                    {
 0491                        VirtualRouterListResult value = default;
 0492                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0493                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 494                        {
 0495                            value = null;
 496                        }
 497                        else
 498                        {
 0499                            value = VirtualRouterListResult.DeserializeVirtualRouterListResult(document.RootElement);
 500                        }
 0501                        return Response.FromValue(value, message.Response);
 502                    }
 503                default:
 0504                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 505            }
 0506        }
 507
 508        /// <summary> Lists all Virtual Routers in a resource group. </summary>
 509        /// <param name="nextLink"> The URL to the next page of results. </param>
 510        /// <param name="resourceGroupName"> The name of the resource group. </param>
 511        /// <param name="cancellationToken"> The cancellation token to use. </param>
 512        public Response<VirtualRouterListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, 
 513        {
 0514            if (nextLink == null)
 515            {
 0516                throw new ArgumentNullException(nameof(nextLink));
 517            }
 0518            if (resourceGroupName == null)
 519            {
 0520                throw new ArgumentNullException(nameof(resourceGroupName));
 521            }
 522
 0523            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0524            _pipeline.Send(message, cancellationToken);
 0525            switch (message.Response.Status)
 526            {
 527                case 200:
 528                    {
 0529                        VirtualRouterListResult value = default;
 0530                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0531                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 532                        {
 0533                            value = null;
 534                        }
 535                        else
 536                        {
 0537                            value = VirtualRouterListResult.DeserializeVirtualRouterListResult(document.RootElement);
 538                        }
 0539                        return Response.FromValue(value, message.Response);
 540                    }
 541                default:
 0542                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 543            }
 0544        }
 545
 546        internal HttpMessage CreateListNextPageRequest(string nextLink)
 547        {
 0548            var message = _pipeline.CreateMessage();
 0549            var request = message.Request;
 0550            request.Method = RequestMethod.Get;
 0551            var uri = new RawRequestUriBuilder();
 0552            uri.Reset(endpoint);
 0553            uri.AppendRawNextLink(nextLink, false);
 0554            request.Uri = uri;
 0555            return message;
 556        }
 557
 558        /// <summary> Gets all the Virtual Routers in a subscription. </summary>
 559        /// <param name="nextLink"> The URL to the next page of results. </param>
 560        /// <param name="cancellationToken"> The cancellation token to use. </param>
 561        public async Task<Response<VirtualRouterListResult>> ListNextPageAsync(string nextLink, CancellationToken cancel
 562        {
 0563            if (nextLink == null)
 564            {
 0565                throw new ArgumentNullException(nameof(nextLink));
 566            }
 567
 0568            using var message = CreateListNextPageRequest(nextLink);
 0569            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0570            switch (message.Response.Status)
 571            {
 572                case 200:
 573                    {
 0574                        VirtualRouterListResult value = default;
 0575                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0576                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 577                        {
 0578                            value = null;
 579                        }
 580                        else
 581                        {
 0582                            value = VirtualRouterListResult.DeserializeVirtualRouterListResult(document.RootElement);
 583                        }
 0584                        return Response.FromValue(value, message.Response);
 585                    }
 586                default:
 0587                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 588            }
 0589        }
 590
 591        /// <summary> Gets all the Virtual Routers in a subscription. </summary>
 592        /// <param name="nextLink"> The URL to the next page of results. </param>
 593        /// <param name="cancellationToken"> The cancellation token to use. </param>
 594        public Response<VirtualRouterListResult> ListNextPage(string nextLink, CancellationToken cancellationToken = def
 595        {
 0596            if (nextLink == null)
 597            {
 0598                throw new ArgumentNullException(nameof(nextLink));
 599            }
 600
 0601            using var message = CreateListNextPageRequest(nextLink);
 0602            _pipeline.Send(message, cancellationToken);
 0603            switch (message.Response.Status)
 604            {
 605                case 200:
 606                    {
 0607                        VirtualRouterListResult value = default;
 0608                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0609                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 610                        {
 0611                            value = null;
 612                        }
 613                        else
 614                        {
 0615                            value = VirtualRouterListResult.DeserializeVirtualRouterListResult(document.RootElement);
 616                        }
 0617                        return Response.FromValue(value, message.Response);
 618                    }
 619                default:
 0620                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 621            }
 0622        }
 623    }
 624}