< Summary

Class:Azure.ResourceManager.Compute.VirtualMachineScaleSetsOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineScaleSetsOperations.cs
Covered lines:252
Uncovered lines:324
Coverable lines:576
Total lines:1428
Line coverage:43.7% (252 of 576)
Covered branches:66
Total branches:152
Branch coverage:43.4% (66 of 152)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
GetAsync()-57.14%100%
Get(...)-57.14%100%
GetInstanceViewAsync()-57.14%100%
GetInstanceView(...)-57.14%100%
ForceRecoveryServiceFabricPlatformUpdateDomainWalkAsync()-0%100%
ForceRecoveryServiceFabricPlatformUpdateDomainWalk(...)-0%100%
ConvertToSinglePlacementGroupAsync()-0%100%
ConvertToSinglePlacementGroup(...)-0%100%
ListAsync(...)-36.84%50%
<ListAsync()-62.5%100%
<ListAsync()-0%100%
List(...)-36.84%50%
<ListAllAsync()-0%100%
<ListAllAsync()-0%100%
ListAllAsync(...)-0%100%
ListAll(...)-0%100%
ListSkusAsync(...)-38.1%50%
<ListSkusAsync()-62.5%100%
<ListSkusAsync()-0%100%
ListSkus(...)-38.1%50%
GetOSUpgradeHistoryAsync(...)-0%0%
<GetOSUpgradeHistoryAsync()-0%100%
<GetOSUpgradeHistoryAsync()-0%100%
GetOSUpgradeHistory(...)-0%0%
StartCreateOrUpdateAsync()-78.57%50%
StartCreateOrUpdate(...)-78.57%50%
StartUpdateAsync()-0%0%
StartUpdate(...)-0%0%
StartDeleteAsync()-58.33%50%
StartDelete(...)-58.33%50%
StartDeallocateAsync()-58.33%50%
StartDeallocate(...)-58.33%50%
StartDeleteInstancesAsync()-57.14%50%
StartDeleteInstances(...)-57.14%50%
StartPowerOffAsync()-58.33%50%
StartPowerOff(...)-58.33%50%
StartRestartAsync()-58.33%50%
StartRestart(...)-58.33%50%
StartStartAsync()-58.33%50%
StartStart(...)-58.33%50%
StartRedeployAsync()-58.33%50%
StartRedeploy(...)-58.33%50%
StartPerformMaintenanceAsync()-66.67%50%
StartPerformMaintenance(...)-66.67%50%
StartUpdateInstancesAsync()-57.14%50%
StartUpdateInstances(...)-57.14%50%
StartReimageAsync()-58.33%50%
StartReimage(...)-58.33%50%
StartReimageAllAsync()-58.33%50%
StartReimageAll(...)-58.33%50%
StartSetOrchestrationServiceStateAsync()-57.14%50%
StartSetOrchestrationServiceState(...)-57.14%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\VirtualMachineScaleSetsOperations.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.Threading;
 10using System.Threading.Tasks;
 11using Azure;
 12using Azure.Core;
 13using Azure.Core.Pipeline;
 14using Azure.ResourceManager.Compute.Models;
 15
 16namespace Azure.ResourceManager.Compute
 17{
 18    /// <summary> The VirtualMachineScaleSets service client. </summary>
 19    public partial class VirtualMachineScaleSetsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 119623        internal VirtualMachineScaleSetsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of VirtualMachineScaleSetsOperations for mocking. </summary>
 39625        protected VirtualMachineScaleSetsOperations()
 26        {
 39627        }
 28        /// <summary> Initializes a new instance of VirtualMachineScaleSetsOperations. </summary>
 29        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 30        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 31        /// <param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription.
 32        /// <param name="endpoint"> server parameter. </param>
 39633        internal VirtualMachineScaleSetsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string su
 34        {
 39635            RestClient = new VirtualMachineScaleSetsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint
 39636            _clientDiagnostics = clientDiagnostics;
 39637            _pipeline = pipeline;
 39638        }
 39
 40        /// <summary> Display information about a virtual machine scale set. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual async Task<Response<VirtualMachineScaleSet>> GetAsync(string resourceGroupName, string vmScaleSet
 45        {
 11046            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.Get");
 11047            scope.Start();
 48            try
 49            {
 11050                return await RestClient.GetAsync(resourceGroupName, vmScaleSetName, cancellationToken).ConfigureAwait(fa
 51            }
 052            catch (Exception e)
 53            {
 054                scope.Failed(e);
 055                throw;
 56            }
 11057        }
 58
 59        /// <summary> Display information about a virtual machine scale set. </summary>
 60        /// <param name="resourceGroupName"> The name of the resource group. </param>
 61        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public virtual Response<VirtualMachineScaleSet> Get(string resourceGroupName, string vmScaleSetName, Cancellatio
 64        {
 11065            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.Get");
 11066            scope.Start();
 67            try
 68            {
 11069                return RestClient.Get(resourceGroupName, vmScaleSetName, cancellationToken);
 70            }
 071            catch (Exception e)
 72            {
 073                scope.Failed(e);
 074                throw;
 75            }
 11076        }
 77
 78        /// <summary> Gets the status of a VM scale set instance. </summary>
 79        /// <param name="resourceGroupName"> The name of the resource group. </param>
 80        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 81        /// <param name="cancellationToken"> The cancellation token to use. </param>
 82        public virtual async Task<Response<VirtualMachineScaleSetInstanceView>> GetInstanceViewAsync(string resourceGrou
 83        {
 3084            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.GetInstanceView");
 3085            scope.Start();
 86            try
 87            {
 3088                return await RestClient.GetInstanceViewAsync(resourceGroupName, vmScaleSetName, cancellationToken).Confi
 89            }
 090            catch (Exception e)
 91            {
 092                scope.Failed(e);
 093                throw;
 94            }
 3095        }
 96
 97        /// <summary> Gets the status of a VM scale set instance. </summary>
 98        /// <param name="resourceGroupName"> The name of the resource group. </param>
 99        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 100        /// <param name="cancellationToken"> The cancellation token to use. </param>
 101        public virtual Response<VirtualMachineScaleSetInstanceView> GetInstanceView(string resourceGroupName, string vmS
 102        {
 30103            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.GetInstanceView");
 30104            scope.Start();
 105            try
 106            {
 30107                return RestClient.GetInstanceView(resourceGroupName, vmScaleSetName, cancellationToken);
 108            }
 0109            catch (Exception e)
 110            {
 0111                scope.Failed(e);
 0112                throw;
 113            }
 30114        }
 115
 116        /// <summary> Manual platform update domain walk to update virtual machines in a service fabric virtual machine 
 117        /// <param name="resourceGroupName"> The name of the resource group. </param>
 118        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 119        /// <param name="platformUpdateDomain"> The platform update domain for which a manual recovery walk is requested
 120        /// <param name="cancellationToken"> The cancellation token to use. </param>
 121        public virtual async Task<Response<RecoveryWalkResponse>> ForceRecoveryServiceFabricPlatformUpdateDomainWalkAsyn
 122        {
 0123            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ForceRecoveryServiceFabr
 0124            scope.Start();
 125            try
 126            {
 0127                return await RestClient.ForceRecoveryServiceFabricPlatformUpdateDomainWalkAsync(resourceGroupName, vmSca
 128            }
 0129            catch (Exception e)
 130            {
 0131                scope.Failed(e);
 0132                throw;
 133            }
 0134        }
 135
 136        /// <summary> Manual platform update domain walk to update virtual machines in a service fabric virtual machine 
 137        /// <param name="resourceGroupName"> The name of the resource group. </param>
 138        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 139        /// <param name="platformUpdateDomain"> The platform update domain for which a manual recovery walk is requested
 140        /// <param name="cancellationToken"> The cancellation token to use. </param>
 141        public virtual Response<RecoveryWalkResponse> ForceRecoveryServiceFabricPlatformUpdateDomainWalk(string resource
 142        {
 0143            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ForceRecoveryServiceFabr
 0144            scope.Start();
 145            try
 146            {
 0147                return RestClient.ForceRecoveryServiceFabricPlatformUpdateDomainWalk(resourceGroupName, vmScaleSetName, 
 148            }
 0149            catch (Exception e)
 150            {
 0151                scope.Failed(e);
 0152                throw;
 153            }
 0154        }
 155
 156        /// <summary> Converts SinglePlacementGroup property to false for a existing virtual machine scale set. </summar
 157        /// <param name="resourceGroupName"> The name of the resource group. </param>
 158        /// <param name="vmScaleSetName"> The name of the virtual machine scale set to create or update. </param>
 159        /// <param name="parameters"> The input object for ConvertToSinglePlacementGroup API. </param>
 160        /// <param name="cancellationToken"> The cancellation token to use. </param>
 161        public virtual async Task<Response> ConvertToSinglePlacementGroupAsync(string resourceGroupName, string vmScaleS
 162        {
 0163            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ConvertToSinglePlacement
 0164            scope.Start();
 165            try
 166            {
 0167                return await RestClient.ConvertToSinglePlacementGroupAsync(resourceGroupName, vmScaleSetName, parameters
 168            }
 0169            catch (Exception e)
 170            {
 0171                scope.Failed(e);
 0172                throw;
 173            }
 0174        }
 175
 176        /// <summary> Converts SinglePlacementGroup property to false for a existing virtual machine scale set. </summar
 177        /// <param name="resourceGroupName"> The name of the resource group. </param>
 178        /// <param name="vmScaleSetName"> The name of the virtual machine scale set to create or update. </param>
 179        /// <param name="parameters"> The input object for ConvertToSinglePlacementGroup API. </param>
 180        /// <param name="cancellationToken"> The cancellation token to use. </param>
 181        public virtual Response ConvertToSinglePlacementGroup(string resourceGroupName, string vmScaleSetName, VMScaleSe
 182        {
 0183            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ConvertToSinglePlacement
 0184            scope.Start();
 185            try
 186            {
 0187                return RestClient.ConvertToSinglePlacementGroup(resourceGroupName, vmScaleSetName, parameters, cancellat
 188            }
 0189            catch (Exception e)
 190            {
 0191                scope.Failed(e);
 0192                throw;
 193            }
 0194        }
 195
 196        /// <summary> Gets a list of all VM scale sets under a resource group. </summary>
 197        /// <param name="resourceGroupName"> The name of the resource group. </param>
 198        /// <param name="cancellationToken"> The cancellation token to use. </param>
 199        public virtual AsyncPageable<VirtualMachineScaleSet> ListAsync(string resourceGroupName, CancellationToken cance
 200        {
 24201            if (resourceGroupName == null)
 202            {
 0203                throw new ArgumentNullException(nameof(resourceGroupName));
 204            }
 205
 206            async Task<Page<VirtualMachineScaleSet>> FirstPageFunc(int? pageSizeHint)
 207            {
 24208                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.List");
 24209                scope.Start();
 210                try
 211                {
 24212                    var response = await RestClient.ListAsync(resourceGroupName, cancellationToken).ConfigureAwait(false
 24213                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 214                }
 0215                catch (Exception e)
 216                {
 0217                    scope.Failed(e);
 0218                    throw;
 219                }
 24220            }
 221            async Task<Page<VirtualMachineScaleSet>> NextPageFunc(string nextLink, int? pageSizeHint)
 222            {
 0223                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.List");
 0224                scope.Start();
 225                try
 226                {
 0227                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, cancellationToken).Co
 0228                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 229                }
 0230                catch (Exception e)
 231                {
 0232                    scope.Failed(e);
 0233                    throw;
 234                }
 0235            }
 24236            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 237        }
 238
 239        /// <summary> Gets a list of all VM scale sets under a resource group. </summary>
 240        /// <param name="resourceGroupName"> The name of the resource group. </param>
 241        /// <param name="cancellationToken"> The cancellation token to use. </param>
 242        public virtual Pageable<VirtualMachineScaleSet> List(string resourceGroupName, CancellationToken cancellationTok
 243        {
 24244            if (resourceGroupName == null)
 245            {
 0246                throw new ArgumentNullException(nameof(resourceGroupName));
 247            }
 248
 249            Page<VirtualMachineScaleSet> FirstPageFunc(int? pageSizeHint)
 250            {
 24251                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.List");
 24252                scope.Start();
 253                try
 254                {
 24255                    var response = RestClient.List(resourceGroupName, cancellationToken);
 24256                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 257                }
 0258                catch (Exception e)
 259                {
 0260                    scope.Failed(e);
 0261                    throw;
 262                }
 24263            }
 264            Page<VirtualMachineScaleSet> NextPageFunc(string nextLink, int? pageSizeHint)
 265            {
 0266                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.List");
 0267                scope.Start();
 268                try
 269                {
 0270                    var response = RestClient.ListNextPage(nextLink, resourceGroupName, cancellationToken);
 0271                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 272                }
 0273                catch (Exception e)
 274                {
 0275                    scope.Failed(e);
 0276                    throw;
 277                }
 0278            }
 24279            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 280        }
 281
 282        /// <summary> Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group.
 283        /// <param name="cancellationToken"> The cancellation token to use. </param>
 284        public virtual AsyncPageable<VirtualMachineScaleSet> ListAllAsync(CancellationToken cancellationToken = default)
 285        {
 286            async Task<Page<VirtualMachineScaleSet>> FirstPageFunc(int? pageSizeHint)
 287            {
 0288                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ListAll");
 0289                scope.Start();
 290                try
 291                {
 0292                    var response = await RestClient.ListAllAsync(cancellationToken).ConfigureAwait(false);
 0293                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 294                }
 0295                catch (Exception e)
 296                {
 0297                    scope.Failed(e);
 0298                    throw;
 299                }
 0300            }
 301            async Task<Page<VirtualMachineScaleSet>> NextPageFunc(string nextLink, int? pageSizeHint)
 302            {
 0303                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ListAll");
 0304                scope.Start();
 305                try
 306                {
 0307                    var response = await RestClient.ListAllNextPageAsync(nextLink, cancellationToken).ConfigureAwait(fal
 0308                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 309                }
 0310                catch (Exception e)
 311                {
 0312                    scope.Failed(e);
 0313                    throw;
 314                }
 0315            }
 0316            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 317        }
 318
 319        /// <summary> Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group.
 320        /// <param name="cancellationToken"> The cancellation token to use. </param>
 321        public virtual Pageable<VirtualMachineScaleSet> ListAll(CancellationToken cancellationToken = default)
 322        {
 323            Page<VirtualMachineScaleSet> FirstPageFunc(int? pageSizeHint)
 324            {
 0325                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ListAll");
 0326                scope.Start();
 327                try
 328                {
 0329                    var response = RestClient.ListAll(cancellationToken);
 0330                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 331                }
 0332                catch (Exception e)
 333                {
 0334                    scope.Failed(e);
 0335                    throw;
 336                }
 0337            }
 338            Page<VirtualMachineScaleSet> NextPageFunc(string nextLink, int? pageSizeHint)
 339            {
 0340                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ListAll");
 0341                scope.Start();
 342                try
 343                {
 0344                    var response = RestClient.ListAllNextPage(nextLink, cancellationToken);
 0345                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 346                }
 0347                catch (Exception e)
 348                {
 0349                    scope.Failed(e);
 0350                    throw;
 351                }
 0352            }
 0353            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 354        }
 355
 356        /// <summary> Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instance
 357        /// <param name="resourceGroupName"> The name of the resource group. </param>
 358        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 359        /// <param name="cancellationToken"> The cancellation token to use. </param>
 360        public virtual AsyncPageable<VirtualMachineScaleSetSku> ListSkusAsync(string resourceGroupName, string vmScaleSe
 361        {
 24362            if (resourceGroupName == null)
 363            {
 0364                throw new ArgumentNullException(nameof(resourceGroupName));
 365            }
 24366            if (vmScaleSetName == null)
 367            {
 0368                throw new ArgumentNullException(nameof(vmScaleSetName));
 369            }
 370
 371            async Task<Page<VirtualMachineScaleSetSku>> FirstPageFunc(int? pageSizeHint)
 372            {
 24373                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ListSkus");
 24374                scope.Start();
 375                try
 376                {
 24377                    var response = await RestClient.ListSkusAsync(resourceGroupName, vmScaleSetName, cancellationToken).
 24378                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 379                }
 0380                catch (Exception e)
 381                {
 0382                    scope.Failed(e);
 0383                    throw;
 384                }
 24385            }
 386            async Task<Page<VirtualMachineScaleSetSku>> NextPageFunc(string nextLink, int? pageSizeHint)
 387            {
 0388                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ListSkus");
 0389                scope.Start();
 390                try
 391                {
 0392                    var response = await RestClient.ListSkusNextPageAsync(nextLink, resourceGroupName, vmScaleSetName, c
 0393                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 394                }
 0395                catch (Exception e)
 396                {
 0397                    scope.Failed(e);
 0398                    throw;
 399                }
 0400            }
 24401            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 402        }
 403
 404        /// <summary> Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instance
 405        /// <param name="resourceGroupName"> The name of the resource group. </param>
 406        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 407        /// <param name="cancellationToken"> The cancellation token to use. </param>
 408        public virtual Pageable<VirtualMachineScaleSetSku> ListSkus(string resourceGroupName, string vmScaleSetName, Can
 409        {
 24410            if (resourceGroupName == null)
 411            {
 0412                throw new ArgumentNullException(nameof(resourceGroupName));
 413            }
 24414            if (vmScaleSetName == null)
 415            {
 0416                throw new ArgumentNullException(nameof(vmScaleSetName));
 417            }
 418
 419            Page<VirtualMachineScaleSetSku> FirstPageFunc(int? pageSizeHint)
 420            {
 24421                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ListSkus");
 24422                scope.Start();
 423                try
 424                {
 24425                    var response = RestClient.ListSkus(resourceGroupName, vmScaleSetName, cancellationToken);
 24426                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 427                }
 0428                catch (Exception e)
 429                {
 0430                    scope.Failed(e);
 0431                    throw;
 432                }
 24433            }
 434            Page<VirtualMachineScaleSetSku> NextPageFunc(string nextLink, int? pageSizeHint)
 435            {
 0436                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.ListSkus");
 0437                scope.Start();
 438                try
 439                {
 0440                    var response = RestClient.ListSkusNextPage(nextLink, resourceGroupName, vmScaleSetName, cancellation
 0441                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 442                }
 0443                catch (Exception e)
 444                {
 0445                    scope.Failed(e);
 0446                    throw;
 447                }
 0448            }
 24449            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 450        }
 451
 452        /// <summary> Gets list of OS upgrades on a VM scale set instance. </summary>
 453        /// <param name="resourceGroupName"> The name of the resource group. </param>
 454        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 455        /// <param name="cancellationToken"> The cancellation token to use. </param>
 456        public virtual AsyncPageable<UpgradeOperationHistoricalStatusInfo> GetOSUpgradeHistoryAsync(string resourceGroup
 457        {
 0458            if (resourceGroupName == null)
 459            {
 0460                throw new ArgumentNullException(nameof(resourceGroupName));
 461            }
 0462            if (vmScaleSetName == null)
 463            {
 0464                throw new ArgumentNullException(nameof(vmScaleSetName));
 465            }
 466
 467            async Task<Page<UpgradeOperationHistoricalStatusInfo>> FirstPageFunc(int? pageSizeHint)
 468            {
 0469                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.GetOSUpgradeHistory"
 0470                scope.Start();
 471                try
 472                {
 0473                    var response = await RestClient.GetOSUpgradeHistoryAsync(resourceGroupName, vmScaleSetName, cancella
 0474                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 475                }
 0476                catch (Exception e)
 477                {
 0478                    scope.Failed(e);
 0479                    throw;
 480                }
 0481            }
 482            async Task<Page<UpgradeOperationHistoricalStatusInfo>> NextPageFunc(string nextLink, int? pageSizeHint)
 483            {
 0484                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.GetOSUpgradeHistory"
 0485                scope.Start();
 486                try
 487                {
 0488                    var response = await RestClient.GetOSUpgradeHistoryNextPageAsync(nextLink, resourceGroupName, vmScal
 0489                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 490                }
 0491                catch (Exception e)
 492                {
 0493                    scope.Failed(e);
 0494                    throw;
 495                }
 0496            }
 0497            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 498        }
 499
 500        /// <summary> Gets list of OS upgrades on a VM scale set instance. </summary>
 501        /// <param name="resourceGroupName"> The name of the resource group. </param>
 502        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 503        /// <param name="cancellationToken"> The cancellation token to use. </param>
 504        public virtual Pageable<UpgradeOperationHistoricalStatusInfo> GetOSUpgradeHistory(string resourceGroupName, stri
 505        {
 0506            if (resourceGroupName == null)
 507            {
 0508                throw new ArgumentNullException(nameof(resourceGroupName));
 509            }
 0510            if (vmScaleSetName == null)
 511            {
 0512                throw new ArgumentNullException(nameof(vmScaleSetName));
 513            }
 514
 515            Page<UpgradeOperationHistoricalStatusInfo> FirstPageFunc(int? pageSizeHint)
 516            {
 0517                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.GetOSUpgradeHistory"
 0518                scope.Start();
 519                try
 520                {
 0521                    var response = RestClient.GetOSUpgradeHistory(resourceGroupName, vmScaleSetName, cancellationToken);
 0522                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 523                }
 0524                catch (Exception e)
 525                {
 0526                    scope.Failed(e);
 0527                    throw;
 528                }
 0529            }
 530            Page<UpgradeOperationHistoricalStatusInfo> NextPageFunc(string nextLink, int? pageSizeHint)
 531            {
 0532                using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.GetOSUpgradeHistory"
 0533                scope.Start();
 534                try
 535                {
 0536                    var response = RestClient.GetOSUpgradeHistoryNextPage(nextLink, resourceGroupName, vmScaleSetName, c
 0537                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 538                }
 0539                catch (Exception e)
 540                {
 0541                    scope.Failed(e);
 0542                    throw;
 543                }
 0544            }
 0545            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 546        }
 547
 548        /// <summary> Create or update a VM scale set. </summary>
 549        /// <param name="resourceGroupName"> The name of the resource group. </param>
 550        /// <param name="vmScaleSetName"> The name of the VM scale set to create or update. </param>
 551        /// <param name="parameters"> The scale set object. </param>
 552        /// <param name="cancellationToken"> The cancellation token to use. </param>
 553        public virtual async Task<VirtualMachineScaleSetsCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resour
 554        {
 92555            if (resourceGroupName == null)
 556            {
 0557                throw new ArgumentNullException(nameof(resourceGroupName));
 558            }
 92559            if (vmScaleSetName == null)
 560            {
 0561                throw new ArgumentNullException(nameof(vmScaleSetName));
 562            }
 92563            if (parameters == null)
 564            {
 0565                throw new ArgumentNullException(nameof(parameters));
 566            }
 567
 92568            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartCreateOrUpdate");
 92569            scope.Start();
 570            try
 571            {
 92572                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameter
 90573                return new VirtualMachineScaleSetsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.Crea
 574            }
 2575            catch (Exception e)
 576            {
 2577                scope.Failed(e);
 2578                throw;
 579            }
 90580        }
 581
 582        /// <summary> Create or update a VM scale set. </summary>
 583        /// <param name="resourceGroupName"> The name of the resource group. </param>
 584        /// <param name="vmScaleSetName"> The name of the VM scale set to create or update. </param>
 585        /// <param name="parameters"> The scale set object. </param>
 586        /// <param name="cancellationToken"> The cancellation token to use. </param>
 587        public virtual VirtualMachineScaleSetsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, stri
 588        {
 92589            if (resourceGroupName == null)
 590            {
 0591                throw new ArgumentNullException(nameof(resourceGroupName));
 592            }
 92593            if (vmScaleSetName == null)
 594            {
 0595                throw new ArgumentNullException(nameof(vmScaleSetName));
 596            }
 92597            if (parameters == null)
 598            {
 0599                throw new ArgumentNullException(nameof(parameters));
 600            }
 601
 92602            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartCreateOrUpdate");
 92603            scope.Start();
 604            try
 605            {
 92606                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, vmScaleSetName, parameters, cancella
 90607                return new VirtualMachineScaleSetsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.Crea
 608            }
 2609            catch (Exception e)
 610            {
 2611                scope.Failed(e);
 2612                throw;
 613            }
 90614        }
 615
 616        /// <summary> Update a VM scale set. </summary>
 617        /// <param name="resourceGroupName"> The name of the resource group. </param>
 618        /// <param name="vmScaleSetName"> The name of the VM scale set to create or update. </param>
 619        /// <param name="parameters"> The scale set object. </param>
 620        /// <param name="cancellationToken"> The cancellation token to use. </param>
 621        public virtual async Task<VirtualMachineScaleSetsUpdateOperation> StartUpdateAsync(string resourceGroupName, str
 622        {
 0623            if (resourceGroupName == null)
 624            {
 0625                throw new ArgumentNullException(nameof(resourceGroupName));
 626            }
 0627            if (vmScaleSetName == null)
 628            {
 0629                throw new ArgumentNullException(nameof(vmScaleSetName));
 630            }
 0631            if (parameters == null)
 632            {
 0633                throw new ArgumentNullException(nameof(parameters));
 634            }
 635
 0636            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartUpdate");
 0637            scope.Start();
 638            try
 639            {
 0640                var originalResponse = await RestClient.UpdateAsync(resourceGroupName, vmScaleSetName, parameters, cance
 0641                return new VirtualMachineScaleSetsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdate
 642            }
 0643            catch (Exception e)
 644            {
 0645                scope.Failed(e);
 0646                throw;
 647            }
 0648        }
 649
 650        /// <summary> Update a VM scale set. </summary>
 651        /// <param name="resourceGroupName"> The name of the resource group. </param>
 652        /// <param name="vmScaleSetName"> The name of the VM scale set to create or update. </param>
 653        /// <param name="parameters"> The scale set object. </param>
 654        /// <param name="cancellationToken"> The cancellation token to use. </param>
 655        public virtual VirtualMachineScaleSetsUpdateOperation StartUpdate(string resourceGroupName, string vmScaleSetNam
 656        {
 0657            if (resourceGroupName == null)
 658            {
 0659                throw new ArgumentNullException(nameof(resourceGroupName));
 660            }
 0661            if (vmScaleSetName == null)
 662            {
 0663                throw new ArgumentNullException(nameof(vmScaleSetName));
 664            }
 0665            if (parameters == null)
 666            {
 0667                throw new ArgumentNullException(nameof(parameters));
 668            }
 669
 0670            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartUpdate");
 0671            scope.Start();
 672            try
 673            {
 0674                var originalResponse = RestClient.Update(resourceGroupName, vmScaleSetName, parameters, cancellationToke
 0675                return new VirtualMachineScaleSetsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdate
 676            }
 0677            catch (Exception e)
 678            {
 0679                scope.Failed(e);
 0680                throw;
 681            }
 0682        }
 683
 684        /// <summary> Deletes a VM scale set. </summary>
 685        /// <param name="resourceGroupName"> The name of the resource group. </param>
 686        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 687        /// <param name="cancellationToken"> The cancellation token to use. </param>
 688        public virtual async Task<VirtualMachineScaleSetsDeleteOperation> StartDeleteAsync(string resourceGroupName, str
 689        {
 62690            if (resourceGroupName == null)
 691            {
 0692                throw new ArgumentNullException(nameof(resourceGroupName));
 693            }
 62694            if (vmScaleSetName == null)
 695            {
 0696                throw new ArgumentNullException(nameof(vmScaleSetName));
 697            }
 698
 62699            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartDelete");
 62700            scope.Start();
 701            try
 702            {
 62703                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, vmScaleSetName, cancellationToken
 62704                return new VirtualMachineScaleSetsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDelete
 705            }
 0706            catch (Exception e)
 707            {
 0708                scope.Failed(e);
 0709                throw;
 710            }
 62711        }
 712
 713        /// <summary> Deletes a VM scale set. </summary>
 714        /// <param name="resourceGroupName"> The name of the resource group. </param>
 715        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 716        /// <param name="cancellationToken"> The cancellation token to use. </param>
 717        public virtual VirtualMachineScaleSetsDeleteOperation StartDelete(string resourceGroupName, string vmScaleSetNam
 718        {
 62719            if (resourceGroupName == null)
 720            {
 0721                throw new ArgumentNullException(nameof(resourceGroupName));
 722            }
 62723            if (vmScaleSetName == null)
 724            {
 0725                throw new ArgumentNullException(nameof(vmScaleSetName));
 726            }
 727
 62728            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartDelete");
 62729            scope.Start();
 730            try
 731            {
 62732                var originalResponse = RestClient.Delete(resourceGroupName, vmScaleSetName, cancellationToken);
 62733                return new VirtualMachineScaleSetsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDelete
 734            }
 0735            catch (Exception e)
 736            {
 0737                scope.Failed(e);
 0738                throw;
 739            }
 62740        }
 741
 742        /// <summary> Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and relea
 743        /// <param name="resourceGroupName"> The name of the resource group. </param>
 744        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 745        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 746        /// <param name="cancellationToken"> The cancellation token to use. </param>
 747        public virtual async Task<VirtualMachineScaleSetsDeallocateOperation> StartDeallocateAsync(string resourceGroupN
 748        {
 6749            if (resourceGroupName == null)
 750            {
 0751                throw new ArgumentNullException(nameof(resourceGroupName));
 752            }
 6753            if (vmScaleSetName == null)
 754            {
 0755                throw new ArgumentNullException(nameof(vmScaleSetName));
 756            }
 757
 6758            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartDeallocate");
 6759            scope.Start();
 760            try
 761            {
 6762                var originalResponse = await RestClient.DeallocateAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs
 6763                return new VirtualMachineScaleSetsDeallocateOperation(_clientDiagnostics, _pipeline, RestClient.CreateDe
 764            }
 0765            catch (Exception e)
 766            {
 0767                scope.Failed(e);
 0768                throw;
 769            }
 6770        }
 771
 772        /// <summary> Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and relea
 773        /// <param name="resourceGroupName"> The name of the resource group. </param>
 774        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 775        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 776        /// <param name="cancellationToken"> The cancellation token to use. </param>
 777        public virtual VirtualMachineScaleSetsDeallocateOperation StartDeallocate(string resourceGroupName, string vmSca
 778        {
 6779            if (resourceGroupName == null)
 780            {
 0781                throw new ArgumentNullException(nameof(resourceGroupName));
 782            }
 6783            if (vmScaleSetName == null)
 784            {
 0785                throw new ArgumentNullException(nameof(vmScaleSetName));
 786            }
 787
 6788            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartDeallocate");
 6789            scope.Start();
 790            try
 791            {
 6792                var originalResponse = RestClient.Deallocate(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancellat
 6793                return new VirtualMachineScaleSetsDeallocateOperation(_clientDiagnostics, _pipeline, RestClient.CreateDe
 794            }
 0795            catch (Exception e)
 796            {
 0797                scope.Failed(e);
 0798                throw;
 799            }
 6800        }
 801
 802        /// <summary> Deletes virtual machines in a VM scale set. </summary>
 803        /// <param name="resourceGroupName"> The name of the resource group. </param>
 804        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 805        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 806        /// <param name="cancellationToken"> The cancellation token to use. </param>
 807        public virtual async Task<VirtualMachineScaleSetsDeleteInstancesOperation> StartDeleteInstancesAsync(string reso
 808        {
 2809            if (resourceGroupName == null)
 810            {
 0811                throw new ArgumentNullException(nameof(resourceGroupName));
 812            }
 2813            if (vmScaleSetName == null)
 814            {
 0815                throw new ArgumentNullException(nameof(vmScaleSetName));
 816            }
 2817            if (vmInstanceIDs == null)
 818            {
 0819                throw new ArgumentNullException(nameof(vmInstanceIDs));
 820            }
 821
 2822            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartDeleteInstances");
 2823            scope.Start();
 824            try
 825            {
 2826                var originalResponse = await RestClient.DeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstan
 2827                return new VirtualMachineScaleSetsDeleteInstancesOperation(_clientDiagnostics, _pipeline, RestClient.Cre
 828            }
 0829            catch (Exception e)
 830            {
 0831                scope.Failed(e);
 0832                throw;
 833            }
 2834        }
 835
 836        /// <summary> Deletes virtual machines in a VM scale set. </summary>
 837        /// <param name="resourceGroupName"> The name of the resource group. </param>
 838        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 839        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 840        /// <param name="cancellationToken"> The cancellation token to use. </param>
 841        public virtual VirtualMachineScaleSetsDeleteInstancesOperation StartDeleteInstances(string resourceGroupName, st
 842        {
 2843            if (resourceGroupName == null)
 844            {
 0845                throw new ArgumentNullException(nameof(resourceGroupName));
 846            }
 2847            if (vmScaleSetName == null)
 848            {
 0849                throw new ArgumentNullException(nameof(vmScaleSetName));
 850            }
 2851            if (vmInstanceIDs == null)
 852            {
 0853                throw new ArgumentNullException(nameof(vmInstanceIDs));
 854            }
 855
 2856            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartDeleteInstances");
 2857            scope.Start();
 858            try
 859            {
 2860                var originalResponse = RestClient.DeleteInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs, canc
 2861                return new VirtualMachineScaleSetsDeleteInstancesOperation(_clientDiagnostics, _pipeline, RestClient.Cre
 862            }
 0863            catch (Exception e)
 864            {
 0865                scope.Failed(e);
 0866                throw;
 867            }
 2868        }
 869
 870        /// <summary> Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still att
 871        /// <param name="resourceGroupName"> The name of the resource group. </param>
 872        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 873        /// <param name="skipShutdown"> The parameter to request non-graceful VM shutdown. True value for this flag indi
 874        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 875        /// <param name="cancellationToken"> The cancellation token to use. </param>
 876        public virtual async Task<VirtualMachineScaleSetsPowerOffOperation> StartPowerOffAsync(string resourceGroupName,
 877        {
 8878            if (resourceGroupName == null)
 879            {
 0880                throw new ArgumentNullException(nameof(resourceGroupName));
 881            }
 8882            if (vmScaleSetName == null)
 883            {
 0884                throw new ArgumentNullException(nameof(vmScaleSetName));
 885            }
 886
 8887            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartPowerOff");
 8888            scope.Start();
 889            try
 890            {
 8891                var originalResponse = await RestClient.PowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, v
 8892                return new VirtualMachineScaleSetsPowerOffOperation(_clientDiagnostics, _pipeline, RestClient.CreatePowe
 893            }
 0894            catch (Exception e)
 895            {
 0896                scope.Failed(e);
 0897                throw;
 898            }
 8899        }
 900
 901        /// <summary> Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still att
 902        /// <param name="resourceGroupName"> The name of the resource group. </param>
 903        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 904        /// <param name="skipShutdown"> The parameter to request non-graceful VM shutdown. True value for this flag indi
 905        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 906        /// <param name="cancellationToken"> The cancellation token to use. </param>
 907        public virtual VirtualMachineScaleSetsPowerOffOperation StartPowerOff(string resourceGroupName, string vmScaleSe
 908        {
 8909            if (resourceGroupName == null)
 910            {
 0911                throw new ArgumentNullException(nameof(resourceGroupName));
 912            }
 8913            if (vmScaleSetName == null)
 914            {
 0915                throw new ArgumentNullException(nameof(vmScaleSetName));
 916            }
 917
 8918            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartPowerOff");
 8919            scope.Start();
 920            try
 921            {
 8922                var originalResponse = RestClient.PowerOff(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceID
 8923                return new VirtualMachineScaleSetsPowerOffOperation(_clientDiagnostics, _pipeline, RestClient.CreatePowe
 924            }
 0925            catch (Exception e)
 926            {
 0927                scope.Failed(e);
 0928                throw;
 929            }
 8930        }
 931
 932        /// <summary> Restarts one or more virtual machines in a VM scale set. </summary>
 933        /// <param name="resourceGroupName"> The name of the resource group. </param>
 934        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 935        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 936        /// <param name="cancellationToken"> The cancellation token to use. </param>
 937        public virtual async Task<VirtualMachineScaleSetsRestartOperation> StartRestartAsync(string resourceGroupName, s
 938        {
 6939            if (resourceGroupName == null)
 940            {
 0941                throw new ArgumentNullException(nameof(resourceGroupName));
 942            }
 6943            if (vmScaleSetName == null)
 944            {
 0945                throw new ArgumentNullException(nameof(vmScaleSetName));
 946            }
 947
 6948            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartRestart");
 6949            scope.Start();
 950            try
 951            {
 6952                var originalResponse = await RestClient.RestartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, c
 6953                return new VirtualMachineScaleSetsRestartOperation(_clientDiagnostics, _pipeline, RestClient.CreateResta
 954            }
 0955            catch (Exception e)
 956            {
 0957                scope.Failed(e);
 0958                throw;
 959            }
 6960        }
 961
 962        /// <summary> Restarts one or more virtual machines in a VM scale set. </summary>
 963        /// <param name="resourceGroupName"> The name of the resource group. </param>
 964        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 965        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 966        /// <param name="cancellationToken"> The cancellation token to use. </param>
 967        public virtual VirtualMachineScaleSetsRestartOperation StartRestart(string resourceGroupName, string vmScaleSetN
 968        {
 6969            if (resourceGroupName == null)
 970            {
 0971                throw new ArgumentNullException(nameof(resourceGroupName));
 972            }
 6973            if (vmScaleSetName == null)
 974            {
 0975                throw new ArgumentNullException(nameof(vmScaleSetName));
 976            }
 977
 6978            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartRestart");
 6979            scope.Start();
 980            try
 981            {
 6982                var originalResponse = RestClient.Restart(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancellation
 6983                return new VirtualMachineScaleSetsRestartOperation(_clientDiagnostics, _pipeline, RestClient.CreateResta
 984            }
 0985            catch (Exception e)
 986            {
 0987                scope.Failed(e);
 0988                throw;
 989            }
 6990        }
 991
 992        /// <summary> Starts one or more virtual machines in a VM scale set. </summary>
 993        /// <param name="resourceGroupName"> The name of the resource group. </param>
 994        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 995        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 996        /// <param name="cancellationToken"> The cancellation token to use. </param>
 997        public virtual async Task<VirtualMachineScaleSetsStartOperation> StartStartAsync(string resourceGroupName, strin
 998        {
 8999            if (resourceGroupName == null)
 1000            {
 01001                throw new ArgumentNullException(nameof(resourceGroupName));
 1002            }
 81003            if (vmScaleSetName == null)
 1004            {
 01005                throw new ArgumentNullException(nameof(vmScaleSetName));
 1006            }
 1007
 81008            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartStart");
 81009            scope.Start();
 1010            try
 1011            {
 81012                var originalResponse = await RestClient.StartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, can
 81013                return new VirtualMachineScaleSetsStartOperation(_clientDiagnostics, _pipeline, RestClient.CreateStartRe
 1014            }
 01015            catch (Exception e)
 1016            {
 01017                scope.Failed(e);
 01018                throw;
 1019            }
 81020        }
 1021
 1022        /// <summary> Starts one or more virtual machines in a VM scale set. </summary>
 1023        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1024        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1025        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1026        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1027        public virtual VirtualMachineScaleSetsStartOperation StartStart(string resourceGroupName, string vmScaleSetName,
 1028        {
 81029            if (resourceGroupName == null)
 1030            {
 01031                throw new ArgumentNullException(nameof(resourceGroupName));
 1032            }
 81033            if (vmScaleSetName == null)
 1034            {
 01035                throw new ArgumentNullException(nameof(vmScaleSetName));
 1036            }
 1037
 81038            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartStart");
 81039            scope.Start();
 1040            try
 1041            {
 81042                var originalResponse = RestClient.Start(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancellationTo
 81043                return new VirtualMachineScaleSetsStartOperation(_clientDiagnostics, _pipeline, RestClient.CreateStartRe
 1044            }
 01045            catch (Exception e)
 1046            {
 01047                scope.Failed(e);
 01048                throw;
 1049            }
 81050        }
 1051
 1052        /// <summary> Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, an
 1053        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1054        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1055        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1056        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1057        public virtual async Task<VirtualMachineScaleSetsRedeployOperation> StartRedeployAsync(string resourceGroupName,
 1058        {
 41059            if (resourceGroupName == null)
 1060            {
 01061                throw new ArgumentNullException(nameof(resourceGroupName));
 1062            }
 41063            if (vmScaleSetName == null)
 1064            {
 01065                throw new ArgumentNullException(nameof(vmScaleSetName));
 1066            }
 1067
 41068            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartRedeploy");
 41069            scope.Start();
 1070            try
 1071            {
 41072                var originalResponse = await RestClient.RedeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, 
 41073                return new VirtualMachineScaleSetsRedeployOperation(_clientDiagnostics, _pipeline, RestClient.CreateRede
 1074            }
 01075            catch (Exception e)
 1076            {
 01077                scope.Failed(e);
 01078                throw;
 1079            }
 41080        }
 1081
 1082        /// <summary> Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, an
 1083        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1084        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1085        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1086        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1087        public virtual VirtualMachineScaleSetsRedeployOperation StartRedeploy(string resourceGroupName, string vmScaleSe
 1088        {
 41089            if (resourceGroupName == null)
 1090            {
 01091                throw new ArgumentNullException(nameof(resourceGroupName));
 1092            }
 41093            if (vmScaleSetName == null)
 1094            {
 01095                throw new ArgumentNullException(nameof(vmScaleSetName));
 1096            }
 1097
 41098            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartRedeploy");
 41099            scope.Start();
 1100            try
 1101            {
 41102                var originalResponse = RestClient.Redeploy(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancellatio
 41103                return new VirtualMachineScaleSetsRedeployOperation(_clientDiagnostics, _pipeline, RestClient.CreateRede
 1104            }
 01105            catch (Exception e)
 1106            {
 01107                scope.Failed(e);
 01108                throw;
 1109            }
 41110        }
 1111
 1112        /// <summary> Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances whic
 1113        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1114        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1115        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1116        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1117        public virtual async Task<VirtualMachineScaleSetsPerformMaintenanceOperation> StartPerformMaintenanceAsync(strin
 1118        {
 41119            if (resourceGroupName == null)
 1120            {
 01121                throw new ArgumentNullException(nameof(resourceGroupName));
 1122            }
 41123            if (vmScaleSetName == null)
 1124            {
 01125                throw new ArgumentNullException(nameof(vmScaleSetName));
 1126            }
 1127
 41128            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartPerformMaintenance"
 41129            scope.Start();
 1130            try
 1131            {
 41132                var originalResponse = await RestClient.PerformMaintenanceAsync(resourceGroupName, vmScaleSetName, vmIns
 01133                return new VirtualMachineScaleSetsPerformMaintenanceOperation(_clientDiagnostics, _pipeline, RestClient.
 1134            }
 41135            catch (Exception e)
 1136            {
 41137                scope.Failed(e);
 41138                throw;
 1139            }
 01140        }
 1141
 1142        /// <summary> Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances whic
 1143        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1144        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1145        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1146        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1147        public virtual VirtualMachineScaleSetsPerformMaintenanceOperation StartPerformMaintenance(string resourceGroupNa
 1148        {
 41149            if (resourceGroupName == null)
 1150            {
 01151                throw new ArgumentNullException(nameof(resourceGroupName));
 1152            }
 41153            if (vmScaleSetName == null)
 1154            {
 01155                throw new ArgumentNullException(nameof(vmScaleSetName));
 1156            }
 1157
 41158            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartPerformMaintenance"
 41159            scope.Start();
 1160            try
 1161            {
 41162                var originalResponse = RestClient.PerformMaintenance(resourceGroupName, vmScaleSetName, vmInstanceIDs, c
 01163                return new VirtualMachineScaleSetsPerformMaintenanceOperation(_clientDiagnostics, _pipeline, RestClient.
 1164            }
 41165            catch (Exception e)
 1166            {
 41167                scope.Failed(e);
 41168                throw;
 1169            }
 01170        }
 1171
 1172        /// <summary> Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. </summary>
 1173        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1174        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1175        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1176        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1177        public virtual async Task<VirtualMachineScaleSetsUpdateInstancesOperation> StartUpdateInstancesAsync(string reso
 1178        {
 21179            if (resourceGroupName == null)
 1180            {
 01181                throw new ArgumentNullException(nameof(resourceGroupName));
 1182            }
 21183            if (vmScaleSetName == null)
 1184            {
 01185                throw new ArgumentNullException(nameof(vmScaleSetName));
 1186            }
 21187            if (vmInstanceIDs == null)
 1188            {
 01189                throw new ArgumentNullException(nameof(vmInstanceIDs));
 1190            }
 1191
 21192            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartUpdateInstances");
 21193            scope.Start();
 1194            try
 1195            {
 21196                var originalResponse = await RestClient.UpdateInstancesAsync(resourceGroupName, vmScaleSetName, vmInstan
 21197                return new VirtualMachineScaleSetsUpdateInstancesOperation(_clientDiagnostics, _pipeline, RestClient.Cre
 1198            }
 01199            catch (Exception e)
 1200            {
 01201                scope.Failed(e);
 01202                throw;
 1203            }
 21204        }
 1205
 1206        /// <summary> Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. </summary>
 1207        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1208        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1209        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1210        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1211        public virtual VirtualMachineScaleSetsUpdateInstancesOperation StartUpdateInstances(string resourceGroupName, st
 1212        {
 21213            if (resourceGroupName == null)
 1214            {
 01215                throw new ArgumentNullException(nameof(resourceGroupName));
 1216            }
 21217            if (vmScaleSetName == null)
 1218            {
 01219                throw new ArgumentNullException(nameof(vmScaleSetName));
 1220            }
 21221            if (vmInstanceIDs == null)
 1222            {
 01223                throw new ArgumentNullException(nameof(vmInstanceIDs));
 1224            }
 1225
 21226            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartUpdateInstances");
 21227            scope.Start();
 1228            try
 1229            {
 21230                var originalResponse = RestClient.UpdateInstances(resourceGroupName, vmScaleSetName, vmInstanceIDs, canc
 21231                return new VirtualMachineScaleSetsUpdateInstancesOperation(_clientDiagnostics, _pipeline, RestClient.Cre
 1232            }
 01233            catch (Exception e)
 1234            {
 01235                scope.Failed(e);
 01236                throw;
 1237            }
 21238        }
 1239
 1240        /// <summary> Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don&a
 1241        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1242        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1243        /// <param name="vmScaleSetReimageInput"> Parameters for Reimaging VM ScaleSet. </param>
 1244        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1245        public virtual async Task<VirtualMachineScaleSetsReimageOperation> StartReimageAsync(string resourceGroupName, s
 1246        {
 61247            if (resourceGroupName == null)
 1248            {
 01249                throw new ArgumentNullException(nameof(resourceGroupName));
 1250            }
 61251            if (vmScaleSetName == null)
 1252            {
 01253                throw new ArgumentNullException(nameof(vmScaleSetName));
 1254            }
 1255
 61256            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartReimage");
 61257            scope.Start();
 1258            try
 1259            {
 61260                var originalResponse = await RestClient.ReimageAsync(resourceGroupName, vmScaleSetName, vmScaleSetReimag
 61261                return new VirtualMachineScaleSetsReimageOperation(_clientDiagnostics, _pipeline, RestClient.CreateReima
 1262            }
 01263            catch (Exception e)
 1264            {
 01265                scope.Failed(e);
 01266                throw;
 1267            }
 61268        }
 1269
 1270        /// <summary> Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don&a
 1271        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1272        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1273        /// <param name="vmScaleSetReimageInput"> Parameters for Reimaging VM ScaleSet. </param>
 1274        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1275        public virtual VirtualMachineScaleSetsReimageOperation StartReimage(string resourceGroupName, string vmScaleSetN
 1276        {
 61277            if (resourceGroupName == null)
 1278            {
 01279                throw new ArgumentNullException(nameof(resourceGroupName));
 1280            }
 61281            if (vmScaleSetName == null)
 1282            {
 01283                throw new ArgumentNullException(nameof(vmScaleSetName));
 1284            }
 1285
 61286            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartReimage");
 61287            scope.Start();
 1288            try
 1289            {
 61290                var originalResponse = RestClient.Reimage(resourceGroupName, vmScaleSetName, vmScaleSetReimageInput, can
 61291                return new VirtualMachineScaleSetsReimageOperation(_clientDiagnostics, _pipeline, RestClient.CreateReima
 1292            }
 01293            catch (Exception e)
 1294            {
 01295                scope.Failed(e);
 01296                throw;
 1297            }
 61298        }
 1299
 1300        /// <summary> Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This op
 1301        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1302        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1303        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1304        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1305        public virtual async Task<VirtualMachineScaleSetsReimageAllOperation> StartReimageAllAsync(string resourceGroupN
 1306        {
 41307            if (resourceGroupName == null)
 1308            {
 01309                throw new ArgumentNullException(nameof(resourceGroupName));
 1310            }
 41311            if (vmScaleSetName == null)
 1312            {
 01313                throw new ArgumentNullException(nameof(vmScaleSetName));
 1314            }
 1315
 41316            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartReimageAll");
 41317            scope.Start();
 1318            try
 1319            {
 41320                var originalResponse = await RestClient.ReimageAllAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs
 41321                return new VirtualMachineScaleSetsReimageAllOperation(_clientDiagnostics, _pipeline, RestClient.CreateRe
 1322            }
 01323            catch (Exception e)
 1324            {
 01325                scope.Failed(e);
 01326                throw;
 1327            }
 41328        }
 1329
 1330        /// <summary> Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This op
 1331        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1332        /// <param name="vmScaleSetName"> The name of the VM scale set. </param>
 1333        /// <param name="vmInstanceIDs"> A list of virtual machine instance IDs from the VM scale set. </param>
 1334        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1335        public virtual VirtualMachineScaleSetsReimageAllOperation StartReimageAll(string resourceGroupName, string vmSca
 1336        {
 41337            if (resourceGroupName == null)
 1338            {
 01339                throw new ArgumentNullException(nameof(resourceGroupName));
 1340            }
 41341            if (vmScaleSetName == null)
 1342            {
 01343                throw new ArgumentNullException(nameof(vmScaleSetName));
 1344            }
 1345
 41346            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartReimageAll");
 41347            scope.Start();
 1348            try
 1349            {
 41350                var originalResponse = RestClient.ReimageAll(resourceGroupName, vmScaleSetName, vmInstanceIDs, cancellat
 41351                return new VirtualMachineScaleSetsReimageAllOperation(_clientDiagnostics, _pipeline, RestClient.CreateRe
 1352            }
 01353            catch (Exception e)
 1354            {
 01355                scope.Failed(e);
 01356                throw;
 1357            }
 41358        }
 1359
 1360        /// <summary> Changes ServiceState property for a given service. </summary>
 1361        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1362        /// <param name="vmScaleSetName"> The name of the virtual machine scale set to create or update. </param>
 1363        /// <param name="parameters"> The input object for SetOrchestrationServiceState API. </param>
 1364        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1365        public virtual async Task<VirtualMachineScaleSetsSetOrchestrationServiceStateOperation> StartSetOrchestrationSer
 1366        {
 41367            if (resourceGroupName == null)
 1368            {
 01369                throw new ArgumentNullException(nameof(resourceGroupName));
 1370            }
 41371            if (vmScaleSetName == null)
 1372            {
 01373                throw new ArgumentNullException(nameof(vmScaleSetName));
 1374            }
 41375            if (parameters == null)
 1376            {
 01377                throw new ArgumentNullException(nameof(parameters));
 1378            }
 1379
 41380            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartSetOrchestrationSer
 41381            scope.Start();
 1382            try
 1383            {
 41384                var originalResponse = await RestClient.SetOrchestrationServiceStateAsync(resourceGroupName, vmScaleSetN
 41385                return new VirtualMachineScaleSetsSetOrchestrationServiceStateOperation(_clientDiagnostics, _pipeline, R
 1386            }
 01387            catch (Exception e)
 1388            {
 01389                scope.Failed(e);
 01390                throw;
 1391            }
 41392        }
 1393
 1394        /// <summary> Changes ServiceState property for a given service. </summary>
 1395        /// <param name="resourceGroupName"> The name of the resource group. </param>
 1396        /// <param name="vmScaleSetName"> The name of the virtual machine scale set to create or update. </param>
 1397        /// <param name="parameters"> The input object for SetOrchestrationServiceState API. </param>
 1398        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1399        public virtual VirtualMachineScaleSetsSetOrchestrationServiceStateOperation StartSetOrchestrationServiceState(st
 1400        {
 41401            if (resourceGroupName == null)
 1402            {
 01403                throw new ArgumentNullException(nameof(resourceGroupName));
 1404            }
 41405            if (vmScaleSetName == null)
 1406            {
 01407                throw new ArgumentNullException(nameof(vmScaleSetName));
 1408            }
 41409            if (parameters == null)
 1410            {
 01411                throw new ArgumentNullException(nameof(parameters));
 1412            }
 1413
 41414            using var scope = _clientDiagnostics.CreateScope("VirtualMachineScaleSetsOperations.StartSetOrchestrationSer
 41415            scope.Start();
 1416            try
 1417            {
 41418                var originalResponse = RestClient.SetOrchestrationServiceState(resourceGroupName, vmScaleSetName, parame
 41419                return new VirtualMachineScaleSetsSetOrchestrationServiceStateOperation(_clientDiagnostics, _pipeline, R
 1420            }
 01421            catch (Exception e)
 1422            {
 01423                scope.Failed(e);
 01424                throw;
 1425            }
 41426        }
 1427    }
 1428}