< Summary

Class:Azure.ResourceManager.Compute.VirtualMachineImagesRestOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineImagesRestOperations.cs
Covered lines:249
Uncovered lines:60
Coverable lines:309
Total lines:695
Line coverage:80.5% (249 of 309)
Covered branches:81
Total branches:142
Branch coverage:57% (81 of 142)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateGetRequest(...)-100%100%
GetAsync()-66.67%50%
Get(...)-66.67%50%
CreateListRequest(...)-96%83.33%
ListAsync()-70.83%56.25%
List(...)-70.83%56.25%
CreateListOffersRequest(...)-100%100%
ListOffersAsync()-75%58.33%
ListOffers(...)-75%58.33%
CreateListPublishersRequest(...)-100%100%
ListPublishersAsync()-77.78%60%
ListPublishers(...)-77.78%60%
CreateListSkusRequest(...)-100%100%
ListSkusAsync()-72.73%57.14%
ListSkus(...)-72.73%57.14%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineImagesRestOperations.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.Collections.Generic;
 10using System.Text.Json;
 11using System.Threading;
 12using System.Threading.Tasks;
 13using Azure;
 14using Azure.Core;
 15using Azure.Core.Pipeline;
 16using Azure.ResourceManager.Compute.Models;
 17
 18namespace Azure.ResourceManager.Compute
 19{
 20    internal partial class VirtualMachineImagesRestOperations
 21    {
 22        private string subscriptionId;
 23        private Uri endpoint;
 24        private ClientDiagnostics _clientDiagnostics;
 25        private HttpPipeline _pipeline;
 26
 27        /// <summary> Initializes a new instance of VirtualMachineImagesRestOperations. </summary>
 28        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 29        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 30        /// <param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription.
 31        /// <param name="endpoint"> server parameter. </param>
 32        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 39633        public VirtualMachineImagesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string sub
 34        {
 39635            if (subscriptionId == null)
 36            {
 037                throw new ArgumentNullException(nameof(subscriptionId));
 38            }
 39639            endpoint ??= new Uri("https://management.azure.com");
 40
 39641            this.subscriptionId = subscriptionId;
 39642            this.endpoint = endpoint;
 39643            _clientDiagnostics = clientDiagnostics;
 39644            _pipeline = pipeline;
 39645        }
 46
 47        internal HttpMessage CreateGetRequest(string location, string publisherName, string offer, string skus, string v
 48        {
 3249            var message = _pipeline.CreateMessage();
 3250            var request = message.Request;
 3251            request.Method = RequestMethod.Get;
 3252            var uri = new RawRequestUriBuilder();
 3253            uri.Reset(endpoint);
 3254            uri.AppendPath("/subscriptions/", false);
 3255            uri.AppendPath(subscriptionId, true);
 3256            uri.AppendPath("/providers/Microsoft.Compute/locations/", false);
 3257            uri.AppendPath(location, true);
 3258            uri.AppendPath("/publishers/", false);
 3259            uri.AppendPath(publisherName, true);
 3260            uri.AppendPath("/artifacttypes/vmimage/offers/", false);
 3261            uri.AppendPath(offer, true);
 3262            uri.AppendPath("/skus/", false);
 3263            uri.AppendPath(skus, true);
 3264            uri.AppendPath("/versions/", false);
 3265            uri.AppendPath(version, true);
 3266            uri.AppendQuery("api-version", "2019-12-01", true);
 3267            request.Uri = uri;
 3268            return message;
 69        }
 70
 71        /// <summary> Gets a virtual machine image. </summary>
 72        /// <param name="location"> The name of a supported Azure region. </param>
 73        /// <param name="publisherName"> A valid image publisher. </param>
 74        /// <param name="offer"> A valid image publisher offer. </param>
 75        /// <param name="skus"> A valid image SKU. </param>
 76        /// <param name="version"> A valid image SKU version. </param>
 77        /// <param name="cancellationToken"> The cancellation token to use. </param>
 78        public async Task<Response<VirtualMachineImage>> GetAsync(string location, string publisherName, string offer, s
 79        {
 1680            if (location == null)
 81            {
 082                throw new ArgumentNullException(nameof(location));
 83            }
 1684            if (publisherName == null)
 85            {
 086                throw new ArgumentNullException(nameof(publisherName));
 87            }
 1688            if (offer == null)
 89            {
 090                throw new ArgumentNullException(nameof(offer));
 91            }
 1692            if (skus == null)
 93            {
 094                throw new ArgumentNullException(nameof(skus));
 95            }
 1696            if (version == null)
 97            {
 098                throw new ArgumentNullException(nameof(version));
 99            }
 100
 16101            using var message = CreateGetRequest(location, publisherName, offer, skus, version);
 16102            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 16103            switch (message.Response.Status)
 104            {
 105                case 200:
 106                    {
 16107                        VirtualMachineImage value = default;
 16108                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 16109                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 110                        {
 0111                            value = null;
 112                        }
 113                        else
 114                        {
 16115                            value = VirtualMachineImage.DeserializeVirtualMachineImage(document.RootElement);
 116                        }
 16117                        return Response.FromValue(value, message.Response);
 118                    }
 119                default:
 0120                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 121            }
 16122        }
 123
 124        /// <summary> Gets a virtual machine image. </summary>
 125        /// <param name="location"> The name of a supported Azure region. </param>
 126        /// <param name="publisherName"> A valid image publisher. </param>
 127        /// <param name="offer"> A valid image publisher offer. </param>
 128        /// <param name="skus"> A valid image SKU. </param>
 129        /// <param name="version"> A valid image SKU version. </param>
 130        /// <param name="cancellationToken"> The cancellation token to use. </param>
 131        public Response<VirtualMachineImage> Get(string location, string publisherName, string offer, string skus, strin
 132        {
 16133            if (location == null)
 134            {
 0135                throw new ArgumentNullException(nameof(location));
 136            }
 16137            if (publisherName == null)
 138            {
 0139                throw new ArgumentNullException(nameof(publisherName));
 140            }
 16141            if (offer == null)
 142            {
 0143                throw new ArgumentNullException(nameof(offer));
 144            }
 16145            if (skus == null)
 146            {
 0147                throw new ArgumentNullException(nameof(skus));
 148            }
 16149            if (version == null)
 150            {
 0151                throw new ArgumentNullException(nameof(version));
 152            }
 153
 16154            using var message = CreateGetRequest(location, publisherName, offer, skus, version);
 16155            _pipeline.Send(message, cancellationToken);
 16156            switch (message.Response.Status)
 157            {
 158                case 200:
 159                    {
 16160                        VirtualMachineImage value = default;
 16161                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 16162                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 163                        {
 0164                            value = null;
 165                        }
 166                        else
 167                        {
 16168                            value = VirtualMachineImage.DeserializeVirtualMachineImage(document.RootElement);
 169                        }
 16170                        return Response.FromValue(value, message.Response);
 171                    }
 172                default:
 0173                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 174            }
 16175        }
 176
 177        internal HttpMessage CreateListRequest(string location, string publisherName, string offer, string skus, string 
 178        {
 320179            var message = _pipeline.CreateMessage();
 320180            var request = message.Request;
 320181            request.Method = RequestMethod.Get;
 320182            var uri = new RawRequestUriBuilder();
 320183            uri.Reset(endpoint);
 320184            uri.AppendPath("/subscriptions/", false);
 320185            uri.AppendPath(subscriptionId, true);
 320186            uri.AppendPath("/providers/Microsoft.Compute/locations/", false);
 320187            uri.AppendPath(location, true);
 320188            uri.AppendPath("/publishers/", false);
 320189            uri.AppendPath(publisherName, true);
 320190            uri.AppendPath("/artifacttypes/vmimage/offers/", false);
 320191            uri.AppendPath(offer, true);
 320192            uri.AppendPath("/skus/", false);
 320193            uri.AppendPath(skus, true);
 320194            uri.AppendPath("/versions", false);
 320195            if (expand != null)
 196            {
 0197                uri.AppendQuery("$expand", expand, true);
 198            }
 320199            if (top != null)
 200            {
 300201                uri.AppendQuery("$top", top.Value, true);
 202            }
 320203            if (orderby != null)
 204            {
 16205                uri.AppendQuery("$orderby", orderby, true);
 206            }
 320207            uri.AppendQuery("api-version", "2019-12-01", true);
 320208            request.Uri = uri;
 320209            return message;
 210        }
 211
 212        /// <summary> Gets a list of all virtual machine image versions for the specified location, publisher, offer, an
 213        /// <param name="location"> The name of a supported Azure region. </param>
 214        /// <param name="publisherName"> A valid image publisher. </param>
 215        /// <param name="offer"> A valid image publisher offer. </param>
 216        /// <param name="skus"> A valid image SKU. </param>
 217        /// <param name="expand"> The expand expression to apply on the operation. </param>
 218        /// <param name="top"> The Integer to use. </param>
 219        /// <param name="orderby"> The String to use. </param>
 220        /// <param name="cancellationToken"> The cancellation token to use. </param>
 221        public async Task<Response<IReadOnlyList<VirtualMachineImageResource>>> ListAsync(string location, string publis
 222        {
 160223            if (location == null)
 224            {
 0225                throw new ArgumentNullException(nameof(location));
 226            }
 160227            if (publisherName == null)
 228            {
 0229                throw new ArgumentNullException(nameof(publisherName));
 230            }
 160231            if (offer == null)
 232            {
 0233                throw new ArgumentNullException(nameof(offer));
 234            }
 160235            if (skus == null)
 236            {
 0237                throw new ArgumentNullException(nameof(skus));
 238            }
 239
 160240            using var message = CreateListRequest(location, publisherName, offer, skus, expand, top, orderby);
 160241            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 160242            switch (message.Response.Status)
 243            {
 244                case 200:
 245                    {
 160246                        IReadOnlyList<VirtualMachineImageResource> value = default;
 160247                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 160248                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 249                        {
 0250                            value = null;
 251                        }
 252                        else
 253                        {
 160254                            List<VirtualMachineImageResource> array = new List<VirtualMachineImageResource>();
 1028255                            foreach (var item in document.RootElement.EnumerateArray())
 256                            {
 354257                                if (item.ValueKind == JsonValueKind.Null)
 258                                {
 0259                                    array.Add(null);
 260                                }
 261                                else
 262                                {
 354263                                    array.Add(VirtualMachineImageResource.DeserializeVirtualMachineImageResource(item));
 264                                }
 265                            }
 160266                            value = array;
 267                        }
 160268                        return Response.FromValue(value, message.Response);
 269                    }
 270                default:
 0271                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 272            }
 160273        }
 274
 275        /// <summary> Gets a list of all virtual machine image versions for the specified location, publisher, offer, an
 276        /// <param name="location"> The name of a supported Azure region. </param>
 277        /// <param name="publisherName"> A valid image publisher. </param>
 278        /// <param name="offer"> A valid image publisher offer. </param>
 279        /// <param name="skus"> A valid image SKU. </param>
 280        /// <param name="expand"> The expand expression to apply on the operation. </param>
 281        /// <param name="top"> The Integer to use. </param>
 282        /// <param name="orderby"> The String to use. </param>
 283        /// <param name="cancellationToken"> The cancellation token to use. </param>
 284        public Response<IReadOnlyList<VirtualMachineImageResource>> List(string location, string publisherName, string o
 285        {
 160286            if (location == null)
 287            {
 0288                throw new ArgumentNullException(nameof(location));
 289            }
 160290            if (publisherName == null)
 291            {
 0292                throw new ArgumentNullException(nameof(publisherName));
 293            }
 160294            if (offer == null)
 295            {
 0296                throw new ArgumentNullException(nameof(offer));
 297            }
 160298            if (skus == null)
 299            {
 0300                throw new ArgumentNullException(nameof(skus));
 301            }
 302
 160303            using var message = CreateListRequest(location, publisherName, offer, skus, expand, top, orderby);
 160304            _pipeline.Send(message, cancellationToken);
 160305            switch (message.Response.Status)
 306            {
 307                case 200:
 308                    {
 160309                        IReadOnlyList<VirtualMachineImageResource> value = default;
 160310                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 160311                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 312                        {
 0313                            value = null;
 314                        }
 315                        else
 316                        {
 160317                            List<VirtualMachineImageResource> array = new List<VirtualMachineImageResource>();
 1028318                            foreach (var item in document.RootElement.EnumerateArray())
 319                            {
 354320                                if (item.ValueKind == JsonValueKind.Null)
 321                                {
 0322                                    array.Add(null);
 323                                }
 324                                else
 325                                {
 354326                                    array.Add(VirtualMachineImageResource.DeserializeVirtualMachineImageResource(item));
 327                                }
 328                            }
 160329                            value = array;
 330                        }
 160331                        return Response.FromValue(value, message.Response);
 332                    }
 333                default:
 0334                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 335            }
 160336        }
 337
 338        internal HttpMessage CreateListOffersRequest(string location, string publisherName)
 339        {
 4340            var message = _pipeline.CreateMessage();
 4341            var request = message.Request;
 4342            request.Method = RequestMethod.Get;
 4343            var uri = new RawRequestUriBuilder();
 4344            uri.Reset(endpoint);
 4345            uri.AppendPath("/subscriptions/", false);
 4346            uri.AppendPath(subscriptionId, true);
 4347            uri.AppendPath("/providers/Microsoft.Compute/locations/", false);
 4348            uri.AppendPath(location, true);
 4349            uri.AppendPath("/publishers/", false);
 4350            uri.AppendPath(publisherName, true);
 4351            uri.AppendPath("/artifacttypes/vmimage/offers", false);
 4352            uri.AppendQuery("api-version", "2019-12-01", true);
 4353            request.Uri = uri;
 4354            return message;
 355        }
 356
 357        /// <summary> Gets a list of virtual machine image offers for the specified location and publisher. </summary>
 358        /// <param name="location"> The name of a supported Azure region. </param>
 359        /// <param name="publisherName"> A valid image publisher. </param>
 360        /// <param name="cancellationToken"> The cancellation token to use. </param>
 361        public async Task<Response<IReadOnlyList<VirtualMachineImageResource>>> ListOffersAsync(string location, string 
 362        {
 2363            if (location == null)
 364            {
 0365                throw new ArgumentNullException(nameof(location));
 366            }
 2367            if (publisherName == null)
 368            {
 0369                throw new ArgumentNullException(nameof(publisherName));
 370            }
 371
 2372            using var message = CreateListOffersRequest(location, publisherName);
 2373            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2374            switch (message.Response.Status)
 375            {
 376                case 200:
 377                    {
 2378                        IReadOnlyList<VirtualMachineImageResource> value = default;
 2379                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2380                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 381                        {
 0382                            value = null;
 383                        }
 384                        else
 385                        {
 2386                            List<VirtualMachineImageResource> array = new List<VirtualMachineImageResource>();
 80387                            foreach (var item in document.RootElement.EnumerateArray())
 388                            {
 38389                                if (item.ValueKind == JsonValueKind.Null)
 390                                {
 0391                                    array.Add(null);
 392                                }
 393                                else
 394                                {
 38395                                    array.Add(VirtualMachineImageResource.DeserializeVirtualMachineImageResource(item));
 396                                }
 397                            }
 2398                            value = array;
 399                        }
 2400                        return Response.FromValue(value, message.Response);
 401                    }
 402                default:
 0403                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 404            }
 2405        }
 406
 407        /// <summary> Gets a list of virtual machine image offers for the specified location and publisher. </summary>
 408        /// <param name="location"> The name of a supported Azure region. </param>
 409        /// <param name="publisherName"> A valid image publisher. </param>
 410        /// <param name="cancellationToken"> The cancellation token to use. </param>
 411        public Response<IReadOnlyList<VirtualMachineImageResource>> ListOffers(string location, string publisherName, Ca
 412        {
 2413            if (location == null)
 414            {
 0415                throw new ArgumentNullException(nameof(location));
 416            }
 2417            if (publisherName == null)
 418            {
 0419                throw new ArgumentNullException(nameof(publisherName));
 420            }
 421
 2422            using var message = CreateListOffersRequest(location, publisherName);
 2423            _pipeline.Send(message, cancellationToken);
 2424            switch (message.Response.Status)
 425            {
 426                case 200:
 427                    {
 2428                        IReadOnlyList<VirtualMachineImageResource> value = default;
 2429                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2430                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 431                        {
 0432                            value = null;
 433                        }
 434                        else
 435                        {
 2436                            List<VirtualMachineImageResource> array = new List<VirtualMachineImageResource>();
 80437                            foreach (var item in document.RootElement.EnumerateArray())
 438                            {
 38439                                if (item.ValueKind == JsonValueKind.Null)
 440                                {
 0441                                    array.Add(null);
 442                                }
 443                                else
 444                                {
 38445                                    array.Add(VirtualMachineImageResource.DeserializeVirtualMachineImageResource(item));
 446                                }
 447                            }
 2448                            value = array;
 449                        }
 2450                        return Response.FromValue(value, message.Response);
 451                    }
 452                default:
 0453                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 454            }
 2455        }
 456
 457        internal HttpMessage CreateListPublishersRequest(string location)
 458        {
 4459            var message = _pipeline.CreateMessage();
 4460            var request = message.Request;
 4461            request.Method = RequestMethod.Get;
 4462            var uri = new RawRequestUriBuilder();
 4463            uri.Reset(endpoint);
 4464            uri.AppendPath("/subscriptions/", false);
 4465            uri.AppendPath(subscriptionId, true);
 4466            uri.AppendPath("/providers/Microsoft.Compute/locations/", false);
 4467            uri.AppendPath(location, true);
 4468            uri.AppendPath("/publishers", false);
 4469            uri.AppendQuery("api-version", "2019-12-01", true);
 4470            request.Uri = uri;
 4471            return message;
 472        }
 473
 474        /// <summary> Gets a list of virtual machine image publishers for the specified Azure location. </summary>
 475        /// <param name="location"> The name of a supported Azure region. </param>
 476        /// <param name="cancellationToken"> The cancellation token to use. </param>
 477        public async Task<Response<IReadOnlyList<VirtualMachineImageResource>>> ListPublishersAsync(string location, Can
 478        {
 2479            if (location == null)
 480            {
 0481                throw new ArgumentNullException(nameof(location));
 482            }
 483
 2484            using var message = CreateListPublishersRequest(location);
 2485            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2486            switch (message.Response.Status)
 487            {
 488                case 200:
 489                    {
 2490                        IReadOnlyList<VirtualMachineImageResource> value = default;
 2491                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2492                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 493                        {
 0494                            value = null;
 495                        }
 496                        else
 497                        {
 2498                            List<VirtualMachineImageResource> array = new List<VirtualMachineImageResource>();
 5216499                            foreach (var item in document.RootElement.EnumerateArray())
 500                            {
 2606501                                if (item.ValueKind == JsonValueKind.Null)
 502                                {
 0503                                    array.Add(null);
 504                                }
 505                                else
 506                                {
 2606507                                    array.Add(VirtualMachineImageResource.DeserializeVirtualMachineImageResource(item));
 508                                }
 509                            }
 2510                            value = array;
 511                        }
 2512                        return Response.FromValue(value, message.Response);
 513                    }
 514                default:
 0515                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 516            }
 2517        }
 518
 519        /// <summary> Gets a list of virtual machine image publishers for the specified Azure location. </summary>
 520        /// <param name="location"> The name of a supported Azure region. </param>
 521        /// <param name="cancellationToken"> The cancellation token to use. </param>
 522        public Response<IReadOnlyList<VirtualMachineImageResource>> ListPublishers(string location, CancellationToken ca
 523        {
 2524            if (location == null)
 525            {
 0526                throw new ArgumentNullException(nameof(location));
 527            }
 528
 2529            using var message = CreateListPublishersRequest(location);
 2530            _pipeline.Send(message, cancellationToken);
 2531            switch (message.Response.Status)
 532            {
 533                case 200:
 534                    {
 2535                        IReadOnlyList<VirtualMachineImageResource> value = default;
 2536                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2537                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 538                        {
 0539                            value = null;
 540                        }
 541                        else
 542                        {
 2543                            List<VirtualMachineImageResource> array = new List<VirtualMachineImageResource>();
 5216544                            foreach (var item in document.RootElement.EnumerateArray())
 545                            {
 2606546                                if (item.ValueKind == JsonValueKind.Null)
 547                                {
 0548                                    array.Add(null);
 549                                }
 550                                else
 551                                {
 2606552                                    array.Add(VirtualMachineImageResource.DeserializeVirtualMachineImageResource(item));
 553                                }
 554                            }
 2555                            value = array;
 556                        }
 2557                        return Response.FromValue(value, message.Response);
 558                    }
 559                default:
 0560                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 561            }
 2562        }
 563
 564        internal HttpMessage CreateListSkusRequest(string location, string publisherName, string offer)
 565        {
 8566            var message = _pipeline.CreateMessage();
 8567            var request = message.Request;
 8568            request.Method = RequestMethod.Get;
 8569            var uri = new RawRequestUriBuilder();
 8570            uri.Reset(endpoint);
 8571            uri.AppendPath("/subscriptions/", false);
 8572            uri.AppendPath(subscriptionId, true);
 8573            uri.AppendPath("/providers/Microsoft.Compute/locations/", false);
 8574            uri.AppendPath(location, true);
 8575            uri.AppendPath("/publishers/", false);
 8576            uri.AppendPath(publisherName, true);
 8577            uri.AppendPath("/artifacttypes/vmimage/offers/", false);
 8578            uri.AppendPath(offer, true);
 8579            uri.AppendPath("/skus", false);
 8580            uri.AppendQuery("api-version", "2019-12-01", true);
 8581            request.Uri = uri;
 8582            return message;
 583        }
 584
 585        /// <summary> Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. </summ
 586        /// <param name="location"> The name of a supported Azure region. </param>
 587        /// <param name="publisherName"> A valid image publisher. </param>
 588        /// <param name="offer"> A valid image publisher offer. </param>
 589        /// <param name="cancellationToken"> The cancellation token to use. </param>
 590        public async Task<Response<IReadOnlyList<VirtualMachineImageResource>>> ListSkusAsync(string location, string pu
 591        {
 4592            if (location == null)
 593            {
 0594                throw new ArgumentNullException(nameof(location));
 595            }
 4596            if (publisherName == null)
 597            {
 0598                throw new ArgumentNullException(nameof(publisherName));
 599            }
 4600            if (offer == null)
 601            {
 0602                throw new ArgumentNullException(nameof(offer));
 603            }
 604
 4605            using var message = CreateListSkusRequest(location, publisherName, offer);
 4606            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4607            switch (message.Response.Status)
 608            {
 609                case 200:
 610                    {
 4611                        IReadOnlyList<VirtualMachineImageResource> value = default;
 4612                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4613                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 614                        {
 0615                            value = null;
 616                        }
 617                        else
 618                        {
 4619                            List<VirtualMachineImageResource> array = new List<VirtualMachineImageResource>();
 364620                            foreach (var item in document.RootElement.EnumerateArray())
 621                            {
 178622                                if (item.ValueKind == JsonValueKind.Null)
 623                                {
 0624                                    array.Add(null);
 625                                }
 626                                else
 627                                {
 178628                                    array.Add(VirtualMachineImageResource.DeserializeVirtualMachineImageResource(item));
 629                                }
 630                            }
 4631                            value = array;
 632                        }
 4633                        return Response.FromValue(value, message.Response);
 634                    }
 635                default:
 0636                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 637            }
 4638        }
 639
 640        /// <summary> Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. </summ
 641        /// <param name="location"> The name of a supported Azure region. </param>
 642        /// <param name="publisherName"> A valid image publisher. </param>
 643        /// <param name="offer"> A valid image publisher offer. </param>
 644        /// <param name="cancellationToken"> The cancellation token to use. </param>
 645        public Response<IReadOnlyList<VirtualMachineImageResource>> ListSkus(string location, string publisherName, stri
 646        {
 4647            if (location == null)
 648            {
 0649                throw new ArgumentNullException(nameof(location));
 650            }
 4651            if (publisherName == null)
 652            {
 0653                throw new ArgumentNullException(nameof(publisherName));
 654            }
 4655            if (offer == null)
 656            {
 0657                throw new ArgumentNullException(nameof(offer));
 658            }
 659
 4660            using var message = CreateListSkusRequest(location, publisherName, offer);
 4661            _pipeline.Send(message, cancellationToken);
 4662            switch (message.Response.Status)
 663            {
 664                case 200:
 665                    {
 4666                        IReadOnlyList<VirtualMachineImageResource> value = default;
 4667                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4668                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 669                        {
 0670                            value = null;
 671                        }
 672                        else
 673                        {
 4674                            List<VirtualMachineImageResource> array = new List<VirtualMachineImageResource>();
 364675                            foreach (var item in document.RootElement.EnumerateArray())
 676                            {
 178677                                if (item.ValueKind == JsonValueKind.Null)
 678                                {
 0679                                    array.Add(null);
 680                                }
 681                                else
 682                                {
 178683                                    array.Add(VirtualMachineImageResource.DeserializeVirtualMachineImageResource(item));
 684                                }
 685                            }
 4686                            value = array;
 687                        }
 4688                        return Response.FromValue(value, message.Response);
 689                    }
 690                default:
 0691                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 692            }
 4693        }
 694    }
 695}