< Summary

Class:Azure.ResourceManager.Compute.VirtualMachineScaleSetsRestOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineScaleSetsRestOperations.cs
Covered lines:590
Uncovered lines:483
Coverable lines:1073
Total lines:2288
Line coverage:54.9% (590 of 1073)
Covered branches:182
Total branches:446
Branch coverage:40.8% (182 of 446)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateCreateOrUpdateRequest(...)-100%100%
CreateOrUpdateAsync()-66.67%50%
CreateOrUpdate(...)-66.67%50%
CreateUpdateRequest(...)-0%100%
UpdateAsync()-0%0%
Update(...)-0%0%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-70%50%
Delete(...)-70%50%
CreateGetRequest(...)-100%100%
GetAsync()-73.33%50%
Get(...)-73.33%50%
CreateDeallocateRequest(...)-100%100%
DeallocateAsync()-70%62.5%
Deallocate(...)-70%62.5%
CreateDeleteInstancesRequest(...)-100%100%
DeleteInstancesAsync()-66.67%60%
DeleteInstances(...)-66.67%60%
CreateGetInstanceViewRequest(...)-100%100%
GetInstanceViewAsync()-73.33%50%
GetInstanceView(...)-73.33%50%
CreateListRequest(...)-100%100%
ListAsync()-76.92%50%
List(...)-76.92%50%
CreateListAllRequest()-0%100%
ListAllAsync()-0%0%
ListAll(...)-0%0%
CreateListSkusRequest(...)-100%100%
ListSkusAsync()-73.33%50%
ListSkus(...)-73.33%50%
CreateGetOSUpgradeHistoryRequest(...)-0%100%
GetOSUpgradeHistoryAsync()-0%0%
GetOSUpgradeHistory(...)-0%0%
CreatePowerOffRequest(...)-100%100%
PowerOffAsync()-70%62.5%
PowerOff(...)-70%62.5%
CreateRestartRequest(...)-100%100%
RestartAsync()-70%62.5%
Restart(...)-70%62.5%
CreateStartRequest(...)-100%100%
StartAsync()-70%62.5%
Start(...)-70%62.5%
CreateRedeployRequest(...)-100%100%
RedeployAsync()-70%62.5%
Redeploy(...)-70%62.5%
CreatePerformMaintenanceRequest(...)-100%100%
PerformMaintenanceAsync()-60%50%
PerformMaintenance(...)-60%50%
CreateUpdateInstancesRequest(...)-100%100%
UpdateInstancesAsync()-66.67%60%
UpdateInstances(...)-66.67%60%
CreateReimageRequest(...)-100%100%
ReimageAsync()-70%62.5%
Reimage(...)-70%62.5%
CreateReimageAllRequest(...)-100%100%
ReimageAllAsync()-70%62.5%
ReimageAll(...)-70%62.5%
CreateForceRecoveryServiceFabricPlatformUpdateDomainWalkRequest(...)-0%100%
ForceRecoveryServiceFabricPlatformUpdateDomainWalkAsync()-0%0%
ForceRecoveryServiceFabricPlatformUpdateDomainWalk(...)-0%0%
CreateConvertToSinglePlacementGroupRequest(...)-0%100%
ConvertToSinglePlacementGroupAsync()-0%0%
ConvertToSinglePlacementGroup(...)-0%0%
CreateSetOrchestrationServiceStateRequest(...)-100%100%
SetOrchestrationServiceStateAsync()-66.67%60%
SetOrchestrationServiceState(...)-66.67%60%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%
CreateListAllNextPageRequest(...)-0%100%
ListAllNextPageAsync()-0%0%
ListAllNextPage(...)-0%0%
CreateListSkusNextPageRequest(...)-0%100%
ListSkusNextPageAsync()-0%0%
ListSkusNextPage(...)-0%0%
CreateGetOSUpgradeHistoryNextPageRequest(...)-0%100%
GetOSUpgradeHistoryNextPageAsync()-0%0%
GetOSUpgradeHistoryNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineScaleSetsRestOperations.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 VirtualMachineScaleSetsRestOperations
 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 VirtualMachineScaleSetsRestOperations. </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 VirtualMachineScaleSetsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string 
 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 vmScaleSetName, VirtualMachine
 47        {
 36448            var message = _pipeline.CreateMessage();
 36449            var request = message.Request;
 36450            request.Method = RequestMethod.Put;
 36451            var uri = new RawRequestUriBuilder();
 36452            uri.Reset(endpoint);
 36453            uri.AppendPath("/subscriptions/", false);
 36454            uri.AppendPath(subscriptionId, true);
 36455            uri.AppendPath("/resourceGroups/", false);
 36456            uri.AppendPath(resourceGroupName, true);
 36457            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 36458            uri.AppendPath(vmScaleSetName, true);
 36459            uri.AppendQuery("api-version", "2019-12-01", true);
 36460            request.Uri = uri;
 36461            request.Headers.Add("Content-Type", "application/json");
 36462            var content = new Utf8JsonRequestContent();
 36463            content.JsonWriter.WriteObjectValue(parameters);
 36464            request.Content = content;
 36465            return message;
 66        }
 67
 68        /// <summary> Create or update a VM scale set. </summary>
 69        /// <param name="resourceGroupName"> The name of the resource group. </param>
 70        /// <param name="vmScaleSetName"> The name of the VM scale set to create or update. </param>
 71        /// <param name="parameters"> The scale set object. </param>
 72        /// <param name="cancellationToken"> The cancellation token to use. </param>
 73        public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineS
 74        {
 9275            if (resourceGroupName == null)
 76            {
 077                throw new ArgumentNullException(nameof(resourceGroupName));
 78            }
 9279            if (vmScaleSetName == null)
 80            {
 081                throw new ArgumentNullException(nameof(vmScaleSetName));
 82            }
 9283            if (parameters == null)
 84            {
 085                throw new ArgumentNullException(nameof(parameters));
 86            }
 87
 9288            using var message = CreateCreateOrUpdateRequest(resourceGroupName, vmScaleSetName, parameters);
 9289            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 9090            switch (message.Response.Status)
 91            {
 92                case 200:
 93                case 201:
 9094                    return message.Response;
 95                default:
 096                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 97            }
 9098        }
 99
 100        /// <summary> Create or update a VM scale set. </summary>
 101        /// <param name="resourceGroupName"> The name of the resource group. </param>
 102        /// <param name="vmScaleSetName"> The name of the VM scale set to create or update. </param>
 103        /// <param name="parameters"> The scale set object. </param>
 104        /// <param name="cancellationToken"> The cancellation token to use. </param>
 105        public Response CreateOrUpdate(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet parameter
 106        {
 92107            if (resourceGroupName == null)
 108            {
 0109                throw new ArgumentNullException(nameof(resourceGroupName));
 110            }
 92111            if (vmScaleSetName == null)
 112            {
 0113                throw new ArgumentNullException(nameof(vmScaleSetName));
 114            }
 92115            if (parameters == null)
 116            {
 0117                throw new ArgumentNullException(nameof(parameters));
 118            }
 119
 92120            using var message = CreateCreateOrUpdateRequest(resourceGroupName, vmScaleSetName, parameters);
 92121            _pipeline.Send(message, cancellationToken);
 90122            switch (message.Response.Status)
 123            {
 124                case 200:
 125                case 201:
 90126                    return message.Response;
 127                default:
 0128                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 129            }
 90130        }
 131
 132        internal HttpMessage CreateUpdateRequest(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet
 133        {
 0134            var message = _pipeline.CreateMessage();
 0135            var request = message.Request;
 0136            request.Method = RequestMethod.Patch;
 0137            var uri = new RawRequestUriBuilder();
 0138            uri.Reset(endpoint);
 0139            uri.AppendPath("/subscriptions/", false);
 0140            uri.AppendPath(subscriptionId, true);
 0141            uri.AppendPath("/resourceGroups/", false);
 0142            uri.AppendPath(resourceGroupName, true);
 0143            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 0144            uri.AppendPath(vmScaleSetName, true);
 0145            uri.AppendQuery("api-version", "2019-12-01", true);
 0146            request.Uri = uri;
 0147            request.Headers.Add("Content-Type", "application/json");
 0148            var content = new Utf8JsonRequestContent();
 0149            content.JsonWriter.WriteObjectValue(parameters);
 0150            request.Content = content;
 0151            return message;
 152        }
 153
 154        /// <summary> Update a VM scale set. </summary>
 155        /// <param name="resourceGroupName"> The name of the resource group. </param>
 156        /// <param name="vmScaleSetName"> The name of the VM scale set to create or update. </param>
 157        /// <param name="parameters"> The scale set object. </param>
 158        /// <param name="cancellationToken"> The cancellation token to use. </param>
 159        public async Task<Response> UpdateAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetU
 160        {
 0161            if (resourceGroupName == null)
 162            {
 0163                throw new ArgumentNullException(nameof(resourceGroupName));
 164            }
 0165            if (vmScaleSetName == null)
 166            {
 0167                throw new ArgumentNullException(nameof(vmScaleSetName));
 168            }
 0169            if (parameters == null)
 170            {
 0171                throw new ArgumentNullException(nameof(parameters));
 172            }
 173
 0174            using var message = CreateUpdateRequest(resourceGroupName, vmScaleSetName, parameters);
 0175            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0176            switch (message.Response.Status)
 177            {
 178                case 200:
 0179                    return message.Response;
 180                default:
 0181                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 182            }
 0183        }
 184
 185        /// <summary> Update a VM scale set. </summary>
 186        /// <param name="resourceGroupName"> The name of the resource group. </param>
 187        /// <param name="vmScaleSetName"> The name of the VM scale set to create or update. </param>
 188        /// <param name="parameters"> The scale set object. </param>
 189        /// <param name="cancellationToken"> The cancellation token to use. </param>
 190        public Response Update(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetUpdate parameters,
 191        {
 0192            if (resourceGroupName == null)
 193            {
 0194                throw new ArgumentNullException(nameof(resourceGroupName));
 195            }
 0196            if (vmScaleSetName == null)
 197            {
 0198                throw new ArgumentNullException(nameof(vmScaleSetName));
 199            }
 0200            if (parameters == null)
 201            {
 0202                throw new ArgumentNullException(nameof(parameters));
 203            }
 204
 0205            using var message = CreateUpdateRequest(resourceGroupName, vmScaleSetName, parameters);
 0206            _pipeline.Send(message, cancellationToken);
 0207            switch (message.Response.Status)
 208            {
 209                case 200:
 0210                    return message.Response;
 211                default:
 0212                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 213            }
 0214        }
 215
 216        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string vmScaleSetName)
 217        {
 248218            var message = _pipeline.CreateMessage();
 248219            var request = message.Request;
 248220            request.Method = RequestMethod.Delete;
 248221            var uri = new RawRequestUriBuilder();
 248222            uri.Reset(endpoint);
 248223            uri.AppendPath("/subscriptions/", false);
 248224            uri.AppendPath(subscriptionId, true);
 248225            uri.AppendPath("/resourceGroups/", false);
 248226            uri.AppendPath(resourceGroupName, true);
 248227            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 248228            uri.AppendPath(vmScaleSetName, true);
 248229            uri.AppendQuery("api-version", "2019-12-01", true);
 248230            request.Uri = uri;
 248231            return message;
 232        }
 233
 234        /// <summary> Deletes a VM scale set. </summary>
 235        /// <param name="resourceGroupName"> The name of the resource group. </param>
 236        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 237        /// <param name="cancellationToken"> The cancellation token to use. </param>
 238        public async Task<Response> DeleteAsync(string resourceGroupName, string vmScaleSetName, CancellationToken cance
 239        {
 62240            if (resourceGroupName == null)
 241            {
 0242                throw new ArgumentNullException(nameof(resourceGroupName));
 243            }
 62244            if (vmScaleSetName == null)
 245            {
 0246                throw new ArgumentNullException(nameof(vmScaleSetName));
 247            }
 248
 62249            using var message = CreateDeleteRequest(resourceGroupName, vmScaleSetName);
 62250            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 62251            switch (message.Response.Status)
 252            {
 253                case 200:
 254                case 202:
 255                case 204:
 62256                    return message.Response;
 257                default:
 0258                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 259            }
 62260        }
 261
 262        /// <summary> Deletes a VM scale set. </summary>
 263        /// <param name="resourceGroupName"> The name of the resource group. </param>
 264        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 265        /// <param name="cancellationToken"> The cancellation token to use. </param>
 266        public Response Delete(string resourceGroupName, string vmScaleSetName, CancellationToken cancellationToken = de
 267        {
 62268            if (resourceGroupName == null)
 269            {
 0270                throw new ArgumentNullException(nameof(resourceGroupName));
 271            }
 62272            if (vmScaleSetName == null)
 273            {
 0274                throw new ArgumentNullException(nameof(vmScaleSetName));
 275            }
 276
 62277            using var message = CreateDeleteRequest(resourceGroupName, vmScaleSetName);
 62278            _pipeline.Send(message, cancellationToken);
 62279            switch (message.Response.Status)
 280            {
 281                case 200:
 282                case 202:
 283                case 204:
 62284                    return message.Response;
 285                default:
 0286                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 287            }
 62288        }
 289
 290        internal HttpMessage CreateGetRequest(string resourceGroupName, string vmScaleSetName)
 291        {
 220292            var message = _pipeline.CreateMessage();
 220293            var request = message.Request;
 220294            request.Method = RequestMethod.Get;
 220295            var uri = new RawRequestUriBuilder();
 220296            uri.Reset(endpoint);
 220297            uri.AppendPath("/subscriptions/", false);
 220298            uri.AppendPath(subscriptionId, true);
 220299            uri.AppendPath("/resourceGroups/", false);
 220300            uri.AppendPath(resourceGroupName, true);
 220301            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 220302            uri.AppendPath(vmScaleSetName, true);
 220303            uri.AppendQuery("api-version", "2019-12-01", true);
 220304            request.Uri = uri;
 220305            return message;
 306        }
 307
 308        /// <summary> Display information about a virtual machine scale set. </summary>
 309        /// <param name="resourceGroupName"> The name of the resource group. </param>
 310        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 311        /// <param name="cancellationToken"> The cancellation token to use. </param>
 312        public async Task<Response<VirtualMachineScaleSet>> GetAsync(string resourceGroupName, string vmScaleSetName, Ca
 313        {
 110314            if (resourceGroupName == null)
 315            {
 0316                throw new ArgumentNullException(nameof(resourceGroupName));
 317            }
 110318            if (vmScaleSetName == null)
 319            {
 0320                throw new ArgumentNullException(nameof(vmScaleSetName));
 321            }
 322
 110323            using var message = CreateGetRequest(resourceGroupName, vmScaleSetName);
 110324            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 110325            switch (message.Response.Status)
 326            {
 327                case 200:
 328                    {
 110329                        VirtualMachineScaleSet value = default;
 110330                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 110331                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 332                        {
 0333                            value = null;
 334                        }
 335                        else
 336                        {
 110337                            value = VirtualMachineScaleSet.DeserializeVirtualMachineScaleSet(document.RootElement);
 338                        }
 110339                        return Response.FromValue(value, message.Response);
 340                    }
 341                default:
 0342                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 343            }
 110344        }
 345
 346        /// <summary> Display information about a virtual machine scale set. </summary>
 347        /// <param name="resourceGroupName"> The name of the resource group. </param>
 348        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 349        /// <param name="cancellationToken"> The cancellation token to use. </param>
 350        public Response<VirtualMachineScaleSet> Get(string resourceGroupName, string vmScaleSetName, CancellationToken c
 351        {
 110352            if (resourceGroupName == null)
 353            {
 0354                throw new ArgumentNullException(nameof(resourceGroupName));
 355            }
 110356            if (vmScaleSetName == null)
 357            {
 0358                throw new ArgumentNullException(nameof(vmScaleSetName));
 359            }
 360
 110361            using var message = CreateGetRequest(resourceGroupName, vmScaleSetName);
 110362            _pipeline.Send(message, cancellationToken);
 110363            switch (message.Response.Status)
 364            {
 365                case 200:
 366                    {
 110367                        VirtualMachineScaleSet value = default;
 110368                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 110369                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 370                        {
 0371                            value = null;
 372                        }
 373                        else
 374                        {
 110375                            value = VirtualMachineScaleSet.DeserializeVirtualMachineScaleSet(document.RootElement);
 376                        }
 110377                        return Response.FromValue(value, message.Response);
 378                    }
 379                default:
 0380                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 381            }
 110382        }
 383
 384        internal HttpMessage CreateDeallocateRequest(string resourceGroupName, string vmScaleSetName, VirtualMachineScal
 385        {
 24386            var message = _pipeline.CreateMessage();
 24387            var request = message.Request;
 24388            request.Method = RequestMethod.Post;
 24389            var uri = new RawRequestUriBuilder();
 24390            uri.Reset(endpoint);
 24391            uri.AppendPath("/subscriptions/", false);
 24392            uri.AppendPath(subscriptionId, true);
 24393            uri.AppendPath("/resourceGroups/", false);
 24394            uri.AppendPath(resourceGroupName, true);
 24395            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 24396            uri.AppendPath(vmScaleSetName, true);
 24397            uri.AppendPath("/deallocate", false);
 24398            uri.AppendQuery("api-version", "2019-12-01", true);
 24399            request.Uri = uri;
 24400            request.Headers.Add("Content-Type", "application/json");
 24401            if (vmInstanceIDs != null)
 402            {
 8403                var content = new Utf8JsonRequestContent();
 8404                content.JsonWriter.WriteObjectValue(vmInstanceIDs);
 8405                request.Content = content;
 406            }
 24407            return message;
 408        }
 409
 410        /// <summary> Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and relea
 411        /// <param name="resourceGroupName"> The name of the resource group. </param>
 412        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 413        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 414        /// <param name="cancellationToken"> The cancellation token to use. </param>
 415        public async Task<Response> DeallocateAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScale
 416        {
 6417            if (resourceGroupName == null)
 418            {
 0419                throw new ArgumentNullException(nameof(resourceGroupName));
 420            }
 6421            if (vmScaleSetName == null)
 422            {
 0423                throw new ArgumentNullException(nameof(vmScaleSetName));
 424            }
 425
 6426            using var message = CreateDeallocateRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 6427            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6428            switch (message.Response.Status)
 429            {
 430                case 200:
 431                case 202:
 6432                    return message.Response;
 433                default:
 0434                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 435            }
 6436        }
 437
 438        /// <summary> Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and relea
 439        /// <param name="resourceGroupName"> The name of the resource group. </param>
 440        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 441        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 442        /// <param name="cancellationToken"> The cancellation token to use. </param>
 443        public Response Deallocate(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs 
 444        {
 6445            if (resourceGroupName == null)
 446            {
 0447                throw new ArgumentNullException(nameof(resourceGroupName));
 448            }
 6449            if (vmScaleSetName == null)
 450            {
 0451                throw new ArgumentNullException(nameof(vmScaleSetName));
 452            }
 453
 6454            using var message = CreateDeallocateRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 6455            _pipeline.Send(message, cancellationToken);
 6456            switch (message.Response.Status)
 457            {
 458                case 200:
 459                case 202:
 6460                    return message.Response;
 461                default:
 0462                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 463            }
 6464        }
 465
 466        internal HttpMessage CreateDeleteInstancesRequest(string resourceGroupName, string vmScaleSetName, VirtualMachin
 467        {
 8468            var message = _pipeline.CreateMessage();
 8469            var request = message.Request;
 8470            request.Method = RequestMethod.Post;
 8471            var uri = new RawRequestUriBuilder();
 8472            uri.Reset(endpoint);
 8473            uri.AppendPath("/subscriptions/", false);
 8474            uri.AppendPath(subscriptionId, true);
 8475            uri.AppendPath("/resourceGroups/", false);
 8476            uri.AppendPath(resourceGroupName, true);
 8477            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 8478            uri.AppendPath(vmScaleSetName, true);
 8479            uri.AppendPath("/delete", false);
 8480            uri.AppendQuery("api-version", "2019-12-01", true);
 8481            request.Uri = uri;
 8482            request.Headers.Add("Content-Type", "application/json");
 8483            var content = new Utf8JsonRequestContent();
 8484            content.JsonWriter.WriteObjectValue(vmInstanceIDs);
 8485            request.Content = content;
 8486            return message;
 487        }
 488
 489        /// <summary> Deletes virtual machines in a VM scale set. </summary>
 490        /// <param name="resourceGroupName"> The name of the resource group. </param>
 491        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 492        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 493        /// <param name="cancellationToken"> The cancellation token to use. </param>
 494        public async Task<Response> DeleteInstancesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachine
 495        {
 2496            if (resourceGroupName == null)
 497            {
 0498                throw new ArgumentNullException(nameof(resourceGroupName));
 499            }
 2500            if (vmScaleSetName == null)
 501            {
 0502                throw new ArgumentNullException(nameof(vmScaleSetName));
 503            }
 2504            if (vmInstanceIDs == null)
 505            {
 0506                throw new ArgumentNullException(nameof(vmInstanceIDs));
 507            }
 508
 2509            using var message = CreateDeleteInstancesRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 2510            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2511            switch (message.Response.Status)
 512            {
 513                case 200:
 514                case 202:
 2515                    return message.Response;
 516                default:
 0517                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 518            }
 2519        }
 520
 521        /// <summary> Deletes virtual machines in a VM scale set. </summary>
 522        /// <param name="resourceGroupName"> The name of the resource group. </param>
 523        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 524        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 525        /// <param name="cancellationToken"> The cancellation token to use. </param>
 526        public Response DeleteInstances(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetVMInstanc
 527        {
 2528            if (resourceGroupName == null)
 529            {
 0530                throw new ArgumentNullException(nameof(resourceGroupName));
 531            }
 2532            if (vmScaleSetName == null)
 533            {
 0534                throw new ArgumentNullException(nameof(vmScaleSetName));
 535            }
 2536            if (vmInstanceIDs == null)
 537            {
 0538                throw new ArgumentNullException(nameof(vmInstanceIDs));
 539            }
 540
 2541            using var message = CreateDeleteInstancesRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 2542            _pipeline.Send(message, cancellationToken);
 2543            switch (message.Response.Status)
 544            {
 545                case 200:
 546                case 202:
 2547                    return message.Response;
 548                default:
 0549                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 550            }
 2551        }
 552
 553        internal HttpMessage CreateGetInstanceViewRequest(string resourceGroupName, string vmScaleSetName)
 554        {
 60555            var message = _pipeline.CreateMessage();
 60556            var request = message.Request;
 60557            request.Method = RequestMethod.Get;
 60558            var uri = new RawRequestUriBuilder();
 60559            uri.Reset(endpoint);
 60560            uri.AppendPath("/subscriptions/", false);
 60561            uri.AppendPath(subscriptionId, true);
 60562            uri.AppendPath("/resourceGroups/", false);
 60563            uri.AppendPath(resourceGroupName, true);
 60564            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 60565            uri.AppendPath(vmScaleSetName, true);
 60566            uri.AppendPath("/instanceView", false);
 60567            uri.AppendQuery("api-version", "2019-12-01", true);
 60568            request.Uri = uri;
 60569            return message;
 570        }
 571
 572        /// <summary> Gets the status of a VM scale set instance. </summary>
 573        /// <param name="resourceGroupName"> The name of the resource group. </param>
 574        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 575        /// <param name="cancellationToken"> The cancellation token to use. </param>
 576        public async Task<Response<VirtualMachineScaleSetInstanceView>> GetInstanceViewAsync(string resourceGroupName, s
 577        {
 30578            if (resourceGroupName == null)
 579            {
 0580                throw new ArgumentNullException(nameof(resourceGroupName));
 581            }
 30582            if (vmScaleSetName == null)
 583            {
 0584                throw new ArgumentNullException(nameof(vmScaleSetName));
 585            }
 586
 30587            using var message = CreateGetInstanceViewRequest(resourceGroupName, vmScaleSetName);
 30588            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 30589            switch (message.Response.Status)
 590            {
 591                case 200:
 592                    {
 30593                        VirtualMachineScaleSetInstanceView value = default;
 30594                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 30595                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 596                        {
 0597                            value = null;
 598                        }
 599                        else
 600                        {
 30601                            value = VirtualMachineScaleSetInstanceView.DeserializeVirtualMachineScaleSetInstanceView(doc
 602                        }
 30603                        return Response.FromValue(value, message.Response);
 604                    }
 605                default:
 0606                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 607            }
 30608        }
 609
 610        /// <summary> Gets the status of a VM scale set instance. </summary>
 611        /// <param name="resourceGroupName"> The name of the resource group. </param>
 612        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 613        /// <param name="cancellationToken"> The cancellation token to use. </param>
 614        public Response<VirtualMachineScaleSetInstanceView> GetInstanceView(string resourceGroupName, string vmScaleSetN
 615        {
 30616            if (resourceGroupName == null)
 617            {
 0618                throw new ArgumentNullException(nameof(resourceGroupName));
 619            }
 30620            if (vmScaleSetName == null)
 621            {
 0622                throw new ArgumentNullException(nameof(vmScaleSetName));
 623            }
 624
 30625            using var message = CreateGetInstanceViewRequest(resourceGroupName, vmScaleSetName);
 30626            _pipeline.Send(message, cancellationToken);
 30627            switch (message.Response.Status)
 628            {
 629                case 200:
 630                    {
 30631                        VirtualMachineScaleSetInstanceView value = default;
 30632                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 30633                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 634                        {
 0635                            value = null;
 636                        }
 637                        else
 638                        {
 30639                            value = VirtualMachineScaleSetInstanceView.DeserializeVirtualMachineScaleSetInstanceView(doc
 640                        }
 30641                        return Response.FromValue(value, message.Response);
 642                    }
 643                default:
 0644                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 645            }
 30646        }
 647
 648        internal HttpMessage CreateListRequest(string resourceGroupName)
 649        {
 48650            var message = _pipeline.CreateMessage();
 48651            var request = message.Request;
 48652            request.Method = RequestMethod.Get;
 48653            var uri = new RawRequestUriBuilder();
 48654            uri.Reset(endpoint);
 48655            uri.AppendPath("/subscriptions/", false);
 48656            uri.AppendPath(subscriptionId, true);
 48657            uri.AppendPath("/resourceGroups/", false);
 48658            uri.AppendPath(resourceGroupName, true);
 48659            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets", false);
 48660            uri.AppendQuery("api-version", "2019-12-01", true);
 48661            request.Uri = uri;
 48662            return message;
 663        }
 664
 665        /// <summary> Gets a list of all VM scale sets under a resource group. </summary>
 666        /// <param name="resourceGroupName"> The name of the resource group. </param>
 667        /// <param name="cancellationToken"> The cancellation token to use. </param>
 668        public async Task<Response<VirtualMachineScaleSetListResult>> ListAsync(string resourceGroupName, CancellationTo
 669        {
 24670            if (resourceGroupName == null)
 671            {
 0672                throw new ArgumentNullException(nameof(resourceGroupName));
 673            }
 674
 24675            using var message = CreateListRequest(resourceGroupName);
 24676            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 24677            switch (message.Response.Status)
 678            {
 679                case 200:
 680                    {
 24681                        VirtualMachineScaleSetListResult value = default;
 24682                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 24683                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 684                        {
 0685                            value = null;
 686                        }
 687                        else
 688                        {
 24689                            value = VirtualMachineScaleSetListResult.DeserializeVirtualMachineScaleSetListResult(documen
 690                        }
 24691                        return Response.FromValue(value, message.Response);
 692                    }
 693                default:
 0694                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 695            }
 24696        }
 697
 698        /// <summary> Gets a list of all VM scale sets under a resource group. </summary>
 699        /// <param name="resourceGroupName"> The name of the resource group. </param>
 700        /// <param name="cancellationToken"> The cancellation token to use. </param>
 701        public Response<VirtualMachineScaleSetListResult> List(string resourceGroupName, CancellationToken cancellationT
 702        {
 24703            if (resourceGroupName == null)
 704            {
 0705                throw new ArgumentNullException(nameof(resourceGroupName));
 706            }
 707
 24708            using var message = CreateListRequest(resourceGroupName);
 24709            _pipeline.Send(message, cancellationToken);
 24710            switch (message.Response.Status)
 711            {
 712                case 200:
 713                    {
 24714                        VirtualMachineScaleSetListResult value = default;
 24715                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 24716                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 717                        {
 0718                            value = null;
 719                        }
 720                        else
 721                        {
 24722                            value = VirtualMachineScaleSetListResult.DeserializeVirtualMachineScaleSetListResult(documen
 723                        }
 24724                        return Response.FromValue(value, message.Response);
 725                    }
 726                default:
 0727                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 728            }
 24729        }
 730
 731        internal HttpMessage CreateListAllRequest()
 732        {
 0733            var message = _pipeline.CreateMessage();
 0734            var request = message.Request;
 0735            request.Method = RequestMethod.Get;
 0736            var uri = new RawRequestUriBuilder();
 0737            uri.Reset(endpoint);
 0738            uri.AppendPath("/subscriptions/", false);
 0739            uri.AppendPath(subscriptionId, true);
 0740            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets", false);
 0741            uri.AppendQuery("api-version", "2019-12-01", true);
 0742            request.Uri = uri;
 0743            return message;
 744        }
 745
 746        /// <summary> Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group.
 747        /// <param name="cancellationToken"> The cancellation token to use. </param>
 748        public async Task<Response<VirtualMachineScaleSetListWithLinkResult>> ListAllAsync(CancellationToken cancellatio
 749        {
 0750            using var message = CreateListAllRequest();
 0751            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0752            switch (message.Response.Status)
 753            {
 754                case 200:
 755                    {
 0756                        VirtualMachineScaleSetListWithLinkResult value = default;
 0757                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0758                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 759                        {
 0760                            value = null;
 761                        }
 762                        else
 763                        {
 0764                            value = VirtualMachineScaleSetListWithLinkResult.DeserializeVirtualMachineScaleSetListWithLi
 765                        }
 0766                        return Response.FromValue(value, message.Response);
 767                    }
 768                default:
 0769                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 770            }
 0771        }
 772
 773        /// <summary> Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group.
 774        /// <param name="cancellationToken"> The cancellation token to use. </param>
 775        public Response<VirtualMachineScaleSetListWithLinkResult> ListAll(CancellationToken cancellationToken = default)
 776        {
 0777            using var message = CreateListAllRequest();
 0778            _pipeline.Send(message, cancellationToken);
 0779            switch (message.Response.Status)
 780            {
 781                case 200:
 782                    {
 0783                        VirtualMachineScaleSetListWithLinkResult value = default;
 0784                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0785                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 786                        {
 0787                            value = null;
 788                        }
 789                        else
 790                        {
 0791                            value = VirtualMachineScaleSetListWithLinkResult.DeserializeVirtualMachineScaleSetListWithLi
 792                        }
 0793                        return Response.FromValue(value, message.Response);
 794                    }
 795                default:
 0796                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 797            }
 0798        }
 799
 800        internal HttpMessage CreateListSkusRequest(string resourceGroupName, string vmScaleSetName)
 801        {
 48802            var message = _pipeline.CreateMessage();
 48803            var request = message.Request;
 48804            request.Method = RequestMethod.Get;
 48805            var uri = new RawRequestUriBuilder();
 48806            uri.Reset(endpoint);
 48807            uri.AppendPath("/subscriptions/", false);
 48808            uri.AppendPath(subscriptionId, true);
 48809            uri.AppendPath("/resourceGroups/", false);
 48810            uri.AppendPath(resourceGroupName, true);
 48811            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 48812            uri.AppendPath(vmScaleSetName, true);
 48813            uri.AppendPath("/skus", false);
 48814            uri.AppendQuery("api-version", "2019-12-01", true);
 48815            request.Uri = uri;
 48816            return message;
 817        }
 818
 819        /// <summary> Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instance
 820        /// <param name="resourceGroupName"> The name of the resource group. </param>
 821        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 822        /// <param name="cancellationToken"> The cancellation token to use. </param>
 823        public async Task<Response<VirtualMachineScaleSetListSkusResult>> ListSkusAsync(string resourceGroupName, string
 824        {
 24825            if (resourceGroupName == null)
 826            {
 0827                throw new ArgumentNullException(nameof(resourceGroupName));
 828            }
 24829            if (vmScaleSetName == null)
 830            {
 0831                throw new ArgumentNullException(nameof(vmScaleSetName));
 832            }
 833
 24834            using var message = CreateListSkusRequest(resourceGroupName, vmScaleSetName);
 24835            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 24836            switch (message.Response.Status)
 837            {
 838                case 200:
 839                    {
 24840                        VirtualMachineScaleSetListSkusResult value = default;
 24841                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 24842                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 843                        {
 0844                            value = null;
 845                        }
 846                        else
 847                        {
 24848                            value = VirtualMachineScaleSetListSkusResult.DeserializeVirtualMachineScaleSetListSkusResult
 849                        }
 24850                        return Response.FromValue(value, message.Response);
 851                    }
 852                default:
 0853                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 854            }
 24855        }
 856
 857        /// <summary> Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instance
 858        /// <param name="resourceGroupName"> The name of the resource group. </param>
 859        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 860        /// <param name="cancellationToken"> The cancellation token to use. </param>
 861        public Response<VirtualMachineScaleSetListSkusResult> ListSkus(string resourceGroupName, string vmScaleSetName, 
 862        {
 24863            if (resourceGroupName == null)
 864            {
 0865                throw new ArgumentNullException(nameof(resourceGroupName));
 866            }
 24867            if (vmScaleSetName == null)
 868            {
 0869                throw new ArgumentNullException(nameof(vmScaleSetName));
 870            }
 871
 24872            using var message = CreateListSkusRequest(resourceGroupName, vmScaleSetName);
 24873            _pipeline.Send(message, cancellationToken);
 24874            switch (message.Response.Status)
 875            {
 876                case 200:
 877                    {
 24878                        VirtualMachineScaleSetListSkusResult value = default;
 24879                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 24880                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 881                        {
 0882                            value = null;
 883                        }
 884                        else
 885                        {
 24886                            value = VirtualMachineScaleSetListSkusResult.DeserializeVirtualMachineScaleSetListSkusResult
 887                        }
 24888                        return Response.FromValue(value, message.Response);
 889                    }
 890                default:
 0891                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 892            }
 24893        }
 894
 895        internal HttpMessage CreateGetOSUpgradeHistoryRequest(string resourceGroupName, string vmScaleSetName)
 896        {
 0897            var message = _pipeline.CreateMessage();
 0898            var request = message.Request;
 0899            request.Method = RequestMethod.Get;
 0900            var uri = new RawRequestUriBuilder();
 0901            uri.Reset(endpoint);
 0902            uri.AppendPath("/subscriptions/", false);
 0903            uri.AppendPath(subscriptionId, true);
 0904            uri.AppendPath("/resourceGroups/", false);
 0905            uri.AppendPath(resourceGroupName, true);
 0906            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 0907            uri.AppendPath(vmScaleSetName, true);
 0908            uri.AppendPath("/osUpgradeHistory", false);
 0909            uri.AppendQuery("api-version", "2019-12-01", true);
 0910            request.Uri = uri;
 0911            return message;
 912        }
 913
 914        /// <summary> Gets list of OS upgrades on a VM scale set instance. </summary>
 915        /// <param name="resourceGroupName"> The name of the resource group. </param>
 916        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 917        /// <param name="cancellationToken"> The cancellation token to use. </param>
 918        public async Task<Response<VirtualMachineScaleSetListOSUpgradeHistory>> GetOSUpgradeHistoryAsync(string resource
 919        {
 0920            if (resourceGroupName == null)
 921            {
 0922                throw new ArgumentNullException(nameof(resourceGroupName));
 923            }
 0924            if (vmScaleSetName == null)
 925            {
 0926                throw new ArgumentNullException(nameof(vmScaleSetName));
 927            }
 928
 0929            using var message = CreateGetOSUpgradeHistoryRequest(resourceGroupName, vmScaleSetName);
 0930            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0931            switch (message.Response.Status)
 932            {
 933                case 200:
 934                    {
 0935                        VirtualMachineScaleSetListOSUpgradeHistory value = default;
 0936                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0937                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 938                        {
 0939                            value = null;
 940                        }
 941                        else
 942                        {
 0943                            value = VirtualMachineScaleSetListOSUpgradeHistory.DeserializeVirtualMachineScaleSetListOSUp
 944                        }
 0945                        return Response.FromValue(value, message.Response);
 946                    }
 947                default:
 0948                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 949            }
 0950        }
 951
 952        /// <summary> Gets list of OS upgrades on a VM scale set instance. </summary>
 953        /// <param name="resourceGroupName"> The name of the resource group. </param>
 954        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 955        /// <param name="cancellationToken"> The cancellation token to use. </param>
 956        public Response<VirtualMachineScaleSetListOSUpgradeHistory> GetOSUpgradeHistory(string resourceGroupName, string
 957        {
 0958            if (resourceGroupName == null)
 959            {
 0960                throw new ArgumentNullException(nameof(resourceGroupName));
 961            }
 0962            if (vmScaleSetName == null)
 963            {
 0964                throw new ArgumentNullException(nameof(vmScaleSetName));
 965            }
 966
 0967            using var message = CreateGetOSUpgradeHistoryRequest(resourceGroupName, vmScaleSetName);
 0968            _pipeline.Send(message, cancellationToken);
 0969            switch (message.Response.Status)
 970            {
 971                case 200:
 972                    {
 0973                        VirtualMachineScaleSetListOSUpgradeHistory value = default;
 0974                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0975                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 976                        {
 0977                            value = null;
 978                        }
 979                        else
 980                        {
 0981                            value = VirtualMachineScaleSetListOSUpgradeHistory.DeserializeVirtualMachineScaleSetListOSUp
 982                        }
 0983                        return Response.FromValue(value, message.Response);
 984                    }
 985                default:
 0986                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 987            }
 0988        }
 989
 990        internal HttpMessage CreatePowerOffRequest(string resourceGroupName, string vmScaleSetName, bool? skipShutdown, 
 991        {
 32992            var message = _pipeline.CreateMessage();
 32993            var request = message.Request;
 32994            request.Method = RequestMethod.Post;
 32995            var uri = new RawRequestUriBuilder();
 32996            uri.Reset(endpoint);
 32997            uri.AppendPath("/subscriptions/", false);
 32998            uri.AppendPath(subscriptionId, true);
 32999            uri.AppendPath("/resourceGroups/", false);
 321000            uri.AppendPath(resourceGroupName, true);
 321001            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 321002            uri.AppendPath(vmScaleSetName, true);
 321003            uri.AppendPath("/poweroff", false);
 321004            if (skipShutdown != null)
 1005            {
 81006                uri.AppendQuery("skipShutdown", skipShutdown.Value, true);
 1007            }
 321008            uri.AppendQuery("api-version", "2019-12-01", true);
 321009            request.Uri = uri;
 321010            request.Headers.Add("Content-Type", "application/json");
 321011            if (vmInstanceIDs != null)
 1012            {
 81013                var content = new Utf8JsonRequestContent();
 81014                content.JsonWriter.WriteObjectValue(vmInstanceIDs);
 81015                request.Content = content;
 1016            }
 321017            return message;
 1018        }
 1019
 1020        /// <summary> Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still att
 1021        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1022        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1023        /// <param name="skipShutdown"> The parameter to request non-graceful VM shutdown. True value for this flag indi
 1024        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1025        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1026        public async Task<Response> PowerOffAsync(string resourceGroupName, string vmScaleSetName, bool? skipShutdown = 
 1027        {
 81028            if (resourceGroupName == null)
 1029            {
 01030                throw new ArgumentNullException(nameof(resourceGroupName));
 1031            }
 81032            if (vmScaleSetName == null)
 1033            {
 01034                throw new ArgumentNullException(nameof(vmScaleSetName));
 1035            }
 1036
 81037            using var message = CreatePowerOffRequest(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs);
 81038            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 81039            switch (message.Response.Status)
 1040            {
 1041                case 200:
 1042                case 202:
 81043                    return message.Response;
 1044                default:
 01045                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1046            }
 81047        }
 1048
 1049        /// <summary> Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still att
 1050        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1051        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1052        /// <param name="skipShutdown"> The parameter to request non-graceful VM shutdown. True value for this flag indi
 1053        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1054        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1055        public Response PowerOff(string resourceGroupName, string vmScaleSetName, bool? skipShutdown = null, VirtualMach
 1056        {
 81057            if (resourceGroupName == null)
 1058            {
 01059                throw new ArgumentNullException(nameof(resourceGroupName));
 1060            }
 81061            if (vmScaleSetName == null)
 1062            {
 01063                throw new ArgumentNullException(nameof(vmScaleSetName));
 1064            }
 1065
 81066            using var message = CreatePowerOffRequest(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs);
 81067            _pipeline.Send(message, cancellationToken);
 81068            switch (message.Response.Status)
 1069            {
 1070                case 200:
 1071                case 202:
 81072                    return message.Response;
 1073                default:
 01074                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1075            }
 81076        }
 1077
 1078        internal HttpMessage CreateRestartRequest(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSe
 1079        {
 241080            var message = _pipeline.CreateMessage();
 241081            var request = message.Request;
 241082            request.Method = RequestMethod.Post;
 241083            var uri = new RawRequestUriBuilder();
 241084            uri.Reset(endpoint);
 241085            uri.AppendPath("/subscriptions/", false);
 241086            uri.AppendPath(subscriptionId, true);
 241087            uri.AppendPath("/resourceGroups/", false);
 241088            uri.AppendPath(resourceGroupName, true);
 241089            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 241090            uri.AppendPath(vmScaleSetName, true);
 241091            uri.AppendPath("/restart", false);
 241092            uri.AppendQuery("api-version", "2019-12-01", true);
 241093            request.Uri = uri;
 241094            request.Headers.Add("Content-Type", "application/json");
 241095            if (vmInstanceIDs != null)
 1096            {
 81097                var content = new Utf8JsonRequestContent();
 81098                content.JsonWriter.WriteObjectValue(vmInstanceIDs);
 81099                request.Content = content;
 1100            }
 241101            return message;
 1102        }
 1103
 1104        /// <summary> Restarts one or more virtual machines in a VM scale set. </summary>
 1105        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1106        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1107        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1108        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1109        public async Task<Response> RestartAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet
 1110        {
 61111            if (resourceGroupName == null)
 1112            {
 01113                throw new ArgumentNullException(nameof(resourceGroupName));
 1114            }
 61115            if (vmScaleSetName == null)
 1116            {
 01117                throw new ArgumentNullException(nameof(vmScaleSetName));
 1118            }
 1119
 61120            using var message = CreateRestartRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 61121            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 61122            switch (message.Response.Status)
 1123            {
 1124                case 200:
 1125                case 202:
 61126                    return message.Response;
 1127                default:
 01128                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1129            }
 61130        }
 1131
 1132        /// <summary> Restarts one or more virtual machines in a VM scale set. </summary>
 1133        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1134        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1135        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1136        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1137        public Response Restart(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmI
 1138        {
 61139            if (resourceGroupName == null)
 1140            {
 01141                throw new ArgumentNullException(nameof(resourceGroupName));
 1142            }
 61143            if (vmScaleSetName == null)
 1144            {
 01145                throw new ArgumentNullException(nameof(vmScaleSetName));
 1146            }
 1147
 61148            using var message = CreateRestartRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 61149            _pipeline.Send(message, cancellationToken);
 61150            switch (message.Response.Status)
 1151            {
 1152                case 200:
 1153                case 202:
 61154                    return message.Response;
 1155                default:
 01156                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1157            }
 61158        }
 1159
 1160        internal HttpMessage CreateStartRequest(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetV
 1161        {
 321162            var message = _pipeline.CreateMessage();
 321163            var request = message.Request;
 321164            request.Method = RequestMethod.Post;
 321165            var uri = new RawRequestUriBuilder();
 321166            uri.Reset(endpoint);
 321167            uri.AppendPath("/subscriptions/", false);
 321168            uri.AppendPath(subscriptionId, true);
 321169            uri.AppendPath("/resourceGroups/", false);
 321170            uri.AppendPath(resourceGroupName, true);
 321171            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 321172            uri.AppendPath(vmScaleSetName, true);
 321173            uri.AppendPath("/start", false);
 321174            uri.AppendQuery("api-version", "2019-12-01", true);
 321175            request.Uri = uri;
 321176            request.Headers.Add("Content-Type", "application/json");
 321177            if (vmInstanceIDs != null)
 1178            {
 81179                var content = new Utf8JsonRequestContent();
 81180                content.JsonWriter.WriteObjectValue(vmInstanceIDs);
 81181                request.Content = content;
 1182            }
 321183            return message;
 1184        }
 1185
 1186        /// <summary> Starts one or more virtual machines in a VM scale set. </summary>
 1187        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1188        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1189        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1190        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1191        public async Task<Response> StartAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetVM
 1192        {
 81193            if (resourceGroupName == null)
 1194            {
 01195                throw new ArgumentNullException(nameof(resourceGroupName));
 1196            }
 81197            if (vmScaleSetName == null)
 1198            {
 01199                throw new ArgumentNullException(nameof(vmScaleSetName));
 1200            }
 1201
 81202            using var message = CreateStartRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 81203            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 81204            switch (message.Response.Status)
 1205            {
 1206                case 200:
 1207                case 202:
 81208                    return message.Response;
 1209                default:
 01210                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1211            }
 81212        }
 1213
 1214        /// <summary> Starts one or more virtual machines in a VM scale set. </summary>
 1215        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1216        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1217        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1218        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1219        public Response Start(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmIns
 1220        {
 81221            if (resourceGroupName == null)
 1222            {
 01223                throw new ArgumentNullException(nameof(resourceGroupName));
 1224            }
 81225            if (vmScaleSetName == null)
 1226            {
 01227                throw new ArgumentNullException(nameof(vmScaleSetName));
 1228            }
 1229
 81230            using var message = CreateStartRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 81231            _pipeline.Send(message, cancellationToken);
 81232            switch (message.Response.Status)
 1233            {
 1234                case 200:
 1235                case 202:
 81236                    return message.Response;
 1237                default:
 01238                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1239            }
 81240        }
 1241
 1242        internal HttpMessage CreateRedeployRequest(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleS
 1243        {
 161244            var message = _pipeline.CreateMessage();
 161245            var request = message.Request;
 161246            request.Method = RequestMethod.Post;
 161247            var uri = new RawRequestUriBuilder();
 161248            uri.Reset(endpoint);
 161249            uri.AppendPath("/subscriptions/", false);
 161250            uri.AppendPath(subscriptionId, true);
 161251            uri.AppendPath("/resourceGroups/", false);
 161252            uri.AppendPath(resourceGroupName, true);
 161253            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 161254            uri.AppendPath(vmScaleSetName, true);
 161255            uri.AppendPath("/redeploy", false);
 161256            uri.AppendQuery("api-version", "2019-12-01", true);
 161257            request.Uri = uri;
 161258            request.Headers.Add("Content-Type", "application/json");
 161259            if (vmInstanceIDs != null)
 1260            {
 81261                var content = new Utf8JsonRequestContent();
 81262                content.JsonWriter.WriteObjectValue(vmInstanceIDs);
 81263                request.Content = content;
 1264            }
 161265            return message;
 1266        }
 1267
 1268        /// <summary> Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, an
 1269        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1270        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1271        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1272        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1273        public async Task<Response> RedeployAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSe
 1274        {
 41275            if (resourceGroupName == null)
 1276            {
 01277                throw new ArgumentNullException(nameof(resourceGroupName));
 1278            }
 41279            if (vmScaleSetName == null)
 1280            {
 01281                throw new ArgumentNullException(nameof(vmScaleSetName));
 1282            }
 1283
 41284            using var message = CreateRedeployRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 41285            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 41286            switch (message.Response.Status)
 1287            {
 1288                case 200:
 1289                case 202:
 41290                    return message.Response;
 1291                default:
 01292                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1293            }
 41294        }
 1295
 1296        /// <summary> Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, an
 1297        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1298        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1299        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1300        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1301        public Response Redeploy(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vm
 1302        {
 41303            if (resourceGroupName == null)
 1304            {
 01305                throw new ArgumentNullException(nameof(resourceGroupName));
 1306            }
 41307            if (vmScaleSetName == null)
 1308            {
 01309                throw new ArgumentNullException(nameof(vmScaleSetName));
 1310            }
 1311
 41312            using var message = CreateRedeployRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 41313            _pipeline.Send(message, cancellationToken);
 41314            switch (message.Response.Status)
 1315            {
 1316                case 200:
 1317                case 202:
 41318                    return message.Response;
 1319                default:
 01320                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1321            }
 41322        }
 1323
 1324        internal HttpMessage CreatePerformMaintenanceRequest(string resourceGroupName, string vmScaleSetName, VirtualMac
 1325        {
 81326            var message = _pipeline.CreateMessage();
 81327            var request = message.Request;
 81328            request.Method = RequestMethod.Post;
 81329            var uri = new RawRequestUriBuilder();
 81330            uri.Reset(endpoint);
 81331            uri.AppendPath("/subscriptions/", false);
 81332            uri.AppendPath(subscriptionId, true);
 81333            uri.AppendPath("/resourceGroups/", false);
 81334            uri.AppendPath(resourceGroupName, true);
 81335            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 81336            uri.AppendPath(vmScaleSetName, true);
 81337            uri.AppendPath("/performMaintenance", false);
 81338            uri.AppendQuery("api-version", "2019-12-01", true);
 81339            request.Uri = uri;
 81340            request.Headers.Add("Content-Type", "application/json");
 81341            if (vmInstanceIDs != null)
 1342            {
 41343                var content = new Utf8JsonRequestContent();
 41344                content.JsonWriter.WriteObjectValue(vmInstanceIDs);
 41345                request.Content = content;
 1346            }
 81347            return message;
 1348        }
 1349
 1350        /// <summary> Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances whic
 1351        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1352        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1353        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1354        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1355        public async Task<Response> PerformMaintenanceAsync(string resourceGroupName, string vmScaleSetName, VirtualMach
 1356        {
 41357            if (resourceGroupName == null)
 1358            {
 01359                throw new ArgumentNullException(nameof(resourceGroupName));
 1360            }
 41361            if (vmScaleSetName == null)
 1362            {
 01363                throw new ArgumentNullException(nameof(vmScaleSetName));
 1364            }
 1365
 41366            using var message = CreatePerformMaintenanceRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 41367            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 41368            switch (message.Response.Status)
 1369            {
 1370                case 200:
 1371                case 202:
 01372                    return message.Response;
 1373                default:
 41374                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1375            }
 01376        }
 1377
 1378        /// <summary> Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances whic
 1379        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1380        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1381        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1382        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1383        public Response PerformMaintenance(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetVMInst
 1384        {
 41385            if (resourceGroupName == null)
 1386            {
 01387                throw new ArgumentNullException(nameof(resourceGroupName));
 1388            }
 41389            if (vmScaleSetName == null)
 1390            {
 01391                throw new ArgumentNullException(nameof(vmScaleSetName));
 1392            }
 1393
 41394            using var message = CreatePerformMaintenanceRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 41395            _pipeline.Send(message, cancellationToken);
 41396            switch (message.Response.Status)
 1397            {
 1398                case 200:
 1399                case 202:
 01400                    return message.Response;
 1401                default:
 41402                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1403            }
 01404        }
 1405
 1406        internal HttpMessage CreateUpdateInstancesRequest(string resourceGroupName, string vmScaleSetName, VirtualMachin
 1407        {
 81408            var message = _pipeline.CreateMessage();
 81409            var request = message.Request;
 81410            request.Method = RequestMethod.Post;
 81411            var uri = new RawRequestUriBuilder();
 81412            uri.Reset(endpoint);
 81413            uri.AppendPath("/subscriptions/", false);
 81414            uri.AppendPath(subscriptionId, true);
 81415            uri.AppendPath("/resourceGroups/", false);
 81416            uri.AppendPath(resourceGroupName, true);
 81417            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 81418            uri.AppendPath(vmScaleSetName, true);
 81419            uri.AppendPath("/manualupgrade", false);
 81420            uri.AppendQuery("api-version", "2019-12-01", true);
 81421            request.Uri = uri;
 81422            request.Headers.Add("Content-Type", "application/json");
 81423            var content = new Utf8JsonRequestContent();
 81424            content.JsonWriter.WriteObjectValue(vmInstanceIDs);
 81425            request.Content = content;
 81426            return message;
 1427        }
 1428
 1429        /// <summary> Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. </summary>
 1430        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1431        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1432        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1433        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1434        public async Task<Response> UpdateInstancesAsync(string resourceGroupName, string vmScaleSetName, VirtualMachine
 1435        {
 21436            if (resourceGroupName == null)
 1437            {
 01438                throw new ArgumentNullException(nameof(resourceGroupName));
 1439            }
 21440            if (vmScaleSetName == null)
 1441            {
 01442                throw new ArgumentNullException(nameof(vmScaleSetName));
 1443            }
 21444            if (vmInstanceIDs == null)
 1445            {
 01446                throw new ArgumentNullException(nameof(vmInstanceIDs));
 1447            }
 1448
 21449            using var message = CreateUpdateInstancesRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 21450            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 21451            switch (message.Response.Status)
 1452            {
 1453                case 200:
 1454                case 202:
 21455                    return message.Response;
 1456                default:
 01457                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1458            }
 21459        }
 1460
 1461        /// <summary> Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. </summary>
 1462        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1463        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1464        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1465        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1466        public Response UpdateInstances(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetVMInstanc
 1467        {
 21468            if (resourceGroupName == null)
 1469            {
 01470                throw new ArgumentNullException(nameof(resourceGroupName));
 1471            }
 21472            if (vmScaleSetName == null)
 1473            {
 01474                throw new ArgumentNullException(nameof(vmScaleSetName));
 1475            }
 21476            if (vmInstanceIDs == null)
 1477            {
 01478                throw new ArgumentNullException(nameof(vmInstanceIDs));
 1479            }
 1480
 21481            using var message = CreateUpdateInstancesRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 21482            _pipeline.Send(message, cancellationToken);
 21483            switch (message.Response.Status)
 1484            {
 1485                case 200:
 1486                case 202:
 21487                    return message.Response;
 1488                default:
 01489                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1490            }
 21491        }
 1492
 1493        internal HttpMessage CreateReimageRequest(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSe
 1494        {
 241495            var message = _pipeline.CreateMessage();
 241496            var request = message.Request;
 241497            request.Method = RequestMethod.Post;
 241498            var uri = new RawRequestUriBuilder();
 241499            uri.Reset(endpoint);
 241500            uri.AppendPath("/subscriptions/", false);
 241501            uri.AppendPath(subscriptionId, true);
 241502            uri.AppendPath("/resourceGroups/", false);
 241503            uri.AppendPath(resourceGroupName, true);
 241504            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 241505            uri.AppendPath(vmScaleSetName, true);
 241506            uri.AppendPath("/reimage", false);
 241507            uri.AppendQuery("api-version", "2019-12-01", true);
 241508            request.Uri = uri;
 241509            request.Headers.Add("Content-Type", "application/json");
 241510            if (vmScaleSetReimageInput != null)
 1511            {
 81512                var content = new Utf8JsonRequestContent();
 81513                content.JsonWriter.WriteObjectValue(vmScaleSetReimageInput);
 81514                request.Content = content;
 1515            }
 241516            return message;
 1517        }
 1518
 1519        /// <summary> Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don&a
 1520        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1521        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1522        /// <param name="vmScaleSetReimageInput"> Parameters for Reimaging VM ScaleSet. </param>
 1523        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1524        public async Task<Response> ReimageAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSet
 1525        {
 61526            if (resourceGroupName == null)
 1527            {
 01528                throw new ArgumentNullException(nameof(resourceGroupName));
 1529            }
 61530            if (vmScaleSetName == null)
 1531            {
 01532                throw new ArgumentNullException(nameof(vmScaleSetName));
 1533            }
 1534
 61535            using var message = CreateReimageRequest(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput);
 61536            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 61537            switch (message.Response.Status)
 1538            {
 1539                case 200:
 1540                case 202:
 61541                    return message.Response;
 1542                default:
 01543                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1544            }
 61545        }
 1546
 1547        /// <summary> Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don&a
 1548        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1549        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1550        /// <param name="vmScaleSetReimageInput"> Parameters for Reimaging VM ScaleSet. </param>
 1551        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1552        public Response Reimage(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetReimageParameters
 1553        {
 61554            if (resourceGroupName == null)
 1555            {
 01556                throw new ArgumentNullException(nameof(resourceGroupName));
 1557            }
 61558            if (vmScaleSetName == null)
 1559            {
 01560                throw new ArgumentNullException(nameof(vmScaleSetName));
 1561            }
 1562
 61563            using var message = CreateReimageRequest(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput);
 61564            _pipeline.Send(message, cancellationToken);
 61565            switch (message.Response.Status)
 1566            {
 1567                case 200:
 1568                case 202:
 61569                    return message.Response;
 1570                default:
 01571                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1572            }
 61573        }
 1574
 1575        internal HttpMessage CreateReimageAllRequest(string resourceGroupName, string vmScaleSetName, VirtualMachineScal
 1576        {
 161577            var message = _pipeline.CreateMessage();
 161578            var request = message.Request;
 161579            request.Method = RequestMethod.Post;
 161580            var uri = new RawRequestUriBuilder();
 161581            uri.Reset(endpoint);
 161582            uri.AppendPath("/subscriptions/", false);
 161583            uri.AppendPath(subscriptionId, true);
 161584            uri.AppendPath("/resourceGroups/", false);
 161585            uri.AppendPath(resourceGroupName, true);
 161586            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 161587            uri.AppendPath(vmScaleSetName, true);
 161588            uri.AppendPath("/reimageall", false);
 161589            uri.AppendQuery("api-version", "2019-12-01", true);
 161590            request.Uri = uri;
 161591            request.Headers.Add("Content-Type", "application/json");
 161592            if (vmInstanceIDs != null)
 1593            {
 81594                var content = new Utf8JsonRequestContent();
 81595                content.JsonWriter.WriteObjectValue(vmInstanceIDs);
 81596                request.Content = content;
 1597            }
 161598            return message;
 1599        }
 1600
 1601        /// <summary> Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This op
 1602        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1603        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1604        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1605        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1606        public async Task<Response> ReimageAllAsync(string resourceGroupName, string vmScaleSetName, VirtualMachineScale
 1607        {
 41608            if (resourceGroupName == null)
 1609            {
 01610                throw new ArgumentNullException(nameof(resourceGroupName));
 1611            }
 41612            if (vmScaleSetName == null)
 1613            {
 01614                throw new ArgumentNullException(nameof(vmScaleSetName));
 1615            }
 1616
 41617            using var message = CreateReimageAllRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 41618            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 41619            switch (message.Response.Status)
 1620            {
 1621                case 200:
 1622                case 202:
 41623                    return message.Response;
 1624                default:
 01625                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1626            }
 41627        }
 1628
 1629        /// <summary> Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This op
 1630        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1631        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1632        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1633        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1634        public Response ReimageAll(string resourceGroupName, string vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs 
 1635        {
 41636            if (resourceGroupName == null)
 1637            {
 01638                throw new ArgumentNullException(nameof(resourceGroupName));
 1639            }
 41640            if (vmScaleSetName == null)
 1641            {
 01642                throw new ArgumentNullException(nameof(vmScaleSetName));
 1643            }
 1644
 41645            using var message = CreateReimageAllRequest(resourceGroupName, vmScaleSetName, vmInstanceIDs);
 41646            _pipeline.Send(message, cancellationToken);
 41647            switch (message.Response.Status)
 1648            {
 1649                case 200:
 1650                case 202:
 41651                    return message.Response;
 1652                default:
 01653                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1654            }
 41655        }
 1656
 1657        internal HttpMessage CreateForceRecoveryServiceFabricPlatformUpdateDomainWalkRequest(string resourceGroupName, s
 1658        {
 01659            var message = _pipeline.CreateMessage();
 01660            var request = message.Request;
 01661            request.Method = RequestMethod.Post;
 01662            var uri = new RawRequestUriBuilder();
 01663            uri.Reset(endpoint);
 01664            uri.AppendPath("/subscriptions/", false);
 01665            uri.AppendPath(subscriptionId, true);
 01666            uri.AppendPath("/resourceGroups/", false);
 01667            uri.AppendPath(resourceGroupName, true);
 01668            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 01669            uri.AppendPath(vmScaleSetName, true);
 01670            uri.AppendPath("/forceRecoveryServiceFabricPlatformUpdateDomainWalk", false);
 01671            uri.AppendQuery("api-version", "2019-12-01", true);
 01672            uri.AppendQuery("platformUpdateDomain", platformUpdateDomain, true);
 01673            request.Uri = uri;
 01674            return message;
 1675        }
 1676
 1677        /// <summary> Manual platform update domain walk to update virtual machines in a service fabric virtual machine 
 1678        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1679        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1680        /// <param name="platformUpdateDomain"> The platform update domain for which a manual recovery walk is requested
 1681        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1682        public async Task<Response<RecoveryWalkResponse>> ForceRecoveryServiceFabricPlatformUpdateDomainWalkAsync(string
 1683        {
 01684            if (resourceGroupName == null)
 1685            {
 01686                throw new ArgumentNullException(nameof(resourceGroupName));
 1687            }
 01688            if (vmScaleSetName == null)
 1689            {
 01690                throw new ArgumentNullException(nameof(vmScaleSetName));
 1691            }
 1692
 01693            using var message = CreateForceRecoveryServiceFabricPlatformUpdateDomainWalkRequest(resourceGroupName, vmSca
 01694            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01695            switch (message.Response.Status)
 1696            {
 1697                case 200:
 1698                    {
 01699                        RecoveryWalkResponse value = default;
 01700                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01701                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1702                        {
 01703                            value = null;
 1704                        }
 1705                        else
 1706                        {
 01707                            value = RecoveryWalkResponse.DeserializeRecoveryWalkResponse(document.RootElement);
 1708                        }
 01709                        return Response.FromValue(value, message.Response);
 1710                    }
 1711                default:
 01712                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1713            }
 01714        }
 1715
 1716        /// <summary> Manual platform update domain walk to update virtual machines in a service fabric virtual machine 
 1717        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1718        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1719        /// <param name="platformUpdateDomain"> The platform update domain for which a manual recovery walk is requested
 1720        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1721        public Response<RecoveryWalkResponse> ForceRecoveryServiceFabricPlatformUpdateDomainWalk(string resourceGroupNam
 1722        {
 01723            if (resourceGroupName == null)
 1724            {
 01725                throw new ArgumentNullException(nameof(resourceGroupName));
 1726            }
 01727            if (vmScaleSetName == null)
 1728            {
 01729                throw new ArgumentNullException(nameof(vmScaleSetName));
 1730            }
 1731
 01732            using var message = CreateForceRecoveryServiceFabricPlatformUpdateDomainWalkRequest(resourceGroupName, vmSca
 01733            _pipeline.Send(message, cancellationToken);
 01734            switch (message.Response.Status)
 1735            {
 1736                case 200:
 1737                    {
 01738                        RecoveryWalkResponse value = default;
 01739                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01740                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1741                        {
 01742                            value = null;
 1743                        }
 1744                        else
 1745                        {
 01746                            value = RecoveryWalkResponse.DeserializeRecoveryWalkResponse(document.RootElement);
 1747                        }
 01748                        return Response.FromValue(value, message.Response);
 1749                    }
 1750                default:
 01751                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1752            }
 01753        }
 1754
 1755        internal HttpMessage CreateConvertToSinglePlacementGroupRequest(string resourceGroupName, string vmScaleSetName,
 1756        {
 01757            var message = _pipeline.CreateMessage();
 01758            var request = message.Request;
 01759            request.Method = RequestMethod.Post;
 01760            var uri = new RawRequestUriBuilder();
 01761            uri.Reset(endpoint);
 01762            uri.AppendPath("/subscriptions/", false);
 01763            uri.AppendPath(subscriptionId, true);
 01764            uri.AppendPath("/resourceGroups/", false);
 01765            uri.AppendPath(resourceGroupName, true);
 01766            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 01767            uri.AppendPath(vmScaleSetName, true);
 01768            uri.AppendPath("/convertToSinglePlacementGroup", false);
 01769            request.Uri = uri;
 01770            request.Headers.Add("Content-Type", "application/json");
 01771            var content = new Utf8JsonRequestContent();
 01772            content.JsonWriter.WriteObjectValue(parameters);
 01773            request.Content = content;
 01774            return message;
 1775        }
 1776
 1777        /// <summary> Converts SinglePlacementGroup property to false for a existing virtual machine scale set. </summar
 1778        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1779        /// <param name="vmScaleSetName"> The name of the virtual machine scale set to create or update. </param>
 1780        /// <param name="parameters"> The input object for ConvertToSinglePlacementGroup API. </param>
 1781        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1782        public async Task<Response> ConvertToSinglePlacementGroupAsync(string resourceGroupName, string vmScaleSetName, 
 1783        {
 01784            if (resourceGroupName == null)
 1785            {
 01786                throw new ArgumentNullException(nameof(resourceGroupName));
 1787            }
 01788            if (vmScaleSetName == null)
 1789            {
 01790                throw new ArgumentNullException(nameof(vmScaleSetName));
 1791            }
 01792            if (parameters == null)
 1793            {
 01794                throw new ArgumentNullException(nameof(parameters));
 1795            }
 1796
 01797            using var message = CreateConvertToSinglePlacementGroupRequest(resourceGroupName, vmScaleSetName, parameters
 01798            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01799            switch (message.Response.Status)
 1800            {
 1801                case 200:
 01802                    return message.Response;
 1803                default:
 01804                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1805            }
 01806        }
 1807
 1808        /// <summary> Converts SinglePlacementGroup property to false for a existing virtual machine scale set. </summar
 1809        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1810        /// <param name="vmScaleSetName"> The name of the virtual machine scale set to create or update. </param>
 1811        /// <param name="parameters"> The input object for ConvertToSinglePlacementGroup API. </param>
 1812        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1813        public Response ConvertToSinglePlacementGroup(string resourceGroupName, string vmScaleSetName, VMScaleSetConvert
 1814        {
 01815            if (resourceGroupName == null)
 1816            {
 01817                throw new ArgumentNullException(nameof(resourceGroupName));
 1818            }
 01819            if (vmScaleSetName == null)
 1820            {
 01821                throw new ArgumentNullException(nameof(vmScaleSetName));
 1822            }
 01823            if (parameters == null)
 1824            {
 01825                throw new ArgumentNullException(nameof(parameters));
 1826            }
 1827
 01828            using var message = CreateConvertToSinglePlacementGroupRequest(resourceGroupName, vmScaleSetName, parameters
 01829            _pipeline.Send(message, cancellationToken);
 01830            switch (message.Response.Status)
 1831            {
 1832                case 200:
 01833                    return message.Response;
 1834                default:
 01835                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1836            }
 01837        }
 1838
 1839        internal HttpMessage CreateSetOrchestrationServiceStateRequest(string resourceGroupName, string vmScaleSetName, 
 1840        {
 161841            var message = _pipeline.CreateMessage();
 161842            var request = message.Request;
 161843            request.Method = RequestMethod.Post;
 161844            var uri = new RawRequestUriBuilder();
 161845            uri.Reset(endpoint);
 161846            uri.AppendPath("/subscriptions/", false);
 161847            uri.AppendPath(subscriptionId, true);
 161848            uri.AppendPath("/resourceGroups/", false);
 161849            uri.AppendPath(resourceGroupName, true);
 161850            uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false);
 161851            uri.AppendPath(vmScaleSetName, true);
 161852            uri.AppendPath("/setOrchestrationServiceState", false);
 161853            uri.AppendQuery("api-version", "2019-12-01", true);
 161854            request.Uri = uri;
 161855            request.Headers.Add("Content-Type", "application/json");
 161856            var content = new Utf8JsonRequestContent();
 161857            content.JsonWriter.WriteObjectValue(parameters);
 161858            request.Content = content;
 161859            return message;
 1860        }
 1861
 1862        /// <summary> Changes ServiceState property for a given service. </summary>
 1863        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1864        /// <param name="vmScaleSetName"> The name of the virtual machine scale set to create or update. </param>
 1865        /// <param name="parameters"> The input object for SetOrchestrationServiceState API. </param>
 1866        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1867        public async Task<Response> SetOrchestrationServiceStateAsync(string resourceGroupName, string vmScaleSetName, O
 1868        {
 41869            if (resourceGroupName == null)
 1870            {
 01871                throw new ArgumentNullException(nameof(resourceGroupName));
 1872            }
 41873            if (vmScaleSetName == null)
 1874            {
 01875                throw new ArgumentNullException(nameof(vmScaleSetName));
 1876            }
 41877            if (parameters == null)
 1878            {
 01879                throw new ArgumentNullException(nameof(parameters));
 1880            }
 1881
 41882            using var message = CreateSetOrchestrationServiceStateRequest(resourceGroupName, vmScaleSetName, parameters)
 41883            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 41884            switch (message.Response.Status)
 1885            {
 1886                case 200:
 1887                case 202:
 41888                    return message.Response;
 1889                default:
 01890                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1891            }
 41892        }
 1893
 1894        /// <summary> Changes ServiceState property for a given service. </summary>
 1895        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1896        /// <param name="vmScaleSetName"> The name of the virtual machine scale set to create or update. </param>
 1897        /// <param name="parameters"> The input object for SetOrchestrationServiceState API. </param>
 1898        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1899        public Response SetOrchestrationServiceState(string resourceGroupName, string vmScaleSetName, OrchestrationServi
 1900        {
 41901            if (resourceGroupName == null)
 1902            {
 01903                throw new ArgumentNullException(nameof(resourceGroupName));
 1904            }
 41905            if (vmScaleSetName == null)
 1906            {
 01907                throw new ArgumentNullException(nameof(vmScaleSetName));
 1908            }
 41909            if (parameters == null)
 1910            {
 01911                throw new ArgumentNullException(nameof(parameters));
 1912            }
 1913
 41914            using var message = CreateSetOrchestrationServiceStateRequest(resourceGroupName, vmScaleSetName, parameters)
 41915            _pipeline.Send(message, cancellationToken);
 41916            switch (message.Response.Status)
 1917            {
 1918                case 200:
 1919                case 202:
 41920                    return message.Response;
 1921                default:
 01922                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1923            }
 41924        }
 1925
 1926        internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName)
 1927        {
 01928            var message = _pipeline.CreateMessage();
 01929            var request = message.Request;
 01930            request.Method = RequestMethod.Get;
 01931            var uri = new RawRequestUriBuilder();
 01932            uri.Reset(endpoint);
 01933            uri.AppendRawNextLink(nextLink, false);
 01934            request.Uri = uri;
 01935            return message;
 1936        }
 1937
 1938        /// <summary> Gets a list of all VM scale sets under a resource group. </summary>
 1939        /// <param name="nextLink"> The URL to the next page of results. </param>
 1940        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1941        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1942        public async Task<Response<VirtualMachineScaleSetListResult>> ListNextPageAsync(string nextLink, string resource
 1943        {
 01944            if (nextLink == null)
 1945            {
 01946                throw new ArgumentNullException(nameof(nextLink));
 1947            }
 01948            if (resourceGroupName == null)
 1949            {
 01950                throw new ArgumentNullException(nameof(resourceGroupName));
 1951            }
 1952
 01953            using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
 01954            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01955            switch (message.Response.Status)
 1956            {
 1957                case 200:
 1958                    {
 01959                        VirtualMachineScaleSetListResult value = default;
 01960                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01961                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1962                        {
 01963                            value = null;
 1964                        }
 1965                        else
 1966                        {
 01967                            value = VirtualMachineScaleSetListResult.DeserializeVirtualMachineScaleSetListResult(documen
 1968                        }
 01969                        return Response.FromValue(value, message.Response);
 1970                    }
 1971                default:
 01972                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1973            }
 01974        }
 1975
 1976        /// <summary> Gets a list of all VM scale sets under a resource group. </summary>
 1977        /// <param name="nextLink"> The URL to the next page of results. </param>
 1978        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1979        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1980        public Response<VirtualMachineScaleSetListResult> ListNextPage(string nextLink, string resourceGroupName, Cancel
 1981        {
 01982            if (nextLink == null)
 1983            {
 01984                throw new ArgumentNullException(nameof(nextLink));
 1985            }
 01986            if (resourceGroupName == null)
 1987            {
 01988                throw new ArgumentNullException(nameof(resourceGroupName));
 1989            }
 1990
 01991            using var message = CreateListNextPageRequest(nextLink, resourceGroupName);
 01992            _pipeline.Send(message, cancellationToken);
 01993            switch (message.Response.Status)
 1994            {
 1995                case 200:
 1996                    {
 01997                        VirtualMachineScaleSetListResult value = default;
 01998                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01999                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 2000                        {
 02001                            value = null;
 2002                        }
 2003                        else
 2004                        {
 02005                            value = VirtualMachineScaleSetListResult.DeserializeVirtualMachineScaleSetListResult(documen
 2006                        }
 02007                        return Response.FromValue(value, message.Response);
 2008                    }
 2009                default:
 02010                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 2011            }
 02012        }
 2013
 2014        internal HttpMessage CreateListAllNextPageRequest(string nextLink)
 2015        {
 02016            var message = _pipeline.CreateMessage();
 02017            var request = message.Request;
 02018            request.Method = RequestMethod.Get;
 02019            var uri = new RawRequestUriBuilder();
 02020            uri.Reset(endpoint);
 02021            uri.AppendRawNextLink(nextLink, false);
 02022            request.Uri = uri;
 02023            return message;
 2024        }
 2025
 2026        /// <summary> Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group.
 2027        /// <param name="nextLink"> The URL to the next page of results. </param>
 2028        /// <param name="cancellationToken"> The cancellation token to use. </param>
 2029        public async Task<Response<VirtualMachineScaleSetListWithLinkResult>> ListAllNextPageAsync(string nextLink, Canc
 2030        {
 02031            if (nextLink == null)
 2032            {
 02033                throw new ArgumentNullException(nameof(nextLink));
 2034            }
 2035
 02036            using var message = CreateListAllNextPageRequest(nextLink);
 02037            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 02038            switch (message.Response.Status)
 2039            {
 2040                case 200:
 2041                    {
 02042                        VirtualMachineScaleSetListWithLinkResult value = default;
 02043                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 02044                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 2045                        {
 02046                            value = null;
 2047                        }
 2048                        else
 2049                        {
 02050                            value = VirtualMachineScaleSetListWithLinkResult.DeserializeVirtualMachineScaleSetListWithLi
 2051                        }
 02052                        return Response.FromValue(value, message.Response);
 2053                    }
 2054                default:
 02055                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 2056            }
 02057        }
 2058
 2059        /// <summary> Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group.
 2060        /// <param name="nextLink"> The URL to the next page of results. </param>
 2061        /// <param name="cancellationToken"> The cancellation token to use. </param>
 2062        public Response<VirtualMachineScaleSetListWithLinkResult> ListAllNextPage(string nextLink, CancellationToken can
 2063        {
 02064            if (nextLink == null)
 2065            {
 02066                throw new ArgumentNullException(nameof(nextLink));
 2067            }
 2068
 02069            using var message = CreateListAllNextPageRequest(nextLink);
 02070            _pipeline.Send(message, cancellationToken);
 02071            switch (message.Response.Status)
 2072            {
 2073                case 200:
 2074                    {
 02075                        VirtualMachineScaleSetListWithLinkResult value = default;
 02076                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 02077                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 2078                        {
 02079                            value = null;
 2080                        }
 2081                        else
 2082                        {
 02083                            value = VirtualMachineScaleSetListWithLinkResult.DeserializeVirtualMachineScaleSetListWithLi
 2084                        }
 02085                        return Response.FromValue(value, message.Response);
 2086                    }
 2087                default:
 02088                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 2089            }
 02090        }
 2091
 2092        internal HttpMessage CreateListSkusNextPageRequest(string nextLink, string resourceGroupName, string vmScaleSetN
 2093        {
 02094            var message = _pipeline.CreateMessage();
 02095            var request = message.Request;
 02096            request.Method = RequestMethod.Get;
 02097            var uri = new RawRequestUriBuilder();
 02098            uri.Reset(endpoint);
 02099            uri.AppendRawNextLink(nextLink, false);
 02100            request.Uri = uri;
 02101            return message;
 2102        }
 2103
 2104        /// <summary> Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instance
 2105        /// <param name="nextLink"> The URL to the next page of results. </param>
 2106        /// <param name="resourceGroupName"> The name of the resource group. </param>
 2107        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 2108        /// <param name="cancellationToken"> The cancellation token to use. </param>
 2109        public async Task<Response<VirtualMachineScaleSetListSkusResult>> ListSkusNextPageAsync(string nextLink, string 
 2110        {
 02111            if (nextLink == null)
 2112            {
 02113                throw new ArgumentNullException(nameof(nextLink));
 2114            }
 02115            if (resourceGroupName == null)
 2116            {
 02117                throw new ArgumentNullException(nameof(resourceGroupName));
 2118            }
 02119            if (vmScaleSetName == null)
 2120            {
 02121                throw new ArgumentNullException(nameof(vmScaleSetName));
 2122            }
 2123
 02124            using var message = CreateListSkusNextPageRequest(nextLink, resourceGroupName, vmScaleSetName);
 02125            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 02126            switch (message.Response.Status)
 2127            {
 2128                case 200:
 2129                    {
 02130                        VirtualMachineScaleSetListSkusResult value = default;
 02131                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 02132                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 2133                        {
 02134                            value = null;
 2135                        }
 2136                        else
 2137                        {
 02138                            value = VirtualMachineScaleSetListSkusResult.DeserializeVirtualMachineScaleSetListSkusResult
 2139                        }
 02140                        return Response.FromValue(value, message.Response);
 2141                    }
 2142                default:
 02143                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 2144            }
 02145        }
 2146
 2147        /// <summary> Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instance
 2148        /// <param name="nextLink"> The URL to the next page of results. </param>
 2149        /// <param name="resourceGroupName"> The name of the resource group. </param>
 2150        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 2151        /// <param name="cancellationToken"> The cancellation token to use. </param>
 2152        public Response<VirtualMachineScaleSetListSkusResult> ListSkusNextPage(string nextLink, string resourceGroupName
 2153        {
 02154            if (nextLink == null)
 2155            {
 02156                throw new ArgumentNullException(nameof(nextLink));
 2157            }
 02158            if (resourceGroupName == null)
 2159            {
 02160                throw new ArgumentNullException(nameof(resourceGroupName));
 2161            }
 02162            if (vmScaleSetName == null)
 2163            {
 02164                throw new ArgumentNullException(nameof(vmScaleSetName));
 2165            }
 2166
 02167            using var message = CreateListSkusNextPageRequest(nextLink, resourceGroupName, vmScaleSetName);
 02168            _pipeline.Send(message, cancellationToken);
 02169            switch (message.Response.Status)
 2170            {
 2171                case 200:
 2172                    {
 02173                        VirtualMachineScaleSetListSkusResult value = default;
 02174                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 02175                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 2176                        {
 02177                            value = null;
 2178                        }
 2179                        else
 2180                        {
 02181                            value = VirtualMachineScaleSetListSkusResult.DeserializeVirtualMachineScaleSetListSkusResult
 2182                        }
 02183                        return Response.FromValue(value, message.Response);
 2184                    }
 2185                default:
 02186                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 2187            }
 02188        }
 2189
 2190        internal HttpMessage CreateGetOSUpgradeHistoryNextPageRequest(string nextLink, string resourceGroupName, string 
 2191        {
 02192            var message = _pipeline.CreateMessage();
 02193            var request = message.Request;
 02194            request.Method = RequestMethod.Get;
 02195            var uri = new RawRequestUriBuilder();
 02196            uri.Reset(endpoint);
 02197            uri.AppendRawNextLink(nextLink, false);
 02198            request.Uri = uri;
 02199            return message;
 2200        }
 2201
 2202        /// <summary> Gets list of OS upgrades on a VM scale set instance. </summary>
 2203        /// <param name="nextLink"> The URL to the next page of results. </param>
 2204        /// <param name="resourceGroupName"> The name of the resource group. </param>
 2205        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 2206        /// <param name="cancellationToken"> The cancellation token to use. </param>
 2207        public async Task<Response<VirtualMachineScaleSetListOSUpgradeHistory>> GetOSUpgradeHistoryNextPageAsync(string 
 2208        {
 02209            if (nextLink == null)
 2210            {
 02211                throw new ArgumentNullException(nameof(nextLink));
 2212            }
 02213            if (resourceGroupName == null)
 2214            {
 02215                throw new ArgumentNullException(nameof(resourceGroupName));
 2216            }
 02217            if (vmScaleSetName == null)
 2218            {
 02219                throw new ArgumentNullException(nameof(vmScaleSetName));
 2220            }
 2221
 02222            using var message = CreateGetOSUpgradeHistoryNextPageRequest(nextLink, resourceGroupName, vmScaleSetName);
 02223            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 02224            switch (message.Response.Status)
 2225            {
 2226                case 200:
 2227                    {
 02228                        VirtualMachineScaleSetListOSUpgradeHistory value = default;
 02229                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 02230                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 2231                        {
 02232                            value = null;
 2233                        }
 2234                        else
 2235                        {
 02236                            value = VirtualMachineScaleSetListOSUpgradeHistory.DeserializeVirtualMachineScaleSetListOSUp
 2237                        }
 02238                        return Response.FromValue(value, message.Response);
 2239                    }
 2240                default:
 02241                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 2242            }
 02243        }
 2244
 2245        /// <summary> Gets list of OS upgrades on a VM scale set instance. </summary>
 2246        /// <param name="nextLink"> The URL to the next page of results. </param>
 2247        /// <param name="resourceGroupName"> The name of the resource group. </param>
 2248        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 2249        /// <param name="cancellationToken"> The cancellation token to use. </param>
 2250        public Response<VirtualMachineScaleSetListOSUpgradeHistory> GetOSUpgradeHistoryNextPage(string nextLink, string 
 2251        {
 02252            if (nextLink == null)
 2253            {
 02254                throw new ArgumentNullException(nameof(nextLink));
 2255            }
 02256            if (resourceGroupName == null)
 2257            {
 02258                throw new ArgumentNullException(nameof(resourceGroupName));
 2259            }
 02260            if (vmScaleSetName == null)
 2261            {
 02262                throw new ArgumentNullException(nameof(vmScaleSetName));
 2263            }
 2264
 02265            using var message = CreateGetOSUpgradeHistoryNextPageRequest(nextLink, resourceGroupName, vmScaleSetName);
 02266            _pipeline.Send(message, cancellationToken);
 02267            switch (message.Response.Status)
 2268            {
 2269                case 200:
 2270                    {
 02271                        VirtualMachineScaleSetListOSUpgradeHistory value = default;
 02272                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 02273                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 2274                        {
 02275                            value = null;
 2276                        }
 2277                        else
 2278                        {
 02279                            value = VirtualMachineScaleSetListOSUpgradeHistory.DeserializeVirtualMachineScaleSetListOSUp
 2280                        }
 02281                        return Response.FromValue(value, message.Response);
 2282                    }
 2283                default:
 02284                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 2285            }
 02286        }
 2287    }
 2288}

Methods/Properties

.ctor(...)
CreateCreateOrUpdateRequest(...)
CreateOrUpdateAsync()
CreateOrUpdate(...)
CreateUpdateRequest(...)
UpdateAsync()
Update(...)
CreateDeleteRequest(...)
DeleteAsync()
Delete(...)
CreateGetRequest(...)
GetAsync()
Get(...)
CreateDeallocateRequest(...)
DeallocateAsync()
Deallocate(...)
CreateDeleteInstancesRequest(...)
DeleteInstancesAsync()
DeleteInstances(...)
CreateGetInstanceViewRequest(...)
GetInstanceViewAsync()
GetInstanceView(...)
CreateListRequest(...)
ListAsync()
List(...)
CreateListAllRequest()
ListAllAsync()
ListAll(...)
CreateListSkusRequest(...)
ListSkusAsync()
ListSkus(...)
CreateGetOSUpgradeHistoryRequest(...)
GetOSUpgradeHistoryAsync()
GetOSUpgradeHistory(...)
CreatePowerOffRequest(...)
PowerOffAsync()
PowerOff(...)
CreateRestartRequest(...)
RestartAsync()
Restart(...)
CreateStartRequest(...)
StartAsync()
Start(...)
CreateRedeployRequest(...)
RedeployAsync()
Redeploy(...)
CreatePerformMaintenanceRequest(...)
PerformMaintenanceAsync()
PerformMaintenance(...)
CreateUpdateInstancesRequest(...)
UpdateInstancesAsync()
UpdateInstances(...)
CreateReimageRequest(...)
ReimageAsync()
Reimage(...)
CreateReimageAllRequest(...)
ReimageAllAsync()
ReimageAll(...)
CreateForceRecoveryServiceFabricPlatformUpdateDomainWalkRequest(...)
ForceRecoveryServiceFabricPlatformUpdateDomainWalkAsync()
ForceRecoveryServiceFabricPlatformUpdateDomainWalk(...)
CreateConvertToSinglePlacementGroupRequest(...)
ConvertToSinglePlacementGroupAsync()
ConvertToSinglePlacementGroup(...)
CreateSetOrchestrationServiceStateRequest(...)
SetOrchestrationServiceStateAsync()
SetOrchestrationServiceState(...)
CreateListNextPageRequest(...)
ListNextPageAsync()
ListNextPage(...)
CreateListAllNextPageRequest(...)
ListAllNextPageAsync()
ListAllNextPage(...)
CreateListSkusNextPageRequest(...)
ListSkusNextPageAsync()
ListSkusNextPage(...)
CreateGetOSUpgradeHistoryNextPageRequest(...)
GetOSUpgradeHistoryNextPageAsync()
GetOSUpgradeHistoryNextPage(...)