< Summary

Class:Azure.ResourceManager.Compute.GalleriesRestOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\GalleriesRestOperations.cs
Covered lines:168
Uncovered lines:147
Coverable lines:315
Total lines:704
Line coverage:53.3% (168 of 315)
Covered branches:38
Total branches:120
Branch coverage:31.6% (38 of 120)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateCreateOrUpdateRequest(...)-100%100%
CreateOrUpdateAsync()-66.67%50%
CreateOrUpdate(...)-66.67%50%
CreateUpdateRequest(...)-0%100%
UpdateAsync()-0%0%
Update(...)-0%0%
CreateGetRequest(...)-100%100%
GetAsync()-73.33%50%
Get(...)-73.33%50%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-70%50%
Delete(...)-70%50%
CreateListByResourceGroupRequest(...)-100%100%
ListByResourceGroupAsync()-76.92%50%
ListByResourceGroup(...)-76.92%50%
CreateListRequest()-100%100%
ListAsync()-81.82%50%
List(...)-81.82%50%
CreateListByResourceGroupNextPageRequest(...)-0%100%
ListByResourceGroupNextPageAsync()-0%0%
ListByResourceGroupNextPage(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\GalleriesRestOperations.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.Compute.Models;
 16
 17namespace Azure.ResourceManager.Compute
 18{
 19    internal partial class GalleriesRestOperations
 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 GalleriesRestOperations. </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"> Subscription credentials which uniquely identify Microsoft Azure subscription.
 30        /// <param name="endpoint"> server parameter. </param>
 31        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 39632        public GalleriesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId
 33        {
 39634            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 39638            endpoint ??= new Uri("https://management.azure.com");
 39
 39640            this.subscriptionId = subscriptionId;
 39641            this.endpoint = endpoint;
 39642            _clientDiagnostics = clientDiagnostics;
 39643            _pipeline = pipeline;
 39644        }
 45
 46        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string galleryName, Gallery gallery)
 47        {
 4848            var message = _pipeline.CreateMessage();
 4849            var request = message.Request;
 4850            request.Method = RequestMethod.Put;
 4851            var uri = new RawRequestUriBuilder();
 4852            uri.Reset(endpoint);
 4853            uri.AppendPath("/subscriptions/", false);
 4854            uri.AppendPath(subscriptionId, true);
 4855            uri.AppendPath("/resourceGroups/", false);
 4856            uri.AppendPath(resourceGroupName, true);
 4857            uri.AppendPath("/providers/Microsoft.Compute/galleries/", false);
 4858            uri.AppendPath(galleryName, true);
 4859            uri.AppendQuery("api-version", "2019-12-01", true);
 4860            request.Uri = uri;
 4861            request.Headers.Add("Content-Type", "application/json");
 4862            var content = new Utf8JsonRequestContent();
 4863            content.JsonWriter.WriteObjectValue(gallery);
 4864            request.Content = content;
 4865            return message;
 66        }
 67
 68        /// <summary> Create or update a Shared Image Gallery. </summary>
 69        /// <param name="resourceGroupName"> The name of the resource group. </param>
 70        /// <param name="galleryName"> The name of the Shared Image Gallery. The allowed characters are alphabets and nu
 71        /// <param name="gallery"> Parameters supplied to the create or update Shared Image Gallery operation. </param>
 72        /// <param name="cancellationToken"> The cancellation token to use. </param>
 73        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string galleryName, Gallery gallery, C
 74        {
 1275            if (resourceGroupName == null)
 76            {
 077                throw new ArgumentNullException(nameof(resourceGroupName));
 78            }
 1279            if (galleryName == null)
 80            {
 081                throw new ArgumentNullException(nameof(galleryName));
 82            }
 1283            if (gallery == null)
 84            {
 085                throw new ArgumentNullException(nameof(gallery));
 86            }
 87
 1288            using var message = CreateCreateOrUpdateRequest(resourceGroupName, galleryName, gallery);
 1289            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 1290            switch (message.Response.Status)
 91            {
 92                case 200:
 93                case 201:
 94                case 202:
 1295                    return message.Response;
 96                default:
 097                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 98            }
 1299        }
 100
 101        /// <summary> Create or update a Shared Image Gallery. </summary>
 102        /// <param name="resourceGroupName"> The name of the resource group. </param>
 103        /// <param name="galleryName"> The name of the Shared Image Gallery. The allowed characters are alphabets and nu
 104        /// <param name="gallery"> Parameters supplied to the create or update Shared Image Gallery operation. </param>
 105        /// <param name="cancellationToken"> The cancellation token to use. </param>
 106        public Response CreateOrUpdate(string resourceGroupName, string galleryName, Gallery gallery, CancellationToken 
 107        {
 12108            if (resourceGroupName == null)
 109            {
 0110                throw new ArgumentNullException(nameof(resourceGroupName));
 111            }
 12112            if (galleryName == null)
 113            {
 0114                throw new ArgumentNullException(nameof(galleryName));
 115            }
 12116            if (gallery == null)
 117            {
 0118                throw new ArgumentNullException(nameof(gallery));
 119            }
 120
 12121            using var message = CreateCreateOrUpdateRequest(resourceGroupName, galleryName, gallery);
 12122            _pipeline.Send(message, cancellationToken);
 12123            switch (message.Response.Status)
 124            {
 125                case 200:
 126                case 201:
 127                case 202:
 12128                    return message.Response;
 129                default:
 0130                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 131            }
 12132        }
 133
 134        internal HttpMessage CreateUpdateRequest(string resourceGroupName, string galleryName, GalleryUpdate gallery)
 135        {
 0136            var message = _pipeline.CreateMessage();
 0137            var request = message.Request;
 0138            request.Method = RequestMethod.Patch;
 0139            var uri = new RawRequestUriBuilder();
 0140            uri.Reset(endpoint);
 0141            uri.AppendPath("/subscriptions/", false);
 0142            uri.AppendPath(subscriptionId, true);
 0143            uri.AppendPath("/resourceGroups/", false);
 0144            uri.AppendPath(resourceGroupName, true);
 0145            uri.AppendPath("/providers/Microsoft.Compute/galleries/", false);
 0146            uri.AppendPath(galleryName, true);
 0147            uri.AppendQuery("api-version", "2019-12-01", true);
 0148            request.Uri = uri;
 0149            request.Headers.Add("Content-Type", "application/json");
 0150            var content = new Utf8JsonRequestContent();
 0151            content.JsonWriter.WriteObjectValue(gallery);
 0152            request.Content = content;
 0153            return message;
 154        }
 155
 156        /// <summary> Update a Shared Image Gallery. </summary>
 157        /// <param name="resourceGroupName"> The name of the resource group. </param>
 158        /// <param name="galleryName"> The name of the Shared Image Gallery. The allowed characters are alphabets and nu
 159        /// <param name="gallery"> Parameters supplied to the update Shared Image Gallery operation. </param>
 160        /// <param name="cancellationToken"> The cancellation token to use. </param>
 161        public async Task<Response> UpdateAsync(string resourceGroupName, string galleryName, GalleryUpdate gallery, Can
 162        {
 0163            if (resourceGroupName == null)
 164            {
 0165                throw new ArgumentNullException(nameof(resourceGroupName));
 166            }
 0167            if (galleryName == null)
 168            {
 0169                throw new ArgumentNullException(nameof(galleryName));
 170            }
 0171            if (gallery == null)
 172            {
 0173                throw new ArgumentNullException(nameof(gallery));
 174            }
 175
 0176            using var message = CreateUpdateRequest(resourceGroupName, galleryName, gallery);
 0177            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0178            switch (message.Response.Status)
 179            {
 180                case 200:
 0181                    return message.Response;
 182                default:
 0183                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 184            }
 0185        }
 186
 187        /// <summary> Update a Shared Image Gallery. </summary>
 188        /// <param name="resourceGroupName"> The name of the resource group. </param>
 189        /// <param name="galleryName"> The name of the Shared Image Gallery. The allowed characters are alphabets and nu
 190        /// <param name="gallery"> Parameters supplied to the update Shared Image Gallery operation. </param>
 191        /// <param name="cancellationToken"> The cancellation token to use. </param>
 192        public Response Update(string resourceGroupName, string galleryName, GalleryUpdate gallery, CancellationToken ca
 193        {
 0194            if (resourceGroupName == null)
 195            {
 0196                throw new ArgumentNullException(nameof(resourceGroupName));
 197            }
 0198            if (galleryName == null)
 199            {
 0200                throw new ArgumentNullException(nameof(galleryName));
 201            }
 0202            if (gallery == null)
 203            {
 0204                throw new ArgumentNullException(nameof(gallery));
 205            }
 206
 0207            using var message = CreateUpdateRequest(resourceGroupName, galleryName, gallery);
 0208            _pipeline.Send(message, cancellationToken);
 0209            switch (message.Response.Status)
 210            {
 211                case 200:
 0212                    return message.Response;
 213                default:
 0214                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 215            }
 0216        }
 217
 218        internal HttpMessage CreateGetRequest(string resourceGroupName, string galleryName)
 219        {
 8220            var message = _pipeline.CreateMessage();
 8221            var request = message.Request;
 8222            request.Method = RequestMethod.Get;
 8223            var uri = new RawRequestUriBuilder();
 8224            uri.Reset(endpoint);
 8225            uri.AppendPath("/subscriptions/", false);
 8226            uri.AppendPath(subscriptionId, true);
 8227            uri.AppendPath("/resourceGroups/", false);
 8228            uri.AppendPath(resourceGroupName, true);
 8229            uri.AppendPath("/providers/Microsoft.Compute/galleries/", false);
 8230            uri.AppendPath(galleryName, true);
 8231            uri.AppendQuery("api-version", "2019-12-01", true);
 8232            request.Uri = uri;
 8233            return message;
 234        }
 235
 236        /// <summary> Retrieves information about a Shared Image Gallery. </summary>
 237        /// <param name="resourceGroupName"> The name of the resource group. </param>
 238        /// <param name="galleryName"> The name of the Shared Image Gallery. </param>
 239        /// <param name="cancellationToken"> The cancellation token to use. </param>
 240        public async Task<Response<Gallery>> GetAsync(string resourceGroupName, string galleryName, CancellationToken ca
 241        {
 4242            if (resourceGroupName == null)
 243            {
 0244                throw new ArgumentNullException(nameof(resourceGroupName));
 245            }
 4246            if (galleryName == null)
 247            {
 0248                throw new ArgumentNullException(nameof(galleryName));
 249            }
 250
 4251            using var message = CreateGetRequest(resourceGroupName, galleryName);
 4252            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4253            switch (message.Response.Status)
 254            {
 255                case 200:
 256                    {
 4257                        Gallery value = default;
 4258                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4259                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 260                        {
 0261                            value = null;
 262                        }
 263                        else
 264                        {
 4265                            value = Gallery.DeserializeGallery(document.RootElement);
 266                        }
 4267                        return Response.FromValue(value, message.Response);
 268                    }
 269                default:
 0270                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 271            }
 4272        }
 273
 274        /// <summary> Retrieves information about a Shared Image Gallery. </summary>
 275        /// <param name="resourceGroupName"> The name of the resource group. </param>
 276        /// <param name="galleryName"> The name of the Shared Image Gallery. </param>
 277        /// <param name="cancellationToken"> The cancellation token to use. </param>
 278        public Response<Gallery> Get(string resourceGroupName, string galleryName, CancellationToken cancellationToken =
 279        {
 4280            if (resourceGroupName == null)
 281            {
 0282                throw new ArgumentNullException(nameof(resourceGroupName));
 283            }
 4284            if (galleryName == null)
 285            {
 0286                throw new ArgumentNullException(nameof(galleryName));
 287            }
 288
 4289            using var message = CreateGetRequest(resourceGroupName, galleryName);
 4290            _pipeline.Send(message, cancellationToken);
 4291            switch (message.Response.Status)
 292            {
 293                case 200:
 294                    {
 4295                        Gallery value = default;
 4296                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4297                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 298                        {
 0299                            value = null;
 300                        }
 301                        else
 302                        {
 4303                            value = Gallery.DeserializeGallery(document.RootElement);
 304                        }
 4305                        return Response.FromValue(value, message.Response);
 306                    }
 307                default:
 0308                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 309            }
 4310        }
 311
 312        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string galleryName)
 313        {
 40314            var message = _pipeline.CreateMessage();
 40315            var request = message.Request;
 40316            request.Method = RequestMethod.Delete;
 40317            var uri = new RawRequestUriBuilder();
 40318            uri.Reset(endpoint);
 40319            uri.AppendPath("/subscriptions/", false);
 40320            uri.AppendPath(subscriptionId, true);
 40321            uri.AppendPath("/resourceGroups/", false);
 40322            uri.AppendPath(resourceGroupName, true);
 40323            uri.AppendPath("/providers/Microsoft.Compute/galleries/", false);
 40324            uri.AppendPath(galleryName, true);
 40325            uri.AppendQuery("api-version", "2019-12-01", true);
 40326            request.Uri = uri;
 40327            return message;
 328        }
 329
 330        /// <summary> Delete a Shared Image Gallery. </summary>
 331        /// <param name="resourceGroupName"> The name of the resource group. </param>
 332        /// <param name="galleryName"> The name of the Shared Image Gallery to be deleted. </param>
 333        /// <param name="cancellationToken"> The cancellation token to use. </param>
 334        public async Task<Response> DeleteAsync(string resourceGroupName, string galleryName, CancellationToken cancella
 335        {
 10336            if (resourceGroupName == null)
 337            {
 0338                throw new ArgumentNullException(nameof(resourceGroupName));
 339            }
 10340            if (galleryName == null)
 341            {
 0342                throw new ArgumentNullException(nameof(galleryName));
 343            }
 344
 10345            using var message = CreateDeleteRequest(resourceGroupName, galleryName);
 10346            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 10347            switch (message.Response.Status)
 348            {
 349                case 200:
 350                case 202:
 351                case 204:
 10352                    return message.Response;
 353                default:
 0354                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 355            }
 10356        }
 357
 358        /// <summary> Delete a Shared Image Gallery. </summary>
 359        /// <param name="resourceGroupName"> The name of the resource group. </param>
 360        /// <param name="galleryName"> The name of the Shared Image Gallery to be deleted. </param>
 361        /// <param name="cancellationToken"> The cancellation token to use. </param>
 362        public Response Delete(string resourceGroupName, string galleryName, CancellationToken cancellationToken = defau
 363        {
 10364            if (resourceGroupName == null)
 365            {
 0366                throw new ArgumentNullException(nameof(resourceGroupName));
 367            }
 10368            if (galleryName == null)
 369            {
 0370                throw new ArgumentNullException(nameof(galleryName));
 371            }
 372
 10373            using var message = CreateDeleteRequest(resourceGroupName, galleryName);
 10374            _pipeline.Send(message, cancellationToken);
 10375            switch (message.Response.Status)
 376            {
 377                case 200:
 378                case 202:
 379                case 204:
 10380                    return message.Response;
 381                default:
 0382                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 383            }
 10384        }
 385
 386        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 387        {
 8388            var message = _pipeline.CreateMessage();
 8389            var request = message.Request;
 8390            request.Method = RequestMethod.Get;
 8391            var uri = new RawRequestUriBuilder();
 8392            uri.Reset(endpoint);
 8393            uri.AppendPath("/subscriptions/", false);
 8394            uri.AppendPath(subscriptionId, true);
 8395            uri.AppendPath("/resourceGroups/", false);
 8396            uri.AppendPath(resourceGroupName, true);
 8397            uri.AppendPath("/providers/Microsoft.Compute/galleries", false);
 8398            uri.AppendQuery("api-version", "2019-12-01", true);
 8399            request.Uri = uri;
 8400            return message;
 401        }
 402
 403        /// <summary> List galleries under a resource group. </summary>
 404        /// <param name="resourceGroupName"> The name of the resource group. </param>
 405        /// <param name="cancellationToken"> The cancellation token to use. </param>
 406        public async Task<Response<GalleryList>> ListByResourceGroupAsync(string resourceGroupName, CancellationToken ca
 407        {
 4408            if (resourceGroupName == null)
 409            {
 0410                throw new ArgumentNullException(nameof(resourceGroupName));
 411            }
 412
 4413            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 4414            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4415            switch (message.Response.Status)
 416            {
 417                case 200:
 418                    {
 4419                        GalleryList value = default;
 4420                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4421                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 422                        {
 0423                            value = null;
 424                        }
 425                        else
 426                        {
 4427                            value = GalleryList.DeserializeGalleryList(document.RootElement);
 428                        }
 4429                        return Response.FromValue(value, message.Response);
 430                    }
 431                default:
 0432                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 433            }
 4434        }
 435
 436        /// <summary> List galleries under a resource group. </summary>
 437        /// <param name="resourceGroupName"> The name of the resource group. </param>
 438        /// <param name="cancellationToken"> The cancellation token to use. </param>
 439        public Response<GalleryList> ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken =
 440        {
 4441            if (resourceGroupName == null)
 442            {
 0443                throw new ArgumentNullException(nameof(resourceGroupName));
 444            }
 445
 4446            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 4447            _pipeline.Send(message, cancellationToken);
 4448            switch (message.Response.Status)
 449            {
 450                case 200:
 451                    {
 4452                        GalleryList value = default;
 4453                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4454                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 455                        {
 0456                            value = null;
 457                        }
 458                        else
 459                        {
 4460                            value = GalleryList.DeserializeGalleryList(document.RootElement);
 461                        }
 4462                        return Response.FromValue(value, message.Response);
 463                    }
 464                default:
 0465                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 466            }
 4467        }
 468
 469        internal HttpMessage CreateListRequest()
 470        {
 4471            var message = _pipeline.CreateMessage();
 4472            var request = message.Request;
 4473            request.Method = RequestMethod.Get;
 4474            var uri = new RawRequestUriBuilder();
 4475            uri.Reset(endpoint);
 4476            uri.AppendPath("/subscriptions/", false);
 4477            uri.AppendPath(subscriptionId, true);
 4478            uri.AppendPath("/providers/Microsoft.Compute/galleries", false);
 4479            uri.AppendQuery("api-version", "2019-12-01", true);
 4480            request.Uri = uri;
 4481            return message;
 482        }
 483
 484        /// <summary> List galleries under a subscription. </summary>
 485        /// <param name="cancellationToken"> The cancellation token to use. </param>
 486        public async Task<Response<GalleryList>> ListAsync(CancellationToken cancellationToken = default)
 487        {
 2488            using var message = CreateListRequest();
 2489            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2490            switch (message.Response.Status)
 491            {
 492                case 200:
 493                    {
 2494                        GalleryList value = default;
 2495                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2496                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 497                        {
 0498                            value = null;
 499                        }
 500                        else
 501                        {
 2502                            value = GalleryList.DeserializeGalleryList(document.RootElement);
 503                        }
 2504                        return Response.FromValue(value, message.Response);
 505                    }
 506                default:
 0507                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 508            }
 2509        }
 510
 511        /// <summary> List galleries under a subscription. </summary>
 512        /// <param name="cancellationToken"> The cancellation token to use. </param>
 513        public Response<GalleryList> List(CancellationToken cancellationToken = default)
 514        {
 2515            using var message = CreateListRequest();
 2516            _pipeline.Send(message, cancellationToken);
 2517            switch (message.Response.Status)
 518            {
 519                case 200:
 520                    {
 2521                        GalleryList value = default;
 2522                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2523                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 524                        {
 0525                            value = null;
 526                        }
 527                        else
 528                        {
 2529                            value = GalleryList.DeserializeGalleryList(document.RootElement);
 530                        }
 2531                        return Response.FromValue(value, message.Response);
 532                    }
 533                default:
 0534                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 535            }
 2536        }
 537
 538        internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 539        {
 0540            var message = _pipeline.CreateMessage();
 0541            var request = message.Request;
 0542            request.Method = RequestMethod.Get;
 0543            var uri = new RawRequestUriBuilder();
 0544            uri.Reset(endpoint);
 0545            uri.AppendRawNextLink(nextLink, false);
 0546            request.Uri = uri;
 0547            return message;
 548        }
 549
 550        /// <summary> List galleries under a resource group. </summary>
 551        /// <param name="nextLink"> The URL to the next page of results. </param>
 552        /// <param name="resourceGroupName"> The name of the resource group. </param>
 553        /// <param name="cancellationToken"> The cancellation token to use. </param>
 554        public async Task<Response<GalleryList>> ListByResourceGroupNextPageAsync(string nextLink, string resourceGroupN
 555        {
 0556            if (nextLink == null)
 557            {
 0558                throw new ArgumentNullException(nameof(nextLink));
 559            }
 0560            if (resourceGroupName == null)
 561            {
 0562                throw new ArgumentNullException(nameof(resourceGroupName));
 563            }
 564
 0565            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0566            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0567            switch (message.Response.Status)
 568            {
 569                case 200:
 570                    {
 0571                        GalleryList value = default;
 0572                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0573                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 574                        {
 0575                            value = null;
 576                        }
 577                        else
 578                        {
 0579                            value = GalleryList.DeserializeGalleryList(document.RootElement);
 580                        }
 0581                        return Response.FromValue(value, message.Response);
 582                    }
 583                default:
 0584                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 585            }
 0586        }
 587
 588        /// <summary> List galleries under a resource group. </summary>
 589        /// <param name="nextLink"> The URL to the next page of results. </param>
 590        /// <param name="resourceGroupName"> The name of the resource group. </param>
 591        /// <param name="cancellationToken"> The cancellation token to use. </param>
 592        public Response<GalleryList> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, Cancellation
 593        {
 0594            if (nextLink == null)
 595            {
 0596                throw new ArgumentNullException(nameof(nextLink));
 597            }
 0598            if (resourceGroupName == null)
 599            {
 0600                throw new ArgumentNullException(nameof(resourceGroupName));
 601            }
 602
 0603            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0604            _pipeline.Send(message, cancellationToken);
 0605            switch (message.Response.Status)
 606            {
 607                case 200:
 608                    {
 0609                        GalleryList value = default;
 0610                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0611                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 612                        {
 0613                            value = null;
 614                        }
 615                        else
 616                        {
 0617                            value = GalleryList.DeserializeGalleryList(document.RootElement);
 618                        }
 0619                        return Response.FromValue(value, message.Response);
 620                    }
 621                default:
 0622                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 623            }
 0624        }
 625
 626        internal HttpMessage CreateListNextPageRequest(string nextLink)
 627        {
 0628            var message = _pipeline.CreateMessage();
 0629            var request = message.Request;
 0630            request.Method = RequestMethod.Get;
 0631            var uri = new RawRequestUriBuilder();
 0632            uri.Reset(endpoint);
 0633            uri.AppendRawNextLink(nextLink, false);
 0634            request.Uri = uri;
 0635            return message;
 636        }
 637
 638        /// <summary> List galleries under a subscription. </summary>
 639        /// <param name="nextLink"> The URL to the next page of results. </param>
 640        /// <param name="cancellationToken"> The cancellation token to use. </param>
 641        public async Task<Response<GalleryList>> ListNextPageAsync(string nextLink, CancellationToken cancellationToken 
 642        {
 0643            if (nextLink == null)
 644            {
 0645                throw new ArgumentNullException(nameof(nextLink));
 646            }
 647
 0648            using var message = CreateListNextPageRequest(nextLink);
 0649            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0650            switch (message.Response.Status)
 651            {
 652                case 200:
 653                    {
 0654                        GalleryList value = default;
 0655                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0656                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 657                        {
 0658                            value = null;
 659                        }
 660                        else
 661                        {
 0662                            value = GalleryList.DeserializeGalleryList(document.RootElement);
 663                        }
 0664                        return Response.FromValue(value, message.Response);
 665                    }
 666                default:
 0667                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 668            }
 0669        }
 670
 671        /// <summary> List galleries under a subscription. </summary>
 672        /// <param name="nextLink"> The URL to the next page of results. </param>
 673        /// <param name="cancellationToken"> The cancellation token to use. </param>
 674        public Response<GalleryList> ListNextPage(string nextLink, CancellationToken cancellationToken = default)
 675        {
 0676            if (nextLink == null)
 677            {
 0678                throw new ArgumentNullException(nameof(nextLink));
 679            }
 680
 0681            using var message = CreateListNextPageRequest(nextLink);
 0682            _pipeline.Send(message, cancellationToken);
 0683            switch (message.Response.Status)
 684            {
 685                case 200:
 686                    {
 0687                        GalleryList value = default;
 0688                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0689                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 690                        {
 0691                            value = null;
 692                        }
 693                        else
 694                        {
 0695                            value = GalleryList.DeserializeGalleryList(document.RootElement);
 696                        }
 0697                        return Response.FromValue(value, message.Response);
 698                    }
 699                default:
 0700                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 701            }
 0702        }
 703    }
 704}