< Summary

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

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%
CreateUpdateTagsRequest(...)-0%100%
UpdateTagsAsync()-0%0%
UpdateTags(...)-0%0%
CreateListAllRequest()-0%100%
ListAllAsync()-0%0%
ListAll(...)-0%0%
CreateListRequest(...)-0%100%
ListAsync()-0%0%
List(...)-0%0%
CreateListAllNextPageRequest(...)-0%100%
ListAllNextPageAsync()-0%0%
ListAllNextPage(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\NetworkProfilesRestOperations.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 NetworkProfilesRestOperations
 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 NetworkProfilesRestOperations. </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 NetworkProfilesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscrip
 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 networkProfileName)
 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/networkProfiles/", false);
 058            uri.AppendPath(networkProfileName, 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 profile. </summary>
 65        /// <param name="resourceGroupName"> The name of the resource group. </param>
 66        /// <param name="networkProfileName"> The name of the NetworkProfile. </param>
 67        /// <param name="cancellationToken"> The cancellation token to use. </param>
 68        public async Task<Response> DeleteAsync(string resourceGroupName, string networkProfileName, CancellationToken c
 69        {
 070            if (resourceGroupName == null)
 71            {
 072                throw new ArgumentNullException(nameof(resourceGroupName));
 73            }
 074            if (networkProfileName == null)
 75            {
 076                throw new ArgumentNullException(nameof(networkProfileName));
 77            }
 78
 079            using var message = CreateDeleteRequest(resourceGroupName, networkProfileName);
 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 profile. </summary>
 93        /// <param name="resourceGroupName"> The name of the resource group. </param>
 94        /// <param name="networkProfileName"> The name of the NetworkProfile. </param>
 95        /// <param name="cancellationToken"> The cancellation token to use. </param>
 96        public Response Delete(string resourceGroupName, string networkProfileName, CancellationToken cancellationToken 
 97        {
 098            if (resourceGroupName == null)
 99            {
 0100                throw new ArgumentNullException(nameof(resourceGroupName));
 101            }
 0102            if (networkProfileName == null)
 103            {
 0104                throw new ArgumentNullException(nameof(networkProfileName));
 105            }
 106
 0107            using var message = CreateDeleteRequest(resourceGroupName, networkProfileName);
 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 networkProfileName, 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/networkProfiles/", false);
 0132            uri.AppendPath(networkProfileName, 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 profile in a specified resource group. </summary>
 143        /// <param name="resourceGroupName"> The name of the resource group. </param>
 144        /// <param name="networkProfileName"> The name of the public IP prefix. </param>
 145        /// <param name="expand"> Expands referenced resources. </param>
 146        /// <param name="cancellationToken"> The cancellation token to use. </param>
 147        public async Task<Response<NetworkProfile>> GetAsync(string resourceGroupName, string networkProfileName, string
 148        {
 0149            if (resourceGroupName == null)
 150            {
 0151                throw new ArgumentNullException(nameof(resourceGroupName));
 152            }
 0153            if (networkProfileName == null)
 154            {
 0155                throw new ArgumentNullException(nameof(networkProfileName));
 156            }
 157
 0158            using var message = CreateGetRequest(resourceGroupName, networkProfileName, expand);
 0159            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0160            switch (message.Response.Status)
 161            {
 162                case 200:
 163                    {
 0164                        NetworkProfile 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 = NetworkProfile.DeserializeNetworkProfile(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 profile in a specified resource group. </summary>
 182        /// <param name="resourceGroupName"> The name of the resource group. </param>
 183        /// <param name="networkProfileName"> The name of the public IP prefix. </param>
 184        /// <param name="expand"> Expands referenced resources. </param>
 185        /// <param name="cancellationToken"> The cancellation token to use. </param>
 186        public Response<NetworkProfile> Get(string resourceGroupName, string networkProfileName, string expand = null, C
 187        {
 0188            if (resourceGroupName == null)
 189            {
 0190                throw new ArgumentNullException(nameof(resourceGroupName));
 191            }
 0192            if (networkProfileName == null)
 193            {
 0194                throw new ArgumentNullException(nameof(networkProfileName));
 195            }
 196
 0197            using var message = CreateGetRequest(resourceGroupName, networkProfileName, expand);
 0198            _pipeline.Send(message, cancellationToken);
 0199            switch (message.Response.Status)
 200            {
 201                case 200:
 202                    {
 0203                        NetworkProfile 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 = NetworkProfile.DeserializeNetworkProfile(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 networkProfileName, NetworkPro
 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/networkProfiles/", false);
 0232            uri.AppendPath(networkProfileName, 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 a network profile. </summary>
 243        /// <param name="resourceGroupName"> The name of the resource group. </param>
 244        /// <param name="networkProfileName"> The name of the network profile. </param>
 245        /// <param name="parameters"> Parameters supplied to the create or update network profile operation. </param>
 246        /// <param name="cancellationToken"> The cancellation token to use. </param>
 247        public async Task<Response<NetworkProfile>> CreateOrUpdateAsync(string resourceGroupName, string networkProfileN
 248        {
 0249            if (resourceGroupName == null)
 250            {
 0251                throw new ArgumentNullException(nameof(resourceGroupName));
 252            }
 0253            if (networkProfileName == null)
 254            {
 0255                throw new ArgumentNullException(nameof(networkProfileName));
 256            }
 0257            if (parameters == null)
 258            {
 0259                throw new ArgumentNullException(nameof(parameters));
 260            }
 261
 0262            using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkProfileName, parameters);
 0263            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0264            switch (message.Response.Status)
 265            {
 266                case 200:
 267                case 201:
 268                    {
 0269                        NetworkProfile value = default;
 0270                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0271                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 272                        {
 0273                            value = null;
 274                        }
 275                        else
 276                        {
 0277                            value = NetworkProfile.DeserializeNetworkProfile(document.RootElement);
 278                        }
 0279                        return Response.FromValue(value, message.Response);
 280                    }
 281                default:
 0282                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 283            }
 0284        }
 285
 286        /// <summary> Creates or updates a network profile. </summary>
 287        /// <param name="resourceGroupName"> The name of the resource group. </param>
 288        /// <param name="networkProfileName"> The name of the network profile. </param>
 289        /// <param name="parameters"> Parameters supplied to the create or update network profile operation. </param>
 290        /// <param name="cancellationToken"> The cancellation token to use. </param>
 291        public Response<NetworkProfile> CreateOrUpdate(string resourceGroupName, string networkProfileName, NetworkProfi
 292        {
 0293            if (resourceGroupName == null)
 294            {
 0295                throw new ArgumentNullException(nameof(resourceGroupName));
 296            }
 0297            if (networkProfileName == null)
 298            {
 0299                throw new ArgumentNullException(nameof(networkProfileName));
 300            }
 0301            if (parameters == null)
 302            {
 0303                throw new ArgumentNullException(nameof(parameters));
 304            }
 305
 0306            using var message = CreateCreateOrUpdateRequest(resourceGroupName, networkProfileName, parameters);
 0307            _pipeline.Send(message, cancellationToken);
 0308            switch (message.Response.Status)
 309            {
 310                case 200:
 311                case 201:
 312                    {
 0313                        NetworkProfile value = default;
 0314                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0315                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 316                        {
 0317                            value = null;
 318                        }
 319                        else
 320                        {
 0321                            value = NetworkProfile.DeserializeNetworkProfile(document.RootElement);
 322                        }
 0323                        return Response.FromValue(value, message.Response);
 324                    }
 325                default:
 0326                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 327            }
 0328        }
 329
 330        internal HttpMessage CreateUpdateTagsRequest(string resourceGroupName, string networkProfileName, TagsObject par
 331        {
 0332            var message = _pipeline.CreateMessage();
 0333            var request = message.Request;
 0334            request.Method = RequestMethod.Patch;
 0335            var uri = new RawRequestUriBuilder();
 0336            uri.Reset(endpoint);
 0337            uri.AppendPath("/subscriptions/", false);
 0338            uri.AppendPath(subscriptionId, true);
 0339            uri.AppendPath("/resourceGroups/", false);
 0340            uri.AppendPath(resourceGroupName, true);
 0341            uri.AppendPath("/providers/Microsoft.Network/networkProfiles/", false);
 0342            uri.AppendPath(networkProfileName, true);
 0343            uri.AppendQuery("api-version", "2020-04-01", true);
 0344            request.Uri = uri;
 0345            request.Headers.Add("Content-Type", "application/json");
 0346            var content = new Utf8JsonRequestContent();
 0347            content.JsonWriter.WriteObjectValue(parameters);
 0348            request.Content = content;
 0349            return message;
 350        }
 351
 352        /// <summary> Updates network profile tags. </summary>
 353        /// <param name="resourceGroupName"> The name of the resource group. </param>
 354        /// <param name="networkProfileName"> The name of the network profile. </param>
 355        /// <param name="parameters"> Parameters supplied to update network profile tags. </param>
 356        /// <param name="cancellationToken"> The cancellation token to use. </param>
 357        public async Task<Response<NetworkProfile>> UpdateTagsAsync(string resourceGroupName, string networkProfileName,
 358        {
 0359            if (resourceGroupName == null)
 360            {
 0361                throw new ArgumentNullException(nameof(resourceGroupName));
 362            }
 0363            if (networkProfileName == null)
 364            {
 0365                throw new ArgumentNullException(nameof(networkProfileName));
 366            }
 0367            if (parameters == null)
 368            {
 0369                throw new ArgumentNullException(nameof(parameters));
 370            }
 371
 0372            using var message = CreateUpdateTagsRequest(resourceGroupName, networkProfileName, parameters);
 0373            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0374            switch (message.Response.Status)
 375            {
 376                case 200:
 377                    {
 0378                        NetworkProfile value = default;
 0379                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0380                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 381                        {
 0382                            value = null;
 383                        }
 384                        else
 385                        {
 0386                            value = NetworkProfile.DeserializeNetworkProfile(document.RootElement);
 387                        }
 0388                        return Response.FromValue(value, message.Response);
 389                    }
 390                default:
 0391                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 392            }
 0393        }
 394
 395        /// <summary> Updates network profile tags. </summary>
 396        /// <param name="resourceGroupName"> The name of the resource group. </param>
 397        /// <param name="networkProfileName"> The name of the network profile. </param>
 398        /// <param name="parameters"> Parameters supplied to update network profile tags. </param>
 399        /// <param name="cancellationToken"> The cancellation token to use. </param>
 400        public Response<NetworkProfile> UpdateTags(string resourceGroupName, string networkProfileName, TagsObject param
 401        {
 0402            if (resourceGroupName == null)
 403            {
 0404                throw new ArgumentNullException(nameof(resourceGroupName));
 405            }
 0406            if (networkProfileName == null)
 407            {
 0408                throw new ArgumentNullException(nameof(networkProfileName));
 409            }
 0410            if (parameters == null)
 411            {
 0412                throw new ArgumentNullException(nameof(parameters));
 413            }
 414
 0415            using var message = CreateUpdateTagsRequest(resourceGroupName, networkProfileName, parameters);
 0416            _pipeline.Send(message, cancellationToken);
 0417            switch (message.Response.Status)
 418            {
 419                case 200:
 420                    {
 0421                        NetworkProfile value = default;
 0422                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0423                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 424                        {
 0425                            value = null;
 426                        }
 427                        else
 428                        {
 0429                            value = NetworkProfile.DeserializeNetworkProfile(document.RootElement);
 430                        }
 0431                        return Response.FromValue(value, message.Response);
 432                    }
 433                default:
 0434                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 435            }
 0436        }
 437
 438        internal HttpMessage CreateListAllRequest()
 439        {
 0440            var message = _pipeline.CreateMessage();
 0441            var request = message.Request;
 0442            request.Method = RequestMethod.Get;
 0443            var uri = new RawRequestUriBuilder();
 0444            uri.Reset(endpoint);
 0445            uri.AppendPath("/subscriptions/", false);
 0446            uri.AppendPath(subscriptionId, true);
 0447            uri.AppendPath("/providers/Microsoft.Network/networkProfiles", false);
 0448            uri.AppendQuery("api-version", "2020-04-01", true);
 0449            request.Uri = uri;
 0450            return message;
 451        }
 452
 453        /// <summary> Gets all the network profiles in a subscription. </summary>
 454        /// <param name="cancellationToken"> The cancellation token to use. </param>
 455        public async Task<Response<NetworkProfileListResult>> ListAllAsync(CancellationToken cancellationToken = default
 456        {
 0457            using var message = CreateListAllRequest();
 0458            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0459            switch (message.Response.Status)
 460            {
 461                case 200:
 462                    {
 0463                        NetworkProfileListResult value = default;
 0464                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0465                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 466                        {
 0467                            value = null;
 468                        }
 469                        else
 470                        {
 0471                            value = NetworkProfileListResult.DeserializeNetworkProfileListResult(document.RootElement);
 472                        }
 0473                        return Response.FromValue(value, message.Response);
 474                    }
 475                default:
 0476                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 477            }
 0478        }
 479
 480        /// <summary> Gets all the network profiles in a subscription. </summary>
 481        /// <param name="cancellationToken"> The cancellation token to use. </param>
 482        public Response<NetworkProfileListResult> ListAll(CancellationToken cancellationToken = default)
 483        {
 0484            using var message = CreateListAllRequest();
 0485            _pipeline.Send(message, cancellationToken);
 0486            switch (message.Response.Status)
 487            {
 488                case 200:
 489                    {
 0490                        NetworkProfileListResult value = default;
 0491                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0492                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 493                        {
 0494                            value = null;
 495                        }
 496                        else
 497                        {
 0498                            value = NetworkProfileListResult.DeserializeNetworkProfileListResult(document.RootElement);
 499                        }
 0500                        return Response.FromValue(value, message.Response);
 501                    }
 502                default:
 0503                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 504            }
 0505        }
 506
 507        internal HttpMessage CreateListRequest(string resourceGroupName)
 508        {
 0509            var message = _pipeline.CreateMessage();
 0510            var request = message.Request;
 0511            request.Method = RequestMethod.Get;
 0512            var uri = new RawRequestUriBuilder();
 0513            uri.Reset(endpoint);
 0514            uri.AppendPath("/subscriptions/", false);
 0515            uri.AppendPath(subscriptionId, true);
 0516            uri.AppendPath("/resourceGroups/", false);
 0517            uri.AppendPath(resourceGroupName, true);
 0518            uri.AppendPath("/providers/Microsoft.Network/networkProfiles", false);
 0519            uri.AppendQuery("api-version", "2020-04-01", true);
 0520            request.Uri = uri;
 0521            return message;
 522        }
 523
 524        /// <summary> Gets all network profiles in a resource group. </summary>
 525        /// <param name="resourceGroupName"> The name of the resource group. </param>
 526        /// <param name="cancellationToken"> The cancellation token to use. </param>
 527        public async Task<Response<NetworkProfileListResult>> ListAsync(string resourceGroupName, CancellationToken canc
 528        {
 0529            if (resourceGroupName == null)
 530            {
 0531                throw new ArgumentNullException(nameof(resourceGroupName));
 532            }
 533
 0534            using var message = CreateListRequest(resourceGroupName);
 0535            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0536            switch (message.Response.Status)
 537            {
 538                case 200:
 539                    {
 0540                        NetworkProfileListResult value = default;
 0541                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0542                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 543                        {
 0544                            value = null;
 545                        }
 546                        else
 547                        {
 0548                            value = NetworkProfileListResult.DeserializeNetworkProfileListResult(document.RootElement);
 549                        }
 0550                        return Response.FromValue(value, message.Response);
 551                    }
 552                default:
 0553                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 554            }
 0555        }
 556
 557        /// <summary> Gets all network profiles in a resource group. </summary>
 558        /// <param name="resourceGroupName"> The name of the resource group. </param>
 559        /// <param name="cancellationToken"> The cancellation token to use. </param>
 560        public Response<NetworkProfileListResult> List(string resourceGroupName, CancellationToken cancellationToken = d
 561        {
 0562            if (resourceGroupName == null)
 563            {
 0564                throw new ArgumentNullException(nameof(resourceGroupName));
 565            }
 566
 0567            using var message = CreateListRequest(resourceGroupName);
 0568            _pipeline.Send(message, cancellationToken);
 0569            switch (message.Response.Status)
 570            {
 571                case 200:
 572                    {
 0573                        NetworkProfileListResult value = default;
 0574                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0575                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 576                        {
 0577                            value = null;
 578                        }
 579                        else
 580                        {
 0581                            value = NetworkProfileListResult.DeserializeNetworkProfileListResult(document.RootElement);
 582                        }
 0583                        return Response.FromValue(value, message.Response);
 584                    }
 585                default:
 0586                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 587            }
 0588        }
 589
 590        internal HttpMessage CreateListAllNextPageRequest(string nextLink)
 591        {
 0592            var message = _pipeline.CreateMessage();
 0593            var request = message.Request;
 0594            request.Method = RequestMethod.Get;
 0595            var uri = new RawRequestUriBuilder();
 0596            uri.Reset(endpoint);
 0597            uri.AppendRawNextLink(nextLink, false);
 0598            request.Uri = uri;
 0599            return message;
 600        }
 601
 602        /// <summary> Gets all the network profiles in a subscription. </summary>
 603        /// <param name="nextLink"> The URL to the next page of results. </param>
 604        /// <param name="cancellationToken"> The cancellation token to use. </param>
 605        public async Task<Response<NetworkProfileListResult>> ListAllNextPageAsync(string nextLink, CancellationToken ca
 606        {
 0607            if (nextLink == null)
 608            {
 0609                throw new ArgumentNullException(nameof(nextLink));
 610            }
 611
 0612            using var message = CreateListAllNextPageRequest(nextLink);
 0613            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0614            switch (message.Response.Status)
 615            {
 616                case 200:
 617                    {
 0618                        NetworkProfileListResult value = default;
 0619                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0620                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 621                        {
 0622                            value = null;
 623                        }
 624                        else
 625                        {
 0626                            value = NetworkProfileListResult.DeserializeNetworkProfileListResult(document.RootElement);
 627                        }
 0628                        return Response.FromValue(value, message.Response);
 629                    }
 630                default:
 0631                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 632            }
 0633        }
 634
 635        /// <summary> Gets all the network profiles in a subscription. </summary>
 636        /// <param name="nextLink"> The URL to the next page of results. </param>
 637        /// <param name="cancellationToken"> The cancellation token to use. </param>
 638        public Response<NetworkProfileListResult> ListAllNextPage(string nextLink, CancellationToken cancellationToken =
 639        {
 0640            if (nextLink == null)
 641            {
 0642                throw new ArgumentNullException(nameof(nextLink));
 643            }
 644
 0645            using var message = CreateListAllNextPageRequest(nextLink);
 0646            _pipeline.Send(message, cancellationToken);
 0647            switch (message.Response.Status)
 648            {
 649                case 200:
 650                    {
 0651                        NetworkProfileListResult value = default;
 0652                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0653                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 654                        {
 0655                            value = null;
 656                        }
 657                        else
 658                        {
 0659                            value = NetworkProfileListResult.DeserializeNetworkProfileListResult(document.RootElement);
 660                        }
 0661                        return Response.FromValue(value, message.Response);
 662                    }
 663                default:
 0664                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 665            }
 0666        }
 667
 668        internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName)
 669        {
 0670            var message = _pipeline.CreateMessage();
 0671            var request = message.Request;
 0672            request.Method = RequestMethod.Get;
 0673            var uri = new RawRequestUriBuilder();
 0674            uri.Reset(endpoint);
 0675            uri.AppendRawNextLink(nextLink, false);
 0676            request.Uri = uri;
 0677            return message;
 678        }
 679
 680        /// <summary> Gets all network profiles in a resource group. </summary>
 681        /// <param name="nextLink"> The URL to the next page of results. </param>
 682        /// <param name="resourceGroupName"> The name of the resource group. </param>
 683        /// <param name="cancellationToken"> The cancellation token to use. </param>
 684        public async Task<Response<NetworkProfileListResult>> ListNextPageAsync(string nextLink, string resourceGroupNam
 685        {
 0686            if (nextLink == null)
 687            {
 0688                throw new ArgumentNullException(nameof(nextLink));
 689            }
 0690            if (resourceGroupName == null)
 691            {
 0692                throw new ArgumentNullException(nameof(resourceGroupName));
 693            }
 694
 0695            using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
 0696            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0697            switch (message.Response.Status)
 698            {
 699                case 200:
 700                    {
 0701                        NetworkProfileListResult value = default;
 0702                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0703                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 704                        {
 0705                            value = null;
 706                        }
 707                        else
 708                        {
 0709                            value = NetworkProfileListResult.DeserializeNetworkProfileListResult(document.RootElement);
 710                        }
 0711                        return Response.FromValue(value, message.Response);
 712                    }
 713                default:
 0714                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 715            }
 0716        }
 717
 718        /// <summary> Gets all network profiles in a resource group. </summary>
 719        /// <param name="nextLink"> The URL to the next page of results. </param>
 720        /// <param name="resourceGroupName"> The name of the resource group. </param>
 721        /// <param name="cancellationToken"> The cancellation token to use. </param>
 722        public Response<NetworkProfileListResult> ListNextPage(string nextLink, string resourceGroupName, CancellationTo
 723        {
 0724            if (nextLink == null)
 725            {
 0726                throw new ArgumentNullException(nameof(nextLink));
 727            }
 0728            if (resourceGroupName == null)
 729            {
 0730                throw new ArgumentNullException(nameof(resourceGroupName));
 731            }
 732
 0733            using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
 0734            _pipeline.Send(message, cancellationToken);
 0735            switch (message.Response.Status)
 736            {
 737                case 200:
 738                    {
 0739                        NetworkProfileListResult value = default;
 0740                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0741                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 742                        {
 0743                            value = null;
 744                        }
 745                        else
 746                        {
 0747                            value = NetworkProfileListResult.DeserializeNetworkProfileListResult(document.RootElement);
 748                        }
 0749                        return Response.FromValue(value, message.Response);
 750                    }
 751                default:
 0752                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 753            }
 0754        }
 755    }
 756}