< Summary

Class:Azure.ResourceManager.Compute.GalleryImageVersionsRestOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\GalleryImageVersionsRestOperations.cs
Covered lines:172
Uncovered lines:145
Coverable lines:317
Total lines:698
Line coverage:54.2% (172 of 317)
Covered branches:50
Total branches:148
Branch coverage:33.7% (50 of 148)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateCreateOrUpdateRequest(...)-100%100%
CreateOrUpdateAsync()-62.5%50%
CreateOrUpdate(...)-62.5%50%
CreateUpdateRequest(...)-0%100%
UpdateAsync()-0%0%
Update(...)-0%0%
CreateGetRequest(...)-100%100%
GetAsync()-68.42%50%
Get(...)-68.42%50%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-64.29%50%
Delete(...)-64.29%50%
CreateListByGalleryImageRequest(...)-100%100%
ListByGalleryImageAsync()-70.59%50%
ListByGalleryImage(...)-70.59%50%
CreateListByGalleryImageNextPageRequest(...)-0%100%
ListByGalleryImageNextPageAsync()-0%0%
ListByGalleryImageNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\GalleryImageVersionsRestOperations.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 GalleryImageVersionsRestOperations
 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 GalleryImageVersionsRestOperations. </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 GalleryImageVersionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string sub
 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, string galleryIma
 47        {
 1648            var message = _pipeline.CreateMessage();
 1649            var request = message.Request;
 1650            request.Method = RequestMethod.Put;
 1651            var uri = new RawRequestUriBuilder();
 1652            uri.Reset(endpoint);
 1653            uri.AppendPath("/subscriptions/", false);
 1654            uri.AppendPath(subscriptionId, true);
 1655            uri.AppendPath("/resourceGroups/", false);
 1656            uri.AppendPath(resourceGroupName, true);
 1657            uri.AppendPath("/providers/Microsoft.Compute/galleries/", false);
 1658            uri.AppendPath(galleryName, true);
 1659            uri.AppendPath("/images/", false);
 1660            uri.AppendPath(galleryImageName, true);
 1661            uri.AppendPath("/versions/", false);
 1662            uri.AppendPath(galleryImageVersionName, true);
 1663            uri.AppendQuery("api-version", "2019-12-01", true);
 1664            request.Uri = uri;
 1665            request.Headers.Add("Content-Type", "application/json");
 1666            var content = new Utf8JsonRequestContent();
 1667            content.JsonWriter.WriteObjectValue(galleryImageVersion);
 1668            request.Content = content;
 1669            return message;
 70        }
 71
 72        /// <summary> Create or update a gallery Image Version. </summary>
 73        /// <param name="resourceGroupName"> The name of the resource group. </param>
 74        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 75        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version is to be
 76        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be created. Needs to follow 
 77        /// <param name="galleryImageVersion"> Parameters supplied to the create or update gallery Image Version operati
 78        /// <param name="cancellationToken"> The cancellation token to use. </param>
 79        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string galleryName, string galleryImag
 80        {
 481            if (resourceGroupName == null)
 82            {
 083                throw new ArgumentNullException(nameof(resourceGroupName));
 84            }
 485            if (galleryName == null)
 86            {
 087                throw new ArgumentNullException(nameof(galleryName));
 88            }
 489            if (galleryImageName == null)
 90            {
 091                throw new ArgumentNullException(nameof(galleryImageName));
 92            }
 493            if (galleryImageVersionName == null)
 94            {
 095                throw new ArgumentNullException(nameof(galleryImageVersionName));
 96            }
 497            if (galleryImageVersion == null)
 98            {
 099                throw new ArgumentNullException(nameof(galleryImageVersion));
 100            }
 101
 4102            using var message = CreateCreateOrUpdateRequest(resourceGroupName, galleryName, galleryImageName, galleryIma
 4103            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4104            switch (message.Response.Status)
 105            {
 106                case 200:
 107                case 201:
 108                case 202:
 4109                    return message.Response;
 110                default:
 0111                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 112            }
 4113        }
 114
 115        /// <summary> Create or update a gallery Image Version. </summary>
 116        /// <param name="resourceGroupName"> The name of the resource group. </param>
 117        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 118        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version is to be
 119        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be created. Needs to follow 
 120        /// <param name="galleryImageVersion"> Parameters supplied to the create or update gallery Image Version operati
 121        /// <param name="cancellationToken"> The cancellation token to use. </param>
 122        public Response CreateOrUpdate(string resourceGroupName, string galleryName, string galleryImageName, string gal
 123        {
 4124            if (resourceGroupName == null)
 125            {
 0126                throw new ArgumentNullException(nameof(resourceGroupName));
 127            }
 4128            if (galleryName == null)
 129            {
 0130                throw new ArgumentNullException(nameof(galleryName));
 131            }
 4132            if (galleryImageName == null)
 133            {
 0134                throw new ArgumentNullException(nameof(galleryImageName));
 135            }
 4136            if (galleryImageVersionName == null)
 137            {
 0138                throw new ArgumentNullException(nameof(galleryImageVersionName));
 139            }
 4140            if (galleryImageVersion == null)
 141            {
 0142                throw new ArgumentNullException(nameof(galleryImageVersion));
 143            }
 144
 4145            using var message = CreateCreateOrUpdateRequest(resourceGroupName, galleryName, galleryImageName, galleryIma
 4146            _pipeline.Send(message, cancellationToken);
 4147            switch (message.Response.Status)
 148            {
 149                case 200:
 150                case 201:
 151                case 202:
 4152                    return message.Response;
 153                default:
 0154                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 155            }
 4156        }
 157
 158        internal HttpMessage CreateUpdateRequest(string resourceGroupName, string galleryName, string galleryImageName, 
 159        {
 0160            var message = _pipeline.CreateMessage();
 0161            var request = message.Request;
 0162            request.Method = RequestMethod.Patch;
 0163            var uri = new RawRequestUriBuilder();
 0164            uri.Reset(endpoint);
 0165            uri.AppendPath("/subscriptions/", false);
 0166            uri.AppendPath(subscriptionId, true);
 0167            uri.AppendPath("/resourceGroups/", false);
 0168            uri.AppendPath(resourceGroupName, true);
 0169            uri.AppendPath("/providers/Microsoft.Compute/galleries/", false);
 0170            uri.AppendPath(galleryName, true);
 0171            uri.AppendPath("/images/", false);
 0172            uri.AppendPath(galleryImageName, true);
 0173            uri.AppendPath("/versions/", false);
 0174            uri.AppendPath(galleryImageVersionName, true);
 0175            uri.AppendQuery("api-version", "2019-12-01", true);
 0176            request.Uri = uri;
 0177            request.Headers.Add("Content-Type", "application/json");
 0178            var content = new Utf8JsonRequestContent();
 0179            content.JsonWriter.WriteObjectValue(galleryImageVersion);
 0180            request.Content = content;
 0181            return message;
 182        }
 183
 184        /// <summary> Update a gallery Image Version. </summary>
 185        /// <param name="resourceGroupName"> The name of the resource group. </param>
 186        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 187        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version is to be
 188        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be updated. Needs to follow 
 189        /// <param name="galleryImageVersion"> Parameters supplied to the update gallery Image Version operation. </para
 190        /// <param name="cancellationToken"> The cancellation token to use. </param>
 191        public async Task<Response> UpdateAsync(string resourceGroupName, string galleryName, string galleryImageName, s
 192        {
 0193            if (resourceGroupName == null)
 194            {
 0195                throw new ArgumentNullException(nameof(resourceGroupName));
 196            }
 0197            if (galleryName == null)
 198            {
 0199                throw new ArgumentNullException(nameof(galleryName));
 200            }
 0201            if (galleryImageName == null)
 202            {
 0203                throw new ArgumentNullException(nameof(galleryImageName));
 204            }
 0205            if (galleryImageVersionName == null)
 206            {
 0207                throw new ArgumentNullException(nameof(galleryImageVersionName));
 208            }
 0209            if (galleryImageVersion == null)
 210            {
 0211                throw new ArgumentNullException(nameof(galleryImageVersion));
 212            }
 213
 0214            using var message = CreateUpdateRequest(resourceGroupName, galleryName, galleryImageName, galleryImageVersio
 0215            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0216            switch (message.Response.Status)
 217            {
 218                case 200:
 0219                    return message.Response;
 220                default:
 0221                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 222            }
 0223        }
 224
 225        /// <summary> Update a gallery Image Version. </summary>
 226        /// <param name="resourceGroupName"> The name of the resource group. </param>
 227        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 228        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version is to be
 229        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be updated. Needs to follow 
 230        /// <param name="galleryImageVersion"> Parameters supplied to the update gallery Image Version operation. </para
 231        /// <param name="cancellationToken"> The cancellation token to use. </param>
 232        public Response Update(string resourceGroupName, string galleryName, string galleryImageName, string galleryImag
 233        {
 0234            if (resourceGroupName == null)
 235            {
 0236                throw new ArgumentNullException(nameof(resourceGroupName));
 237            }
 0238            if (galleryName == null)
 239            {
 0240                throw new ArgumentNullException(nameof(galleryName));
 241            }
 0242            if (galleryImageName == null)
 243            {
 0244                throw new ArgumentNullException(nameof(galleryImageName));
 245            }
 0246            if (galleryImageVersionName == null)
 247            {
 0248                throw new ArgumentNullException(nameof(galleryImageVersionName));
 249            }
 0250            if (galleryImageVersion == null)
 251            {
 0252                throw new ArgumentNullException(nameof(galleryImageVersion));
 253            }
 254
 0255            using var message = CreateUpdateRequest(resourceGroupName, galleryName, galleryImageName, galleryImageVersio
 0256            _pipeline.Send(message, cancellationToken);
 0257            switch (message.Response.Status)
 258            {
 259                case 200:
 0260                    return message.Response;
 261                default:
 0262                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 263            }
 0264        }
 265
 266        internal HttpMessage CreateGetRequest(string resourceGroupName, string galleryName, string galleryImageName, str
 267        {
 12268            var message = _pipeline.CreateMessage();
 12269            var request = message.Request;
 12270            request.Method = RequestMethod.Get;
 12271            var uri = new RawRequestUriBuilder();
 12272            uri.Reset(endpoint);
 12273            uri.AppendPath("/subscriptions/", false);
 12274            uri.AppendPath(subscriptionId, true);
 12275            uri.AppendPath("/resourceGroups/", false);
 12276            uri.AppendPath(resourceGroupName, true);
 12277            uri.AppendPath("/providers/Microsoft.Compute/galleries/", false);
 12278            uri.AppendPath(galleryName, true);
 12279            uri.AppendPath("/images/", false);
 12280            uri.AppendPath(galleryImageName, true);
 12281            uri.AppendPath("/versions/", false);
 12282            uri.AppendPath(galleryImageVersionName, true);
 12283            uri.AppendQuery("$expand", "ReplicationStatus", true);
 12284            uri.AppendQuery("api-version", "2019-12-01", true);
 12285            request.Uri = uri;
 12286            return message;
 287        }
 288
 289        /// <summary> Retrieves information about a gallery Image Version. </summary>
 290        /// <param name="resourceGroupName"> The name of the resource group. </param>
 291        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 292        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version resides.
 293        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be retrieved. </param>
 294        /// <param name="cancellationToken"> The cancellation token to use. </param>
 295        public async Task<Response<GalleryImageVersion>> GetAsync(string resourceGroupName, string galleryName, string g
 296        {
 6297            if (resourceGroupName == null)
 298            {
 0299                throw new ArgumentNullException(nameof(resourceGroupName));
 300            }
 6301            if (galleryName == null)
 302            {
 0303                throw new ArgumentNullException(nameof(galleryName));
 304            }
 6305            if (galleryImageName == null)
 306            {
 0307                throw new ArgumentNullException(nameof(galleryImageName));
 308            }
 6309            if (galleryImageVersionName == null)
 310            {
 0311                throw new ArgumentNullException(nameof(galleryImageVersionName));
 312            }
 313
 6314            using var message = CreateGetRequest(resourceGroupName, galleryName, galleryImageName, galleryImageVersionNa
 6315            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6316            switch (message.Response.Status)
 317            {
 318                case 200:
 319                    {
 6320                        GalleryImageVersion value = default;
 6321                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 6322                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 323                        {
 0324                            value = null;
 325                        }
 326                        else
 327                        {
 6328                            value = GalleryImageVersion.DeserializeGalleryImageVersion(document.RootElement);
 329                        }
 6330                        return Response.FromValue(value, message.Response);
 331                    }
 332                default:
 0333                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 334            }
 6335        }
 336
 337        /// <summary> Retrieves information about a gallery Image Version. </summary>
 338        /// <param name="resourceGroupName"> The name of the resource group. </param>
 339        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 340        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version resides.
 341        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be retrieved. </param>
 342        /// <param name="cancellationToken"> The cancellation token to use. </param>
 343        public Response<GalleryImageVersion> Get(string resourceGroupName, string galleryName, string galleryImageName, 
 344        {
 6345            if (resourceGroupName == null)
 346            {
 0347                throw new ArgumentNullException(nameof(resourceGroupName));
 348            }
 6349            if (galleryName == null)
 350            {
 0351                throw new ArgumentNullException(nameof(galleryName));
 352            }
 6353            if (galleryImageName == null)
 354            {
 0355                throw new ArgumentNullException(nameof(galleryImageName));
 356            }
 6357            if (galleryImageVersionName == null)
 358            {
 0359                throw new ArgumentNullException(nameof(galleryImageVersionName));
 360            }
 361
 6362            using var message = CreateGetRequest(resourceGroupName, galleryName, galleryImageName, galleryImageVersionNa
 6363            _pipeline.Send(message, cancellationToken);
 6364            switch (message.Response.Status)
 365            {
 366                case 200:
 367                    {
 6368                        GalleryImageVersion value = default;
 6369                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6370                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 371                        {
 0372                            value = null;
 373                        }
 374                        else
 375                        {
 6376                            value = GalleryImageVersion.DeserializeGalleryImageVersion(document.RootElement);
 377                        }
 6378                        return Response.FromValue(value, message.Response);
 379                    }
 380                default:
 0381                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 382            }
 6383        }
 384
 385        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string galleryName, string galleryImageName, 
 386        {
 8387            var message = _pipeline.CreateMessage();
 8388            var request = message.Request;
 8389            request.Method = RequestMethod.Delete;
 8390            var uri = new RawRequestUriBuilder();
 8391            uri.Reset(endpoint);
 8392            uri.AppendPath("/subscriptions/", false);
 8393            uri.AppendPath(subscriptionId, true);
 8394            uri.AppendPath("/resourceGroups/", false);
 8395            uri.AppendPath(resourceGroupName, true);
 8396            uri.AppendPath("/providers/Microsoft.Compute/galleries/", false);
 8397            uri.AppendPath(galleryName, true);
 8398            uri.AppendPath("/images/", false);
 8399            uri.AppendPath(galleryImageName, true);
 8400            uri.AppendPath("/versions/", false);
 8401            uri.AppendPath(galleryImageVersionName, true);
 8402            uri.AppendQuery("api-version", "2019-12-01", true);
 8403            request.Uri = uri;
 8404            return message;
 405        }
 406
 407        /// <summary> Delete a gallery Image Version. </summary>
 408        /// <param name="resourceGroupName"> The name of the resource group. </param>
 409        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 410        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version resides.
 411        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be deleted. </param>
 412        /// <param name="cancellationToken"> The cancellation token to use. </param>
 413        public async Task<Response> DeleteAsync(string resourceGroupName, string galleryName, string galleryImageName, s
 414        {
 2415            if (resourceGroupName == null)
 416            {
 0417                throw new ArgumentNullException(nameof(resourceGroupName));
 418            }
 2419            if (galleryName == null)
 420            {
 0421                throw new ArgumentNullException(nameof(galleryName));
 422            }
 2423            if (galleryImageName == null)
 424            {
 0425                throw new ArgumentNullException(nameof(galleryImageName));
 426            }
 2427            if (galleryImageVersionName == null)
 428            {
 0429                throw new ArgumentNullException(nameof(galleryImageVersionName));
 430            }
 431
 2432            using var message = CreateDeleteRequest(resourceGroupName, galleryName, galleryImageName, galleryImageVersio
 2433            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2434            switch (message.Response.Status)
 435            {
 436                case 200:
 437                case 202:
 438                case 204:
 2439                    return message.Response;
 440                default:
 0441                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 442            }
 2443        }
 444
 445        /// <summary> Delete a gallery Image Version. </summary>
 446        /// <param name="resourceGroupName"> The name of the resource group. </param>
 447        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 448        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version resides.
 449        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be deleted. </param>
 450        /// <param name="cancellationToken"> The cancellation token to use. </param>
 451        public Response Delete(string resourceGroupName, string galleryName, string galleryImageName, string galleryImag
 452        {
 2453            if (resourceGroupName == null)
 454            {
 0455                throw new ArgumentNullException(nameof(resourceGroupName));
 456            }
 2457            if (galleryName == null)
 458            {
 0459                throw new ArgumentNullException(nameof(galleryName));
 460            }
 2461            if (galleryImageName == null)
 462            {
 0463                throw new ArgumentNullException(nameof(galleryImageName));
 464            }
 2465            if (galleryImageVersionName == null)
 466            {
 0467                throw new ArgumentNullException(nameof(galleryImageVersionName));
 468            }
 469
 2470            using var message = CreateDeleteRequest(resourceGroupName, galleryName, galleryImageName, galleryImageVersio
 2471            _pipeline.Send(message, cancellationToken);
 2472            switch (message.Response.Status)
 473            {
 474                case 200:
 475                case 202:
 476                case 204:
 2477                    return message.Response;
 478                default:
 0479                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 480            }
 2481        }
 482
 483        internal HttpMessage CreateListByGalleryImageRequest(string resourceGroupName, string galleryName, string galler
 484        {
 8485            var message = _pipeline.CreateMessage();
 8486            var request = message.Request;
 8487            request.Method = RequestMethod.Get;
 8488            var uri = new RawRequestUriBuilder();
 8489            uri.Reset(endpoint);
 8490            uri.AppendPath("/subscriptions/", false);
 8491            uri.AppendPath(subscriptionId, true);
 8492            uri.AppendPath("/resourceGroups/", false);
 8493            uri.AppendPath(resourceGroupName, true);
 8494            uri.AppendPath("/providers/Microsoft.Compute/galleries/", false);
 8495            uri.AppendPath(galleryName, true);
 8496            uri.AppendPath("/images/", false);
 8497            uri.AppendPath(galleryImageName, true);
 8498            uri.AppendPath("/versions", false);
 8499            uri.AppendQuery("api-version", "2019-12-01", true);
 8500            request.Uri = uri;
 8501            return message;
 502        }
 503
 504        /// <summary> List gallery Image Versions in a gallery Image Definition. </summary>
 505        /// <param name="resourceGroupName"> The name of the resource group. </param>
 506        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 507        /// <param name="galleryImageName"> The name of the Shared Image Gallery Image Definition from which the Image V
 508        /// <param name="cancellationToken"> The cancellation token to use. </param>
 509        public async Task<Response<GalleryImageVersionList>> ListByGalleryImageAsync(string resourceGroupName, string ga
 510        {
 4511            if (resourceGroupName == null)
 512            {
 0513                throw new ArgumentNullException(nameof(resourceGroupName));
 514            }
 4515            if (galleryName == null)
 516            {
 0517                throw new ArgumentNullException(nameof(galleryName));
 518            }
 4519            if (galleryImageName == null)
 520            {
 0521                throw new ArgumentNullException(nameof(galleryImageName));
 522            }
 523
 4524            using var message = CreateListByGalleryImageRequest(resourceGroupName, galleryName, galleryImageName);
 4525            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4526            switch (message.Response.Status)
 527            {
 528                case 200:
 529                    {
 4530                        GalleryImageVersionList value = default;
 4531                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4532                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 533                        {
 0534                            value = null;
 535                        }
 536                        else
 537                        {
 4538                            value = GalleryImageVersionList.DeserializeGalleryImageVersionList(document.RootElement);
 539                        }
 4540                        return Response.FromValue(value, message.Response);
 541                    }
 542                default:
 0543                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 544            }
 4545        }
 546
 547        /// <summary> List gallery Image Versions in a gallery Image Definition. </summary>
 548        /// <param name="resourceGroupName"> The name of the resource group. </param>
 549        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 550        /// <param name="galleryImageName"> The name of the Shared Image Gallery Image Definition from which the Image V
 551        /// <param name="cancellationToken"> The cancellation token to use. </param>
 552        public Response<GalleryImageVersionList> ListByGalleryImage(string resourceGroupName, string galleryName, string
 553        {
 4554            if (resourceGroupName == null)
 555            {
 0556                throw new ArgumentNullException(nameof(resourceGroupName));
 557            }
 4558            if (galleryName == null)
 559            {
 0560                throw new ArgumentNullException(nameof(galleryName));
 561            }
 4562            if (galleryImageName == null)
 563            {
 0564                throw new ArgumentNullException(nameof(galleryImageName));
 565            }
 566
 4567            using var message = CreateListByGalleryImageRequest(resourceGroupName, galleryName, galleryImageName);
 4568            _pipeline.Send(message, cancellationToken);
 4569            switch (message.Response.Status)
 570            {
 571                case 200:
 572                    {
 4573                        GalleryImageVersionList value = default;
 4574                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4575                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 576                        {
 0577                            value = null;
 578                        }
 579                        else
 580                        {
 4581                            value = GalleryImageVersionList.DeserializeGalleryImageVersionList(document.RootElement);
 582                        }
 4583                        return Response.FromValue(value, message.Response);
 584                    }
 585                default:
 0586                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 587            }
 4588        }
 589
 590        internal HttpMessage CreateListByGalleryImageNextPageRequest(string nextLink, string resourceGroupName, string g
 591        {
 0592            var message = _pipeline.CreateMessage();
 0593            var request = message.Request;
 0594            request.Method = RequestMethod.Get;
 0595            var uri = new RawRequestUriBuilder();
 0596            uri.Reset(endpoint);
 0597            uri.AppendRawNextLink(nextLink, false);
 0598            request.Uri = uri;
 0599            return message;
 600        }
 601
 602        /// <summary> List gallery Image Versions in a gallery Image Definition. </summary>
 603        /// <param name="nextLink"> The URL to the next page of results. </param>
 604        /// <param name="resourceGroupName"> The name of the resource group. </param>
 605        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 606        /// <param name="galleryImageName"> The name of the Shared Image Gallery Image Definition from which the Image V
 607        /// <param name="cancellationToken"> The cancellation token to use. </param>
 608        public async Task<Response<GalleryImageVersionList>> ListByGalleryImageNextPageAsync(string nextLink, string res
 609        {
 0610            if (nextLink == null)
 611            {
 0612                throw new ArgumentNullException(nameof(nextLink));
 613            }
 0614            if (resourceGroupName == null)
 615            {
 0616                throw new ArgumentNullException(nameof(resourceGroupName));
 617            }
 0618            if (galleryName == null)
 619            {
 0620                throw new ArgumentNullException(nameof(galleryName));
 621            }
 0622            if (galleryImageName == null)
 623            {
 0624                throw new ArgumentNullException(nameof(galleryImageName));
 625            }
 626
 0627            using var message = CreateListByGalleryImageNextPageRequest(nextLink, resourceGroupName, galleryName, galler
 0628            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0629            switch (message.Response.Status)
 630            {
 631                case 200:
 632                    {
 0633                        GalleryImageVersionList value = default;
 0634                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0635                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 636                        {
 0637                            value = null;
 638                        }
 639                        else
 640                        {
 0641                            value = GalleryImageVersionList.DeserializeGalleryImageVersionList(document.RootElement);
 642                        }
 0643                        return Response.FromValue(value, message.Response);
 644                    }
 645                default:
 0646                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 647            }
 0648        }
 649
 650        /// <summary> List gallery Image Versions in a gallery Image Definition. </summary>
 651        /// <param name="nextLink"> The URL to the next page of results. </param>
 652        /// <param name="resourceGroupName"> The name of the resource group. </param>
 653        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 654        /// <param name="galleryImageName"> The name of the Shared Image Gallery Image Definition from which the Image V
 655        /// <param name="cancellationToken"> The cancellation token to use. </param>
 656        public Response<GalleryImageVersionList> ListByGalleryImageNextPage(string nextLink, string resourceGroupName, s
 657        {
 0658            if (nextLink == null)
 659            {
 0660                throw new ArgumentNullException(nameof(nextLink));
 661            }
 0662            if (resourceGroupName == null)
 663            {
 0664                throw new ArgumentNullException(nameof(resourceGroupName));
 665            }
 0666            if (galleryName == null)
 667            {
 0668                throw new ArgumentNullException(nameof(galleryName));
 669            }
 0670            if (galleryImageName == null)
 671            {
 0672                throw new ArgumentNullException(nameof(galleryImageName));
 673            }
 674
 0675            using var message = CreateListByGalleryImageNextPageRequest(nextLink, resourceGroupName, galleryName, galler
 0676            _pipeline.Send(message, cancellationToken);
 0677            switch (message.Response.Status)
 678            {
 679                case 200:
 680                    {
 0681                        GalleryImageVersionList value = default;
 0682                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0683                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 684                        {
 0685                            value = null;
 686                        }
 687                        else
 688                        {
 0689                            value = GalleryImageVersionList.DeserializeGalleryImageVersionList(document.RootElement);
 690                        }
 0691                        return Response.FromValue(value, message.Response);
 692                    }
 693                default:
 0694                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 695            }
 0696        }
 697    }
 698}