< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateListRequest(...)-0%100%
ListAsync()-0%0%
List(...)-0%0%
CreateListAllRequest()-0%100%
ListAllAsync()-0%0%
ListAll(...)-0%0%
CreateGetRequest(...)-0%100%
GetAsync()-0%0%
Get(...)-0%0%
CreateCreateOrUpdateRequest(...)-0%100%
CreateOrUpdateAsync()-0%0%
CreateOrUpdate(...)-0%0%
CreateDeleteRequest(...)-0%100%
DeleteAsync()-0%0%
Delete(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%
CreateListAllNextPageRequest(...)-0%100%
ListAllNextPageAsync()-0%0%
ListAllNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\WebApplicationFirewallPoliciesRestOperations.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 WebApplicationFirewallPoliciesRestOperations
 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 WebApplicationFirewallPoliciesRestOperations. </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 WebApplicationFirewallPoliciesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, 
 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 CreateListRequest(string resourceGroupName)
 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/ApplicationGatewayWebApplicationFirewallPolicies", false);
 058            uri.AppendQuery("api-version", "2020-04-01", true);
 059            request.Uri = uri;
 060            return message;
 61        }
 62
 63        /// <summary> Lists all of the protection policies within a resource group. </summary>
 64        /// <param name="resourceGroupName"> The name of the resource group. </param>
 65        /// <param name="cancellationToken"> The cancellation token to use. </param>
 66        public async Task<Response<WebApplicationFirewallPolicyListResult>> ListAsync(string resourceGroupName, Cancella
 67        {
 068            if (resourceGroupName == null)
 69            {
 070                throw new ArgumentNullException(nameof(resourceGroupName));
 71            }
 72
 073            using var message = CreateListRequest(resourceGroupName);
 074            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 075            switch (message.Response.Status)
 76            {
 77                case 200:
 78                    {
 079                        WebApplicationFirewallPolicyListResult value = default;
 080                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 081                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 82                        {
 083                            value = null;
 84                        }
 85                        else
 86                        {
 087                            value = WebApplicationFirewallPolicyListResult.DeserializeWebApplicationFirewallPolicyListRe
 88                        }
 089                        return Response.FromValue(value, message.Response);
 90                    }
 91                default:
 092                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 93            }
 094        }
 95
 96        /// <summary> Lists all of the protection policies within a resource group. </summary>
 97        /// <param name="resourceGroupName"> The name of the resource group. </param>
 98        /// <param name="cancellationToken"> The cancellation token to use. </param>
 99        public Response<WebApplicationFirewallPolicyListResult> List(string resourceGroupName, CancellationToken cancell
 100        {
 0101            if (resourceGroupName == null)
 102            {
 0103                throw new ArgumentNullException(nameof(resourceGroupName));
 104            }
 105
 0106            using var message = CreateListRequest(resourceGroupName);
 0107            _pipeline.Send(message, cancellationToken);
 0108            switch (message.Response.Status)
 109            {
 110                case 200:
 111                    {
 0112                        WebApplicationFirewallPolicyListResult value = default;
 0113                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0114                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 115                        {
 0116                            value = null;
 117                        }
 118                        else
 119                        {
 0120                            value = WebApplicationFirewallPolicyListResult.DeserializeWebApplicationFirewallPolicyListRe
 121                        }
 0122                        return Response.FromValue(value, message.Response);
 123                    }
 124                default:
 0125                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 126            }
 0127        }
 128
 129        internal HttpMessage CreateListAllRequest()
 130        {
 0131            var message = _pipeline.CreateMessage();
 0132            var request = message.Request;
 0133            request.Method = RequestMethod.Get;
 0134            var uri = new RawRequestUriBuilder();
 0135            uri.Reset(endpoint);
 0136            uri.AppendPath("/subscriptions/", false);
 0137            uri.AppendPath(subscriptionId, true);
 0138            uri.AppendPath("/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies", false);
 0139            uri.AppendQuery("api-version", "2020-04-01", true);
 0140            request.Uri = uri;
 0141            return message;
 142        }
 143
 144        /// <summary> Gets all the WAF policies in a subscription. </summary>
 145        /// <param name="cancellationToken"> The cancellation token to use. </param>
 146        public async Task<Response<WebApplicationFirewallPolicyListResult>> ListAllAsync(CancellationToken cancellationT
 147        {
 0148            using var message = CreateListAllRequest();
 0149            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0150            switch (message.Response.Status)
 151            {
 152                case 200:
 153                    {
 0154                        WebApplicationFirewallPolicyListResult value = default;
 0155                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0156                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 157                        {
 0158                            value = null;
 159                        }
 160                        else
 161                        {
 0162                            value = WebApplicationFirewallPolicyListResult.DeserializeWebApplicationFirewallPolicyListRe
 163                        }
 0164                        return Response.FromValue(value, message.Response);
 165                    }
 166                default:
 0167                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 168            }
 0169        }
 170
 171        /// <summary> Gets all the WAF policies in a subscription. </summary>
 172        /// <param name="cancellationToken"> The cancellation token to use. </param>
 173        public Response<WebApplicationFirewallPolicyListResult> ListAll(CancellationToken cancellationToken = default)
 174        {
 0175            using var message = CreateListAllRequest();
 0176            _pipeline.Send(message, cancellationToken);
 0177            switch (message.Response.Status)
 178            {
 179                case 200:
 180                    {
 0181                        WebApplicationFirewallPolicyListResult value = default;
 0182                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0183                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 184                        {
 0185                            value = null;
 186                        }
 187                        else
 188                        {
 0189                            value = WebApplicationFirewallPolicyListResult.DeserializeWebApplicationFirewallPolicyListRe
 190                        }
 0191                        return Response.FromValue(value, message.Response);
 192                    }
 193                default:
 0194                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 195            }
 0196        }
 197
 198        internal HttpMessage CreateGetRequest(string resourceGroupName, string policyName)
 199        {
 0200            var message = _pipeline.CreateMessage();
 0201            var request = message.Request;
 0202            request.Method = RequestMethod.Get;
 0203            var uri = new RawRequestUriBuilder();
 0204            uri.Reset(endpoint);
 0205            uri.AppendPath("/subscriptions/", false);
 0206            uri.AppendPath(subscriptionId, true);
 0207            uri.AppendPath("/resourceGroups/", false);
 0208            uri.AppendPath(resourceGroupName, true);
 0209            uri.AppendPath("/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/", false);
 0210            uri.AppendPath(policyName, true);
 0211            uri.AppendQuery("api-version", "2020-04-01", true);
 0212            request.Uri = uri;
 0213            return message;
 214        }
 215
 216        /// <summary> Retrieve protection policy with specified name within a resource group. </summary>
 217        /// <param name="resourceGroupName"> The name of the resource group. </param>
 218        /// <param name="policyName"> The name of the policy. </param>
 219        /// <param name="cancellationToken"> The cancellation token to use. </param>
 220        public async Task<Response<WebApplicationFirewallPolicy>> GetAsync(string resourceGroupName, string policyName, 
 221        {
 0222            if (resourceGroupName == null)
 223            {
 0224                throw new ArgumentNullException(nameof(resourceGroupName));
 225            }
 0226            if (policyName == null)
 227            {
 0228                throw new ArgumentNullException(nameof(policyName));
 229            }
 230
 0231            using var message = CreateGetRequest(resourceGroupName, policyName);
 0232            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0233            switch (message.Response.Status)
 234            {
 235                case 200:
 236                    {
 0237                        WebApplicationFirewallPolicy value = default;
 0238                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0239                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 240                        {
 0241                            value = null;
 242                        }
 243                        else
 244                        {
 0245                            value = WebApplicationFirewallPolicy.DeserializeWebApplicationFirewallPolicy(document.RootEl
 246                        }
 0247                        return Response.FromValue(value, message.Response);
 248                    }
 249                default:
 0250                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 251            }
 0252        }
 253
 254        /// <summary> Retrieve protection policy with specified name within a resource group. </summary>
 255        /// <param name="resourceGroupName"> The name of the resource group. </param>
 256        /// <param name="policyName"> The name of the policy. </param>
 257        /// <param name="cancellationToken"> The cancellation token to use. </param>
 258        public Response<WebApplicationFirewallPolicy> Get(string resourceGroupName, string policyName, CancellationToken
 259        {
 0260            if (resourceGroupName == null)
 261            {
 0262                throw new ArgumentNullException(nameof(resourceGroupName));
 263            }
 0264            if (policyName == null)
 265            {
 0266                throw new ArgumentNullException(nameof(policyName));
 267            }
 268
 0269            using var message = CreateGetRequest(resourceGroupName, policyName);
 0270            _pipeline.Send(message, cancellationToken);
 0271            switch (message.Response.Status)
 272            {
 273                case 200:
 274                    {
 0275                        WebApplicationFirewallPolicy value = default;
 0276                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0277                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 278                        {
 0279                            value = null;
 280                        }
 281                        else
 282                        {
 0283                            value = WebApplicationFirewallPolicy.DeserializeWebApplicationFirewallPolicy(document.RootEl
 284                        }
 0285                        return Response.FromValue(value, message.Response);
 286                    }
 287                default:
 0288                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 289            }
 0290        }
 291
 292        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string policyName, WebApplicationFire
 293        {
 0294            var message = _pipeline.CreateMessage();
 0295            var request = message.Request;
 0296            request.Method = RequestMethod.Put;
 0297            var uri = new RawRequestUriBuilder();
 0298            uri.Reset(endpoint);
 0299            uri.AppendPath("/subscriptions/", false);
 0300            uri.AppendPath(subscriptionId, true);
 0301            uri.AppendPath("/resourceGroups/", false);
 0302            uri.AppendPath(resourceGroupName, true);
 0303            uri.AppendPath("/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/", false);
 0304            uri.AppendPath(policyName, true);
 0305            uri.AppendQuery("api-version", "2020-04-01", true);
 0306            request.Uri = uri;
 0307            request.Headers.Add("Content-Type", "application/json");
 0308            var content = new Utf8JsonRequestContent();
 0309            content.JsonWriter.WriteObjectValue(parameters);
 0310            request.Content = content;
 0311            return message;
 312        }
 313
 314        /// <summary> Creates or update policy with specified rule set name within a resource group. </summary>
 315        /// <param name="resourceGroupName"> The name of the resource group. </param>
 316        /// <param name="policyName"> The name of the policy. </param>
 317        /// <param name="parameters"> Policy to be created. </param>
 318        /// <param name="cancellationToken"> The cancellation token to use. </param>
 319        public async Task<Response<WebApplicationFirewallPolicy>> CreateOrUpdateAsync(string resourceGroupName, string p
 320        {
 0321            if (resourceGroupName == null)
 322            {
 0323                throw new ArgumentNullException(nameof(resourceGroupName));
 324            }
 0325            if (policyName == null)
 326            {
 0327                throw new ArgumentNullException(nameof(policyName));
 328            }
 0329            if (parameters == null)
 330            {
 0331                throw new ArgumentNullException(nameof(parameters));
 332            }
 333
 0334            using var message = CreateCreateOrUpdateRequest(resourceGroupName, policyName, parameters);
 0335            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0336            switch (message.Response.Status)
 337            {
 338                case 200:
 339                case 201:
 340                    {
 0341                        WebApplicationFirewallPolicy value = default;
 0342                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0343                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 344                        {
 0345                            value = null;
 346                        }
 347                        else
 348                        {
 0349                            value = WebApplicationFirewallPolicy.DeserializeWebApplicationFirewallPolicy(document.RootEl
 350                        }
 0351                        return Response.FromValue(value, message.Response);
 352                    }
 353                default:
 0354                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 355            }
 0356        }
 357
 358        /// <summary> Creates or update policy with specified rule set name within a resource group. </summary>
 359        /// <param name="resourceGroupName"> The name of the resource group. </param>
 360        /// <param name="policyName"> The name of the policy. </param>
 361        /// <param name="parameters"> Policy to be created. </param>
 362        /// <param name="cancellationToken"> The cancellation token to use. </param>
 363        public Response<WebApplicationFirewallPolicy> CreateOrUpdate(string resourceGroupName, string policyName, WebApp
 364        {
 0365            if (resourceGroupName == null)
 366            {
 0367                throw new ArgumentNullException(nameof(resourceGroupName));
 368            }
 0369            if (policyName == null)
 370            {
 0371                throw new ArgumentNullException(nameof(policyName));
 372            }
 0373            if (parameters == null)
 374            {
 0375                throw new ArgumentNullException(nameof(parameters));
 376            }
 377
 0378            using var message = CreateCreateOrUpdateRequest(resourceGroupName, policyName, parameters);
 0379            _pipeline.Send(message, cancellationToken);
 0380            switch (message.Response.Status)
 381            {
 382                case 200:
 383                case 201:
 384                    {
 0385                        WebApplicationFirewallPolicy value = default;
 0386                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0387                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 388                        {
 0389                            value = null;
 390                        }
 391                        else
 392                        {
 0393                            value = WebApplicationFirewallPolicy.DeserializeWebApplicationFirewallPolicy(document.RootEl
 394                        }
 0395                        return Response.FromValue(value, message.Response);
 396                    }
 397                default:
 0398                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 399            }
 0400        }
 401
 402        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string policyName)
 403        {
 0404            var message = _pipeline.CreateMessage();
 0405            var request = message.Request;
 0406            request.Method = RequestMethod.Delete;
 0407            var uri = new RawRequestUriBuilder();
 0408            uri.Reset(endpoint);
 0409            uri.AppendPath("/subscriptions/", false);
 0410            uri.AppendPath(subscriptionId, true);
 0411            uri.AppendPath("/resourceGroups/", false);
 0412            uri.AppendPath(resourceGroupName, true);
 0413            uri.AppendPath("/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/", false);
 0414            uri.AppendPath(policyName, true);
 0415            uri.AppendQuery("api-version", "2020-04-01", true);
 0416            request.Uri = uri;
 0417            return message;
 418        }
 419
 420        /// <summary> Deletes Policy. </summary>
 421        /// <param name="resourceGroupName"> The name of the resource group. </param>
 422        /// <param name="policyName"> The name of the policy. </param>
 423        /// <param name="cancellationToken"> The cancellation token to use. </param>
 424        public async Task<Response> DeleteAsync(string resourceGroupName, string policyName, CancellationToken cancellat
 425        {
 0426            if (resourceGroupName == null)
 427            {
 0428                throw new ArgumentNullException(nameof(resourceGroupName));
 429            }
 0430            if (policyName == null)
 431            {
 0432                throw new ArgumentNullException(nameof(policyName));
 433            }
 434
 0435            using var message = CreateDeleteRequest(resourceGroupName, policyName);
 0436            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0437            switch (message.Response.Status)
 438            {
 439                case 200:
 440                case 202:
 441                case 204:
 0442                    return message.Response;
 443                default:
 0444                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 445            }
 0446        }
 447
 448        /// <summary> Deletes Policy. </summary>
 449        /// <param name="resourceGroupName"> The name of the resource group. </param>
 450        /// <param name="policyName"> The name of the policy. </param>
 451        /// <param name="cancellationToken"> The cancellation token to use. </param>
 452        public Response Delete(string resourceGroupName, string policyName, CancellationToken cancellationToken = defaul
 453        {
 0454            if (resourceGroupName == null)
 455            {
 0456                throw new ArgumentNullException(nameof(resourceGroupName));
 457            }
 0458            if (policyName == null)
 459            {
 0460                throw new ArgumentNullException(nameof(policyName));
 461            }
 462
 0463            using var message = CreateDeleteRequest(resourceGroupName, policyName);
 0464            _pipeline.Send(message, cancellationToken);
 0465            switch (message.Response.Status)
 466            {
 467                case 200:
 468                case 202:
 469                case 204:
 0470                    return message.Response;
 471                default:
 0472                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 473            }
 0474        }
 475
 476        internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName)
 477        {
 0478            var message = _pipeline.CreateMessage();
 0479            var request = message.Request;
 0480            request.Method = RequestMethod.Get;
 0481            var uri = new RawRequestUriBuilder();
 0482            uri.Reset(endpoint);
 0483            uri.AppendRawNextLink(nextLink, false);
 0484            request.Uri = uri;
 0485            return message;
 486        }
 487
 488        /// <summary> Lists all of the protection policies within a resource group. </summary>
 489        /// <param name="nextLink"> The URL to the next page of results. </param>
 490        /// <param name="resourceGroupName"> The name of the resource group. </param>
 491        /// <param name="cancellationToken"> The cancellation token to use. </param>
 492        public async Task<Response<WebApplicationFirewallPolicyListResult>> ListNextPageAsync(string nextLink, string re
 493        {
 0494            if (nextLink == null)
 495            {
 0496                throw new ArgumentNullException(nameof(nextLink));
 497            }
 0498            if (resourceGroupName == null)
 499            {
 0500                throw new ArgumentNullException(nameof(resourceGroupName));
 501            }
 502
 0503            using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
 0504            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0505            switch (message.Response.Status)
 506            {
 507                case 200:
 508                    {
 0509                        WebApplicationFirewallPolicyListResult value = default;
 0510                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0511                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 512                        {
 0513                            value = null;
 514                        }
 515                        else
 516                        {
 0517                            value = WebApplicationFirewallPolicyListResult.DeserializeWebApplicationFirewallPolicyListRe
 518                        }
 0519                        return Response.FromValue(value, message.Response);
 520                    }
 521                default:
 0522                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 523            }
 0524        }
 525
 526        /// <summary> Lists all of the protection policies within a resource group. </summary>
 527        /// <param name="nextLink"> The URL to the next page of results. </param>
 528        /// <param name="resourceGroupName"> The name of the resource group. </param>
 529        /// <param name="cancellationToken"> The cancellation token to use. </param>
 530        public Response<WebApplicationFirewallPolicyListResult> ListNextPage(string nextLink, string resourceGroupName, 
 531        {
 0532            if (nextLink == null)
 533            {
 0534                throw new ArgumentNullException(nameof(nextLink));
 535            }
 0536            if (resourceGroupName == null)
 537            {
 0538                throw new ArgumentNullException(nameof(resourceGroupName));
 539            }
 540
 0541            using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
 0542            _pipeline.Send(message, cancellationToken);
 0543            switch (message.Response.Status)
 544            {
 545                case 200:
 546                    {
 0547                        WebApplicationFirewallPolicyListResult value = default;
 0548                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0549                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 550                        {
 0551                            value = null;
 552                        }
 553                        else
 554                        {
 0555                            value = WebApplicationFirewallPolicyListResult.DeserializeWebApplicationFirewallPolicyListRe
 556                        }
 0557                        return Response.FromValue(value, message.Response);
 558                    }
 559                default:
 0560                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 561            }
 0562        }
 563
 564        internal HttpMessage CreateListAllNextPageRequest(string nextLink)
 565        {
 0566            var message = _pipeline.CreateMessage();
 0567            var request = message.Request;
 0568            request.Method = RequestMethod.Get;
 0569            var uri = new RawRequestUriBuilder();
 0570            uri.Reset(endpoint);
 0571            uri.AppendRawNextLink(nextLink, false);
 0572            request.Uri = uri;
 0573            return message;
 574        }
 575
 576        /// <summary> Gets all the WAF policies in a subscription. </summary>
 577        /// <param name="nextLink"> The URL to the next page of results. </param>
 578        /// <param name="cancellationToken"> The cancellation token to use. </param>
 579        public async Task<Response<WebApplicationFirewallPolicyListResult>> ListAllNextPageAsync(string nextLink, Cancel
 580        {
 0581            if (nextLink == null)
 582            {
 0583                throw new ArgumentNullException(nameof(nextLink));
 584            }
 585
 0586            using var message = CreateListAllNextPageRequest(nextLink);
 0587            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0588            switch (message.Response.Status)
 589            {
 590                case 200:
 591                    {
 0592                        WebApplicationFirewallPolicyListResult value = default;
 0593                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0594                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 595                        {
 0596                            value = null;
 597                        }
 598                        else
 599                        {
 0600                            value = WebApplicationFirewallPolicyListResult.DeserializeWebApplicationFirewallPolicyListRe
 601                        }
 0602                        return Response.FromValue(value, message.Response);
 603                    }
 604                default:
 0605                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 606            }
 0607        }
 608
 609        /// <summary> Gets all the WAF policies in a subscription. </summary>
 610        /// <param name="nextLink"> The URL to the next page of results. </param>
 611        /// <param name="cancellationToken"> The cancellation token to use. </param>
 612        public Response<WebApplicationFirewallPolicyListResult> ListAllNextPage(string nextLink, CancellationToken cance
 613        {
 0614            if (nextLink == null)
 615            {
 0616                throw new ArgumentNullException(nameof(nextLink));
 617            }
 618
 0619            using var message = CreateListAllNextPageRequest(nextLink);
 0620            _pipeline.Send(message, cancellationToken);
 0621            switch (message.Response.Status)
 622            {
 623                case 200:
 624                    {
 0625                        WebApplicationFirewallPolicyListResult value = default;
 0626                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0627                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 628                        {
 0629                            value = null;
 630                        }
 631                        else
 632                        {
 0633                            value = WebApplicationFirewallPolicyListResult.DeserializeWebApplicationFirewallPolicyListRe
 634                        }
 0635                        return Response.FromValue(value, message.Response);
 636                    }
 637                default:
 0638                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 639            }
 0640        }
 641    }
 642}