< Summary

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

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%
CreateUpdateTagsRequest(...)-0%100%
UpdateTagsAsync()-0%0%
UpdateTags(...)-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\NetworkVirtualAppliancesRestOperations.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 NetworkVirtualAppliancesRestOperations
 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 NetworkVirtualAppliancesRestOperations. </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 NetworkVirtualAppliancesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string
 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 networkVirtualApplianceName)
 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/networkVirtualAppliances/", false);
 058            uri.AppendPath(networkVirtualApplianceName, true);
 059            uri.AppendQuery("api-version", "2020-04-01", true);
 060            request.Uri = uri;
 061            return message;
 62        }
 63
 64        /// <summary> Deletes the specified Network Virtual Appliance. </summary>
 65        /// <param name="resourceGroupName"> The name of the resource group. </param>
 66        /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </param>
 67        /// <param name="cancellationToken"> The cancellation token to use. </param>
 68        public async Task<Response> DeleteAsync(string resourceGroupName, string networkVirtualApplianceName, Cancellati
 69        {
 070            if (resourceGroupName == null)
 71            {
 072                throw new ArgumentNullException(nameof(resourceGroupName));
 73            }
 074            if (networkVirtualApplianceName == null)
 75            {
 076                throw new ArgumentNullException(nameof(networkVirtualApplianceName));
 77            }
 78
 079            using var message = CreateDeleteRequest(resourceGroupName, networkVirtualApplianceName);
 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 Network Virtual Appliance. </summary>
 93        /// <param name="resourceGroupName"> The name of the resource group. </param>
 94        /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </param>
 95        /// <param name="cancellationToken"> The cancellation token to use. </param>
 96        public Response Delete(string resourceGroupName, string networkVirtualApplianceName, CancellationToken cancellat
 97        {
 098            if (resourceGroupName == null)
 99            {
 0100                throw new ArgumentNullException(nameof(resourceGroupName));
 101            }
 0102            if (networkVirtualApplianceName == null)
 103            {
 0104                throw new ArgumentNullException(nameof(networkVirtualApplianceName));
 105            }
 106
 0107            using var message = CreateDeleteRequest(resourceGroupName, networkVirtualApplianceName);
 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 networkVirtualApplianceName, string expan
 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/networkVirtualAppliances/", false);
 0132            uri.AppendPath(networkVirtualApplianceName, 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 Network Virtual Appliance. </summary>
 143        /// <param name="resourceGroupName"> The name of the resource group. </param>
 144        /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </param>
 145        /// <param name="expand"> Expands referenced resources. </param>
 146        /// <param name="cancellationToken"> The cancellation token to use. </param>
 147        public async Task<Response<NetworkVirtualAppliance>> GetAsync(string resourceGroupName, string networkVirtualApp
 148        {
 0149            if (resourceGroupName == null)
 150            {
 0151                throw new ArgumentNullException(nameof(resourceGroupName));
 152            }
 0153            if (networkVirtualApplianceName == null)
 154            {
 0155                throw new ArgumentNullException(nameof(networkVirtualApplianceName));
 156            }
 157
 0158            using var message = CreateGetRequest(resourceGroupName, networkVirtualApplianceName, expand);
 0159            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0160            switch (message.Response.Status)
 161            {
 162                case 200:
 163                    {
 0164                        NetworkVirtualAppliance 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 = NetworkVirtualAppliance.DeserializeNetworkVirtualAppliance(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 Network Virtual Appliance. </summary>
 182        /// <param name="resourceGroupName"> The name of the resource group. </param>
 183        /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </param>
 184        /// <param name="expand"> Expands referenced resources. </param>
 185        /// <param name="cancellationToken"> The cancellation token to use. </param>
 186        public Response<NetworkVirtualAppliance> Get(string resourceGroupName, string networkVirtualApplianceName, strin
 187        {
 0188            if (resourceGroupName == null)
 189            {
 0190                throw new ArgumentNullException(nameof(resourceGroupName));
 191            }
 0192            if (networkVirtualApplianceName == null)
 193            {
 0194                throw new ArgumentNullException(nameof(networkVirtualApplianceName));
 195            }
 196
 0197            using var message = CreateGetRequest(resourceGroupName, networkVirtualApplianceName, expand);
 0198            _pipeline.Send(message, cancellationToken);
 0199            switch (message.Response.Status)
 200            {
 201                case 200:
 202                    {
 0203                        NetworkVirtualAppliance 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 = NetworkVirtualAppliance.DeserializeNetworkVirtualAppliance(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 CreateUpdateTagsRequest(string resourceGroupName, string networkVirtualApplianceName, TagsO
 221        {
 0222            var message = _pipeline.CreateMessage();
 0223            var request = message.Request;
 0224            request.Method = RequestMethod.Patch;
 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/networkVirtualAppliances/", false);
 0232            uri.AppendPath(networkVirtualApplianceName, 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> Updates a Network Virtual Appliance. </summary>
 243        /// <param name="resourceGroupName"> The resource group name of Network Virtual Appliance. </param>
 244        /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance being updated. </param>
 245        /// <param name="parameters"> Parameters supplied to Update Network Virtual Appliance Tags. </param>
 246        /// <param name="cancellationToken"> The cancellation token to use. </param>
 247        public async Task<Response<NetworkVirtualAppliance>> UpdateTagsAsync(string resourceGroupName, string networkVir
 248        {
 0249            if (resourceGroupName == null)
 250            {
 0251                throw new ArgumentNullException(nameof(resourceGroupName));
 252            }
 0253            if (networkVirtualApplianceName == null)
 254            {
 0255                throw new ArgumentNullException(nameof(networkVirtualApplianceName));
 256            }
 0257            if (parameters == null)
 258            {
 0259                throw new ArgumentNullException(nameof(parameters));
 260            }
 261
 0262            using var message = CreateUpdateTagsRequest(resourceGroupName, networkVirtualApplianceName, parameters);
 0263            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0264            switch (message.Response.Status)
 265            {
 266                case 200:
 267                    {
 0268                        NetworkVirtualAppliance value = default;
 0269                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0270                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 271                        {
 0272                            value = null;
 273                        }
 274                        else
 275                        {
 0276                            value = NetworkVirtualAppliance.DeserializeNetworkVirtualAppliance(document.RootElement);
 277                        }
 0278                        return Response.FromValue(value, message.Response);
 279                    }
 280                default:
 0281                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 282            }
 0283        }
 284
 285        /// <summary> Updates a Network Virtual Appliance. </summary>
 286        /// <param name="resourceGroupName"> The resource group name of Network Virtual Appliance. </param>
 287        /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance being updated. </param>
 288        /// <param name="parameters"> Parameters supplied to Update Network Virtual Appliance Tags. </param>
 289        /// <param name="cancellationToken"> The cancellation token to use. </param>
 290        public Response<NetworkVirtualAppliance> UpdateTags(string resourceGroupName, string networkVirtualApplianceName
 291        {
 0292            if (resourceGroupName == null)
 293            {
 0294                throw new ArgumentNullException(nameof(resourceGroupName));
 295            }
 0296            if (networkVirtualApplianceName == null)
 297            {
 0298                throw new ArgumentNullException(nameof(networkVirtualApplianceName));
 299            }
 0300            if (parameters == null)
 301            {
 0302                throw new ArgumentNullException(nameof(parameters));
 303            }
 304
 0305            using var message = CreateUpdateTagsRequest(resourceGroupName, networkVirtualApplianceName, parameters);
 0306            _pipeline.Send(message, cancellationToken);
 0307            switch (message.Response.Status)
 308            {
 309                case 200:
 310                    {
 0311                        NetworkVirtualAppliance value = default;
 0312                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0313                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 314                        {
 0315                            value = null;
 316                        }
 317                        else
 318                        {
 0319                            value = NetworkVirtualAppliance.DeserializeNetworkVirtualAppliance(document.RootElement);
 320                        }
 0321                        return Response.FromValue(value, message.Response);
 322                    }
 323                default:
 0324                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 325            }
 0326        }
 327
 328        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string networkVirtualApplianceName, N
 329        {
 0330            var message = _pipeline.CreateMessage();
 0331            var request = message.Request;
 0332            request.Method = RequestMethod.Put;
 0333            var uri = new RawRequestUriBuilder();
 0334            uri.Reset(endpoint);
 0335            uri.AppendPath("/subscriptions/", false);
 0336            uri.AppendPath(subscriptionId, true);
 0337            uri.AppendPath("/resourceGroups/", false);
 0338            uri.AppendPath(resourceGroupName, true);
 0339            uri.AppendPath("/providers/Microsoft.Network/networkVirtualAppliances/", false);
 0340            uri.AppendPath(networkVirtualApplianceName, true);
 0341            uri.AppendQuery("api-version", "2020-04-01", true);
 0342            request.Uri = uri;
 0343            request.Headers.Add("Content-Type", "application/json");
 0344            var content = new Utf8JsonRequestContent();
 0345            content.JsonWriter.WriteObjectValue(parameters);
 0346            request.Content = content;
 0347            return message;
 348        }
 349
 350        /// <summary> Creates or updates the specified Network Virtual Appliance. </summary>
 351        /// <param name="resourceGroupName"> The name of the resource group. </param>
 352        /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </param>
 353        /// <param name="parameters"> Parameters supplied to the create or update Network Virtual Appliance. </param>
 354        /// <param name="cancellationToken"> The cancellation token to use. </param>
 355        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string networkVirtualApplianceName, Ne
 356        {
 0357            if (resourceGroupName == null)
 358            {
 0359                throw new ArgumentNullException(nameof(resourceGroupName));
 360            }
 0361            if (networkVirtualApplianceName == null)
 362            {
 0363                throw new ArgumentNullException(nameof(networkVirtualApplianceName));
 364            }
 0365            if (parameters == null)
 366            {
 0367                throw new ArgumentNullException(nameof(parameters));
 368            }
 369
 0370            using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkVirtualApplianceName, parameters);
 0371            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0372            switch (message.Response.Status)
 373            {
 374                case 200:
 375                case 201:
 0376                    return message.Response;
 377                default:
 0378                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 379            }
 0380        }
 381
 382        /// <summary> Creates or updates the specified Network Virtual Appliance. </summary>
 383        /// <param name="resourceGroupName"> The name of the resource group. </param>
 384        /// <param name="networkVirtualApplianceName"> The name of Network Virtual Appliance. </param>
 385        /// <param name="parameters"> Parameters supplied to the create or update Network Virtual Appliance. </param>
 386        /// <param name="cancellationToken"> The cancellation token to use. </param>
 387        public Response CreateOrUpdate(string resourceGroupName, string networkVirtualApplianceName, NetworkVirtualAppli
 388        {
 0389            if (resourceGroupName == null)
 390            {
 0391                throw new ArgumentNullException(nameof(resourceGroupName));
 392            }
 0393            if (networkVirtualApplianceName == null)
 394            {
 0395                throw new ArgumentNullException(nameof(networkVirtualApplianceName));
 396            }
 0397            if (parameters == null)
 398            {
 0399                throw new ArgumentNullException(nameof(parameters));
 400            }
 401
 0402            using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkVirtualApplianceName, parameters);
 0403            _pipeline.Send(message, cancellationToken);
 0404            switch (message.Response.Status)
 405            {
 406                case 200:
 407                case 201:
 0408                    return message.Response;
 409                default:
 0410                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 411            }
 0412        }
 413
 414        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 415        {
 0416            var message = _pipeline.CreateMessage();
 0417            var request = message.Request;
 0418            request.Method = RequestMethod.Get;
 0419            var uri = new RawRequestUriBuilder();
 0420            uri.Reset(endpoint);
 0421            uri.AppendPath("/subscriptions/", false);
 0422            uri.AppendPath(subscriptionId, true);
 0423            uri.AppendPath("/resourceGroups/", false);
 0424            uri.AppendPath(resourceGroupName, true);
 0425            uri.AppendPath("/providers/Microsoft.Network/networkVirtualAppliances", false);
 0426            uri.AppendQuery("api-version", "2020-04-01", true);
 0427            request.Uri = uri;
 0428            return message;
 429        }
 430
 431        /// <summary> Lists all Network Virtual Appliances in a resource group. </summary>
 432        /// <param name="resourceGroupName"> The name of the resource group. </param>
 433        /// <param name="cancellationToken"> The cancellation token to use. </param>
 434        public async Task<Response<NetworkVirtualApplianceListResult>> ListByResourceGroupAsync(string resourceGroupName
 435        {
 0436            if (resourceGroupName == null)
 437            {
 0438                throw new ArgumentNullException(nameof(resourceGroupName));
 439            }
 440
 0441            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0442            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0443            switch (message.Response.Status)
 444            {
 445                case 200:
 446                    {
 0447                        NetworkVirtualApplianceListResult value = default;
 0448                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0449                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 450                        {
 0451                            value = null;
 452                        }
 453                        else
 454                        {
 0455                            value = NetworkVirtualApplianceListResult.DeserializeNetworkVirtualApplianceListResult(docum
 456                        }
 0457                        return Response.FromValue(value, message.Response);
 458                    }
 459                default:
 0460                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 461            }
 0462        }
 463
 464        /// <summary> Lists all Network Virtual Appliances in a resource group. </summary>
 465        /// <param name="resourceGroupName"> The name of the resource group. </param>
 466        /// <param name="cancellationToken"> The cancellation token to use. </param>
 467        public Response<NetworkVirtualApplianceListResult> ListByResourceGroup(string resourceGroupName, CancellationTok
 468        {
 0469            if (resourceGroupName == null)
 470            {
 0471                throw new ArgumentNullException(nameof(resourceGroupName));
 472            }
 473
 0474            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0475            _pipeline.Send(message, cancellationToken);
 0476            switch (message.Response.Status)
 477            {
 478                case 200:
 479                    {
 0480                        NetworkVirtualApplianceListResult value = default;
 0481                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0482                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 483                        {
 0484                            value = null;
 485                        }
 486                        else
 487                        {
 0488                            value = NetworkVirtualApplianceListResult.DeserializeNetworkVirtualApplianceListResult(docum
 489                        }
 0490                        return Response.FromValue(value, message.Response);
 491                    }
 492                default:
 0493                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 494            }
 0495        }
 496
 497        internal HttpMessage CreateListRequest()
 498        {
 0499            var message = _pipeline.CreateMessage();
 0500            var request = message.Request;
 0501            request.Method = RequestMethod.Get;
 0502            var uri = new RawRequestUriBuilder();
 0503            uri.Reset(endpoint);
 0504            uri.AppendPath("/subscriptions/", false);
 0505            uri.AppendPath(subscriptionId, true);
 0506            uri.AppendPath("/providers/Microsoft.Network/networkVirtualAppliances", false);
 0507            uri.AppendQuery("api-version", "2020-04-01", true);
 0508            request.Uri = uri;
 0509            return message;
 510        }
 511
 512        /// <summary> Gets all Network Virtual Appliances in a subscription. </summary>
 513        /// <param name="cancellationToken"> The cancellation token to use. </param>
 514        public async Task<Response<NetworkVirtualApplianceListResult>> ListAsync(CancellationToken cancellationToken = d
 515        {
 0516            using var message = CreateListRequest();
 0517            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0518            switch (message.Response.Status)
 519            {
 520                case 200:
 521                    {
 0522                        NetworkVirtualApplianceListResult value = default;
 0523                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0524                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 525                        {
 0526                            value = null;
 527                        }
 528                        else
 529                        {
 0530                            value = NetworkVirtualApplianceListResult.DeserializeNetworkVirtualApplianceListResult(docum
 531                        }
 0532                        return Response.FromValue(value, message.Response);
 533                    }
 534                default:
 0535                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 536            }
 0537        }
 538
 539        /// <summary> Gets all Network Virtual Appliances in a subscription. </summary>
 540        /// <param name="cancellationToken"> The cancellation token to use. </param>
 541        public Response<NetworkVirtualApplianceListResult> List(CancellationToken cancellationToken = default)
 542        {
 0543            using var message = CreateListRequest();
 0544            _pipeline.Send(message, cancellationToken);
 0545            switch (message.Response.Status)
 546            {
 547                case 200:
 548                    {
 0549                        NetworkVirtualApplianceListResult value = default;
 0550                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0551                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 552                        {
 0553                            value = null;
 554                        }
 555                        else
 556                        {
 0557                            value = NetworkVirtualApplianceListResult.DeserializeNetworkVirtualApplianceListResult(docum
 558                        }
 0559                        return Response.FromValue(value, message.Response);
 560                    }
 561                default:
 0562                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 563            }
 0564        }
 565
 566        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 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> Lists all Network Virtual Appliances in a resource group. </summary>
 579        /// <param name="nextLink"> The URL to the next page of results. </param>
 580        /// <param name="resourceGroupName"> The name of the resource group. </param>
 581        /// <param name="cancellationToken"> The cancellation token to use. </param>
 582        public async Task<Response<NetworkVirtualApplianceListResult>> ListByResourceGroupNextPageAsync(string nextLink,
 583        {
 0584            if (nextLink == null)
 585            {
 0586                throw new ArgumentNullException(nameof(nextLink));
 587            }
 0588            if (resourceGroupName == null)
 589            {
 0590                throw new ArgumentNullException(nameof(resourceGroupName));
 591            }
 592
 0593            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0594            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0595            switch (message.Response.Status)
 596            {
 597                case 200:
 598                    {
 0599                        NetworkVirtualApplianceListResult value = default;
 0600                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0601                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 602                        {
 0603                            value = null;
 604                        }
 605                        else
 606                        {
 0607                            value = NetworkVirtualApplianceListResult.DeserializeNetworkVirtualApplianceListResult(docum
 608                        }
 0609                        return Response.FromValue(value, message.Response);
 610                    }
 611                default:
 0612                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 613            }
 0614        }
 615
 616        /// <summary> Lists all Network Virtual Appliances in a resource group. </summary>
 617        /// <param name="nextLink"> The URL to the next page of results. </param>
 618        /// <param name="resourceGroupName"> The name of the resource group. </param>
 619        /// <param name="cancellationToken"> The cancellation token to use. </param>
 620        public Response<NetworkVirtualApplianceListResult> ListByResourceGroupNextPage(string nextLink, string resourceG
 621        {
 0622            if (nextLink == null)
 623            {
 0624                throw new ArgumentNullException(nameof(nextLink));
 625            }
 0626            if (resourceGroupName == null)
 627            {
 0628                throw new ArgumentNullException(nameof(resourceGroupName));
 629            }
 630
 0631            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0632            _pipeline.Send(message, cancellationToken);
 0633            switch (message.Response.Status)
 634            {
 635                case 200:
 636                    {
 0637                        NetworkVirtualApplianceListResult value = default;
 0638                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0639                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 640                        {
 0641                            value = null;
 642                        }
 643                        else
 644                        {
 0645                            value = NetworkVirtualApplianceListResult.DeserializeNetworkVirtualApplianceListResult(docum
 646                        }
 0647                        return Response.FromValue(value, message.Response);
 648                    }
 649                default:
 0650                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 651            }
 0652        }
 653
 654        internal HttpMessage CreateListNextPageRequest(string nextLink)
 655        {
 0656            var message = _pipeline.CreateMessage();
 0657            var request = message.Request;
 0658            request.Method = RequestMethod.Get;
 0659            var uri = new RawRequestUriBuilder();
 0660            uri.Reset(endpoint);
 0661            uri.AppendRawNextLink(nextLink, false);
 0662            request.Uri = uri;
 0663            return message;
 664        }
 665
 666        /// <summary> Gets all Network Virtual Appliances in a subscription. </summary>
 667        /// <param name="nextLink"> The URL to the next page of results. </param>
 668        /// <param name="cancellationToken"> The cancellation token to use. </param>
 669        public async Task<Response<NetworkVirtualApplianceListResult>> ListNextPageAsync(string nextLink, CancellationTo
 670        {
 0671            if (nextLink == null)
 672            {
 0673                throw new ArgumentNullException(nameof(nextLink));
 674            }
 675
 0676            using var message = CreateListNextPageRequest(nextLink);
 0677            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0678            switch (message.Response.Status)
 679            {
 680                case 200:
 681                    {
 0682                        NetworkVirtualApplianceListResult value = default;
 0683                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0684                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 685                        {
 0686                            value = null;
 687                        }
 688                        else
 689                        {
 0690                            value = NetworkVirtualApplianceListResult.DeserializeNetworkVirtualApplianceListResult(docum
 691                        }
 0692                        return Response.FromValue(value, message.Response);
 693                    }
 694                default:
 0695                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 696            }
 0697        }
 698
 699        /// <summary> Gets all Network Virtual Appliances in a subscription. </summary>
 700        /// <param name="nextLink"> The URL to the next page of results. </param>
 701        /// <param name="cancellationToken"> The cancellation token to use. </param>
 702        public Response<NetworkVirtualApplianceListResult> ListNextPage(string nextLink, CancellationToken cancellationT
 703        {
 0704            if (nextLink == null)
 705            {
 0706                throw new ArgumentNullException(nameof(nextLink));
 707            }
 708
 0709            using var message = CreateListNextPageRequest(nextLink);
 0710            _pipeline.Send(message, cancellationToken);
 0711            switch (message.Response.Status)
 712            {
 713                case 200:
 714                    {
 0715                        NetworkVirtualApplianceListResult 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 = NetworkVirtualApplianceListResult.DeserializeNetworkVirtualApplianceListResult(docum
 724                        }
 0725                        return Response.FromValue(value, message.Response);
 726                    }
 727                default:
 0728                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 729            }
 0730        }
 731    }
 732}