< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateGetRequest(...)-0%100%
GetAsync()-0%0%
Get(...)-0%0%
CreateCreateOrUpdateRequest(...)-0%100%
CreateOrUpdateAsync()-0%0%
CreateOrUpdate(...)-0%0%
CreateUpdateTagsRequest(...)-0%100%
UpdateTagsAsync()-0%0%
UpdateTags(...)-0%0%
CreateDeleteRequest(...)-0%100%
DeleteAsync()-0%0%
Delete(...)-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\VirtualHubsRestOperations.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 VirtualHubsRestOperations
 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 VirtualHubsRestOperations. </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 VirtualHubsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscription
 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 CreateGetRequest(string resourceGroupName, string virtualHubName)
 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("/resourceGroups/", false);
 056            uri.AppendPath(resourceGroupName, true);
 057            uri.AppendPath("/providers/Microsoft.Network/virtualHubs/", false);
 058            uri.AppendPath(virtualHubName, true);
 059            uri.AppendQuery("api-version", "2020-04-01", true);
 060            request.Uri = uri;
 061            return message;
 62        }
 63
 64        /// <summary> Retrieves the details of a VirtualHub. </summary>
 65        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 66        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 67        /// <param name="cancellationToken"> The cancellation token to use. </param>
 68        public async Task<Response<VirtualHub>> GetAsync(string resourceGroupName, string virtualHubName, CancellationTo
 69        {
 070            if (resourceGroupName == null)
 71            {
 072                throw new ArgumentNullException(nameof(resourceGroupName));
 73            }
 074            if (virtualHubName == null)
 75            {
 076                throw new ArgumentNullException(nameof(virtualHubName));
 77            }
 78
 079            using var message = CreateGetRequest(resourceGroupName, virtualHubName);
 080            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 081            switch (message.Response.Status)
 82            {
 83                case 200:
 84                    {
 085                        VirtualHub value = default;
 086                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 087                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 88                        {
 089                            value = null;
 90                        }
 91                        else
 92                        {
 093                            value = VirtualHub.DeserializeVirtualHub(document.RootElement);
 94                        }
 095                        return Response.FromValue(value, message.Response);
 96                    }
 97                default:
 098                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 99            }
 0100        }
 101
 102        /// <summary> Retrieves the details of a VirtualHub. </summary>
 103        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 104        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 105        /// <param name="cancellationToken"> The cancellation token to use. </param>
 106        public Response<VirtualHub> Get(string resourceGroupName, string virtualHubName, CancellationToken cancellationT
 107        {
 0108            if (resourceGroupName == null)
 109            {
 0110                throw new ArgumentNullException(nameof(resourceGroupName));
 111            }
 0112            if (virtualHubName == null)
 113            {
 0114                throw new ArgumentNullException(nameof(virtualHubName));
 115            }
 116
 0117            using var message = CreateGetRequest(resourceGroupName, virtualHubName);
 0118            _pipeline.Send(message, cancellationToken);
 0119            switch (message.Response.Status)
 120            {
 121                case 200:
 122                    {
 0123                        VirtualHub value = default;
 0124                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0125                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 126                        {
 0127                            value = null;
 128                        }
 129                        else
 130                        {
 0131                            value = VirtualHub.DeserializeVirtualHub(document.RootElement);
 132                        }
 0133                        return Response.FromValue(value, message.Response);
 134                    }
 135                default:
 0136                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 137            }
 0138        }
 139
 140        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string virtualHubName, VirtualHub vir
 141        {
 0142            var message = _pipeline.CreateMessage();
 0143            var request = message.Request;
 0144            request.Method = RequestMethod.Put;
 0145            var uri = new RawRequestUriBuilder();
 0146            uri.Reset(endpoint);
 0147            uri.AppendPath("/subscriptions/", false);
 0148            uri.AppendPath(subscriptionId, true);
 0149            uri.AppendPath("/resourceGroups/", false);
 0150            uri.AppendPath(resourceGroupName, true);
 0151            uri.AppendPath("/providers/Microsoft.Network/virtualHubs/", false);
 0152            uri.AppendPath(virtualHubName, true);
 0153            uri.AppendQuery("api-version", "2020-04-01", true);
 0154            request.Uri = uri;
 0155            request.Headers.Add("Content-Type", "application/json");
 0156            var content = new Utf8JsonRequestContent();
 0157            content.JsonWriter.WriteObjectValue(virtualHubParameters);
 0158            request.Content = content;
 0159            return message;
 160        }
 161
 162        /// <summary> Creates a VirtualHub resource if it doesn&apos;t exist else updates the existing VirtualHub. </sum
 163        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 164        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 165        /// <param name="virtualHubParameters"> Parameters supplied to create or update VirtualHub. </param>
 166        /// <param name="cancellationToken"> The cancellation token to use. </param>
 167        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string virtualHubName, VirtualHub virt
 168        {
 0169            if (resourceGroupName == null)
 170            {
 0171                throw new ArgumentNullException(nameof(resourceGroupName));
 172            }
 0173            if (virtualHubName == null)
 174            {
 0175                throw new ArgumentNullException(nameof(virtualHubName));
 176            }
 0177            if (virtualHubParameters == null)
 178            {
 0179                throw new ArgumentNullException(nameof(virtualHubParameters));
 180            }
 181
 0182            using var message = CreateCreateOrUpdateRequest(resourceGroupName, virtualHubName, virtualHubParameters);
 0183            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0184            switch (message.Response.Status)
 185            {
 186                case 200:
 187                case 201:
 0188                    return message.Response;
 189                default:
 0190                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 191            }
 0192        }
 193
 194        /// <summary> Creates a VirtualHub resource if it doesn&apos;t exist else updates the existing VirtualHub. </sum
 195        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 196        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 197        /// <param name="virtualHubParameters"> Parameters supplied to create or update VirtualHub. </param>
 198        /// <param name="cancellationToken"> The cancellation token to use. </param>
 199        public Response CreateOrUpdate(string resourceGroupName, string virtualHubName, VirtualHub virtualHubParameters,
 200        {
 0201            if (resourceGroupName == null)
 202            {
 0203                throw new ArgumentNullException(nameof(resourceGroupName));
 204            }
 0205            if (virtualHubName == null)
 206            {
 0207                throw new ArgumentNullException(nameof(virtualHubName));
 208            }
 0209            if (virtualHubParameters == null)
 210            {
 0211                throw new ArgumentNullException(nameof(virtualHubParameters));
 212            }
 213
 0214            using var message = CreateCreateOrUpdateRequest(resourceGroupName, virtualHubName, virtualHubParameters);
 0215            _pipeline.Send(message, cancellationToken);
 0216            switch (message.Response.Status)
 217            {
 218                case 200:
 219                case 201:
 0220                    return message.Response;
 221                default:
 0222                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 223            }
 0224        }
 225
 226        internal HttpMessage CreateUpdateTagsRequest(string resourceGroupName, string virtualHubName, TagsObject virtual
 227        {
 0228            var message = _pipeline.CreateMessage();
 0229            var request = message.Request;
 0230            request.Method = RequestMethod.Patch;
 0231            var uri = new RawRequestUriBuilder();
 0232            uri.Reset(endpoint);
 0233            uri.AppendPath("/subscriptions/", false);
 0234            uri.AppendPath(subscriptionId, true);
 0235            uri.AppendPath("/resourceGroups/", false);
 0236            uri.AppendPath(resourceGroupName, true);
 0237            uri.AppendPath("/providers/Microsoft.Network/virtualHubs/", false);
 0238            uri.AppendPath(virtualHubName, true);
 0239            uri.AppendQuery("api-version", "2020-04-01", true);
 0240            request.Uri = uri;
 0241            request.Headers.Add("Content-Type", "application/json");
 0242            var content = new Utf8JsonRequestContent();
 0243            content.JsonWriter.WriteObjectValue(virtualHubParameters);
 0244            request.Content = content;
 0245            return message;
 246        }
 247
 248        /// <summary> Updates VirtualHub tags. </summary>
 249        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 250        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 251        /// <param name="virtualHubParameters"> Parameters supplied to update VirtualHub tags. </param>
 252        /// <param name="cancellationToken"> The cancellation token to use. </param>
 253        public async Task<Response<VirtualHub>> UpdateTagsAsync(string resourceGroupName, string virtualHubName, TagsObj
 254        {
 0255            if (resourceGroupName == null)
 256            {
 0257                throw new ArgumentNullException(nameof(resourceGroupName));
 258            }
 0259            if (virtualHubName == null)
 260            {
 0261                throw new ArgumentNullException(nameof(virtualHubName));
 262            }
 0263            if (virtualHubParameters == null)
 264            {
 0265                throw new ArgumentNullException(nameof(virtualHubParameters));
 266            }
 267
 0268            using var message = CreateUpdateTagsRequest(resourceGroupName, virtualHubName, virtualHubParameters);
 0269            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0270            switch (message.Response.Status)
 271            {
 272                case 200:
 273                    {
 0274                        VirtualHub value = default;
 0275                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0276                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 277                        {
 0278                            value = null;
 279                        }
 280                        else
 281                        {
 0282                            value = VirtualHub.DeserializeVirtualHub(document.RootElement);
 283                        }
 0284                        return Response.FromValue(value, message.Response);
 285                    }
 286                default:
 0287                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 288            }
 0289        }
 290
 291        /// <summary> Updates VirtualHub tags. </summary>
 292        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 293        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 294        /// <param name="virtualHubParameters"> Parameters supplied to update VirtualHub tags. </param>
 295        /// <param name="cancellationToken"> The cancellation token to use. </param>
 296        public Response<VirtualHub> UpdateTags(string resourceGroupName, string virtualHubName, TagsObject virtualHubPar
 297        {
 0298            if (resourceGroupName == null)
 299            {
 0300                throw new ArgumentNullException(nameof(resourceGroupName));
 301            }
 0302            if (virtualHubName == null)
 303            {
 0304                throw new ArgumentNullException(nameof(virtualHubName));
 305            }
 0306            if (virtualHubParameters == null)
 307            {
 0308                throw new ArgumentNullException(nameof(virtualHubParameters));
 309            }
 310
 0311            using var message = CreateUpdateTagsRequest(resourceGroupName, virtualHubName, virtualHubParameters);
 0312            _pipeline.Send(message, cancellationToken);
 0313            switch (message.Response.Status)
 314            {
 315                case 200:
 316                    {
 0317                        VirtualHub value = default;
 0318                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0319                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 320                        {
 0321                            value = null;
 322                        }
 323                        else
 324                        {
 0325                            value = VirtualHub.DeserializeVirtualHub(document.RootElement);
 326                        }
 0327                        return Response.FromValue(value, message.Response);
 328                    }
 329                default:
 0330                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 331            }
 0332        }
 333
 334        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string virtualHubName)
 335        {
 0336            var message = _pipeline.CreateMessage();
 0337            var request = message.Request;
 0338            request.Method = RequestMethod.Delete;
 0339            var uri = new RawRequestUriBuilder();
 0340            uri.Reset(endpoint);
 0341            uri.AppendPath("/subscriptions/", false);
 0342            uri.AppendPath(subscriptionId, true);
 0343            uri.AppendPath("/resourceGroups/", false);
 0344            uri.AppendPath(resourceGroupName, true);
 0345            uri.AppendPath("/providers/Microsoft.Network/virtualHubs/", false);
 0346            uri.AppendPath(virtualHubName, true);
 0347            uri.AppendQuery("api-version", "2020-04-01", true);
 0348            request.Uri = uri;
 0349            return message;
 350        }
 351
 352        /// <summary> Deletes a VirtualHub. </summary>
 353        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 354        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 355        /// <param name="cancellationToken"> The cancellation token to use. </param>
 356        public async Task<Response> DeleteAsync(string resourceGroupName, string virtualHubName, CancellationToken cance
 357        {
 0358            if (resourceGroupName == null)
 359            {
 0360                throw new ArgumentNullException(nameof(resourceGroupName));
 361            }
 0362            if (virtualHubName == null)
 363            {
 0364                throw new ArgumentNullException(nameof(virtualHubName));
 365            }
 366
 0367            using var message = CreateDeleteRequest(resourceGroupName, virtualHubName);
 0368            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0369            switch (message.Response.Status)
 370            {
 371                case 200:
 372                case 202:
 373                case 204:
 0374                    return message.Response;
 375                default:
 0376                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 377            }
 0378        }
 379
 380        /// <summary> Deletes a VirtualHub. </summary>
 381        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 382        /// <param name="virtualHubName"> The name of the VirtualHub. </param>
 383        /// <param name="cancellationToken"> The cancellation token to use. </param>
 384        public Response Delete(string resourceGroupName, string virtualHubName, CancellationToken cancellationToken = de
 385        {
 0386            if (resourceGroupName == null)
 387            {
 0388                throw new ArgumentNullException(nameof(resourceGroupName));
 389            }
 0390            if (virtualHubName == null)
 391            {
 0392                throw new ArgumentNullException(nameof(virtualHubName));
 393            }
 394
 0395            using var message = CreateDeleteRequest(resourceGroupName, virtualHubName);
 0396            _pipeline.Send(message, cancellationToken);
 0397            switch (message.Response.Status)
 398            {
 399                case 200:
 400                case 202:
 401                case 204:
 0402                    return message.Response;
 403                default:
 0404                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 405            }
 0406        }
 407
 408        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 409        {
 0410            var message = _pipeline.CreateMessage();
 0411            var request = message.Request;
 0412            request.Method = RequestMethod.Get;
 0413            var uri = new RawRequestUriBuilder();
 0414            uri.Reset(endpoint);
 0415            uri.AppendPath("/subscriptions/", false);
 0416            uri.AppendPath(subscriptionId, true);
 0417            uri.AppendPath("/resourceGroups/", false);
 0418            uri.AppendPath(resourceGroupName, true);
 0419            uri.AppendPath("/providers/Microsoft.Network/virtualHubs", false);
 0420            uri.AppendQuery("api-version", "2020-04-01", true);
 0421            request.Uri = uri;
 0422            return message;
 423        }
 424
 425        /// <summary> Lists all the VirtualHubs in a resource group. </summary>
 426        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 427        /// <param name="cancellationToken"> The cancellation token to use. </param>
 428        public async Task<Response<ListVirtualHubsResult>> ListByResourceGroupAsync(string resourceGroupName, Cancellati
 429        {
 0430            if (resourceGroupName == null)
 431            {
 0432                throw new ArgumentNullException(nameof(resourceGroupName));
 433            }
 434
 0435            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0436            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0437            switch (message.Response.Status)
 438            {
 439                case 200:
 440                    {
 0441                        ListVirtualHubsResult value = default;
 0442                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0443                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 444                        {
 0445                            value = null;
 446                        }
 447                        else
 448                        {
 0449                            value = ListVirtualHubsResult.DeserializeListVirtualHubsResult(document.RootElement);
 450                        }
 0451                        return Response.FromValue(value, message.Response);
 452                    }
 453                default:
 0454                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 455            }
 0456        }
 457
 458        /// <summary> Lists all the VirtualHubs in a resource group. </summary>
 459        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 460        /// <param name="cancellationToken"> The cancellation token to use. </param>
 461        public Response<ListVirtualHubsResult> ListByResourceGroup(string resourceGroupName, CancellationToken cancellat
 462        {
 0463            if (resourceGroupName == null)
 464            {
 0465                throw new ArgumentNullException(nameof(resourceGroupName));
 466            }
 467
 0468            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0469            _pipeline.Send(message, cancellationToken);
 0470            switch (message.Response.Status)
 471            {
 472                case 200:
 473                    {
 0474                        ListVirtualHubsResult value = default;
 0475                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0476                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 477                        {
 0478                            value = null;
 479                        }
 480                        else
 481                        {
 0482                            value = ListVirtualHubsResult.DeserializeListVirtualHubsResult(document.RootElement);
 483                        }
 0484                        return Response.FromValue(value, message.Response);
 485                    }
 486                default:
 0487                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 488            }
 0489        }
 490
 491        internal HttpMessage CreateListRequest()
 492        {
 0493            var message = _pipeline.CreateMessage();
 0494            var request = message.Request;
 0495            request.Method = RequestMethod.Get;
 0496            var uri = new RawRequestUriBuilder();
 0497            uri.Reset(endpoint);
 0498            uri.AppendPath("/subscriptions/", false);
 0499            uri.AppendPath(subscriptionId, true);
 0500            uri.AppendPath("/providers/Microsoft.Network/virtualHubs", false);
 0501            uri.AppendQuery("api-version", "2020-04-01", true);
 0502            request.Uri = uri;
 0503            return message;
 504        }
 505
 506        /// <summary> Lists all the VirtualHubs in a subscription. </summary>
 507        /// <param name="cancellationToken"> The cancellation token to use. </param>
 508        public async Task<Response<ListVirtualHubsResult>> ListAsync(CancellationToken cancellationToken = default)
 509        {
 0510            using var message = CreateListRequest();
 0511            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0512            switch (message.Response.Status)
 513            {
 514                case 200:
 515                    {
 0516                        ListVirtualHubsResult value = default;
 0517                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0518                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 519                        {
 0520                            value = null;
 521                        }
 522                        else
 523                        {
 0524                            value = ListVirtualHubsResult.DeserializeListVirtualHubsResult(document.RootElement);
 525                        }
 0526                        return Response.FromValue(value, message.Response);
 527                    }
 528                default:
 0529                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 530            }
 0531        }
 532
 533        /// <summary> Lists all the VirtualHubs in a subscription. </summary>
 534        /// <param name="cancellationToken"> The cancellation token to use. </param>
 535        public Response<ListVirtualHubsResult> List(CancellationToken cancellationToken = default)
 536        {
 0537            using var message = CreateListRequest();
 0538            _pipeline.Send(message, cancellationToken);
 0539            switch (message.Response.Status)
 540            {
 541                case 200:
 542                    {
 0543                        ListVirtualHubsResult value = default;
 0544                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0545                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 546                        {
 0547                            value = null;
 548                        }
 549                        else
 550                        {
 0551                            value = ListVirtualHubsResult.DeserializeListVirtualHubsResult(document.RootElement);
 552                        }
 0553                        return Response.FromValue(value, message.Response);
 554                    }
 555                default:
 0556                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 557            }
 0558        }
 559
 560        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 561        {
 0562            var message = _pipeline.CreateMessage();
 0563            var request = message.Request;
 0564            request.Method = RequestMethod.Get;
 0565            var uri = new RawRequestUriBuilder();
 0566            uri.Reset(endpoint);
 0567            uri.AppendRawNextLink(nextLink, false);
 0568            request.Uri = uri;
 0569            return message;
 570        }
 571
 572        /// <summary> Lists all the VirtualHubs in a resource group. </summary>
 573        /// <param name="nextLink"> The URL to the next page of results. </param>
 574        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 575        /// <param name="cancellationToken"> The cancellation token to use. </param>
 576        public async Task<Response<ListVirtualHubsResult>> ListByResourceGroupNextPageAsync(string nextLink, string reso
 577        {
 0578            if (nextLink == null)
 579            {
 0580                throw new ArgumentNullException(nameof(nextLink));
 581            }
 0582            if (resourceGroupName == null)
 583            {
 0584                throw new ArgumentNullException(nameof(resourceGroupName));
 585            }
 586
 0587            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0588            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0589            switch (message.Response.Status)
 590            {
 591                case 200:
 592                    {
 0593                        ListVirtualHubsResult value = default;
 0594                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0595                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 596                        {
 0597                            value = null;
 598                        }
 599                        else
 600                        {
 0601                            value = ListVirtualHubsResult.DeserializeListVirtualHubsResult(document.RootElement);
 602                        }
 0603                        return Response.FromValue(value, message.Response);
 604                    }
 605                default:
 0606                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 607            }
 0608        }
 609
 610        /// <summary> Lists all the VirtualHubs in a resource group. </summary>
 611        /// <param name="nextLink"> The URL to the next page of results. </param>
 612        /// <param name="resourceGroupName"> The resource group name of the VirtualHub. </param>
 613        /// <param name="cancellationToken"> The cancellation token to use. </param>
 614        public Response<ListVirtualHubsResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, Ca
 615        {
 0616            if (nextLink == null)
 617            {
 0618                throw new ArgumentNullException(nameof(nextLink));
 619            }
 0620            if (resourceGroupName == null)
 621            {
 0622                throw new ArgumentNullException(nameof(resourceGroupName));
 623            }
 624
 0625            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0626            _pipeline.Send(message, cancellationToken);
 0627            switch (message.Response.Status)
 628            {
 629                case 200:
 630                    {
 0631                        ListVirtualHubsResult value = default;
 0632                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0633                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 634                        {
 0635                            value = null;
 636                        }
 637                        else
 638                        {
 0639                            value = ListVirtualHubsResult.DeserializeListVirtualHubsResult(document.RootElement);
 640                        }
 0641                        return Response.FromValue(value, message.Response);
 642                    }
 643                default:
 0644                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 645            }
 0646        }
 647
 648        internal HttpMessage CreateListNextPageRequest(string nextLink)
 649        {
 0650            var message = _pipeline.CreateMessage();
 0651            var request = message.Request;
 0652            request.Method = RequestMethod.Get;
 0653            var uri = new RawRequestUriBuilder();
 0654            uri.Reset(endpoint);
 0655            uri.AppendRawNextLink(nextLink, false);
 0656            request.Uri = uri;
 0657            return message;
 658        }
 659
 660        /// <summary> Lists all the VirtualHubs in a subscription. </summary>
 661        /// <param name="nextLink"> The URL to the next page of results. </param>
 662        /// <param name="cancellationToken"> The cancellation token to use. </param>
 663        public async Task<Response<ListVirtualHubsResult>> ListNextPageAsync(string nextLink, CancellationToken cancella
 664        {
 0665            if (nextLink == null)
 666            {
 0667                throw new ArgumentNullException(nameof(nextLink));
 668            }
 669
 0670            using var message = CreateListNextPageRequest(nextLink);
 0671            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0672            switch (message.Response.Status)
 673            {
 674                case 200:
 675                    {
 0676                        ListVirtualHubsResult value = default;
 0677                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0678                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 679                        {
 0680                            value = null;
 681                        }
 682                        else
 683                        {
 0684                            value = ListVirtualHubsResult.DeserializeListVirtualHubsResult(document.RootElement);
 685                        }
 0686                        return Response.FromValue(value, message.Response);
 687                    }
 688                default:
 0689                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 690            }
 0691        }
 692
 693        /// <summary> Lists all the VirtualHubs in a subscription. </summary>
 694        /// <param name="nextLink"> The URL to the next page of results. </param>
 695        /// <param name="cancellationToken"> The cancellation token to use. </param>
 696        public Response<ListVirtualHubsResult> ListNextPage(string nextLink, CancellationToken cancellationToken = defau
 697        {
 0698            if (nextLink == null)
 699            {
 0700                throw new ArgumentNullException(nameof(nextLink));
 701            }
 702
 0703            using var message = CreateListNextPageRequest(nextLink);
 0704            _pipeline.Send(message, cancellationToken);
 0705            switch (message.Response.Status)
 706            {
 707                case 200:
 708                    {
 0709                        ListVirtualHubsResult value = default;
 0710                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0711                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 712                        {
 0713                            value = null;
 714                        }
 715                        else
 716                        {
 0717                            value = ListVirtualHubsResult.DeserializeListVirtualHubsResult(document.RootElement);
 718                        }
 0719                        return Response.FromValue(value, message.Response);
 720                    }
 721                default:
 0722                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 723            }
 0724        }
 725    }
 726}