< Summary

Class:Azure.ResourceManager.Compute.VirtualMachineScaleSetVMExtensionsRestOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineScaleSetVMExtensionsRestOperations.cs
Covered lines:0
Uncovered lines:274
Coverable lines:274
Total lines:599
Line coverage:0% (0 of 274)
Covered branches:0
Total branches:128
Branch coverage:0% (0 of 128)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateCreateOrUpdateRequest(...)-0%100%
CreateOrUpdateAsync()-0%0%
CreateOrUpdate(...)-0%0%
CreateUpdateRequest(...)-0%100%
UpdateAsync()-0%0%
Update(...)-0%0%
CreateDeleteRequest(...)-0%100%
DeleteAsync()-0%0%
Delete(...)-0%0%
CreateGetRequest(...)-0%0%
GetAsync()-0%0%
Get(...)-0%0%
CreateListRequest(...)-0%0%
ListAsync()-0%0%
List(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineScaleSetVMExtensionsRestOperations.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 VirtualMachineScaleSetVMExtensionsRestOperations
 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 VirtualMachineScaleSetVMExtensionsRestOperations. </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
 032        public VirtualMachineScaleSetVMExtensionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeli
 33        {
 034            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 038            endpoint ??= new Uri("https://management.azure.com");
 39
 040            this.subscriptionId = subscriptionId;
 041            this.endpoint = endpoint;
 042            _clientDiagnostics = clientDiagnostics;
 043            _pipeline = pipeline;
 044        }
 45
 46        internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string vmScaleSetName, string instanc
 47        {
 048            var message = _pipeline.CreateMessage();
 049            var request = message.Request;
 050            request.Method = RequestMethod.Put;
 051            var uri = new RawRequestUriBuilder();
 052            uri.Reset(endpoint);
 053            uri.AppendPath("/subscriptions/", false);
 054            uri.AppendPath(subscriptionId, true);
 055            uri.AppendPath("/resourceGroups/", false);
 056            uri.AppendPath(resourceGroupName, true);
 057            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 058            uri.AppendPath(vmScaleSetName, true);
 059            uri.AppendPath("/virtualMachines/", false);
 060            uri.AppendPath(instanceId, true);
 061            uri.AppendPath("/extensions/", false);
 062            uri.AppendPath(vmExtensionName, true);
 063            uri.AppendQuery("api-version", "2019-12-01", true);
 064            request.Uri = uri;
 065            request.Headers.Add("Content-Type", "application/json");
 066            var content = new Utf8JsonRequestContent();
 067            content.JsonWriter.WriteObjectValue(extensionParameters);
 068            request.Content = content;
 069            return message;
 70        }
 71
 72        /// <summary> The operation to create or update the VMSS VM extension. </summary>
 73        /// <param name="resourceGroupName"> The name of the resource group. </param>
 74        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 75        /// <param name="instanceId"> The instance ID of the virtual machine. </param>
 76        /// <param name="vmExtensionName"> The name of the virtual machine extension. </param>
 77        /// <param name="extensionParameters"> Parameters supplied to the Create Virtual Machine Extension operation. </
 78        /// <param name="cancellationToken"> The cancellation token to use. </param>
 79        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string vmScaleSetName, string instance
 80        {
 081            if (resourceGroupName == null)
 82            {
 083                throw new ArgumentNullException(nameof(resourceGroupName));
 84            }
 085            if (vmScaleSetName == null)
 86            {
 087                throw new ArgumentNullException(nameof(vmScaleSetName));
 88            }
 089            if (instanceId == null)
 90            {
 091                throw new ArgumentNullException(nameof(instanceId));
 92            }
 093            if (vmExtensionName == null)
 94            {
 095                throw new ArgumentNullException(nameof(vmExtensionName));
 96            }
 097            if (extensionParameters == null)
 98            {
 099                throw new ArgumentNullException(nameof(extensionParameters));
 100            }
 101
 0102            using var message = CreateCreateOrUpdateRequest(resourceGroupName, vmScaleSetName, instanceId, vmExtensionNa
 0103            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0104            switch (message.Response.Status)
 105            {
 106                case 200:
 107                case 201:
 0108                    return message.Response;
 109                default:
 0110                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 111            }
 0112        }
 113
 114        /// <summary> The operation to create or update the VMSS VM extension. </summary>
 115        /// <param name="resourceGroupName"> The name of the resource group. </param>
 116        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 117        /// <param name="instanceId"> The instance ID of the virtual machine. </param>
 118        /// <param name="vmExtensionName"> The name of the virtual machine extension. </param>
 119        /// <param name="extensionParameters"> Parameters supplied to the Create Virtual Machine Extension operation. </
 120        /// <param name="cancellationToken"> The cancellation token to use. </param>
 121        public Response CreateOrUpdate(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExte
 122        {
 0123            if (resourceGroupName == null)
 124            {
 0125                throw new ArgumentNullException(nameof(resourceGroupName));
 126            }
 0127            if (vmScaleSetName == null)
 128            {
 0129                throw new ArgumentNullException(nameof(vmScaleSetName));
 130            }
 0131            if (instanceId == null)
 132            {
 0133                throw new ArgumentNullException(nameof(instanceId));
 134            }
 0135            if (vmExtensionName == null)
 136            {
 0137                throw new ArgumentNullException(nameof(vmExtensionName));
 138            }
 0139            if (extensionParameters == null)
 140            {
 0141                throw new ArgumentNullException(nameof(extensionParameters));
 142            }
 143
 0144            using var message = CreateCreateOrUpdateRequest(resourceGroupName, vmScaleSetName, instanceId, vmExtensionNa
 0145            _pipeline.Send(message, cancellationToken);
 0146            switch (message.Response.Status)
 147            {
 148                case 200:
 149                case 201:
 0150                    return message.Response;
 151                default:
 0152                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 153            }
 0154        }
 155
 156        internal HttpMessage CreateUpdateRequest(string resourceGroupName, string vmScaleSetName, string instanceId, str
 157        {
 0158            var message = _pipeline.CreateMessage();
 0159            var request = message.Request;
 0160            request.Method = RequestMethod.Patch;
 0161            var uri = new RawRequestUriBuilder();
 0162            uri.Reset(endpoint);
 0163            uri.AppendPath("/subscriptions/", false);
 0164            uri.AppendPath(subscriptionId, true);
 0165            uri.AppendPath("/resourceGroups/", false);
 0166            uri.AppendPath(resourceGroupName, true);
 0167            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 0168            uri.AppendPath(vmScaleSetName, true);
 0169            uri.AppendPath("/virtualMachines/", false);
 0170            uri.AppendPath(instanceId, true);
 0171            uri.AppendPath("/extensions/", false);
 0172            uri.AppendPath(vmExtensionName, true);
 0173            uri.AppendQuery("api-version", "2019-12-01", true);
 0174            request.Uri = uri;
 0175            request.Headers.Add("Content-Type", "application/json");
 0176            var content = new Utf8JsonRequestContent();
 0177            content.JsonWriter.WriteObjectValue(extensionParameters);
 0178            request.Content = content;
 0179            return message;
 180        }
 181
 182        /// <summary> The operation to update the VMSS VM extension. </summary>
 183        /// <param name="resourceGroupName"> The name of the resource group. </param>
 184        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 185        /// <param name="instanceId"> The instance ID of the virtual machine. </param>
 186        /// <param name="vmExtensionName"> The name of the virtual machine extension. </param>
 187        /// <param name="extensionParameters"> Parameters supplied to the Update Virtual Machine Extension operation. </
 188        /// <param name="cancellationToken"> The cancellation token to use. </param>
 189        public async Task<Response> UpdateAsync(string resourceGroupName, string vmScaleSetName, string instanceId, stri
 190        {
 0191            if (resourceGroupName == null)
 192            {
 0193                throw new ArgumentNullException(nameof(resourceGroupName));
 194            }
 0195            if (vmScaleSetName == null)
 196            {
 0197                throw new ArgumentNullException(nameof(vmScaleSetName));
 198            }
 0199            if (instanceId == null)
 200            {
 0201                throw new ArgumentNullException(nameof(instanceId));
 202            }
 0203            if (vmExtensionName == null)
 204            {
 0205                throw new ArgumentNullException(nameof(vmExtensionName));
 206            }
 0207            if (extensionParameters == null)
 208            {
 0209                throw new ArgumentNullException(nameof(extensionParameters));
 210            }
 211
 0212            using var message = CreateUpdateRequest(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, exte
 0213            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0214            switch (message.Response.Status)
 215            {
 216                case 200:
 0217                    return message.Response;
 218                default:
 0219                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 220            }
 0221        }
 222
 223        /// <summary> The operation to update the VMSS VM extension. </summary>
 224        /// <param name="resourceGroupName"> The name of the resource group. </param>
 225        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 226        /// <param name="instanceId"> The instance ID of the virtual machine. </param>
 227        /// <param name="vmExtensionName"> The name of the virtual machine extension. </param>
 228        /// <param name="extensionParameters"> Parameters supplied to the Update Virtual Machine Extension operation. </
 229        /// <param name="cancellationToken"> The cancellation token to use. </param>
 230        public Response Update(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionNam
 231        {
 0232            if (resourceGroupName == null)
 233            {
 0234                throw new ArgumentNullException(nameof(resourceGroupName));
 235            }
 0236            if (vmScaleSetName == null)
 237            {
 0238                throw new ArgumentNullException(nameof(vmScaleSetName));
 239            }
 0240            if (instanceId == null)
 241            {
 0242                throw new ArgumentNullException(nameof(instanceId));
 243            }
 0244            if (vmExtensionName == null)
 245            {
 0246                throw new ArgumentNullException(nameof(vmExtensionName));
 247            }
 0248            if (extensionParameters == null)
 249            {
 0250                throw new ArgumentNullException(nameof(extensionParameters));
 251            }
 252
 0253            using var message = CreateUpdateRequest(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, exte
 0254            _pipeline.Send(message, cancellationToken);
 0255            switch (message.Response.Status)
 256            {
 257                case 200:
 0258                    return message.Response;
 259                default:
 0260                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 261            }
 0262        }
 263
 264        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string vmScaleSetName, string instanceId, str
 265        {
 0266            var message = _pipeline.CreateMessage();
 0267            var request = message.Request;
 0268            request.Method = RequestMethod.Delete;
 0269            var uri = new RawRequestUriBuilder();
 0270            uri.Reset(endpoint);
 0271            uri.AppendPath("/subscriptions/", false);
 0272            uri.AppendPath(subscriptionId, true);
 0273            uri.AppendPath("/resourceGroups/", false);
 0274            uri.AppendPath(resourceGroupName, true);
 0275            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 0276            uri.AppendPath(vmScaleSetName, true);
 0277            uri.AppendPath("/virtualMachines/", false);
 0278            uri.AppendPath(instanceId, true);
 0279            uri.AppendPath("/extensions/", false);
 0280            uri.AppendPath(vmExtensionName, true);
 0281            uri.AppendQuery("api-version", "2019-12-01", true);
 0282            request.Uri = uri;
 0283            return message;
 284        }
 285
 286        /// <summary> The operation to delete the VMSS VM extension. </summary>
 287        /// <param name="resourceGroupName"> The name of the resource group. </param>
 288        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 289        /// <param name="instanceId"> The instance ID of the virtual machine. </param>
 290        /// <param name="vmExtensionName"> The name of the virtual machine extension. </param>
 291        /// <param name="cancellationToken"> The cancellation token to use. </param>
 292        public async Task<Response> DeleteAsync(string resourceGroupName, string vmScaleSetName, string instanceId, stri
 293        {
 0294            if (resourceGroupName == null)
 295            {
 0296                throw new ArgumentNullException(nameof(resourceGroupName));
 297            }
 0298            if (vmScaleSetName == null)
 299            {
 0300                throw new ArgumentNullException(nameof(vmScaleSetName));
 301            }
 0302            if (instanceId == null)
 303            {
 0304                throw new ArgumentNullException(nameof(instanceId));
 305            }
 0306            if (vmExtensionName == null)
 307            {
 0308                throw new ArgumentNullException(nameof(vmExtensionName));
 309            }
 310
 0311            using var message = CreateDeleteRequest(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName);
 0312            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0313            switch (message.Response.Status)
 314            {
 315                case 200:
 316                case 202:
 317                case 204:
 0318                    return message.Response;
 319                default:
 0320                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 321            }
 0322        }
 323
 324        /// <summary> The operation to delete the VMSS VM extension. </summary>
 325        /// <param name="resourceGroupName"> The name of the resource group. </param>
 326        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 327        /// <param name="instanceId"> The instance ID of the virtual machine. </param>
 328        /// <param name="vmExtensionName"> The name of the virtual machine extension. </param>
 329        /// <param name="cancellationToken"> The cancellation token to use. </param>
 330        public Response Delete(string resourceGroupName, string vmScaleSetName, string instanceId, string vmExtensionNam
 331        {
 0332            if (resourceGroupName == null)
 333            {
 0334                throw new ArgumentNullException(nameof(resourceGroupName));
 335            }
 0336            if (vmScaleSetName == null)
 337            {
 0338                throw new ArgumentNullException(nameof(vmScaleSetName));
 339            }
 0340            if (instanceId == null)
 341            {
 0342                throw new ArgumentNullException(nameof(instanceId));
 343            }
 0344            if (vmExtensionName == null)
 345            {
 0346                throw new ArgumentNullException(nameof(vmExtensionName));
 347            }
 348
 0349            using var message = CreateDeleteRequest(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName);
 0350            _pipeline.Send(message, cancellationToken);
 0351            switch (message.Response.Status)
 352            {
 353                case 200:
 354                case 202:
 355                case 204:
 0356                    return message.Response;
 357                default:
 0358                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 359            }
 0360        }
 361
 362        internal HttpMessage CreateGetRequest(string resourceGroupName, string vmScaleSetName, string instanceId, string
 363        {
 0364            var message = _pipeline.CreateMessage();
 0365            var request = message.Request;
 0366            request.Method = RequestMethod.Get;
 0367            var uri = new RawRequestUriBuilder();
 0368            uri.Reset(endpoint);
 0369            uri.AppendPath("/subscriptions/", false);
 0370            uri.AppendPath(subscriptionId, true);
 0371            uri.AppendPath("/resourceGroups/", false);
 0372            uri.AppendPath(resourceGroupName, true);
 0373            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 0374            uri.AppendPath(vmScaleSetName, true);
 0375            uri.AppendPath("/virtualMachines/", false);
 0376            uri.AppendPath(instanceId, true);
 0377            uri.AppendPath("/extensions/", false);
 0378            uri.AppendPath(vmExtensionName, true);
 0379            if (expand != null)
 380            {
 0381                uri.AppendQuery("$expand", expand, true);
 382            }
 0383            uri.AppendQuery("api-version", "2019-12-01", true);
 0384            request.Uri = uri;
 0385            return message;
 386        }
 387
 388        /// <summary> The operation to get the VMSS VM extension. </summary>
 389        /// <param name="resourceGroupName"> The name of the resource group. </param>
 390        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 391        /// <param name="instanceId"> The instance ID of the virtual machine. </param>
 392        /// <param name="vmExtensionName"> The name of the virtual machine extension. </param>
 393        /// <param name="expand"> The expand expression to apply on the operation. </param>
 394        /// <param name="cancellationToken"> The cancellation token to use. </param>
 395        public async Task<Response<VirtualMachineExtension>> GetAsync(string resourceGroupName, string vmScaleSetName, s
 396        {
 0397            if (resourceGroupName == null)
 398            {
 0399                throw new ArgumentNullException(nameof(resourceGroupName));
 400            }
 0401            if (vmScaleSetName == null)
 402            {
 0403                throw new ArgumentNullException(nameof(vmScaleSetName));
 404            }
 0405            if (instanceId == null)
 406            {
 0407                throw new ArgumentNullException(nameof(instanceId));
 408            }
 0409            if (vmExtensionName == null)
 410            {
 0411                throw new ArgumentNullException(nameof(vmExtensionName));
 412            }
 413
 0414            using var message = CreateGetRequest(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand)
 0415            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0416            switch (message.Response.Status)
 417            {
 418                case 200:
 419                    {
 0420                        VirtualMachineExtension value = default;
 0421                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0422                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 423                        {
 0424                            value = null;
 425                        }
 426                        else
 427                        {
 0428                            value = VirtualMachineExtension.DeserializeVirtualMachineExtension(document.RootElement);
 429                        }
 0430                        return Response.FromValue(value, message.Response);
 431                    }
 432                default:
 0433                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 434            }
 0435        }
 436
 437        /// <summary> The operation to get the VMSS VM extension. </summary>
 438        /// <param name="resourceGroupName"> The name of the resource group. </param>
 439        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 440        /// <param name="instanceId"> The instance ID of the virtual machine. </param>
 441        /// <param name="vmExtensionName"> The name of the virtual machine extension. </param>
 442        /// <param name="expand"> The expand expression to apply on the operation. </param>
 443        /// <param name="cancellationToken"> The cancellation token to use. </param>
 444        public Response<VirtualMachineExtension> Get(string resourceGroupName, string vmScaleSetName, string instanceId,
 445        {
 0446            if (resourceGroupName == null)
 447            {
 0448                throw new ArgumentNullException(nameof(resourceGroupName));
 449            }
 0450            if (vmScaleSetName == null)
 451            {
 0452                throw new ArgumentNullException(nameof(vmScaleSetName));
 453            }
 0454            if (instanceId == null)
 455            {
 0456                throw new ArgumentNullException(nameof(instanceId));
 457            }
 0458            if (vmExtensionName == null)
 459            {
 0460                throw new ArgumentNullException(nameof(vmExtensionName));
 461            }
 462
 0463            using var message = CreateGetRequest(resourceGroupName, vmScaleSetName, instanceId, vmExtensionName, expand)
 0464            _pipeline.Send(message, cancellationToken);
 0465            switch (message.Response.Status)
 466            {
 467                case 200:
 468                    {
 0469                        VirtualMachineExtension value = default;
 0470                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0471                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 472                        {
 0473                            value = null;
 474                        }
 475                        else
 476                        {
 0477                            value = VirtualMachineExtension.DeserializeVirtualMachineExtension(document.RootElement);
 478                        }
 0479                        return Response.FromValue(value, message.Response);
 480                    }
 481                default:
 0482                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 483            }
 0484        }
 485
 486        internal HttpMessage CreateListRequest(string resourceGroupName, string vmScaleSetName, string instanceId, strin
 487        {
 0488            var message = _pipeline.CreateMessage();
 0489            var request = message.Request;
 0490            request.Method = RequestMethod.Get;
 0491            var uri = new RawRequestUriBuilder();
 0492            uri.Reset(endpoint);
 0493            uri.AppendPath("/subscriptions/", false);
 0494            uri.AppendPath(subscriptionId, true);
 0495            uri.AppendPath("/resourceGroups/", false);
 0496            uri.AppendPath(resourceGroupName, true);
 0497            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 0498            uri.AppendPath(vmScaleSetName, true);
 0499            uri.AppendPath("/virtualMachines/", false);
 0500            uri.AppendPath(instanceId, true);
 0501            uri.AppendPath("/extensions", false);
 0502            if (expand != null)
 503            {
 0504                uri.AppendQuery("$expand", expand, true);
 505            }
 0506            uri.AppendQuery("api-version", "2019-12-01", true);
 0507            request.Uri = uri;
 0508            return message;
 509        }
 510
 511        /// <summary> The operation to get all extensions of an instance in Virtual Machine Scaleset. </summary>
 512        /// <param name="resourceGroupName"> The name of the resource group. </param>
 513        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 514        /// <param name="instanceId"> The instance ID of the virtual machine. </param>
 515        /// <param name="expand"> The expand expression to apply on the operation. </param>
 516        /// <param name="cancellationToken"> The cancellation token to use. </param>
 517        public async Task<Response<VirtualMachineExtensionsListResult>> ListAsync(string resourceGroupName, string vmSca
 518        {
 0519            if (resourceGroupName == null)
 520            {
 0521                throw new ArgumentNullException(nameof(resourceGroupName));
 522            }
 0523            if (vmScaleSetName == null)
 524            {
 0525                throw new ArgumentNullException(nameof(vmScaleSetName));
 526            }
 0527            if (instanceId == null)
 528            {
 0529                throw new ArgumentNullException(nameof(instanceId));
 530            }
 531
 0532            using var message = CreateListRequest(resourceGroupName, vmScaleSetName, instanceId, expand);
 0533            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0534            switch (message.Response.Status)
 535            {
 536                case 200:
 537                    {
 0538                        VirtualMachineExtensionsListResult value = default;
 0539                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0540                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 541                        {
 0542                            value = null;
 543                        }
 544                        else
 545                        {
 0546                            value = VirtualMachineExtensionsListResult.DeserializeVirtualMachineExtensionsListResult(doc
 547                        }
 0548                        return Response.FromValue(value, message.Response);
 549                    }
 550                default:
 0551                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 552            }
 0553        }
 554
 555        /// <summary> The operation to get all extensions of an instance in Virtual Machine Scaleset. </summary>
 556        /// <param name="resourceGroupName"> The name of the resource group. </param>
 557        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 558        /// <param name="instanceId"> The instance ID of the virtual machine. </param>
 559        /// <param name="expand"> The expand expression to apply on the operation. </param>
 560        /// <param name="cancellationToken"> The cancellation token to use. </param>
 561        public Response<VirtualMachineExtensionsListResult> List(string resourceGroupName, string vmScaleSetName, string
 562        {
 0563            if (resourceGroupName == null)
 564            {
 0565                throw new ArgumentNullException(nameof(resourceGroupName));
 566            }
 0567            if (vmScaleSetName == null)
 568            {
 0569                throw new ArgumentNullException(nameof(vmScaleSetName));
 570            }
 0571            if (instanceId == null)
 572            {
 0573                throw new ArgumentNullException(nameof(instanceId));
 574            }
 575
 0576            using var message = CreateListRequest(resourceGroupName, vmScaleSetName, instanceId, expand);
 0577            _pipeline.Send(message, cancellationToken);
 0578            switch (message.Response.Status)
 579            {
 580                case 200:
 581                    {
 0582                        VirtualMachineExtensionsListResult value = default;
 0583                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0584                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 585                        {
 0586                            value = null;
 587                        }
 588                        else
 589                        {
 0590                            value = VirtualMachineExtensionsListResult.DeserializeVirtualMachineExtensionsListResult(doc
 591                        }
 0592                        return Response.FromValue(value, message.Response);
 593                    }
 594                default:
 0595                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 596            }
 0597        }
 598    }
 599}