< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateDeleteRequest(...)-0%100%
DeleteAsync()-0%0%
Delete(...)-0%0%
CreateGetRequest(...)-0%100%
GetAsync()-0%0%
Get(...)-0%0%
CreateCreateOrUpdateRequest(...)-0%100%
CreateOrUpdateAsync()-0%0%
CreateOrUpdate(...)-0%0%
CreateListRequest()-0%100%
ListAsync()-0%0%
List(...)-0%0%
CreateListByResourceGroupRequest(...)-0%100%
ListByResourceGroupAsync()-0%0%
ListByResourceGroup(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%
CreateListByResourceGroupNextPageRequest(...)-0%100%
ListByResourceGroupNextPageAsync()-0%0%
ListByResourceGroupNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\BastionHostsRestOperations.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 BastionHostsRestOperations
 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 BastionHostsRestOperations. </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 BastionHostsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptio
 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 bastionHostName)
 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/bastionHosts/", false);
 058            uri.AppendPath(bastionHostName, true);
 059            uri.AppendQuery("api-version", "2020-04-01", true);
 060            request.Uri = uri;
 061            return message;
 62        }
 63
 64        /// <summary> Deletes the specified Bastion Host. </summary>
 65        /// <param name="resourceGroupName"> The name of the resource group. </param>
 66        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 67        /// <param name="cancellationToken"> The cancellation token to use. </param>
 68        public async Task<Response> DeleteAsync(string resourceGroupName, string bastionHostName, CancellationToken canc
 69        {
 070            if (resourceGroupName == null)
 71            {
 072                throw new ArgumentNullException(nameof(resourceGroupName));
 73            }
 074            if (bastionHostName == null)
 75            {
 076                throw new ArgumentNullException(nameof(bastionHostName));
 77            }
 78
 079            using var message = CreateDeleteRequest(resourceGroupName, bastionHostName);
 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 Bastion Host. </summary>
 93        /// <param name="resourceGroupName"> The name of the resource group. </param>
 94        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 95        /// <param name="cancellationToken"> The cancellation token to use. </param>
 96        public Response Delete(string resourceGroupName, string bastionHostName, CancellationToken cancellationToken = d
 97        {
 098            if (resourceGroupName == null)
 99            {
 0100                throw new ArgumentNullException(nameof(resourceGroupName));
 101            }
 0102            if (bastionHostName == null)
 103            {
 0104                throw new ArgumentNullException(nameof(bastionHostName));
 105            }
 106
 0107            using var message = CreateDeleteRequest(resourceGroupName, bastionHostName);
 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 bastionHostName)
 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/bastionHosts/", false);
 0132            uri.AppendPath(bastionHostName, true);
 0133            uri.AppendQuery("api-version", "2020-04-01", true);
 0134            request.Uri = uri;
 0135            return message;
 136        }
 137
 138        /// <summary> Gets the specified Bastion Host. </summary>
 139        /// <param name="resourceGroupName"> The name of the resource group. </param>
 140        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 141        /// <param name="cancellationToken"> The cancellation token to use. </param>
 142        public async Task<Response<BastionHost>> GetAsync(string resourceGroupName, string bastionHostName, Cancellation
 143        {
 0144            if (resourceGroupName == null)
 145            {
 0146                throw new ArgumentNullException(nameof(resourceGroupName));
 147            }
 0148            if (bastionHostName == null)
 149            {
 0150                throw new ArgumentNullException(nameof(bastionHostName));
 151            }
 152
 0153            using var message = CreateGetRequest(resourceGroupName, bastionHostName);
 0154            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0155            switch (message.Response.Status)
 156            {
 157                case 200:
 158                    {
 0159                        BastionHost value = default;
 0160                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0161                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 162                        {
 0163                            value = null;
 164                        }
 165                        else
 166                        {
 0167                            value = BastionHost.DeserializeBastionHost(document.RootElement);
 168                        }
 0169                        return Response.FromValue(value, message.Response);
 170                    }
 171                default:
 0172                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 173            }
 0174        }
 175
 176        /// <summary> Gets the specified Bastion Host. </summary>
 177        /// <param name="resourceGroupName"> The name of the resource group. </param>
 178        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 179        /// <param name="cancellationToken"> The cancellation token to use. </param>
 180        public Response<BastionHost> Get(string resourceGroupName, string bastionHostName, CancellationToken cancellatio
 181        {
 0182            if (resourceGroupName == null)
 183            {
 0184                throw new ArgumentNullException(nameof(resourceGroupName));
 185            }
 0186            if (bastionHostName == null)
 187            {
 0188                throw new ArgumentNullException(nameof(bastionHostName));
 189            }
 190
 0191            using var message = CreateGetRequest(resourceGroupName, bastionHostName);
 0192            _pipeline.Send(message, cancellationToken);
 0193            switch (message.Response.Status)
 194            {
 195                case 200:
 196                    {
 0197                        BastionHost value = default;
 0198                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0199                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 200                        {
 0201                            value = null;
 202                        }
 203                        else
 204                        {
 0205                            value = BastionHost.DeserializeBastionHost(document.RootElement);
 206                        }
 0207                        return Response.FromValue(value, message.Response);
 208                    }
 209                default:
 0210                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 211            }
 0212        }
 213
 214        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string bastionHostName, BastionHost p
 215        {
 0216            var message = _pipeline.CreateMessage();
 0217            var request = message.Request;
 0218            request.Method = RequestMethod.Put;
 0219            var uri = new RawRequestUriBuilder();
 0220            uri.Reset(endpoint);
 0221            uri.AppendPath("/subscriptions/", false);
 0222            uri.AppendPath(subscriptionId, true);
 0223            uri.AppendPath("/resourceGroups/", false);
 0224            uri.AppendPath(resourceGroupName, true);
 0225            uri.AppendPath("/providers/Microsoft.Network/bastionHosts/", false);
 0226            uri.AppendPath(bastionHostName, true);
 0227            uri.AppendQuery("api-version", "2020-04-01", true);
 0228            request.Uri = uri;
 0229            request.Headers.Add("Content-Type", "application/json");
 0230            var content = new Utf8JsonRequestContent();
 0231            content.JsonWriter.WriteObjectValue(parameters);
 0232            request.Content = content;
 0233            return message;
 234        }
 235
 236        /// <summary> Creates or updates the specified Bastion Host. </summary>
 237        /// <param name="resourceGroupName"> The name of the resource group. </param>
 238        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 239        /// <param name="parameters"> Parameters supplied to the create or update Bastion Host operation. </param>
 240        /// <param name="cancellationToken"> The cancellation token to use. </param>
 241        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string bastionHostName, BastionHost pa
 242        {
 0243            if (resourceGroupName == null)
 244            {
 0245                throw new ArgumentNullException(nameof(resourceGroupName));
 246            }
 0247            if (bastionHostName == null)
 248            {
 0249                throw new ArgumentNullException(nameof(bastionHostName));
 250            }
 0251            if (parameters == null)
 252            {
 0253                throw new ArgumentNullException(nameof(parameters));
 254            }
 255
 0256            using var message = CreateCreateOrUpdateRequest(resourceGroupName, bastionHostName, parameters);
 0257            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0258            switch (message.Response.Status)
 259            {
 260                case 200:
 261                case 201:
 0262                    return message.Response;
 263                default:
 0264                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 265            }
 0266        }
 267
 268        /// <summary> Creates or updates the specified Bastion Host. </summary>
 269        /// <param name="resourceGroupName"> The name of the resource group. </param>
 270        /// <param name="bastionHostName"> The name of the Bastion Host. </param>
 271        /// <param name="parameters"> Parameters supplied to the create or update Bastion Host operation. </param>
 272        /// <param name="cancellationToken"> The cancellation token to use. </param>
 273        public Response CreateOrUpdate(string resourceGroupName, string bastionHostName, BastionHost parameters, Cancell
 274        {
 0275            if (resourceGroupName == null)
 276            {
 0277                throw new ArgumentNullException(nameof(resourceGroupName));
 278            }
 0279            if (bastionHostName == null)
 280            {
 0281                throw new ArgumentNullException(nameof(bastionHostName));
 282            }
 0283            if (parameters == null)
 284            {
 0285                throw new ArgumentNullException(nameof(parameters));
 286            }
 287
 0288            using var message = CreateCreateOrUpdateRequest(resourceGroupName, bastionHostName, parameters);
 0289            _pipeline.Send(message, cancellationToken);
 0290            switch (message.Response.Status)
 291            {
 292                case 200:
 293                case 201:
 0294                    return message.Response;
 295                default:
 0296                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 297            }
 0298        }
 299
 300        internal HttpMessage CreateListRequest()
 301        {
 0302            var message = _pipeline.CreateMessage();
 0303            var request = message.Request;
 0304            request.Method = RequestMethod.Get;
 0305            var uri = new RawRequestUriBuilder();
 0306            uri.Reset(endpoint);
 0307            uri.AppendPath("/subscriptions/", false);
 0308            uri.AppendPath(subscriptionId, true);
 0309            uri.AppendPath("/providers/Microsoft.Network/bastionHosts", false);
 0310            uri.AppendQuery("api-version", "2020-04-01", true);
 0311            request.Uri = uri;
 0312            return message;
 313        }
 314
 315        /// <summary> Lists all Bastion Hosts in a subscription. </summary>
 316        /// <param name="cancellationToken"> The cancellation token to use. </param>
 317        public async Task<Response<BastionHostListResult>> ListAsync(CancellationToken cancellationToken = default)
 318        {
 0319            using var message = CreateListRequest();
 0320            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0321            switch (message.Response.Status)
 322            {
 323                case 200:
 324                    {
 0325                        BastionHostListResult value = default;
 0326                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0327                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 328                        {
 0329                            value = null;
 330                        }
 331                        else
 332                        {
 0333                            value = BastionHostListResult.DeserializeBastionHostListResult(document.RootElement);
 334                        }
 0335                        return Response.FromValue(value, message.Response);
 336                    }
 337                default:
 0338                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 339            }
 0340        }
 341
 342        /// <summary> Lists all Bastion Hosts in a subscription. </summary>
 343        /// <param name="cancellationToken"> The cancellation token to use. </param>
 344        public Response<BastionHostListResult> List(CancellationToken cancellationToken = default)
 345        {
 0346            using var message = CreateListRequest();
 0347            _pipeline.Send(message, cancellationToken);
 0348            switch (message.Response.Status)
 349            {
 350                case 200:
 351                    {
 0352                        BastionHostListResult value = default;
 0353                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0354                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 355                        {
 0356                            value = null;
 357                        }
 358                        else
 359                        {
 0360                            value = BastionHostListResult.DeserializeBastionHostListResult(document.RootElement);
 361                        }
 0362                        return Response.FromValue(value, message.Response);
 363                    }
 364                default:
 0365                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 366            }
 0367        }
 368
 369        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 370        {
 0371            var message = _pipeline.CreateMessage();
 0372            var request = message.Request;
 0373            request.Method = RequestMethod.Get;
 0374            var uri = new RawRequestUriBuilder();
 0375            uri.Reset(endpoint);
 0376            uri.AppendPath("/subscriptions/", false);
 0377            uri.AppendPath(subscriptionId, true);
 0378            uri.AppendPath("/resourceGroups/", false);
 0379            uri.AppendPath(resourceGroupName, true);
 0380            uri.AppendPath("/providers/Microsoft.Network/bastionHosts", false);
 0381            uri.AppendQuery("api-version", "2020-04-01", true);
 0382            request.Uri = uri;
 0383            return message;
 384        }
 385
 386        /// <summary> Lists all Bastion Hosts in a resource group. </summary>
 387        /// <param name="resourceGroupName"> The name of the resource group. </param>
 388        /// <param name="cancellationToken"> The cancellation token to use. </param>
 389        public async Task<Response<BastionHostListResult>> ListByResourceGroupAsync(string resourceGroupName, Cancellati
 390        {
 0391            if (resourceGroupName == null)
 392            {
 0393                throw new ArgumentNullException(nameof(resourceGroupName));
 394            }
 395
 0396            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0397            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0398            switch (message.Response.Status)
 399            {
 400                case 200:
 401                    {
 0402                        BastionHostListResult value = default;
 0403                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0404                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 405                        {
 0406                            value = null;
 407                        }
 408                        else
 409                        {
 0410                            value = BastionHostListResult.DeserializeBastionHostListResult(document.RootElement);
 411                        }
 0412                        return Response.FromValue(value, message.Response);
 413                    }
 414                default:
 0415                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 416            }
 0417        }
 418
 419        /// <summary> Lists all Bastion Hosts in a resource group. </summary>
 420        /// <param name="resourceGroupName"> The name of the resource group. </param>
 421        /// <param name="cancellationToken"> The cancellation token to use. </param>
 422        public Response<BastionHostListResult> ListByResourceGroup(string resourceGroupName, CancellationToken cancellat
 423        {
 0424            if (resourceGroupName == null)
 425            {
 0426                throw new ArgumentNullException(nameof(resourceGroupName));
 427            }
 428
 0429            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 0430            _pipeline.Send(message, cancellationToken);
 0431            switch (message.Response.Status)
 432            {
 433                case 200:
 434                    {
 0435                        BastionHostListResult value = default;
 0436                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0437                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 438                        {
 0439                            value = null;
 440                        }
 441                        else
 442                        {
 0443                            value = BastionHostListResult.DeserializeBastionHostListResult(document.RootElement);
 444                        }
 0445                        return Response.FromValue(value, message.Response);
 446                    }
 447                default:
 0448                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 449            }
 0450        }
 451
 452        internal HttpMessage CreateListNextPageRequest(string nextLink)
 453        {
 0454            var message = _pipeline.CreateMessage();
 0455            var request = message.Request;
 0456            request.Method = RequestMethod.Get;
 0457            var uri = new RawRequestUriBuilder();
 0458            uri.Reset(endpoint);
 0459            uri.AppendRawNextLink(nextLink, false);
 0460            request.Uri = uri;
 0461            return message;
 462        }
 463
 464        /// <summary> Lists all Bastion Hosts in a subscription. </summary>
 465        /// <param name="nextLink"> The URL to the next page of results. </param>
 466        /// <param name="cancellationToken"> The cancellation token to use. </param>
 467        public async Task<Response<BastionHostListResult>> ListNextPageAsync(string nextLink, CancellationToken cancella
 468        {
 0469            if (nextLink == null)
 470            {
 0471                throw new ArgumentNullException(nameof(nextLink));
 472            }
 473
 0474            using var message = CreateListNextPageRequest(nextLink);
 0475            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0476            switch (message.Response.Status)
 477            {
 478                case 200:
 479                    {
 0480                        BastionHostListResult value = default;
 0481                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0482                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 483                        {
 0484                            value = null;
 485                        }
 486                        else
 487                        {
 0488                            value = BastionHostListResult.DeserializeBastionHostListResult(document.RootElement);
 489                        }
 0490                        return Response.FromValue(value, message.Response);
 491                    }
 492                default:
 0493                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 494            }
 0495        }
 496
 497        /// <summary> Lists all Bastion Hosts in a subscription. </summary>
 498        /// <param name="nextLink"> The URL to the next page of results. </param>
 499        /// <param name="cancellationToken"> The cancellation token to use. </param>
 500        public Response<BastionHostListResult> ListNextPage(string nextLink, CancellationToken cancellationToken = defau
 501        {
 0502            if (nextLink == null)
 503            {
 0504                throw new ArgumentNullException(nameof(nextLink));
 505            }
 506
 0507            using var message = CreateListNextPageRequest(nextLink);
 0508            _pipeline.Send(message, cancellationToken);
 0509            switch (message.Response.Status)
 510            {
 511                case 200:
 512                    {
 0513                        BastionHostListResult value = default;
 0514                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0515                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 516                        {
 0517                            value = null;
 518                        }
 519                        else
 520                        {
 0521                            value = BastionHostListResult.DeserializeBastionHostListResult(document.RootElement);
 522                        }
 0523                        return Response.FromValue(value, message.Response);
 524                    }
 525                default:
 0526                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 527            }
 0528        }
 529
 530        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 531        {
 0532            var message = _pipeline.CreateMessage();
 0533            var request = message.Request;
 0534            request.Method = RequestMethod.Get;
 0535            var uri = new RawRequestUriBuilder();
 0536            uri.Reset(endpoint);
 0537            uri.AppendRawNextLink(nextLink, false);
 0538            request.Uri = uri;
 0539            return message;
 540        }
 541
 542        /// <summary> Lists all Bastion Hosts in a resource group. </summary>
 543        /// <param name="nextLink"> The URL to the next page of results. </param>
 544        /// <param name="resourceGroupName"> The name of the resource group. </param>
 545        /// <param name="cancellationToken"> The cancellation token to use. </param>
 546        public async Task<Response<BastionHostListResult>> ListByResourceGroupNextPageAsync(string nextLink, string reso
 547        {
 0548            if (nextLink == null)
 549            {
 0550                throw new ArgumentNullException(nameof(nextLink));
 551            }
 0552            if (resourceGroupName == null)
 553            {
 0554                throw new ArgumentNullException(nameof(resourceGroupName));
 555            }
 556
 0557            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0558            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0559            switch (message.Response.Status)
 560            {
 561                case 200:
 562                    {
 0563                        BastionHostListResult value = default;
 0564                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0565                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 566                        {
 0567                            value = null;
 568                        }
 569                        else
 570                        {
 0571                            value = BastionHostListResult.DeserializeBastionHostListResult(document.RootElement);
 572                        }
 0573                        return Response.FromValue(value, message.Response);
 574                    }
 575                default:
 0576                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 577            }
 0578        }
 579
 580        /// <summary> Lists all Bastion Hosts in a resource group. </summary>
 581        /// <param name="nextLink"> The URL to the next page of results. </param>
 582        /// <param name="resourceGroupName"> The name of the resource group. </param>
 583        /// <param name="cancellationToken"> The cancellation token to use. </param>
 584        public Response<BastionHostListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, Ca
 585        {
 0586            if (nextLink == null)
 587            {
 0588                throw new ArgumentNullException(nameof(nextLink));
 589            }
 0590            if (resourceGroupName == null)
 591            {
 0592                throw new ArgumentNullException(nameof(resourceGroupName));
 593            }
 594
 0595            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0596            _pipeline.Send(message, cancellationToken);
 0597            switch (message.Response.Status)
 598            {
 599                case 200:
 600                    {
 0601                        BastionHostListResult value = default;
 0602                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0603                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 604                        {
 0605                            value = null;
 606                        }
 607                        else
 608                        {
 0609                            value = BastionHostListResult.DeserializeBastionHostListResult(document.RootElement);
 610                        }
 0611                        return Response.FromValue(value, message.Response);
 612                    }
 613                default:
 0614                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 615            }
 0616        }
 617    }
 618}